Search in sources :

Example 31 with NodeConnector

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);
}
Also used : NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) NodeConnectorKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)

Example 32 with NodeConnector

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;
}
Also used : NodeConnectorRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef) NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) NodeConnectorKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)

Example 33 with NodeConnector

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();
}
Also used : NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) NodeConnectorKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)

Example 34 with NodeConnector

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();
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) Tunnel(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel) NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) BigInteger(java.math.BigInteger)

Example 35 with NodeConnector

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();
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) Tunnel(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel) NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) BigInteger(java.math.BigInteger)

Aggregations

NodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector)20 FlowCapableNodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector)16 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)13 NodeConnectorKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)12 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)11 NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)10 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)9 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)8 NodeConnectorRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef)7 BigInteger (java.math.BigInteger)4 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)4 ArrayList (java.util.ArrayList)3 ExecutionException (java.util.concurrent.ExecutionException)3 ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)3 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)3 PacketException (org.opendaylight.openflowplugin.libraries.liblldp.PacketException)3 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 Test (org.junit.Test)2 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)2 Tunnel (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel)2