Search in sources :

Example 11 with FlowCapableNodeConnector

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector in project openflowplugin by opendaylight.

the class PortUpdateTranslator method translate.

@Override
public FlowCapableNodeConnector translate(final PortGrouping input, final DeviceInfo deviceInfo, final Object connectionDistinguisher) {
    final FlowCapableNodeConnectorBuilder builder = new FlowCapableNodeConnectorBuilder();
    // OF1.0
    if (deviceInfo.getVersion() == OFConstants.OFP_VERSION_1_0) {
        builder.setAdvertisedFeatures(PortTranslatorUtil.translatePortFeatures(input.getAdvertisedFeaturesV10()));
        builder.setConfiguration(PortTranslatorUtil.translatePortConfig(input.getConfigV10()));
        builder.setCurrentFeature(PortTranslatorUtil.translatePortFeatures(input.getCurrentFeaturesV10()));
        builder.setPeerFeatures(PortTranslatorUtil.translatePortFeatures(input.getPeerFeaturesV10()));
        builder.setState(PortTranslatorUtil.translatePortState(input.getStateV10()));
        builder.setSupported(PortTranslatorUtil.translatePortFeatures(input.getSupportedFeaturesV10()));
    } else if (deviceInfo.getVersion() == OFConstants.OFP_VERSION_1_3) {
        builder.setAdvertisedFeatures(PortTranslatorUtil.translatePortFeatures(input.getAdvertisedFeatures()));
        builder.setConfiguration(PortTranslatorUtil.translatePortConfig(input.getConfig()));
        builder.setCurrentFeature(PortTranslatorUtil.translatePortFeatures(input.getCurrentFeatures()));
        builder.setPeerFeatures(PortTranslatorUtil.translatePortFeatures(input.getPeerFeatures()));
        builder.setState(PortTranslatorUtil.translatePortState(input.getState()));
        builder.setSupported(PortTranslatorUtil.translatePortFeatures(input.getSupportedFeatures()));
        builder.setQueue(Collections.<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue>emptyList());
    }
    if (input instanceof PortStatusMessage) {
        if (((PortStatusMessage) input).getReason() != null) {
            builder.setReason(PortReason.forValue(((PortStatusMessage) input).getReason().getIntValue()));
        } else {
            LOG.debug("PortStatus Message has reason as null");
        }
    }
    builder.setCurrentSpeed(input.getCurrSpeed());
    builder.setHardwareAddress(input.getHwAddr());
    builder.setMaximumSpeed(input.getMaxSpeed());
    builder.setName(input.getName());
    builder.setPortNumber(new PortNumberUni(input.getPortNo()));
    return builder.build();
}
Also used : FlowCapableNodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder) PortStatusMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage) PortNumberUni(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni)

Example 12 with FlowCapableNodeConnector

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector in project openflowplugin by opendaylight.

the class TerminationPointChangeListenerImpl method processAddedTerminationPoints.

private void processAddedTerminationPoints(final DataTreeModification<FlowCapableNodeConnector> modification) {
    final InstanceIdentifier<FlowCapableNodeConnector> iiToNodeInInventory = modification.getRootPath().getRootIdentifier();
    TpId terminationPointIdInTopology = provideTopologyTerminationPointId(iiToNodeInInventory);
    if (terminationPointIdInTopology != null) {
        InstanceIdentifier<TerminationPoint> iiToTopologyTerminationPoint = provideIIToTopologyTerminationPoint(terminationPointIdInTopology, iiToNodeInInventory);
        TerminationPoint point = prepareTopologyTerminationPoint(terminationPointIdInTopology, iiToNodeInInventory);
        sendToTransactionChain(point, iiToTopologyTerminationPoint);
        removeLinks(modification.getRootNode().getDataAfter(), point);
    } else {
        LOG.debug("Inventory node connector key is null. Data can't be written to topology termination point");
    }
}
Also used : TpId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)

Example 13 with FlowCapableNodeConnector

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector in project openflowplugin by opendaylight.

the class TerminationPointChangeListenerImpl method prepareTopologyTerminationPoint.

private static TerminationPoint prepareTopologyTerminationPoint(final TpId terminationPointIdInTopology, final InstanceIdentifier<FlowCapableNodeConnector> iiToNodeInInventory) {
    final InventoryNodeConnector inventoryNodeConnector = new InventoryNodeConnectorBuilder().setInventoryNodeConnectorRef(new NodeConnectorRef(iiToNodeInInventory.firstIdentifierOf(NodeConnector.class))).build();
    final TerminationPointBuilder terminationPointBuilder = new TerminationPointBuilder();
    terminationPointBuilder.setTpId(terminationPointIdInTopology);
    terminationPointBuilder.addAugmentation(InventoryNodeConnector.class, inventoryNodeConnector);
    return terminationPointBuilder.build();
}
Also used : InventoryNodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.topology.inventory.rev131030.InventoryNodeConnectorBuilder) NodeConnectorRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef) InventoryNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.model.topology.inventory.rev131030.InventoryNodeConnector) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) InventoryNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.model.topology.inventory.rev131030.InventoryNodeConnector) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder)

Example 14 with FlowCapableNodeConnector

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector in project openflowplugin by opendaylight.

the class DataTreeChangeListenerBase method provideFlowCapableNodeConnector.

protected FlowCapableNodeConnector provideFlowCapableNodeConnector(final boolean isLinkDown, final boolean isPortDown) {
    FlowCapableNodeConnectorBuilder builder = new FlowCapableNodeConnectorBuilder();
    builder.setState(new StateBuilder().setLinkDown(isLinkDown).build());
    builder.setConfiguration(new PortConfig(true, true, true, isPortDown));
    return builder.build();
}
Also used : FlowCapableNodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder) StateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.StateBuilder) PortConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig)

Example 15 with FlowCapableNodeConnector

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector in project openflowplugin by opendaylight.

the class PortUpdateTranslatorTest method testTranslate_13.

@Test
public void testTranslate_13() throws Exception {
    Mockito.when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
    final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures portFeatures = org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures.getDefaultInstance("hundredGbFd");
    final FlowCapableNodeConnector nodeConnector = portUpdateTranslator.translate(portBld.build(), deviceInfo, null);
    commonCheck(nodeConnector);
    Assert.assertEquals(portConfig, nodeConnector.getConfiguration());
    Assert.assertEquals(portFeatures, nodeConnector.getCurrentFeature());
    Assert.assertEquals(portFeatures, nodeConnector.getAdvertisedFeatures());
    Assert.assertEquals(portFeatures, nodeConnector.getPeerFeatures());
    Assert.assertEquals(portFeatures, nodeConnector.getSupported());
    Assert.assertEquals(portStateBld.build(), nodeConnector.getState());
    Assert.assertTrue(nodeConnector.getQueue().isEmpty());
}
Also used : FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) Test(org.junit.Test)

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