Search in sources :

Example 1 with PortConfig

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

the class SalPortServiceImplTest method dummyUpdatePortInput.

private UpdatePortInput dummyUpdatePortInput() {
    org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortBuilder concretePortBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortBuilder();
    concretePortBuilder.setConfiguration(new PortConfig(true, true, true, true));
    concretePortBuilder.setAdvertisedFeatures(new PortFeatures(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true));
    concretePortBuilder.setPortNumber(new PortNumberUni(DUMMY_PORT_NUMBER));
    concretePortBuilder.setHardwareAddress(new MacAddress(DUMMY_MAC_ADDRESS));
    List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port> ports = Lists.newArrayList(concretePortBuilder.build());
    Port port = new PortBuilder().setPort(ports).build();
    UpdatedPort updatePort = new UpdatedPortBuilder().setPort(port).build();
    return new UpdatePortInputBuilder().setUpdatedPort(updatePort).build();
}
Also used : PortNumberUni(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni) UpdatedPort(org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.port.update.UpdatedPort) Port(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.Port) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) UpdatedPort(org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.port.update.UpdatedPort) PortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.PortBuilder) UpdatedPortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.port.update.UpdatedPortBuilder) PortFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures) UpdatePortInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortInputBuilder) UpdatedPortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.port.update.UpdatedPortBuilder) PortConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig)

Example 2 with PortConfig

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

the class DataTreeChangeListenerBase method provideFlowCapableNodeConnector.

protected FlowCapableNodeConnector provideFlowCapableNodeConnector(final boolean isLinkDown, final boolean isPortDown) {
    FlowCapableNodeConnectorBuilder builder = new FlowCapableNodeConnectorBuilder();
    builder.setState(new StateBuilder().setLinkDown(isLinkDown).build());
    builder.setConfiguration(new PortConfig(true, true, true, isPortDown));
    return builder.build();
}
Also used : FlowCapableNodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder) 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 3 with PortConfig

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

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

the class PortStatusMessageFactoryTest method testWithDifferentBitmaps.

/**
 * Testing {@link PortStatusMessageFactory} for correct translation into POJO.
 */
@Test
public void testWithDifferentBitmaps() {
    ByteBuf bb = BufferHelper.buildBuffer(// reason, padding
    "01 00 00 00 00 00 00 00 " + // port no, padding
    "00 01 02 03 00 00 00 00 " + // mac address, padding
    "08 00 27 00 B0 EB 00 00 " + // port name, String "s1-eth1"
    "73 31 2d 65 74 68 31 00 00 00 00 00 00 00 00 00 " + // port config
    "00 00 00 24 " + // port state
    "00 00 00 02 " + // current + advertised features
    "00 00 00 81 00 00 00 A1 " + // supported + peer features
    "00 00 FF FF 00 00 00 00 " + // curr speed, max speed
    "00 00 00 81 00 00 00 80");
    PortStatusMessage message = BufferHelper.deserialize(statusFactory, bb);
    Assert.assertEquals("Wrong portConfig", new PortConfig(true, false, true, false), message.getConfig());
    Assert.assertEquals("Wrong portState", new PortState(true, false, false), message.getState());
    Assert.assertEquals("Wrong supportedFeatures", new PortFeatures(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true), message.getSupportedFeatures());
    Assert.assertEquals("Wrong peerFeatures", new PortFeatures(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), message.getPeerFeatures());
}
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) PortStatusMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage) ByteBuf(io.netty.buffer.ByteBuf) PortConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig) Test(org.junit.Test)

Example 5 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 testTranslate_13.

@Test
public void testTranslate_13() throws Exception {
    Mockito.when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
    final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures portFeatures = org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures.getDefaultInstance("hundredGbFd");
    final FlowCapableNodeConnector nodeConnector = portUpdateTranslator.translate(portBld.build(), deviceInfo, null);
    commonCheck(nodeConnector);
    Assert.assertEquals(portConfig, nodeConnector.getConfiguration());
    Assert.assertEquals(portFeatures, nodeConnector.getCurrentFeature());
    Assert.assertEquals(portFeatures, nodeConnector.getAdvertisedFeatures());
    Assert.assertEquals(portFeatures, nodeConnector.getPeerFeatures());
    Assert.assertEquals(portFeatures, nodeConnector.getSupported());
    Assert.assertEquals(portStateBld.build(), nodeConnector.getState());
    Assert.assertTrue(nodeConnector.getQueue().isEmpty());
}
Also used : FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) 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