use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector in project genius by opendaylight.
the class MDSALUtil method getInterfaceName.
public static String getInterfaceName(NodeConnectorRef ref, DataBroker dataBroker) {
NodeConnectorId nodeConnectorId = getNodeConnectorId(dataBroker, ref);
NodeId nodeId = getNodeIdFromNodeConnectorId(nodeConnectorId);
InstanceIdentifier<NodeConnector> ncIdentifier = InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(nodeId)).child(NodeConnector.class, new NodeConnectorKey(nodeConnectorId)).build();
return read(dataBroker, LogicalDatastoreType.OPERATIONAL, ncIdentifier).toJavaUtil().map(nc -> nc.getAugmentation(FlowCapableNodeConnector.class)).map(FlowCapableNodeConnector::getName).orElse(null);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector in project genius by opendaylight.
the class MDSALManager method getNodeConnRef.
protected static NodeConnectorRef getNodeConnRef(final String nodeId, final String port) {
StringBuilder stringBuilder = new StringBuilder(nodeId);
StringBuilder append = stringBuilder.append(":");
StringBuilder build = append.append(port);
String string = build.toString();
NodeConnectorId nodeConnectorId = new NodeConnectorId(string);
NodeConnectorKey nodeConnectorKey = new NodeConnectorKey(nodeConnectorId);
NodeConnectorKey connectorKey = nodeConnectorKey;
InstanceIdentifierBuilder<Nodes> builder = InstanceIdentifier.builder(Nodes.class);
NodeKey nodeKey = new NodeKey(new NodeId(nodeId));
InstanceIdentifierBuilder<Node> child = builder.child(Node.class, nodeKey);
InstanceIdentifierBuilder<NodeConnector> anotherChild = child.child(NodeConnector.class, connectorKey);
InstanceIdentifier<NodeConnector> path = anotherChild.toInstance();
NodeConnectorRef nodeConnectorRef = new NodeConnectorRef(path);
return nodeConnectorRef;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector in project genius by opendaylight.
the class DirectTunnelUtils method isNodeConnectorPresent.
public boolean isNodeConnectorPresent(NodeConnectorId nodeConnectorId) throws ReadFailedException {
NodeId nodeId = getNodeIdFromNodeConnectorId(nodeConnectorId);
InstanceIdentifier<NodeConnector> ncIdentifier = InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, new NodeKey(nodeId)).child(NodeConnector.class, new NodeConnectorKey(nodeConnectorId)).build();
return SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, ncIdentifier).isPresent();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector in project genius by opendaylight.
the class InterfaceManagerTestUtil method createFlowCapableNodeConnector.
static void createFlowCapableNodeConnector(DataBroker dataBroker, String interfaceName, Class<? extends InterfaceType> ifType) throws TransactionCommitFailedException {
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
BigInteger dpnId = Tunnel.class.equals(ifType) ? DPN_ID_2 : DPN_ID_1;
long portNo = Tunnel.class.equals(ifType) ? PORT_NO_1 : PORT_NO_1;
NodeConnector nodeConnector = InterfaceManagerTestUtil.buildFlowCapableNodeConnector(buildNodeConnectorId(dpnId, portNo), interfaceName, true);
tx.put(OPERATIONAL, buildNodeConnectorInstanceIdentifier(dpnId, portNo), nodeConnector, true);
tx.submit().checkedGet();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector in project genius by opendaylight.
the class InterfaceManagerTestUtil method updateFlowCapableNodeConnectorState.
static void updateFlowCapableNodeConnectorState(DataBroker dataBroker, String interfaceName, Class<? extends InterfaceType> ifType, boolean isLive) throws TransactionCommitFailedException {
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
BigInteger dpnId = Tunnel.class.equals(ifType) ? DPN_ID_2 : DPN_ID_1;
long portNo = Tunnel.class.equals(ifType) ? PORT_NO_1 : PORT_NO_1;
NodeConnector nodeConnector = InterfaceManagerTestUtil.buildFlowCapableNodeConnector(buildNodeConnectorId(dpnId, portNo), interfaceName, isLive);
tx.merge(OPERATIONAL, buildNodeConnectorInstanceIdentifier(dpnId, portNo), nodeConnector, true);
tx.submit().checkedGet();
}
Aggregations