Search in sources :

Example 26 with FlowCapableNodeConnector

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

Example 27 with FlowCapableNodeConnector

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();
}
Also used : PortState(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortState) PortConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig)

Example 28 with FlowCapableNodeConnector

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));
}
Also used : PortNumberUni(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni) TransmitPacketInput(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) Test(org.junit.Test)

Example 29 with FlowCapableNodeConnector

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));
}
Also used : DataTreeModification(org.opendaylight.controller.md.sal.binding.api.DataTreeModification) NodeConnectorRemoved(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemoved) TestData(org.opendaylight.openflowplugin.applications.notification.supplier.impl.helper.TestData) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 30 with FlowCapableNodeConnector

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();
    }
}
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) FlowCapableNodeConnectorStatisticsDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsDataBuilder) NodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) FlowCapableNodeConnectorStatisticsData(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsData) NodeConnectorKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)

Aggregations

FlowCapableNodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector)22 NodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector)12 Test (org.junit.Test)9 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)7 DataTreeModification (org.opendaylight.controller.md.sal.binding.api.DataTreeModification)6 FlowCapableNodeConnectorBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder)4 NodeConnectorRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef)4 NodeConnectorKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)4 ArrayList (java.util.ArrayList)3 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)3 PortConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig)3 NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)3 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)3 ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)2 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)2 Counter (org.opendaylight.infrautils.metrics.Counter)2 TestData (org.opendaylight.openflowplugin.applications.notification.supplier.impl.helper.TestData)2 InterfaceBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceBuilder)2 PhysAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)2 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)2