Search in sources :

Example 16 with Ports

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.port._case.Ports in project openflowplugin by opendaylight.

the class MultipartReplyPortDescDeserializer method deserialize.

@Override
public MultipartReplyBody deserialize(ByteBuf message) {
    final MultipartReplyPortDescBuilder builder = new MultipartReplyPortDescBuilder();
    final List<Ports> items = new ArrayList<>();
    while (message.readableBytes() > 0) {
        final PortsBuilder itemBuilder = new PortsBuilder();
        itemBuilder.setPortNumber(new PortNumberUni(message.readUnsignedInt()));
        message.skipBytes(PADDING_IN_PORT_DESC_HEADER_01);
        itemBuilder.setHardwareAddress(ByteBufUtils.readIetfMacAddress(message));
        message.skipBytes(PADDING_IN_PORT_DESC_HEADER_02);
        items.add(itemBuilder.setName(ByteBufUtils.decodeNullTerminatedString(message, EncodeConstants.MAX_PORT_NAME_LENGTH)).setConfiguration(readPortConfig(message)).setState(readPortState(message)).setCurrentFeature(readPortFeatures(message)).setAdvertisedFeatures(readPortFeatures(message)).setSupported(readPortFeatures(message)).setPeerFeatures(readPortFeatures(message)).setCurrentSpeed(message.readUnsignedInt()).setMaximumSpeed(message.readUnsignedInt()).build());
    }
    return builder.setPorts(items).build();
}
Also used : MultipartReplyPortDescBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.MultipartReplyPortDescBuilder) PortNumberUni(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni) ArrayList(java.util.ArrayList) Ports(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.multipart.reply.port.desc.Ports) PortsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.multipart.reply.port.desc.PortsBuilder)

Example 17 with Ports

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.port._case.Ports in project openflowplugin by opendaylight.

the class MultipartReplyMessageFactoryTest method createPortList.

private static List<Ports> createPortList() {
    PortsBuilder builder = new PortsBuilder();
    builder.setPortNo(1L);
    builder.setHwAddr(new MacAddress("94:de:80:a6:61:40"));
    builder.setName("Port name");
    builder.setConfig(new PortConfig(true, false, true, false));
    builder.setState(new PortState(true, false, true));
    builder.setCurrentFeatures(new PortFeatures(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false));
    builder.setAdvertisedFeatures(new PortFeatures(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false));
    builder.setSupportedFeatures(new PortFeatures(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false));
    builder.setPeerFeatures(new PortFeatures(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false));
    builder.setCurrSpeed(1234L);
    builder.setMaxSpeed(1234L);
    List<Ports> list = new ArrayList<>();
    list.add(builder.build());
    return list;
}
Also used : PortState(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState) PortFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures) ArrayList(java.util.ArrayList) 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) PortConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig)

Example 18 with Ports

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.port._case.Ports in project openflowplugin by opendaylight.

the class OF10FeaturesReplyMessageFactoryTest method createPorts.

private static List<PhyPort> createPorts() {
    final List<PhyPort> ports = new ArrayList<>();
    PhyPortBuilder builder = new PhyPortBuilder();
    builder.setPortNo(1L);
    builder.setHwAddr(new MacAddress("94:de:80:a6:61:40"));
    builder.setName("Port name");
    builder.setConfigV10(new PortConfigV10(true, false, true, false, true, false, true));
    builder.setStateV10(new PortStateV10(true, false, true, false, true, false, true, false));
    builder.setCurrentFeaturesV10(new PortFeaturesV10(true, false, true, false, true, false, true, false, true, false, true, false));
    builder.setAdvertisedFeaturesV10(new PortFeaturesV10(true, false, true, false, true, false, true, false, true, false, true, false));
    builder.setSupportedFeaturesV10(new PortFeaturesV10(true, false, true, false, true, false, true, false, true, false, true, false));
    builder.setPeerFeaturesV10(new PortFeaturesV10(true, false, true, false, true, false, true, false, true, false, true, false));
    ports.add(builder.build());
    return ports;
}
Also used : PortConfigV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10) PortStateV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10) PortFeaturesV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10) PhyPortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPortBuilder) ArrayList(java.util.ArrayList) PhyPort(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPort) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)

Example 19 with Ports

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.port._case.Ports in project openflowplugin by opendaylight.

the class PortConvertor method toPortDesc.

/**
 * This method is called as a reply to OFPMP_PORT_DESCRIPTION message(OF1.3.1).
 *
 * @param source  FlowCapablePort
 * @param version openflow version
 * @return OF:Ports
 */
@VisibleForTesting
static Ports toPortDesc(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.FlowCapablePort source, short version) {
    PortsBuilder ofPortDescDataBuilder = new PortsBuilder();
    ofPortDescDataBuilder.setPortNo(OpenflowPortsUtil.getProtocolPortNumber(OpenflowVersion.get(version), // portNO
    source.getPortNumber()));
    ofPortDescDataBuilder.setHwAddr(source.getHardwareAddress());
    ofPortDescDataBuilder.setName(source.getName());
    PortConfig config = maskPortConfigFields(source.getConfiguration());
    ofPortDescDataBuilder.setConfig(config);
    PortState portState = getPortState(source.getState());
    ofPortDescDataBuilder.setState(portState);
    ofPortDescDataBuilder.setCurrentFeatures(getPortFeatures(source.getCurrentFeature()));
    ofPortDescDataBuilder.setAdvertisedFeatures(getPortFeatures(source.getAdvertisedFeatures()));
    ofPortDescDataBuilder.setSupportedFeatures(getPortFeatures(source.getSupported()));
    ofPortDescDataBuilder.setPeerFeatures(getPortFeatures(source.getPeerFeatures()));
    ofPortDescDataBuilder.setCurrSpeed(source.getCurrentSpeed());
    ofPortDescDataBuilder.setMaxSpeed(source.getMaximumSpeed());
    return ofPortDescDataBuilder.build();
}
Also used : PortState(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState) 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) PortConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 20 with Ports

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.port._case.Ports in project netvirt by opendaylight.

the class AclLiveStatisticsRpcServiceTest method getStatsTwoPortBothDirection.

/**
 * Test stats for two ports and both direction. <br>
 * port1 is valid <br>
 * port2 is invalid <br>
 * Expectation: Error expected for port2
 *
 * @throws Exception the exception
 */
@Test
public void getStatsTwoPortBothDirection() throws Exception {
    List<String> lstInterfaces = Arrays.asList(PORT_1, PORT_2);
    Direction direction = Direction.Both;
    GetAclPortStatisticsInput input = new GetAclPortStatisticsInputBuilder().setDirection(direction).setInterfaceNames(lstInterfaces).build();
    Future<RpcResult<GetAclPortStatisticsOutput>> rpcResultFuture = aclStatsService.getAclPortStatistics(input);
    RpcResult<GetAclPortStatisticsOutput> output = rpcResultFuture.get();
    LOG.info("getStatsTwoPortBothDirection output = {}", output);
    assertStatsOutput(output, direction);
}
Also used : GetAclPortStatisticsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsOutput) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) GetAclPortStatisticsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsInput) Direction(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.Direction) GetAclPortStatisticsInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsInputBuilder) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)36 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)32 ExecutionException (java.util.concurrent.ExecutionException)22 Ports (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.Ports)21 RouterPorts (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.RouterPorts)19 InternalToExternalPortMap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.ports.InternalToExternalPortMap)18 Port (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port)13 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)13 BigInteger (java.math.BigInteger)11 Test (org.junit.Test)11 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)9 LearntVpnVipToPort (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.data.LearntVpnVipToPort)9 Subnetmap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)9 PortsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.PortsKey)8 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)7 HashSet (java.util.HashSet)6 VpnPortipToPort (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.neutron.vpn.portip.port.data.VpnPortipToPort)6 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)5 ByteBuf (io.netty.buffer.ByteBuf)5 HashMap (java.util.HashMap)5