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);
}
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());
}
});
}
}
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);
}
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);
}
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);
}
Aggregations