private void setManagedBy(final OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder, final ConnectionInfo connectionInfo) { InstanceIdentifier<Node> connectionNodePath = createInstanceIdentifier(connectionInfo); ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath)); }
private Node readOvsdbNodeByRef(OvsdbNodeRef nodeRef) { Preconditions.checkNotNull(nodeRef, "Cannot READ OVS Node from OVSDB operational store, nodeRef is null."); InstanceIdentifier<Node> bridgeIID = (InstanceIdentifier<Node>) nodeRef.getValue(); return SfcDataStoreAPI.readTransactionAPI(bridgeIID, LogicalDatastoreType.OPERATIONAL); } }
String bridgeName) { LOG.info("Creating a bridge on node {}", ovsdbNode.getNodeId().getValue()); final InstanceIdentifier<Node> ovsdbNodeIid = uni.getOvsdbNodeRef().getValue().firstIdentifierOf(Node.class); if (ovsdbNodeIid != null) { final NodeBuilder bridgeNodeBuilder = new NodeBuilder(); ovsdbBridgeAugmentationBuilder.setBridgeName(new OvsdbBridgeName(bridgeName)); ovsdbBridgeAugmentationBuilder.setProtocolEntry(OvsdbUtils.createMdsalProtocols()); final OvsdbNodeRef ovsdbNodeRef = new OvsdbNodeRef(ovsdbNodeIid); ovsdbBridgeAugmentationBuilder.setManagedBy(ovsdbNodeRef); bridgeNodeBuilder.addAugmentation(OvsdbBridgeAugmentation.class, ovsdbBridgeAugmentationBuilder.build());
public Node readOvsdbNode(Node bridgeNode) { Node ovsdbNode = null; OvsdbBridgeAugmentation bridgeAugmentation = extractBridgeAugmentation(bridgeNode); if (bridgeAugmentation != null) { InstanceIdentifier<Node> ovsdbNodeIid = (InstanceIdentifier<Node>) bridgeAugmentation.getManagedBy().getValue(); ovsdbNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, ovsdbNodeIid); }else{ LOG.debug("readOvsdbNode: Provided node is not a bridge node : {}",bridgeNode); } return ovsdbNode; }
/** * Set the manager node for the node. * * @param ovsdbBridgeAugmentationBuilder * A {@link OvsdbBridgeAugmentationBuilder} instance. * @param ovsdbNodeKey A {@link NodeKey} instance. */ private void setManagedByForBridge(OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder, NodeKey ovsdbNodeKey) { InstanceIdentifier<Node> connectionNodePath = this.createInstanceIdentifier(ovsdbNodeKey.getNodeId()); LOG.trace("setManagedByForBridge: connectionNodePath: {}", connectionNodePath); ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath)); }
public Node readOvsdbNode(Node bridgeNode) { Node ovsdbNode = null; OvsdbBridgeAugmentation bridgeAugmentation = extractBridgeAugmentation(bridgeNode); if (bridgeAugmentation != null) { InstanceIdentifier<Node> ovsdbNodeIid = (InstanceIdentifier<Node>) bridgeAugmentation.getManagedBy().getValue(); ovsdbNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, ovsdbNodeIid); }else{ LOG.debug("readOvsdbNode: Provided node is not a bridge node : {}",bridgeNode); } return ovsdbNode; }
private void setManagedByForBridge(OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder, NodeKey ovsdbNodeKey) { InstanceIdentifier<Node> connectionNodePath = MdsalHelper.createInstanceIdentifier(ovsdbNodeKey.getNodeId()); ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath)); }
public Node readOvsdbNode(Node bridgeNode) { Node ovsdbNode = null; OvsdbBridgeAugmentation bridgeAugmentation = extractBridgeAugmentation(bridgeNode); if (bridgeAugmentation != null) { InstanceIdentifier<Node> ovsdbNodeIid = (InstanceIdentifier<Node>) bridgeAugmentation.getManagedBy().getValue(); ovsdbNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, ovsdbNodeIid); }else{ LOG.debug("readOvsdbNode: Provided node is not a bridge node : {}",bridgeNode); } return ovsdbNode; }
private void setManagedByForBridge(OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder, NodeKey ovsdbNodeKey) { InstanceIdentifier<Node> connectionNodePath = createInstanceIdentifier(ovsdbNodeKey.getNodeId()); ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath)); }
public static OvsdbNodeAugmentation getOvsdbNodeAugmentation(OvsdbNodeRef nodeRef, ExecutorService executor) { Preconditions.checkNotNull(executor); if (nodeRef.getValue().getTargetType().equals(Node.class)) { Object[] methodParams = {nodeRef}; SfcOvsDataStoreAPI readOvsdbNode = new SfcOvsDataStoreAPI(SfcOvsDataStoreAPI.Method.READ_OVSDB_NODE_BY_REF, methodParams); Node ovsdbNode = (Node) SfcOvsUtil.submitCallable(readOvsdbNode, executor); if (ovsdbNode != null) { return ovsdbNode.getAugmentation(OvsdbNodeAugmentation.class); } else { LOG.warn("Could not find ovsdb-node for connection for {}", ovsdbNode); } } else { LOG.warn("Bridge 'managedBy' non-ovsdb-node. nodeRef {}", nodeRef); } return null; }
private void setManagedByForBridge(OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder, NodeKey ovsdbNodeKey) { InstanceIdentifier<Node> connectionNodePath = MdsalHelper.createInstanceIdentifier(ovsdbNodeKey.getNodeId()); ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath)); }
try { OvsdbNodeRef ref = mn.getManagedBy(); if (ref != null && ref.getValue() != null) { ReadOnlyTransaction transaction = db.newReadOnlyTransaction(); @SuppressWarnings("unchecked") InstanceIdentifier<Node> path = (InstanceIdentifier<Node>) ref.getValue(); } else { LOG.warn("OvsdbManagedNode {} claims to be managed by {} but " + "that OvsdbNode does not exist", mn, ref.getValue()); return Optional.absent();
private void setManagedBy(OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder) { InstanceIdentifier<Node> connectionNodePath = getOvsdbConnectionInstance().getInstanceIdentifier(); ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath)); }
private InstanceIdentifier<?> getManagedByIidFromOperDS(InstanceIdentifier<?> bridgeIid) { // Get the InstanceIdentifier of the containing node InstanceIdentifier<Node> nodeEntryIid = bridgeIid.firstIdentifierOf(Node.class); Optional<?> bridgeNode = SouthboundUtil.readNode(db.newReadWriteTransaction(),nodeEntryIid); if (bridgeNode.isPresent() && bridgeNode.get() instanceof Node) { Node node = (Node)bridgeNode.get(); OvsdbBridgeAugmentation bridge = node.getAugmentation(OvsdbBridgeAugmentation.class); if (bridge != null && bridge.getManagedBy() != null) { return bridge.getManagedBy().getValue(); } } return null; }
OvsdbNodeRef ovsdbNodeRef = new OvsdbNodeRef(SfcOvsUtil.buildOvsdbNodeIID(managerNode.getNodeId())); builder.setManagedBy(ovsdbNodeRef); builder.setBridgeName(new OvsdbBridgeName(serviceForwarderOvsBridge.getBridgeName()));
private InstanceIdentifier<?> getManagedByIid(Map<InstanceIdentifier<?>, DataObject> map, InstanceIdentifier<?> iidToCheck) { // Get the InstanceIdentifier of the containing node InstanceIdentifier<Node> nodeEntryIid = iidToCheck.firstIdentifierOf(Node.class); // Look for the Node in the created/updated data DataObject dataObject = null; if (map != null && map.get(nodeEntryIid) != null) { dataObject = map.get(nodeEntryIid); } // If we are contained in a bridge managed by this iid if (dataObject != null && dataObject instanceof Node) { Node node = (Node)dataObject; OvsdbBridgeAugmentation bridge = node.getAugmentation(OvsdbBridgeAugmentation.class); if (bridge != null && bridge.getManagedBy() != null && bridge.getManagedBy().getValue().equals(this.iid)) { return bridge.getManagedBy().getValue(); } } return null; }
ovsdbBridgeAugmentationBuilder.setBridgeName(new OvsdbBridgeName(bridgeName)); ovsdbBridgeAugmentationBuilder.setProtocolEntry(OvsdbUtils.createMdsalProtocols()); final OvsdbNodeRef ovsdbNodeRef = new OvsdbNodeRef(ovsdbNodeIid); ovsdbBridgeAugmentationBuilder.setManagedBy(ovsdbNodeRef); bridgeNodeBuilder.addAugmentation(OvsdbBridgeAugmentation.class,
private OvsdbNodeAugmentation getOperNode(final OvsdbBridgeAugmentation operBridge) { @SuppressWarnings("unchecked") InstanceIdentifier<Node> iidNode = (InstanceIdentifier<Node>)operBridge.getManagedBy().getValue(); OvsdbNodeAugmentation operNode = null; ReadOnlyTransaction transaction = SouthboundProvider.getDb().newReadOnlyTransaction(); CheckedFuture<Optional<Node>, ReadFailedException> future = transaction.read(LogicalDatastoreType.OPERATIONAL, iidNode); try { Optional<Node> nodeOptional = future.get(); if (nodeOptional.isPresent()) { operNode = nodeOptional.get().getAugmentation(OvsdbNodeAugmentation.class); } } catch (InterruptedException | ExecutionException e) { LOG.warn("Error reading from datastore", e); } return operNode; }
InstanceIdentifier<?> ovsdbNodeIid, DataBroker dataBroker) { final OvsdbNodeRef ovsdbNodeRef = new OvsdbNodeRef(ovsdbNodeIid); final UniAugmentationBuilder updatedUniBuilder = new UniAugmentationBuilder(uni); if (ovsdbNodeRef != null) {
public NodeId extractBridgeOvsdbNodeId(Node bridgeNode) { NodeId ovsdbNodeId = null; OvsdbBridgeAugmentation bridgeAugmentation = extractBridgeAugmentation(bridgeNode); if (bridgeAugmentation != null) { @SuppressWarnings("unchecked") InstanceIdentifier<Node> ovsdbNodeIid = (InstanceIdentifier<Node>) (bridgeAugmentation.getManagedBy().getValue()); ovsdbNodeId = InstanceIdentifier.keyOf(ovsdbNodeIid).getNodeId(); } return ovsdbNodeId; }