Search in sources :

Example 16 with Node

use of Nodes.Node in project openflowplugin by opendaylight.

the class InventoryDataServiceUtil method nodeConnectorInstanceIdentifierFromDatapathIdPortno.

public static InstanceIdentifier<NodeConnector> nodeConnectorInstanceIdentifierFromDatapathIdPortno(final BigInteger datapathId, final Long portNo, final OpenflowVersion ofVersion) {
    NodeId nodeId = nodeIdFromDatapathId(datapathId);
    KeyedInstanceIdentifier<Node, NodeKey> nodePath = NODES_IDENTIFIER.child(Node.class, new NodeKey(nodeId));
    return nodeConnectorInstanceIdentifierFromDatapathIdPortno(datapathId, portNo, ofVersion, nodePath);
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)

Example 17 with Node

use of Nodes.Node in project openflowplugin by opendaylight.

the class LLDPSpeaker method run.

/**
 * Send LLDPDU frames to all known openflow switch ports.
 */
@Override
public void run() {
    if (OperStatus.RUN.equals(operationalStatus)) {
        LOG.debug("Sending LLDP frames to nodes {}", Arrays.toString(deviceOwnershipStatusService.getOwnedNodes().toArray()));
        LOG.debug("Sending LLDP frames to total {} ports", getOwnedPorts());
        nodeConnectorMap.keySet().forEach(ncIID -> {
            NodeConnectorId nodeConnectorId = InstanceIdentifier.keyOf(ncIID).getId();
            NodeId nodeId = ncIID.firstKeyOf(Node.class, NodeKey.class).getId();
            if (deviceOwnershipStatusService.isEntityOwned(nodeId.getValue())) {
                LOG.debug("Node is owned by this controller, sending LLDP packet through port {}", nodeConnectorId.getValue());
                packetProcessingService.transmitPacket(nodeConnectorMap.get(ncIID));
            } else {
                LOG.trace("Node {} is not owned by this controller, so skip sending LLDP packet on port {}", nodeId.getValue(), nodeConnectorId.getValue());
            }
        });
    }
}
Also used : NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)

Example 18 with Node

use of Nodes.Node in project openflowplugin by opendaylight.

the class SimplifiedOperationalListenerTest method setUp.

@Before
public void setUp() throws Exception {
    final DataBroker db = Mockito.mock(DataBroker.class);
    final FlowCapableNodeSnapshotDao configSnapshot = new FlowCapableNodeSnapshotDao();
    final FlowCapableNodeSnapshotDao operationalSnapshot = new FlowCapableNodeSnapshotDao();
    final FlowCapableNodeDao configDao = new FlowCapableNodeCachedDao(configSnapshot, new FlowCapableNodeOdlDao(db, LogicalDatastoreType.CONFIGURATION));
    nodeListenerOperational = new SimplifiedOperationalListener(reactor, operationalSnapshot, configDao, reconciliationRegistry, deviceMastershipManager);
    InstanceIdentifier<Node> nodePath = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(NODE_ID));
    fcNodePath = nodePath.augmentation(FlowCapableNode.class);
    final DataTreeIdentifier<Node> dataTreeIdentifier = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, nodePath);
    Mockito.when(db.newReadOnlyTransaction()).thenReturn(roTx);
    Mockito.when(operationalNode.getId()).thenReturn(NODE_ID);
    Mockito.when(dataTreeModification.getRootPath()).thenReturn(dataTreeIdentifier);
    Mockito.when(dataTreeModification.getRootNode()).thenReturn(operationalModification);
    Mockito.when(operationalNode.getAugmentation(FlowCapableNode.class)).thenReturn(fcOperationalNode);
}
Also used : FlowCapableNodeSnapshotDao(org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeSnapshotDao) FlowCapableNodeOdlDao(org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeOdlDao) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) FlowCapableNodeDao(org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeDao) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) FlowCapableNodeCachedDao(org.opendaylight.openflowplugin.applications.frsync.dao.FlowCapableNodeCachedDao) Before(org.junit.Before)

Example 19 with Node

use of Nodes.Node in project openflowplugin by opendaylight.

the class SyncReactorClusterDecoratorTest method setUp.

@Before
public void setUp() {
    reactor = new SyncReactorClusterDecorator(delegate, deviceMastershipManager);
    InstanceIdentifier<Node> nodePath = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(NODE_ID));
    fcNodePath = nodePath.augmentation(FlowCapableNode.class);
}
Also used : FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) Before(org.junit.Before)

Example 20 with Node

use of Nodes.Node in project openflowplugin by opendaylight.

the class SyncReactorGuardDecoratorTest method setUp.

@Before
public void setUp() throws Exception {
    reactor = new SyncReactorGuardDecorator(delegate);
    InstanceIdentifier<Node> nodePath = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(NODE_ID));
    fcNodePath = nodePath.augmentation(FlowCapableNode.class);
    final Node operationalNode = Mockito.mock(Node.class);
    Mockito.when(operationalNode.getId()).thenReturn(NODE_ID);
    Mockito.when(operationalNode.getAugmentation(FlowCapableNode.class)).thenReturn(fcOperationalNode);
}
Also used : FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) Before(org.junit.Before)

Aggregations

Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)112 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)58 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)56 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)54 NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)43 Test (org.junit.Test)21 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)20 FlowId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId)19 TableKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey)19 FlowKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey)19 NodeRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef)17 BigInteger (java.math.BigInteger)16 ArrayList (java.util.ArrayList)16 NodeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder)16 ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)15 Before (org.junit.Before)11 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)8 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)7 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)7 Optional (com.google.common.base.Optional)6