use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector in project openflowplugin by opendaylight.
the class NodeConnectorInventoryEventTranslator method processAddedConnector.
private void processAddedConnector(final DataTreeModification<T> modification) {
final InstanceIdentifier<T> identifier = modification.getRootPath().getRootIdentifier();
InstanceIdentifier<NodeConnector> nodeConnectorInstanceId = identifier.firstIdentifierOf(NodeConnector.class);
if (compareIITail(identifier, II_TO_FLOW_CAPABLE_NODE_CONNECTOR)) {
FlowCapableNodeConnector flowConnector = (FlowCapableNodeConnector) modification.getRootNode().getDataAfter();
if (!isPortDown(flowConnector)) {
notifyNodeConnectorAppeared(nodeConnectorInstanceId, flowConnector);
} else {
iiToDownFlowCapableNodeConnectors.put(nodeConnectorInstanceId, flowConnector);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector in project openflowplugin by opendaylight.
the class NodeConnectorInventoryEventTranslator method isPortDown.
private static boolean isPortDown(final FlowCapableNodeConnector flowCapableNodeConnector) {
PortState portState = flowCapableNodeConnector.getState();
PortConfig portConfig = flowCapableNodeConnector.getConfiguration();
return portState != null && portState.isLinkDown() || portConfig != null && portConfig.isPORTDOWN();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector in project openflowplugin by opendaylight.
the class LLDPSpeakerTest method testLocalNodeConnectorCreation.
/**
* Test that checks if LLDPSpeaker working fine with local ports.
*/
@Test
public void testLocalNodeConnectorCreation() {
// Call nodeConnectorAdded with local port
FlowCapableNodeConnector fcnc = TestUtils.createFlowCapableNodeConnector().setPortNumber(new PortNumberUni("LOCAL")).build();
lldpSpeaker.nodeConnectorAdded(ID, fcnc);
// Verify that nothing happened for local port
verify(packetProcessingService, never()).transmitPacket(any(TransmitPacketInput.class));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector in project openflowplugin by opendaylight.
the class NodeConnectorNotificationSupplierImplTest method testDeleteChangeEvent.
@Test
public void testDeleteChangeEvent() {
final TestData testData = new TestData(createTestFlowCapableConnectorNodePath(), createTestFlowCapableNodeConnecor(), null, DataObjectModification.ModificationType.DELETE);
Collection<DataTreeModification<FlowCapableNodeConnector>> collection = new ArrayList<>();
collection.add(testData);
notifSupplierImpl.onDataTreeChanged(collection);
verify(notifProviderService, times(1)).publish(Matchers.any(NodeConnectorRemoved.class));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector in project openflowplugin by opendaylight.
the class DeviceContextImpl method writePortStatusMessage.
private void writePortStatusMessage(final PortStatus portStatusMessage) {
final FlowCapableNodeConnector flowCapableNodeConnector = portStatusTranslator.translate(portStatusMessage, getDeviceInfo(), null);
final KeyedInstanceIdentifier<NodeConnector, NodeConnectorKey> iiToNodeConnector = getDeviceInfo().getNodeInstanceIdentifier().child(NodeConnector.class, new NodeConnectorKey(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(deviceInfo.getDatapathId(), portStatusMessage.getPortNo(), OpenflowVersion.get(deviceInfo.getVersion()))));
writeToTransaction(LogicalDatastoreType.OPERATIONAL, iiToNodeConnector, new NodeConnectorBuilder().setKey(iiToNodeConnector.getKey()).addAugmentation(FlowCapableNodeConnectorStatisticsData.class, new FlowCapableNodeConnectorStatisticsDataBuilder().build()).addAugmentation(FlowCapableNodeConnector.class, flowCapableNodeConnector).build());
submitTransaction();
if (PortReason.OFPPRDELETE.equals(portStatusMessage.getReason())) {
addDeleteToTxChain(LogicalDatastoreType.OPERATIONAL, iiToNodeConnector);
submitTransaction();
}
}
Aggregations