org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node Java Examples
The following examples show how to use
org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TopologyNodeState.java From bgpcep with Eclipse Public License 1.0 | 6 votes |
private synchronized void putTopologyNode() { final Node node = new NodeBuilder().withKey(this.nodeId.getKey()) .setNodeId(this.nodeId.getKey().getNodeId()).build(); final WriteTransaction t = this.chain.newWriteOnlyTransaction(); LOG.trace("Put topology Node {}, value {}", this.nodeId, node); t.merge(LogicalDatastoreType.OPERATIONAL, this.nodeId, node); t.commit().addCallback(new FutureCallback<CommitInfo>() { @Override public void onSuccess(final CommitInfo result) { LOG.trace("Topology Node stored {}, value {}", TopologyNodeState.this.nodeId, node); } @Override public void onFailure(final Throwable throwable) { LOG.trace("Put topology Node failed {}, value {}", TopologyNodeState.this.nodeId, node, throwable); } }, MoreExecutors.directExecutor()); }
Example #2
Source File: OvsdbBridgeUpdateCommand.java From ovsdb with Eclipse Public License 1.0 | 6 votes |
private Node buildBridgeNode(Bridge bridge) { NodeBuilder bridgeNodeBuilder = new NodeBuilder(); NodeId bridgeNodeId = getNodeId(bridge); bridgeNodeBuilder.setNodeId(bridgeNodeId); OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder = new OvsdbBridgeAugmentationBuilder(); ovsdbBridgeAugmentationBuilder.setBridgeName(new OvsdbBridgeName(bridge.getName())); ovsdbBridgeAugmentationBuilder.setBridgeUuid(new Uuid(bridge.getUuid().toString())); setDataPath(ovsdbBridgeAugmentationBuilder, bridge); setDataPathType(ovsdbBridgeAugmentationBuilder, bridge); setProtocol(ovsdbBridgeAugmentationBuilder, bridge); setExternalIds(ovsdbBridgeAugmentationBuilder, bridge); setOtherConfig(ovsdbBridgeAugmentationBuilder, bridge); setFailMode(ovsdbBridgeAugmentationBuilder, bridge); setOpenFlowNodeRef(ovsdbBridgeAugmentationBuilder, bridge); setManagedBy(ovsdbBridgeAugmentationBuilder); setAutoAttach(ovsdbBridgeAugmentationBuilder, bridge); setStpEnalbe(ovsdbBridgeAugmentationBuilder,bridge); bridgeNodeBuilder.addAugmentation(OvsdbBridgeAugmentation.class, ovsdbBridgeAugmentationBuilder.build()); LOG.debug("Built with the intent to store bridge data {}", ovsdbBridgeAugmentationBuilder.build()); return bridgeNodeBuilder.build(); }
Example #3
Source File: HwvtepReconciliationManager.java From ovsdb with Eclipse Public License 1.0 | 6 votes |
private void processConnectedNodes(Collection<DataTreeModification<Node>> changes) { for (DataTreeModification<Node> change : changes) { DataObjectModification<Node> mod = change.getRootNode(); Node node = getCreated(mod); if (node != null) { PhysicalSwitchAugmentation physicalSwitch = node.augmentation(PhysicalSwitchAugmentation.class); if (physicalSwitch != null) { HwvtepConnectionInstance connection = hcm.getConnectionInstance(physicalSwitch); if (connection != null) { LOG.info("HwvtepReconciliationManager Reconcile config for node {}, IP : {}", node.key(), connection.getConnectionInfo().getRemoteAddress()); hcm.reconcileConfigurations(connection, node); } } } } }
Example #4
Source File: BridgeOperationalStateTest.java From ovsdb with Eclipse Public License 1.0 | 6 votes |
@Test public void testGetOvsdbBridgeAugmentation() throws Exception { Optional<OvsdbBridgeAugmentation> optOvsdbBri = briOperationState.getOvsdbBridgeAugmentation(nodeIid); verify(briOperationState, times(1)).getBridgeNode(any(InstanceIdentifier.class)); assertNotNull(optOvsdbBri); assertTrue(optOvsdbBri.equals(Optional.empty())); Node node = mock(Node.class); Optional<Node> optNode = Optional.of(node); doReturn(optNode).when(briOperationState).getBridgeNode(any(InstanceIdentifier.class)); OvsdbBridgeAugmentation ovsdbBriAug = mock(OvsdbBridgeAugmentation.class); doReturn(ovsdbBriAug).when(node).augmentation(OvsdbBridgeAugmentation.class); Optional<OvsdbBridgeAugmentation> ovsdbBriAugOptional = briOperationState.getOvsdbBridgeAugmentation(iid); assertNotNull(ovsdbBriAugOptional); assertTrue(ovsdbBriAugOptional.get() instanceof OvsdbBridgeAugmentation); }
Example #5
Source File: ConnectionReconciliationTask.java From ovsdb with Eclipse Public License 1.0 | 6 votes |
@Override public boolean reconcileConfiguration(HwvtepConnectionManager connectionManager) { boolean result = false; connectionAttempt.incrementAndGet(); InstanceIdentifier<Node> nodeId = (InstanceIdentifier<Node>) nodeIid; HwvtepGlobalAugmentation hwvtepNode = (HwvtepGlobalAugmentation) configData; LOG.info("Retry({}) connection to Ovsdb Node {} ", connectionAttempt.get(), hwvtepNode.getConnectionInfo()); OvsdbClient client = null; try { client = connectionManager.connect(nodeId, hwvtepNode); if (client != null) { LOG.info("Successfully connected to Hwvtep Node {} ", hwvtepNode.getConnectionInfo()); result = true; } else { LOG.warn("Connection retry({}) failed for {}.", connectionAttempt.get(), hwvtepNode.getConnectionInfo()); } } catch (UnknownHostException | ConnectException e) { LOG.warn("Connection retry({}) failed with exception. ", connectionAttempt.get(), e); } return result; }
Example #6
Source File: AbstractTransactCommand.java From ovsdb with Eclipse Public License 1.0 | 6 votes |
@NonNull protected Map<InstanceIdentifier<Node>, List<T>> extractRemoved( final Collection<DataTreeModification<Node>> modification, final Class<T> class1) { Map<InstanceIdentifier<Node>, List<T>> result = new HashMap<>(); if (modification != null && !modification.isEmpty()) { for (DataTreeModification<Node> change : modification) { final InstanceIdentifier<Node> key = change.getRootPath().getRootIdentifier(); if (!Objects.equals(hwvtepOperationalState.getConnectionInstance().getInstanceIdentifier(), key)) { continue; } Class<? extends Identifiable> classType = (Class<? extends Identifiable>) getClassType(); List<T> removed; if (getOperationalState().isInReconciliation()) { removed = getRemoved(change); } else { removed = (List<T>) getOperationalState().getDeletedData(key, classType); } removed.addAll(getCascadeDeleteData(change)); result.put(key, removed); } } return result; }
Example #7
Source File: HwvtepPhysicalSwitchRemoveCommand.java From ovsdb with Eclipse Public License 1.0 | 6 votes |
@Override public void execute(ReadWriteTransaction transaction) { Collection<PhysicalSwitch> deletedPSRows = TyperUtils.extractRowsRemoved(PhysicalSwitch.class, getUpdates(), getDbSchema()).values(); for (PhysicalSwitch phySwitch : deletedPSRows) { InstanceIdentifier<Node> nodeIid = HwvtepSouthboundMapper.createInstanceIdentifier( getOvsdbConnectionInstance(), phySwitch); InstanceIdentifier<Switches> switchIid = getOvsdbConnectionInstance().getInstanceIdentifier() .augmentation(HwvtepGlobalAugmentation.class) .child(Switches.class, new SwitchesKey(new HwvtepPhysicalSwitchRef(nodeIid))); // TODO handle removal of reference to managed switch from model transaction.delete(LogicalDatastoreType.OPERATIONAL, nodeIid); transaction.delete(LogicalDatastoreType.OPERATIONAL, switchIid); getDeviceInfo().clearDeviceOperData(Node.class, switchIid); addToDeviceUpdate(TransactionType.DELETE, phySwitch); LOG.info("DEVICE - {} {}", TransactionType.DELETE, phySwitch); } }
Example #8
Source File: HwvtepDataChangeListener.java From ovsdb with Eclipse Public License 1.0 | 6 votes |
private void disconnect(Collection<DataTreeModification<Node>> changes) { for (DataTreeModification<Node> change : changes) { final InstanceIdentifier<Node> key = change.getRootPath().getRootIdentifier(); final DataObjectModification<Node> mod = change.getRootNode(); Node deleted = getRemoved(mod); if (deleted != null) { HwvtepGlobalAugmentation hgDeleted = deleted.augmentation(HwvtepGlobalAugmentation.class); if (hgDeleted != null) { try { hcm.disconnect(hgDeleted); hcm.stopConnectionReconciliationIfActive(key, hgDeleted); } catch (UnknownHostException e) { LOG.warn("Failed to disconnect HWVTEP Node", e); } } } } }
Example #9
Source File: OvsdbConnectionManager.java From ovsdb with Eclipse Public License 1.0 | 6 votes |
private Entity getEntityFromConnectionInstance(@NonNull final OvsdbConnectionInstance ovsdbConnectionInstance) { InstanceIdentifier<Node> iid = ovsdbConnectionInstance.getInstanceIdentifier(); if (iid == null) { /* Switch initiated connection won't have iid, till it gets OpenVSwitch * table update but update callback is always registered after ownership * is granted. So we are explicitly fetch the row here to get the iid. */ OpenVSwitch openvswitchRow = getOpenVswitchTableEntry(ovsdbConnectionInstance); iid = SouthboundMapper.getInstanceIdentifier(instanceIdentifierCodec, openvswitchRow); LOG.info("Ovsdb InstanceIdentifier {} generated for device " + "connection {}",iid,ovsdbConnectionInstance.getConnectionInfo()); ovsdbConnectionInstance.setInstanceIdentifier(iid); } Entity deviceEntity = new Entity(ENTITY_TYPE, iid); LOG.debug("Ovsdb Entity {} created for device connection {}", deviceEntity, ovsdbConnectionInstance.getConnectionInfo()); return deviceEntity; }
Example #10
Source File: TransactUtils.java From ovsdb with Eclipse Public License 1.0 | 6 votes |
public static UUID getLogicalSwitchUUID(final TransactionBuilder transaction, final HwvtepOperationalState operationalState, final InstanceIdentifier<LogicalSwitches> lswitchIid) { HwvtepDeviceInfo hwvtepDeviceInfo = operationalState.getDeviceInfo(); HwvtepDeviceInfo.DeviceData lsData = hwvtepDeviceInfo.getDeviceOperData(LogicalSwitches.class, lswitchIid); if (lsData != null) { if (lsData.getUuid() != null) { return lsData.getUuid(); } if (lsData.isInTransitState()) { return getLogicalSwitchUUID(lswitchIid); } return null; } LogicalSwitchUpdateCommand cmd = new LogicalSwitchUpdateCommand(operationalState, Collections.emptyList()); MdsalUtils mdsalUtils = new MdsalUtils(operationalState.getDataBroker()); LogicalSwitches ls = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, lswitchIid); if (ls != null) { cmd.updateLogicalSwitch(transaction, lswitchIid.firstIdentifierOf(Node.class), Lists.newArrayList(ls)); } else { LOG.error("Could not find logical switch in config ds {}", lswitchIid); return null; } return getLogicalSwitchUUID(lswitchIid); }
Example #11
Source File: OvsdbControllerUpdateCommandTest.java From ovsdb with Eclipse Public License 1.0 | 6 votes |
@SuppressWarnings("unchecked") @Test public void testUpdateController2() throws Exception { ReadWriteTransaction transaction = mock(ReadWriteTransaction.class); Map<UUID, Controller> updatedControllerRows = new HashMap<>(); Map<InstanceIdentifier<Node>, Node> bridgeNodes = new HashMap<>(); Node node = mock(Node.class); InstanceIdentifier<Node> bridgeIid = mock(InstanceIdentifier.class); bridgeNodes.put(bridgeIid, node); PowerMockito.doReturn(bridgeNodes).when(ovsdbControllerUpdateCommand, "getBridgeNodes", any(ReadWriteTransaction.class)); Whitebox.invokeMethod(ovsdbControllerUpdateCommand, "updateController", transaction, updatedControllerRows); PowerMockito.verifyPrivate(ovsdbControllerUpdateCommand).invoke("getBridgeNodes", any(ReadWriteTransaction.class)); }
Example #12
Source File: SouthboundUtils.java From ovsdb with Eclipse Public License 1.0 | 6 votes |
/** * Get OpenvSwitch other-config by key. * @param node OVSDB node * @param key key to extract from other-config * @return the value for key or null if key not found */ public String getOpenvswitchOtherConfig(Node node, String key) { OvsdbNodeAugmentation ovsdbNode = node.augmentation(OvsdbNodeAugmentation.class); if (ovsdbNode == null) { Node nodeFromReadOvsdbNode = readOvsdbNode(node); if (nodeFromReadOvsdbNode != null) { ovsdbNode = nodeFromReadOvsdbNode.augmentation(OvsdbNodeAugmentation.class); } } if (ovsdbNode != null) { final OpenvswitchOtherConfigs found = ovsdbNode.nonnullOpenvswitchOtherConfigs() .get(new OpenvswitchOtherConfigsKey(key)); if (found != null) { return found.getOtherConfigValue(); } } return null; }
Example #13
Source File: TransactUtils.java From ovsdb with Eclipse Public License 1.0 | 6 votes |
public static Map<InstanceIdentifier<Node>,Node> extractNode( Map<InstanceIdentifier<?>, DataObject> changes) { Map<InstanceIdentifier<Node>,Node> result = new HashMap<>(); if (changes != null) { for (Entry<InstanceIdentifier<?>, DataObject> created : changes.entrySet()) { if (created.getValue() instanceof Node) { Node value = (Node) created.getValue(); Class<?> type = created.getKey().getTargetType(); if (type.equals(Node.class)) { // Actually checked above @SuppressWarnings("unchecked") InstanceIdentifier<Node> iid = (InstanceIdentifier<Node>) created.getKey(); result.put(iid, value); } } } } return result; }
Example #14
Source File: SouthboundMapper.java From ovsdb with Eclipse Public License 1.0 | 6 votes |
public static InstanceIdentifier<Node> getInstanceIdentifier(final InstanceIdentifierCodec instanceIdentifierCodec, final OpenVSwitch ovs) { if (ovs.getExternalIdsColumn() != null && ovs.getExternalIdsColumn().getData() != null && ovs.getExternalIdsColumn().getData().containsKey(SouthboundConstants.IID_EXTERNAL_ID_KEY)) { String iidString = ovs.getExternalIdsColumn().getData().get(SouthboundConstants.IID_EXTERNAL_ID_KEY); return (InstanceIdentifier<Node>) instanceIdentifierCodec.bindingDeserializerOrNull(iidString); } else { String nodeString = SouthboundConstants.OVSDB_URI_PREFIX + "://" + SouthboundConstants.UUID + "/" + ovs.getUuid().toString(); NodeId nodeId = new NodeId(new Uri(nodeString)); NodeKey nodeKey = new NodeKey(nodeId); return InstanceIdentifier.builder(NetworkTopology.class) .child(Topology.class,new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID)) .child(Node.class,nodeKey) .build(); } }
Example #15
Source File: SouthboundMapperTest.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
@SuppressWarnings("unchecked") @Test public void testCreateInstanceIdentifier1() throws Exception { Bridge bridge = mock(Bridge.class); // When bridge is not empty, we expect a deserialized identifier Column<GenericTableSchema, Map<String, String>> column = mock(Column.class); when(bridge.getExternalIdsColumn()).thenReturn(column); Map<String, String> map = new HashMap<>(); map.put(SouthboundConstants.IID_EXTERNAL_ID_KEY, "IID_EXTERNAL_ID_KEY"); when(column.getData()).thenReturn(map); InstanceIdentifierCodec iidc = mock(InstanceIdentifierCodec.class); InstanceIdentifier deserializedIid = InstanceIdentifier.create(Node.class); when(iidc.bindingDeserializerOrNull("IID_EXTERNAL_ID_KEY")).thenReturn(deserializedIid); OvsdbConnectionInstance client = mock(OvsdbConnectionInstance.class, Mockito.RETURNS_DEEP_STUBS); assertEquals("Incorrect Instance Identifier received", deserializedIid, SouthboundMapper.createInstanceIdentifier(iidc, client, bridge)); // When bridge is empty, we expect a new identifier pointing to the bridge when(bridge.getExternalIdsColumn()).thenReturn(null); when(client.getNodeKey().getNodeId().getValue()).thenReturn("uri"); when(bridge.getName()).thenReturn("bridgeName"); InstanceIdentifier<Node> returnedIid = SouthboundMapper.createInstanceIdentifier(iidc, client, bridge); assertEquals("Incorrect identifier type", Node.class, returnedIid.getTargetType()); assertEquals("Incorrect node key", new NodeId(new Uri("uri/bridge/bridgeName")), returnedIid.firstKeyOf(Node.class).getNodeId()); }
Example #16
Source File: UcastMacsRemoteUpdateCommand.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
@Override public void onConfigUpdate(final TransactionBuilder transaction, final InstanceIdentifier<Node> nodeIid, final RemoteUcastMacs remoteUcastMacs, final InstanceIdentifier macKey, final Object... extraData) { InstanceIdentifier<RemoteUcastMacs> macIid = nodeIid.augmentation(HwvtepGlobalAugmentation.class) .child(RemoteUcastMacs.class, remoteUcastMacs.key()); processDependencies(UCAST_MAC_DATA_VALIDATOR, transaction, nodeIid, macIid, remoteUcastMacs); }
Example #17
Source File: TopologyStatsProviderImpl.java From bgpcep with Eclipse Public License 1.0 | 5 votes |
@Override public synchronized void close() throws Exception { if (closed.compareAndSet(false, true)) { LOG.info("Closing TopologyStatsProvider service."); this.scheduleTask.cancel(true); final WriteTransaction wTx = this.transactionChain.newWriteOnlyTransaction(); for (final KeyedInstanceIdentifier<Node, NodeKey> statId : this.statsMap.keySet()) { wTx.delete(LogicalDatastoreType.OPERATIONAL, statId); } wTx.commit().get(); this.statsMap.clear(); this.transactionChain.close(); this.scheduler.shutdown(); } }
Example #18
Source File: SouthboundUtils.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
public Node readOvsdbNode(Node bridgeNode) { Node ovsdbNode = null; OvsdbBridgeAugmentation bridgeAugmentation = extractBridgeAugmentation(bridgeNode); if (bridgeAugmentation != null) { InstanceIdentifier<Node> ovsdbNodeIid = (InstanceIdentifier<Node>) bridgeAugmentation.getManagedBy().getValue(); ovsdbNode = provider.read(LogicalDatastoreType.OPERATIONAL, ovsdbNodeIid); } else { LOG.debug("readOvsdbNode: Provided node is not a bridge node : {}",bridgeNode); } return ovsdbNode; }
Example #19
Source File: HwvtepOperationalState.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
public HwvtepOperationalState(final HwvtepConnectionInstance connectionInstance) { this.connectionInstance = connectionInstance; this.deviceInfo = connectionInstance.getDeviceInfo(); this.db = connectionInstance.getDataBroker(); this.changes = null; transaction = connectionInstance.getDataBroker().newReadWriteTransaction(); Optional<Node> readNode = new MdsalUtils(db).readOptional(LogicalDatastoreType.OPERATIONAL, connectionInstance.getInstanceIdentifier()); if (readNode.isPresent()) { operationalNodes.put(connectionInstance.getInstanceIdentifier(), readNode.get()); } }
Example #20
Source File: OvsdbBridgeUpdateCommandTest.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
@SuppressWarnings("unchecked") @Test public void testUpdateBridge() throws Exception { MemberModifier .suppress(MemberMatcher.method(OvsdbBridgeUpdateCommand.class, "buildConnectionNode", Bridge.class)); ReadWriteTransaction transaction = mock(ReadWriteTransaction.class); doNothing().when(transaction).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(Node.class)); // suppress calls to private methods MemberModifier .suppress(MemberMatcher.method(OvsdbBridgeUpdateCommand.class, "getInstanceIdentifier", Bridge.class)); MemberModifier.suppress(MemberMatcher.method(OvsdbBridgeUpdateCommand.class, "buildBridgeNode", Bridge.class)); MemberModifier.suppress(MemberMatcher.method(OvsdbBridgeUpdateCommand.class, "deleteEntries", ReadWriteTransaction.class, List.class)); MemberModifier.suppress(MemberMatcher.method(OvsdbBridgeUpdateCommand.class, "protocolEntriesToRemove", InstanceIdentifier.class, Bridge.class)); MemberModifier.suppress(MemberMatcher.method(OvsdbBridgeUpdateCommand.class, "externalIdsToRemove", InstanceIdentifier.class, Bridge.class)); MemberModifier.suppress(MemberMatcher.method(OvsdbBridgeUpdateCommand.class, "bridgeOtherConfigsToRemove", InstanceIdentifier.class, Bridge.class)); MemberModifier.suppress(MemberMatcher.method(OvsdbBridgeUpdateCommand.class, "getNodeId", Bridge.class)); Bridge bridge = mock(Bridge.class); InstanceIdentifier<Node> connectionIId = mock(InstanceIdentifier.class); Whitebox.invokeMethod(ovsdbBridgeUpdateCommand, "updateBridge", transaction, bridge, connectionIId); verify(ovsdbBridgeUpdateCommand, times(3)).deleteEntries(any(ReadWriteTransaction.class), eq(null)); }
Example #21
Source File: HwvtepGlobalRemoveCommand.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
@Override public void execute(ReadWriteTransaction transaction) { FluentFuture<Optional<Node>> hwvtepGlobalFuture = transaction.read( LogicalDatastoreType.OPERATIONAL, nodeInstanceIdentifier); try { Optional<Node> hwvtepGlobalOptional = hwvtepGlobalFuture.get(); if (hwvtepGlobalOptional.isPresent()) { Node hwvtepNode = hwvtepGlobalOptional.get(); HwvtepGlobalAugmentation hgAugmentation = hwvtepNode.augmentation(HwvtepGlobalAugmentation.class); if (checkIfOnlyConnectedManager(hgAugmentation)) { if (hgAugmentation != null) { Map<SwitchesKey, Switches> switches = hgAugmentation.getSwitches(); if (switches != null) { for (Switches hwSwitch : switches.values()) { LOG.debug("Deleting hwvtep switch {}", hwSwitch); transaction.delete( LogicalDatastoreType.OPERATIONAL, hwSwitch.getSwitchRef().getValue()); } } else { LOG.debug("{} had no switches", hwvtepNode.getNodeId().getValue()); } } else { LOG.warn("{} had no HwvtepGlobalAugmentation", hwvtepNode.getNodeId().getValue()); } transaction.delete(LogicalDatastoreType.OPERATIONAL, nodeInstanceIdentifier); } else { LOG.debug("Other southbound plugin instances in cluster are connected to the device," + " not deleting OvsdbNode form data store."); } } } catch (InterruptedException | ExecutionException e) { LOG.warn("Failure to delete ovsdbNode", e); } }
Example #22
Source File: OvsdbDataTreeChangeListener.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
private void updateConnections(@NonNull Collection<DataTreeModification<Node>> changes) { for (DataTreeModification<Node> change : changes) { switch (change.getRootNode().getModificationType()) { case SUBTREE_MODIFIED: case WRITE: DataObjectModification<OvsdbNodeAugmentation> ovsdbNodeModification = change.getRootNode().getModifiedAugmentation(OvsdbNodeAugmentation.class); if (ovsdbNodeModification != null) { final OvsdbNodeAugmentation dataBefore = ovsdbNodeModification.getDataBefore(); if (dataBefore != null) { OvsdbNodeAugmentation dataAfter = ovsdbNodeModification.getDataAfter(); if (dataAfter != null) { ConnectionInfo connectionInfo = dataAfter.getConnectionInfo(); if (connectionInfo != null) { OvsdbClient client = cm.getClient(connectionInfo); if (client == null) { if (dataBefore != null) { try { cm.disconnect(dataBefore); cm.connect(change.getRootPath().getRootIdentifier(), dataAfter); } catch (UnknownHostException | ConnectException e) { LOG.warn("Error disconnecting from or connecting to ovsdbNode", e); } } } } } } } break; default: // FIXME: delete seems to be unhandled break; } } }
Example #23
Source File: UcastMacsRemoteRemoveCommand.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
@Override public void doDeviceTransaction(final TransactionBuilder transaction, final InstanceIdentifier<Node> instanceIdentifier, final RemoteUcastMacs mac, final InstanceIdentifier macKey, final Object... extraData) { removeUcastMacRemote(transaction, instanceIdentifier, Lists.newArrayList(mac)); }
Example #24
Source File: HwvtepUcastMacsRemoteUpdateCommand.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
private Node buildConnectionNode(final Collection<UcastMacsRemote> macRemotes) { NodeBuilder connectionNode = new NodeBuilder(); connectionNode.setNodeId(getOvsdbConnectionInstance().getNodeId()); HwvtepGlobalAugmentationBuilder hgAugmentationBuilder = new HwvtepGlobalAugmentationBuilder(); List<RemoteUcastMacs> remoteUMacs = new ArrayList<>(); macRemotes.forEach(mac -> remoteUMacs.add(buildRemoteUcast(mac))); hgAugmentationBuilder.setRemoteUcastMacs(remoteUMacs); connectionNode.addAugmentation(HwvtepGlobalAugmentation.class, hgAugmentationBuilder.build()); return connectionNode.build(); }
Example #25
Source File: HwvtepOperationalDataChangeListener.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
private InstanceIdentifier<Node> getWildcardPath() { InstanceIdentifier<Node> path = InstanceIdentifier .create(NetworkTopology.class) .child(Topology.class, new TopologyKey(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID)) .child(Node.class); return path; }
Example #26
Source File: QosRemovedCommand.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
@Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final Collection<DataTreeModification<Node>> modifications, final InstanceIdentifierCodec instanceIdentifierCodec) { execute(transaction, state, TransactUtils.extractOriginal(modifications, OvsdbNodeAugmentation.class), TransactUtils.extractUpdated(modifications, OvsdbNodeAugmentation.class)); }
Example #27
Source File: OvsdbOperGlobalListener.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
private InstanceIdentifier<Node> getWildcardPath() { InstanceIdentifier<Node> path = InstanceIdentifier .create(NetworkTopology.class) .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID)) .child(Node.class); return path; }
Example #28
Source File: SouthboundIT.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
private Node connectOvsdbNode(final ConnectionInfo connectionInfo) throws InterruptedException { final InstanceIdentifier<Node> iid = SouthboundUtils.createInstanceIdentifier(connectionInfo); Assert.assertTrue( mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, iid, SouthboundUtils.createNode(connectionInfo))); waitForOperationalCreation(iid); Node node = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, iid); Assert.assertNotNull(node); LOG.info("Connected to {}", SouthboundUtils.connectionInfoToString(connectionInfo)); return node; }
Example #29
Source File: BridgeRemovedCommand.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
@Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final Collection<DataTreeModification<Node>> modifications, final InstanceIdentifierCodec instanceIdentifierCodec) { execute(transaction, state, TransactUtils.extractRemoved(modifications, OvsdbBridgeAugmentation.class), TransactUtils.extractOriginal(modifications, OvsdbBridgeAugmentation.class)); }
Example #30
Source File: HwvtepOperGlobalListener.java From ovsdb with Eclipse Public License 1.0 | 5 votes |
private void disconnect(Collection<DataTreeModification<Node>> changes) { changes.forEach((change) -> { InstanceIdentifier<Node> key = change.getRootPath().getRootIdentifier(); DataObjectModification<Node> mod = change.getRootNode(); Node node = getRemoved(mod); if (node != null) { CONNECTED_NODES.remove(key); NODE_CONNECTION_INFO.remove(key); synchronized (HwvtepOperGlobalListener.class) { runPendingJobs(key); } } }); }