Search in sources :

Example 6 with PortConfig

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig in project openflowplugin by opendaylight.

the class PortUpdateTranslatorTest method assemblePortStatusMessage.

private PortStatusMessageBuilder assemblePortStatusMessage(long portNoValue, long speed) {
    final PortFeatures portFeatures13 = PortFeatures.getDefaultInstance("_100gbFd");
    final PortFeaturesV10 portFeatures10 = PortFeaturesV10.getDefaultInstance("_100mbFd");
    final PortConfig portConfig13 = PortConfig.getDefaultInstance("noFwd");
    final PortConfigV10 portConfig10 = PortConfigV10.getDefaultInstance("noFwd");
    final PortState portState13 = PortState.getDefaultInstance("live");
    final PortStateV10 portState10 = PortStateV10.getDefaultInstance("live");
    return new PortStatusMessageBuilder().setPortNo(portNoValue).setReason(PortReason.OFPPRADD).setAdvertisedFeatures(portFeatures13).setAdvertisedFeaturesV10(portFeatures10).setConfig(portConfig13).setConfigV10(portConfig10).setCurrentFeatures(portFeatures13).setCurrentFeaturesV10(portFeatures10).setPeerFeatures(portFeatures13).setPeerFeaturesV10(portFeatures10).setState(portState13).setStateV10(portState10).setSupportedFeatures(portFeatures13).setSupportedFeaturesV10(portFeatures10).setCurrSpeed(speed).setHwAddr(new MacAddress("01:02:03:04:05:06")).setMaxSpeed(2 * speed).setName("utPortName:" + portNoValue);
}
Also used : PortConfigV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10) PortFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures) PortFeaturesV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10) PortState(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState) PortStateV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10) PortStatusMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) PortConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig)

Example 7 with PortConfig

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig in project openflowplugin by opendaylight.

the class PortConvertor method convert.

@Override
public PortModInput convert(Port source, VersionConvertorData data) {
    PortConfig config = maskPortConfigFields(source.getConfiguration());
    PortConfigV10 configV10 = maskPortConfigV10Fields(source.getConfiguration());
    PortModInputBuilder portModInputBuilder = new PortModInputBuilder();
    portModInputBuilder.setAdvertise(getPortFeatures(source.getAdvertisedFeatures()));
    portModInputBuilder.setPortNo(new PortNumber(OpenflowPortsUtil.getProtocolPortNumber(OpenflowVersion.get(data.getVersion()), source.getPortNumber())));
    portModInputBuilder.setConfig(config);
    portModInputBuilder.setMask(MoreObjects.firstNonNull(maskPortConfigFields(source.getMask()), new PortConfig(true, true, true, true)));
    portModInputBuilder.setHwAddress(new MacAddress(source.getHardwareAddress()));
    portModInputBuilder.setVersion(data.getVersion());
    portModInputBuilder.setConfigV10(configV10);
    portModInputBuilder.setMaskV10(MoreObjects.firstNonNull(maskPortConfigV10Fields(source.getMask()), new PortConfigV10(true, true, true, true, true, true, true)));
    portModInputBuilder.setAdvertiseV10(getPortFeaturesV10(source.getAdvertisedFeatures()));
    return portModInputBuilder.build();
}
Also used : PortConfigV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10) PortModInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInputBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) PortConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig)

Example 8 with PortConfig

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig 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 9 with PortConfig

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig in project genius by opendaylight.

the class InterfaceManagerTestUtil method buildFlowCapableNodeConnector.

static FlowCapableNodeConnector buildFlowCapableNodeConnector(boolean isPortDown, boolean isLive, String macAddress, String portName) {
    PortConfig portConfig = new PortConfig(false, false, false, isPortDown);
    State state = new StateBuilder().setBlocked(true).setLinkDown(false).setLive(isLive).build();
    FlowCapableNodeConnectorBuilder fcNodeConnector = new FlowCapableNodeConnectorBuilder().setName(portName).setHardwareAddress(MacAddress.getDefaultInstance(macAddress)).setConfiguration(portConfig).setState(state);
    return fcNodeConnector.build();
}
Also used : FlowCapableNodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder) State(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.State) 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 10 with PortConfig

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig in project bgpcep by opendaylight.

the class OpenConfigMappingUtilTest method testGetPort.

@Test
public void testGetPort() {
    final TransportBuilder transport = new TransportBuilder();
    assertEquals(PORT, OpenConfigMappingUtil.getPort(NEIGHBOR, null));
    assertEquals(PORT, OpenConfigMappingUtil.getPort(new NeighborBuilder().setTransport(transport.build()).build(), null));
    assertEquals(PORT, OpenConfigMappingUtil.getPort(new NeighborBuilder().setTransport(transport.setConfig(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.ConfigBuilder().build()).build()).build(), null));
    final PortNumber newPort = new PortNumber(111);
    final Config portConfig = new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.ConfigBuilder().addAugmentation(NeighborTransportConfig.class, new NeighborTransportConfigBuilder().setRemotePort(newPort).build()).build();
    assertEquals(newPort, OpenConfigMappingUtil.getPort(new NeighborBuilder().setTransport(transport.setConfig(portConfig).build()).build(), null));
    assertEquals(newPort, OpenConfigMappingUtil.getPort(new NeighborBuilder().setTransport(transport.setConfig(portConfig).build()).build(), new PeerGroupBuilder().build()));
    final Config portConfigGroup = new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.ConfigBuilder().addAugmentation(PeerGroupTransportConfig.class, new PeerGroupTransportConfigBuilder().setRemotePort(newPort).build()).build();
    assertEquals(newPort, OpenConfigMappingUtil.getPort(new NeighborBuilder().build(), new PeerGroupBuilder().setTransport(transport.setConfig(portConfigGroup).build()).build()));
}
Also used : PeerGroupBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.peer.group.PeerGroupBuilder) Config(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.Config) NeighborTransportConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborTransportConfig) PeerGroupTransportConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.PeerGroupTransportConfig) NeighborPeerGroupConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborPeerGroupConfig) NeighborClusterIdConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborClusterIdConfig) NeighborAddPathsConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAddPathsConfig) GlobalAddPathsConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.GlobalAddPathsConfig) PeerGroupTransportConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.PeerGroupTransportConfig) PeerGroupTransportConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.PeerGroupTransportConfigBuilder) TransportBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.TransportBuilder) NeighborBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.NeighborBuilder) NeighborTransportConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborTransportConfig) NeighborTransportConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborTransportConfigBuilder) NeighborPeerGroupConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborPeerGroupConfigBuilder) ConfigBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.ConfigBuilder) PeerGroupTransportConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.PeerGroupTransportConfigBuilder) NeighborAddPathsConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAddPathsConfigBuilder) NeighborTransportConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborTransportConfigBuilder) GlobalAddPathsConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.GlobalAddPathsConfigBuilder) NeighborClusterIdConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborClusterIdConfigBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) Test(org.junit.Test)

Aggregations

PortConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig)10 Test (org.junit.Test)9 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)9 PortFeatures (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures)9 PortState (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState)7 ByteBuf (io.netty.buffer.ByteBuf)6 PortConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig)4 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)3 PortStatusMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage)3 FlowCapableNodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector)2 FlowCapableNodeConnectorBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder)2 StateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.StateBuilder)2 PortConfigV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10)2 PortModInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput)2 PortModInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInputBuilder)2 PortStatusMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder)2 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)2 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)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ArrayList (java.util.ArrayList)1