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 testWithNoPortsSet.
/**
* Testing {@link OF10FeaturesReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithNoPortsSet() {
ByteBuf bb = BufferHelper.buildBuffer("00 01 02 03 04 05 06 07 00 01 02 03 01 00 00 00 " + "00 00 00 00 00 00 00 00");
GetFeaturesOutput builtByFactory = BufferHelper.deserialize(featuresFactory, bb);
BufferHelper.checkHeaderV10(builtByFactory);
Assert.assertEquals("Wrong capabilities", new CapabilitiesV10(false, false, false, false, false, false, false, false), builtByFactory.getCapabilitiesV10());
Assert.assertEquals("Wrong actions", new ActionTypeV10(false, false, false, false, false, false, false, false, false, false, false, false, false), builtByFactory.getActionsV10());
Assert.assertEquals("Wrong ports size", 0, builtByFactory.getPhyPort().size());
}
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 testWithTwoPortsSet.
/**
* Testing {@link OF10FeaturesReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithTwoPortsSet() {
ByteBuf bb = BufferHelper.buildBuffer("00 01 02 03 04 05 06 07 00 01 02 03 01 00 00 00 " + "00 00 00 8B 00 00 03 B5 " + "00 10 01 01 05 01 04 02 41 4C 4F 48 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07 01 " + "00 00 00 31 00 00 04 42 00 00 03 0C 00 00 08 88 " + "00 10 01 01 05 01 04 02 41 4C 4F 48 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 15 00 00 00 00 " + "00 00 00 31 00 00 04 42 00 00 03 0C 00 00 08 88");
GetFeaturesOutput builtByFactory = BufferHelper.deserialize(featuresFactory, bb);
BufferHelper.checkHeaderV10(builtByFactory);
Assert.assertEquals("Wrong ports size", 2, builtByFactory.getPhyPort().size());
PhyPort port = builtByFactory.getPhyPort().get(0);
Assert.assertEquals("Wrong port - port-no", 16, port.getPortNo().intValue());
Assert.assertEquals("Wrong port - hw-addr", new MacAddress("01:01:05:01:04:02"), port.getHwAddr());
Assert.assertEquals("Wrong port - name", new String("ALOHA"), port.getName());
Assert.assertEquals("Wrong port - config", new PortConfigV10(false, false, false, false, false, false, false), port.getConfigV10());
Assert.assertEquals("Wrong port - state", new PortStateV10(false, true, false, true, true, true, false, true), port.getStateV10());
port = builtByFactory.getPhyPort().get(1);
Assert.assertEquals("Wrong port - state", new PortStateV10(false, false, false, false, false, false, true, false), port.getStateV10());
}
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 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);
}
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 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;
}
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 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;
}
Aggregations