@Override public NodeKey getSourceNodeKey() { return mount.getNode().getKey(); }
/** * Delete Bridge on the given Node. * * @param ovsdbNode the node object of the OVS instance * @param bridgeName the bridgename of the bridge to be removed * @return true if the bridge deleted is successful. */ private boolean deleteBridge(Node ovsdbNode, String bridgeName) { InstanceIdentifier<Node> bridgeIid = this.createInstanceIdentifier(ovsdbNode.getKey(), bridgeName); return mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, bridgeIid); }
/** * This method reconciles Termination Point configurations for the given list of bridge nodes. * * @param connectionManager OvsdbConnectionManager object * @param connectionInstance OvsdbConnectionInstance object * @param bridgeNodes list of bridge nodes be reconciled for termination points */ public void reconcileTerminationPoints(final OvsdbConnectionManager connectionManager, final OvsdbConnectionInstance connectionInstance, final List<Node> bridgeNodes) { LOG.debug("Reconcile Termination Point Configuration for Bridges {}", bridgeNodes); Preconditions.checkNotNull(bridgeNodes, "Bridge Node list must not be null"); if (!bridgeNodes.isEmpty()) { for (Node node : bridgeNodes) { bridgeNodeCache.put(node.getKey(), new NodeConnectionMetadata(node, connectionManager, connectionInstance)); } registerBridgeCreatedDataTreeChangeListener(); } }
@Override public void onSuccess(final Optional<Topology> data) { if(data.isPresent()) { final List<Node> nodes = data.get().getNode(); if(nodes != null){ for (final Node node : nodes) { if (nodeRegex.matcher(node.getNodeId().getValue()).matches()) { notifyNode(EventSourceTopology.EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, node.getKey())); } } } } tx.close(); }
public OvsdbBridgeAugmentation getBridgeFromConfig(Node node, String bridge) { OvsdbBridgeAugmentation ovsdbBridgeAugmentation = null; InstanceIdentifier<Node> bridgeIid = createInstanceIdentifier(node.getKey(), bridge); Node bridgeNode = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, bridgeIid); if (bridgeNode != null) { ovsdbBridgeAugmentation = bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class); } return ovsdbBridgeAugmentation; }
public OvsdbBridgeAugmentation getBridgeFromConfig(Node node, String bridge) { OvsdbBridgeAugmentation ovsdbBridgeAugmentation = null; InstanceIdentifier<Node> bridgeIid = MdsalHelper.createInstanceIdentifier(node.getKey(), bridge); Node bridgeNode = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, bridgeIid); if (bridgeNode != null) { ovsdbBridgeAugmentation = bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class); } return ovsdbBridgeAugmentation; }
public OvsdbBridgeAugmentation getBridgeFromConfig(Node node, String bridge) { OvsdbBridgeAugmentation ovsdbBridgeAugmentation = null; InstanceIdentifier<Node> bridgeIid = MdsalHelper.createInstanceIdentifier(node.getKey(), bridge); Node bridgeNode = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, bridgeIid); if (bridgeNode != null) { ovsdbBridgeAugmentation = bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class); } return ovsdbBridgeAugmentation; }
@Override public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event) { for (final Map.Entry<InstanceIdentifier<?>, DataObject> createdEntry : event.getCreatedData().entrySet()) { if (createdEntry.getValue() instanceof Node) { final Node node = (Node) createdEntry.getValue(); LOG.debug("Create node..."); if (getNodeIdRegexPattern().matcher(node.getNodeId().getValue()).matches()) { LOG.debug("Matched..."); notifyNode(EventSourceTopology.EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, node.getKey())); } } } for (final Map.Entry<InstanceIdentifier<?>, DataObject> changeEntry : event.getUpdatedData().entrySet()) { if (changeEntry.getValue() instanceof Node) { final Node node = (Node) changeEntry.getValue(); if (getNodeIdRegexPattern().matcher(node.getNodeId().getValue()).matches()) { notifyNode(changeEntry.getKey()); } } } }
public OvsdbBridgeAugmentation readBridge(Node node, String name) { OvsdbBridgeAugmentation ovsdbBridgeAugmentation = null; ConnectionInfo connectionInfo = getConnectionInfo(node); if (connectionInfo != null) { InstanceIdentifier<Node> bridgeIid = MdsalHelper.createInstanceIdentifier(node.getKey(), name); Node bridgeNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, bridgeIid); if (bridgeNode != null) { ovsdbBridgeAugmentation = bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class); } } return ovsdbBridgeAugmentation; }
public OvsdbBridgeAugmentation readBridge(Node node, String name) { OvsdbBridgeAugmentation ovsdbBridgeAugmentation = null; ConnectionInfo connectionInfo = getConnectionInfo(node); if (connectionInfo != null) { InstanceIdentifier<Node> bridgeIid = MdsalHelper.createInstanceIdentifier(node.getKey(), name); Node bridgeNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, bridgeIid); if (bridgeNode != null) { ovsdbBridgeAugmentation = bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class); } } return ovsdbBridgeAugmentation; }
/** * Puts the given host in the this local HashMap and into MD-SAL database. * * @param hostId * the key for the map * @param host * the value for the map * @return the old value from the local cache if present, null otherwise. */ @Override public synchronized V put(K hostId, V host) { final Node hostNode = ((Host) host).getHostNode(); final InstanceIdentifier<Node> buildNodeIID = Utilities.buildNodeIID(hostNode.getKey(), topologyId); this.opProcessor.enqueueOperation(new HostTrackerOperation() { @Override public void applyOperation(ReadWriteTransaction tx) { tx.merge(LogicalDatastoreType.OPERATIONAL, buildNodeIID, hostNode, true); } }); LOG.trace("Putting MD-SAL {}", hostNode.getNodeId()); return putLocally(buildNodeIID, host); }
public InstanceIdentifier<TerminationPoint> createTerminationPointInstanceIdentifier(Node node, String portName){ InstanceIdentifier<TerminationPoint> terminationPointPath = InstanceIdentifier .create(NetworkTopology.class) .child(Topology.class, new TopologyKey(OVSDB_TOPOLOGY_ID)) .child(Node.class,node.getKey()) .child(TerminationPoint.class, new TerminationPointKey(new TpId(portName))); LOG.debug("Termination point InstanceIdentifier generated : {}",terminationPointPath); return terminationPointPath; }
public static InstanceIdentifier<TerminationPoint> createTerminationPointInstanceIdentifier(Node node, String portName){ InstanceIdentifier<TerminationPoint> terminationPointPath = InstanceIdentifier .create(NetworkTopology.class) .child(Topology.class, new TopologyKey(OVSDB_TOPOLOGY_ID)) .child(Node.class,node.getKey()) .child(TerminationPoint.class, new TerminationPointKey(new TpId(portName))); LOG.debug("Termination point InstanceIdentifier generated : {}",terminationPointPath); return terminationPointPath; }
public static InstanceIdentifier<TerminationPoint> createTerminationPointInstanceIdentifier(Node node, String portName){ InstanceIdentifier<TerminationPoint> terminationPointPath = InstanceIdentifier .create(NetworkTopology.class) .child(Topology.class, new TopologyKey(OVSDB_TOPOLOGY_ID)) .child(Node.class,node.getKey()) .child(TerminationPoint.class, new TerminationPointKey(new TpId(portName))); LOG.debug("Termination point InstanceIdentifier generated : {}",terminationPointPath); return terminationPointPath; }
public Node readBridgeNode(Node node, String name) { Node ovsdbNode = node; if (extractNodeAugmentation(ovsdbNode) == null) { ovsdbNode = readOvsdbNode(node); if (ovsdbNode == null) { return null; } } Node bridgeNode = null; ConnectionInfo connectionInfo = getConnectionInfo(ovsdbNode); if (connectionInfo != null) { InstanceIdentifier<Node> bridgeIid = MdsalHelper.createInstanceIdentifier(node.getKey(), name); bridgeNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, bridgeIid); } return bridgeNode; }
public Node readBridgeNode(Node node, String name) { Node ovsdbNode = node; if (extractNodeAugmentation(ovsdbNode) == null) { ovsdbNode = readOvsdbNode(node); if (ovsdbNode == null) { return null; } } Node bridgeNode = null; ConnectionInfo connectionInfo = getConnectionInfo(ovsdbNode); if (connectionInfo != null) { InstanceIdentifier<Node> bridgeIid = MdsalHelper.createInstanceIdentifier(node.getKey(), name); bridgeNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, bridgeIid); } return bridgeNode; }
public Node readBridgeNode(Node node, String name) { Node ovsdbNode = node; if (extractNodeAugmentation(ovsdbNode) == null) { ovsdbNode = readOvsdbNode(node); if (ovsdbNode == null) { return null; } } Node bridgeNode = null; ConnectionInfo connectionInfo = getConnectionInfo(ovsdbNode); if (connectionInfo != null) { InstanceIdentifier<Node> bridgeIid = createInstanceIdentifier(node.getKey(), name); bridgeNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, bridgeIid); } return bridgeNode; }
/** * Generates an Instance Identifier for a Termination Point * by using the bridge node and the Termination Point ID. * @param bridgeNode The bridge Node to where the TP resides. * @param tpId The termination point ID * @return An Instance Identifier for a specific TP */ public static InstanceIdentifier<TerminationPoint> getTerminationPointIid( Node bridgeNode, TpId tpId) { InstanceIdentifier<TerminationPoint> terminationPointPath = InstanceIdentifier .create(NetworkTopology.class) .child(Topology.class, new TopologyKey(UnimgrConstants.OVSDB_TOPOLOGY_ID)) .child(Node.class, bridgeNode.getKey()) .child(TerminationPoint.class, new TerminationPointKey(tpId)); return terminationPointPath; }
/** * Generates an Instance Identifier for a Termination Point by using * the Bridge Node and the Port Name. * @param bridgeNode The bridge where the port resides. * @param portName The name of the port, example: eth0 * @return instance identifier */ public static InstanceIdentifier<TerminationPoint> getTerminationPointIid( Node bridgeNode, String portName) { InstanceIdentifier<TerminationPoint> terminationPointPath = InstanceIdentifier .create(NetworkTopology.class) .child(Topology.class, new TopologyKey(UnimgrConstants.OVSDB_TOPOLOGY_ID)) .child(Node.class, bridgeNode.getKey()) .child(TerminationPoint.class, new TerminationPointKey(new TpId(portName))); return terminationPointPath; }
/** * Create instance identifier for the specified termination point. * * @param node A {@link Node} instance. * @param portName The name of the port. * @return InstanceIdentifier. */ private static InstanceIdentifier<TerminationPoint> createTerminationPointInstanceIdentifier(Node node, String portName) { InstanceIdentifier<TerminationPoint> terminationPointPath = InstanceIdentifier. builder(NetworkTopology.class). child(Topology.class, new TopologyKey(new TopologyId(new Uri("ovsdb:1")))). child(Node.class, node.getKey()). child(TerminationPoint.class, new TerminationPointKey(new TpId(portName))). build(); LOG.debug("Termination point InstanceIdentifier generated : {}", terminationPointPath); return terminationPointPath; }