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);
}
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();
}
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();
}
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();
}
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()));
}
Aggregations