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; }
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; }
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; }
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; }
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 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; }
/** * Method builds OVS NodeId which is based on: * 1. OVS Node InstanceIdentifier which manages the OVS Bridge * 2. OVS Bridge name * <p> * If the two aforementioned fields are missing, NullPointerException is raised. * <p> * * @param ovsdbBridge OvsdbBridgeAugmentation * @return NodeId */ private static NodeId getManagedByNodeId(OvsdbBridgeAugmentation ovsdbBridge) { Preconditions.checkNotNull(ovsdbBridge, "Cannot getManagedByNodeId, OvsdbBridgeAugmentation is null."); Preconditions.checkNotNull(ovsdbBridge.getBridgeName(), "Cannot build getManagedByNodeId, BridgeName is null."); Preconditions.checkNotNull(ovsdbBridge.getManagedBy(), "Cannot build getManagedByNodeId, ManagedBy is null."); String bridgeName = (ovsdbBridge.getBridgeName().getValue()); InstanceIdentifier<Node> nodeIID = (InstanceIdentifier<Node>) ovsdbBridge.getManagedBy().getValue(); KeyedInstanceIdentifier keyedInstanceIdentifier = (KeyedInstanceIdentifier) nodeIID.firstIdentifierOf(Node.class); Preconditions.checkNotNull(keyedInstanceIdentifier, "Cannot build getManagedByNodeId, parent OVS Node is null."); NodeKey nodeKey = (NodeKey) keyedInstanceIdentifier.getKey(); String nodeId = nodeKey.getNodeId().getValue(); nodeId = nodeId.concat(OVSDB_BRIDGE_PREFIX + bridgeName); return new NodeId(nodeId); }
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; }
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; }
LOG.debug("Reconcile Configuration for node {}", node.getNodeId()); OvsdbBridgeAugmentation bridge = node.getAugmentation(OvsdbBridgeAugmentation.class); if (bridge != null && bridge.getManagedBy() != null && bridge.getManagedBy().getValue().equals(ndIid)) { brChanges.putAll(extractBridgeConfigurationChanges(node, bridge)); tpChanges.add(node);
return false; if (!Objects.equals(_managedBy, other.getManagedBy())) { return false;
if (bridgeAugmentation.getManagedBy() != null) { nodeIid = (InstanceIdentifier<Node>) bridgeAugmentation.getManagedBy().getValue(); client = cm.getConnectionInstance(nodeIid);
OvsdbNodeRef ovsdbNode = bridgeAugmentation.getManagedBy(); if (ovsdbNode != null) { NodeKey ovsdbNodeKey = ovsdbNode.getValue().firstKeyOf(Node.class);
public OvsdbBridgeAugmentationBuilder(OvsdbBridgeAugmentation base) { this._autoAttach = base.getAutoAttach(); this._bridgeExternalIds = base.getBridgeExternalIds(); this._bridgeName = base.getBridgeName(); this._bridgeOpenflowNodeRef = base.getBridgeOpenflowNodeRef(); this._bridgeOtherConfigs = base.getBridgeOtherConfigs(); this._bridgeUuid = base.getBridgeUuid(); this._controllerEntry = base.getControllerEntry(); this._datapathId = base.getDatapathId(); this._datapathType = base.getDatapathType(); this._failMode = base.getFailMode(); this._flowNode = base.getFlowNode(); this._managedBy = base.getManagedBy(); this._protocolEntry = base.getProtocolEntry(); }
String serviceNode = OvsdbMdsalHelper.getNodeKey(ovsdbBridgeAugmentation.getManagedBy().getValue()); if(serviceNode.isEmpty()) { serviceNode += SFF_DEFAULT_NAME + counter.incrementAndGet(); ovsNodeBuilder.setNodeId(ovsdbBridgeAugmentation.getManagedBy()); sffOvsNodeAugBuilder.setOvsNode(ovsNodeBuilder.build()); sffBuilder.addAugmentation(SffOvsNodeAugmentation.class, sffOvsNodeAugBuilder.build());