Search in sources :

Example 71 with Ports

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.Ports in project openflowplugin by opendaylight.

the class PortConvertorTest method testtoPortDescwithAllParameters.

/**
 * test of {@link PortConvertor#toPortDesc(FlowCapablePort , short)}.
 */
@Test
public void testtoPortDescwithAllParameters() {
    State state = new StateBuilder().setBlocked(false).setLinkDown(false).setLive(false).build();
    FlowCapableNodeConnectorBuilder flowCapableNodeConnectorBuilder = new FlowCapableNodeConnectorBuilder();
    flowCapableNodeConnectorBuilder.setAdvertisedFeatures(features);
    flowCapableNodeConnectorBuilder.setConfiguration(config);
    flowCapableNodeConnectorBuilder.setCurrentFeature(features);
    flowCapableNodeConnectorBuilder.setCurrentSpeed(null);
    flowCapableNodeConnectorBuilder.setHardwareAddress(new MacAddress(DEFAULT_MAC_ADDRESS));
    flowCapableNodeConnectorBuilder.setMaximumSpeed(null);
    flowCapableNodeConnectorBuilder.setName("foo");
    flowCapableNodeConnectorBuilder.setPeerFeatures(features);
    flowCapableNodeConnectorBuilder.setPortNumber(new PortNumberUni(42L));
    flowCapableNodeConnectorBuilder.setState(state);
    flowCapableNodeConnectorBuilder.setSupported(features);
    final Ports portsOut = PortConvertor.toPortDesc(flowCapableNodeConnectorBuilder.build(), EncodeConstants.OF13_VERSION_ID);
    PortsBuilder portsB = new PortsBuilder();
    portsB.setAdvertisedFeatures(portf31);
    portsB.setConfig(config31);
    portsB.setCurrentFeatures(portf31);
    portsB.setCurrSpeed(null);
    portsB.setHwAddr(new MacAddress(DEFAULT_MAC_ADDRESS));
    portsB.setMaxSpeed(null);
    portsB.setName("foo");
    portsB.setPeerFeatures(portf31);
    portsB.setPortNo(42L);
    portsB.setState(new PortState(false, false, false));
    portsB.setSupportedFeatures(portf31);
    Assert.assertEquals(portsB.build(), portsOut);
}
Also used : FlowCapableNodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder) PortState(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState) State(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.State) PortState(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState) PortNumberUni(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni) StateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.StateBuilder) Ports(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.desc._case.multipart.reply.port.desc.Ports) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) PortsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.desc._case.multipart.reply.port.desc.PortsBuilder) Test(org.junit.Test)

Example 72 with Ports

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.Ports in project genius by opendaylight.

the class InterfacemgrProvider method getTunnelPortsOnBridge.

/**
 * Get all termination points of type tunnel on a given DPN.
 *
 * @param dpnId
 *            Datapath Node Identifier
 *
 * @return If the data at the supplied path exists, returns a list of all termination point
 *         Augmentations of type tunnel
 */
@Override
public List<OvsdbTerminationPointAugmentation> getTunnelPortsOnBridge(BigInteger dpnId) {
    List<OvsdbTerminationPointAugmentation> tunnelPorts = new ArrayList<>();
    List<TerminationPoint> portList = interfaceMetaUtils.getTerminationPointsOnBridge(dpnId);
    for (TerminationPoint ovsPort : portList) {
        OvsdbTerminationPointAugmentation portAug = ovsPort.getAugmentation(OvsdbTerminationPointAugmentation.class);
        if (portAug != null && SouthboundUtils.isInterfaceTypeTunnel(portAug.getInterfaceType())) {
            tunnelPorts.add(portAug);
        }
    }
    LOG.debug("Found {} tunnel ports on bridge {}", tunnelPorts.size(), dpnId);
    return tunnelPorts;
}
Also used : ArrayList(java.util.ArrayList) OvsdbTerminationPointAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)

Example 73 with Ports

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.Ports in project genius by opendaylight.

the class InterfacemgrProvider method getPortsOnBridge.

@Override
public /**
 * Get all termination points on a given DPN.
 * This API uses read on Operational DS. If there are perf issues in cluster
 * setup, we can consider caching later.
 *
 * @param dpnId
 *            Datapath Node Identifier
 *
 * @return If the data at the supplied path exists, returns a list of all termination point
 *         Augmentations
 */
List<OvsdbTerminationPointAugmentation> getPortsOnBridge(BigInteger dpnId) {
    List<OvsdbTerminationPointAugmentation> ports = new ArrayList<>();
    List<TerminationPoint> portList = interfaceMetaUtils.getTerminationPointsOnBridge(dpnId);
    for (TerminationPoint ovsPort : portList) {
        if (ovsPort.getAugmentation(OvsdbTerminationPointAugmentation.class) != null) {
            ports.add(ovsPort.getAugmentation(OvsdbTerminationPointAugmentation.class));
        }
    }
    LOG.debug("Found {} ports on bridge {}", ports.size(), dpnId);
    return ports;
}
Also used : ArrayList(java.util.ArrayList) OvsdbTerminationPointAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)

Example 74 with Ports

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.Ports in project genius by opendaylight.

the class ShowOvsPorts method doExecute.

@Override
protected Object doExecute() {
    LOG.debug("Executing show ovs-ports command");
    List<OvsdbTerminationPointAugmentation> ports = interfaceManager.getPortsOnBridge(dpnId);
    if (!ports.isEmpty()) {
        IfmCLIUtil.showBridgePortsHeader(session, dpnId);
    }
    for (OvsdbTerminationPointAugmentation port : ports) {
        IfmCLIUtil.showBridgePortsOutput(session, port);
    }
    return null;
}
Also used : OvsdbTerminationPointAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation)

Aggregations

ArrayList (java.util.ArrayList)29 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)21 BigInteger (java.math.BigInteger)16 Ports (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.Ports)13 RouterPorts (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.RouterPorts)12 Test (org.junit.Test)11 InternalToExternalPortMap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.ports.InternalToExternalPortMap)11 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)9 Subnetmap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)8 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)8 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)7 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)7 Port (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port)7 ExecutionException (java.util.concurrent.ExecutionException)6 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)5 ByteBuf (io.netty.buffer.ByteBuf)5 HashSet (java.util.HashSet)4 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)4 RouterPortsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.RouterPortsKey)4 Ports (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.desc._case.multipart.reply.port.desc.Ports)4