/** * Return the node ID in the specified instance identifier. * * @param iid instance of InstanceIdentifier. * @return NodeId of the Controller. */ private NodeId getNodeId(InstanceIdentifier<Node> iid) { NodeKey nodeKey = iid.firstKeyOf(Node.class); return nodeKey.getNodeId(); }
@Override public void onSuccess(@Nullable Optional<Node> node) { if (node.isPresent()) { LOG.info("Disconnected/Failed connection {} was controller initiated, attempting " + "reconnection", ovsdbNode.getConnectionInfo()); reconciliationManager.enqueue(task); } else { LOG.debug("Connection {} was switch initiated, no reconciliation is required", iid.firstKeyOf(Node.class).getNodeId()); } }
private NodeId getNodeId(final Map.Entry<InstanceIdentifier<?>, DataObject> entry) { NodeId nodeId = null; for (InstanceIdentifier.PathArgument pathArgument : entry.getKey().getPathArguments()) { if (pathArgument instanceof InstanceIdentifier.IdentifiableItem<?, ?>) { final Identifier key = ((InstanceIdentifier.IdentifiableItem) pathArgument).getKey(); if (key instanceof NodeKey) { nodeId = ((NodeKey) key).getNodeId(); } } } return nodeId; }
private NodeId getNodeId(Bridge bridge) { NodeKey nodeKey = getInstanceIdentifier(bridge).firstKeyOf(Node.class, NodeKey.class); return nodeKey.getNodeId(); } }
private NodeId getNodeId(OpenVSwitch ovs) { NodeKey nodeKey = getInstanceIdentifier(ovs).firstKeyOf(Node.class, NodeKey.class); return nodeKey.getNodeId(); } }
/** * Read Node from the OVSDB path. * * @param ovsdbNodeKey A {@link NodeKey} instance. * @param bridgeName The name of the bridge. * @return The {@link InstanceIdentifier} for the manager node. */ private InstanceIdentifier<Node> createInstanceIdentifier(NodeKey ovsdbNodeKey, String bridgeName) { return createInstanceIdentifier( getManagedNodeId(ovsdbNodeKey.getNodeId(), bridgeName)); }
private void setManagedByForBridge(OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder, NodeKey ovsdbNodeKey) { InstanceIdentifier<Node> connectionNodePath = createInstanceIdentifier(ovsdbNodeKey.getNodeId()); ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath)); }
private void setManagedByForBridge(OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder, NodeKey ovsdbNodeKey) { InstanceIdentifier<Node> connectionNodePath = MdsalHelper.createInstanceIdentifier(ovsdbNodeKey.getNodeId()); ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath)); }
/** * Gets the managed by node id. * * @param globalRef * the global ref * @return the managed by node id */ private String getManagedByNodeId(HwvtepGlobalRef globalRef) { InstanceIdentifier<?> instId = globalRef.getValue(); return instId.firstKeyOf(Node.class).getNodeId().getValue(); }
@Override public FabricRenderer composeFabric(InstanceIdentifier<FabricNode> iid, FabricAttributeBuilder fabric, ComposeFabricInput input) { FabricId fabricId = new FabricId(iid.firstKeyOf(Node.class).getNodeId()); FabricContext fabricCtx = new FabricContext(fabricId, dataBroker, availableMacs); fabricCtxs.put(iid, fabricCtx); return new VlanFabricRenderer(dataBroker, fabricCtx); }
public VlanFabricListener(InstanceIdentifier<FabricNode> fabricIId, final DataBroker dataProvider, final RpcProviderRegistry rpcRegistry, final FabricContext fabricCtx) { this.fabricIId = fabricIId; this.fabricid = new FabricId(fabricIId.firstKeyOf(Node.class).getNodeId()); this.dataBroker = dataProvider; this.rpcRegistry = rpcRegistry; executor = fabricCtx.executor; this.fabricCtx = fabricCtx; epMgr = new EndPointManager(dataProvider, rpcRegistry, fabricCtx); }
private void setManagedByForBridge(OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder, NodeKey ovsdbNodeKey) { InstanceIdentifier<Node> connectionNodePath = MdsalHelper.createInstanceIdentifier(ovsdbNodeKey.getNodeId()); ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath)); }
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; }
NodeImpl(NodeBuilder base) { if (base.key() != null) { this.key = base.key(); } else { this.key = new NodeKey(base.getNodeId()); } this._nodeId = key.getNodeId(); this._supportingNode = base.getSupportingNode(); this._terminationPoint = base.getTerminationPoint(); this.augmentation = ImmutableMap.copyOf(base.augmentation); }
public static InstanceIdentifier<Node> createInstanceIdentifier( OvsdbConnectionInstance client, String bridgeName) { String nodeString = client.getNodeKey().getNodeId().getValue() + "/bridge/" + bridgeName; NodeId nodeId = new NodeId(new Uri(nodeString)); return createInstanceIdentifier(nodeId); }
private void insert(final KeyedInstanceIdentifier<Node, NodeKey> sourcePath) { final NodeKey nodeKey = sourcePath.getKey(); final InstanceIdentifier<Node1> augmentPath = sourcePath.augmentation(Node1.class); final Node1 nodeAgument = new Node1Builder().setEventSourceNode(new NodeId(nodeKey.getNodeId().getValue())).build(); putData(OPERATIONAL, augmentPath, nodeAgument); }
private void insert(final KeyedInstanceIdentifier<Node, NodeKey> sourcePath) { final NodeKey nodeKey = sourcePath.getKey(); final InstanceIdentifier<Node1> augmentPath = sourcePath.augmentation(Node1.class); final Node1 nodeAgument = new Node1Builder().setEventSourceNode( new NodeId(nodeKey.getNodeId().getValue())).build(); putData(OPERATIONAL, augmentPath, nodeAgument); }
private void putTopologyNode() { final Node node = new NodeBuilder().setKey(nodeId.getKey()).setNodeId(nodeId.getKey().getNodeId()).build(); final WriteTransaction t = beginTransaction(); t.put(LogicalDatastoreType.OPERATIONAL, nodeId, node); t.submit(); }
@Override public void routeCleared(InstanceIdentifier<Node> lrIid) { NodeId nodeId = lrIid.firstKeyOf(Node.class).getNodeId(); LogicRouterContext routerCtx = fabricCtx.getLogicRouterCtx(nodeId); WriteTransaction wt = dataBroker.newWriteOnlyTransaction(); for (DeviceKey key : fabricCtx.getSpineDevices()) { DeviceContext devCtx = fabricCtx.getDeviceCtx(key); wt.delete(LogicalDatastoreType.OPERATIONAL, devCtx.createVrfRouteIId((int) routerCtx.getVrfCtx())); } MdSalUtils.wrapperSubmit(wt, executor); } }