Search in sources :

Example 16 with InPort

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPort in project openflowplugin by opendaylight.

the class OpenflowpluginTestCommandProvider method createTestFlow.

private FlowBuilder createTestFlow(final NodeBuilder nodeBuilder, final String flowTypeArg, final String tableId) {
    final long TEST_ID = 123;
    final FlowBuilder flow = new FlowBuilder();
    long id = TEST_ID;
    String flowType = flowTypeArg;
    if (flowType == null) {
        flowType = "f1";
    }
    flow.setPriority(2);
    switch(flowType) {
        case "f1":
            id += 1;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createDecNwTtlInstructions().build());
            break;
        case "f2":
            id += 2;
            flow.setMatch(createMatch2().build());
            flow.setInstructions(createDropInstructions().build());
            break;
        case "f3":
            id += 3;
            flow.setMatch(createMatch3().build());
            flow.setInstructions(createDropInstructions().build());
            break;
        case "f4":
            id += 4;
            flow.setMatch(createEthernetMatch().build());
            flow.setInstructions(createDropInstructions().build());
            break;
        case "f5":
            id += 5;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction().build());
            break;
        case "f6":
            id += 6;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createGotoTableInstructions().build());
            break;
        case "f7":
            id += 7;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createMeterInstructions().build());
            break;
        case "f8":
            id += 8;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction1().build());
            break;
        case "f9":
            id += 9;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction2().build());
            break;
        case "f10":
            id += 10;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction3().build());
            break;
        case "f11":
            id += 11;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction4().build());
            break;
        case "f12":
            id += 12;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction5().build());
            break;
        case "f13":
            id += 13;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction6().build());
            break;
        case "f14":
            id += 14;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction7().build());
            break;
        case "f15":
            id += 15;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction8().build());
            break;
        case "f16":
            id += 16;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction9().build());
            break;
        case "f17":
            id += 17;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction10().build());
            break;
        case "f18":
            id += 18;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction11().build());
            break;
        case "f19":
            id += 19;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction12().build());
            break;
        case "f20":
            id += 20;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction13().build());
            break;
        case "f21":
            id += 21;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction14().build());
            break;
        case "f22":
            id += 22;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction15().build());
            break;
        case "f23":
            id += 23;
            // f23 can be used as test-case for generating error notification
            // if the particular group is not configured - tested
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction16().build());
            break;
        case "f24":
            id += 24;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction17().build());
            break;
        case "f25":
            id += 25;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction18().build());
            break;
        case "f26":
            id += 26;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction19().build());
            break;
        case "f27":
            id += 27;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createMetadataInstructions().build());
            break;
        case "f28":
            id += 28;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction20().build());
            break;
        case "f29":
            id += 29;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction21().build());
            break;
        case "f30":
            id += 30;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction22().build());
            break;
        case "f31":
            id += 31;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction23(nodeBuilder.getId()).build());
            break;
        case "f32":
            id += 32;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction24().build());
            break;
        case "f33":
            id += 33;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction25().build());
            break;
        case "f34":
            id += 34;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction26().build());
            break;
        case "f35":
            id += 35;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction27().build());
            break;
        case "f36":
            id += 36;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction28().build());
            break;
        case "f37":
            id += 37;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction29().build());
            break;
        case "f38":
            id += 38;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction30().build());
            break;
        case "f39":
            id += 39;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction31().build());
            break;
        case "f40":
            id += 40;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction32().build());
            break;
        case "f41":
            id += 41;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction33().build());
            break;
        case "f42":
            id += 42;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction34().build());
            break;
        case "f43":
            id += 43;
            flow.setMatch(createICMPv6Match().build());
            flow.setInstructions(createDecNwTtlInstructions().build());
            break;
        case "f44":
            id += 44;
            flow.setMatch(createInphyportMatch(nodeBuilder.getId()).build());
            flow.setInstructions(createDropInstructions().build());
            break;
        case "f45":
            id += 45;
            flow.setMatch(createMetadataMatch().build());
            flow.setInstructions(createDropInstructions().build());
            break;
        case "f46":
            id += 46;
            flow.setMatch(createL3IPv6Match().build());
            flow.setInstructions(createDecNwTtlInstructions().build());
            break;
        case "f47":
            id += 47;
            flow.setMatch(createL4SCTPMatch().build());
            flow.setInstructions(createAppyActionInstruction().build());
            break;
        case "f48":
            id += 48;
            flow.setMatch(createTunnelIDMatch().build());
            flow.setInstructions(createGotoTableInstructions().build());
            break;
        case "f49":
            id += 49;
            flow.setMatch(createVlanMatch().build());
            flow.setInstructions(createMeterInstructions().build());
            break;
        case "f50":
            id += 50;
            flow.setMatch(createPbbMatch().build());
            flow.setInstructions(createMeterInstructions().build());
            break;
        case "f51":
            id += 51;
            flow.setMatch(createVlanMatch().build());
            flow.setInstructions(createDropInstructions().build());
            break;
        case "f52":
            id += 52;
            flow.setMatch(createL4TCPMatch().build());
            flow.setInstructions(createDropInstructions().build());
            break;
        case "f53":
            id += 53;
            flow.setMatch(createL4UDPMatch().build());
            flow.setInstructions(createDropInstructions().build());
            break;
        case "f54":
            id += 54;
            flow.setMatch(new MatchBuilder().build());
            flow.setInstructions(createSentToControllerInstructions().build());
            flow.setPriority(0);
            break;
        case "f55":
            id += 55;
            flow.setMatch(createToSMatch().build());
            flow.setInstructions(createDropInstructions().build());
            break;
        case "f56":
            id += 56;
            flow.setMatch(createToSMatch().build());
            flow.setInstructions(createOutputInstructions("INPORT", 10).build());
            break;
        case "f57":
            id += 57;
            flow.setMatch(createToSMatch().build());
            flow.setInstructions(createOutputInstructions("FLOOD", 20).build());
            break;
        case "f58":
            id += 58;
            flow.setMatch(createToSMatch().build());
            flow.setInstructions(createOutputInstructions("ALL", 30).build());
            break;
        case "f59":
            id += 59;
            flow.setMatch(createToSMatch().build());
            flow.setInstructions(createOutputInstructions("NORMAL", 40).build());
            break;
        case "f60":
            id += 60;
            flow.setMatch(createToSMatch().build());
            flow.setInstructions(createOutputInstructions("LOCAL", 50).build());
            break;
        case "f61":
            id += 61;
            flow.setMatch(createToSMatch().build());
            flow.setInstructions(createOutputInstructions("TABLE", 60).build());
            break;
        case "f62":
            id += 62;
            flow.setMatch(createToSMatch().build());
            flow.setInstructions(createOutputInstructions("NONE", 70).build());
            break;
        case "f63":
            id += 63;
            flow.setMatch(createToSMatch().build());
            flow.setInstructions(createStripVlanInstructions().build());
            flow.setBarrier(Boolean.TRUE);
            break;
        case "f64":
            id += 64;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction35().build());
            break;
        case "f65":
            id += 65;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction36().build());
            break;
        case "f66":
            id += 66;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction37().build());
            break;
        case "f67":
            id += 67;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createAppyActionInstruction38().build());
            break;
        case "f68":
            id += 68;
            flow.setMatch(createL4TCPMatch().build());
            flow.setInstructions(createAppyActionInstruction39().build());
            break;
        case "f69":
            id += 69;
            flow.setMatch(createL4UDPMatch().build());
            flow.setInstructions(createAppyActionInstruction40().build());
            break;
        case "f70":
            id += 70;
            flow.setMatch(createL4SCTPMatch().build());
            flow.setInstructions(createAppyActionInstruction41().build());
            break;
        case "f71":
            id += 71;
            flow.setMatch(createICMPv4Match().build());
            flow.setInstructions(createAppyActionInstruction42().build());
            break;
        case "f72":
            id += 72;
            flow.setMatch(createArpMatch().build());
            flow.setInstructions(createAppyActionInstruction43().build());
            break;
        case "f73":
            id += 73;
            flow.setMatch(createL3IPv6Match().build());
            flow.setInstructions(createAppyActionInstruction44().build());
            break;
        case "f74":
            id += 74;
            flow.setMatch(createICMPv6Match().build());
            flow.setInstructions(createAppyActionInstruction45().build());
            break;
        case "f75":
            id += 75;
            flow.setMatch(createMplsMatch().build());
            flow.setInstructions(createAppyActionInstruction46().build());
            break;
        case "f76":
            id += 76;
            flow.setMatch(createPbbMatch().build());
            flow.setInstructions(createAppyActionInstruction47().build());
            break;
        case "f77":
            id += 77;
            flow.setMatch(createTunnelIDMatch().build());
            flow.setInstructions(createAppyActionInstruction48().build());
            break;
        case "f78":
            id += 78;
            flow.setMatch(createMatch33().build());
            flow.setInstructions(createDropInstructions().build());
            break;
        case "f79":
            id += 79;
            flow.setMatch(createICMPv6Match1().build());
            flow.setInstructions(createDecNwTtlInstructions().build());
            break;
        case "f80":
            id += 80;
            flow.setMatch(createVlanMatch().build());
            flow.setInstructions(createAppyActionInstruction88().build());
            break;
        case "f81":
            id += 81;
            flow.setMatch(createLLDPMatch().build());
            flow.setInstructions(createSentToControllerInstructions().build());
            break;
        case "f82":
            id += 82;
            flow.setMatch(createToSMatch().build());
            flow.setInstructions(createOutputInstructions().build());
            break;
        case "f83":
            // Test TCP_Flag Match
            id += 83;
            flow.setMatch(createTcpFlagMatch().build());
            flow.setInstructions(createDropInstructions().build());
            break;
        case "f84":
            id += 84;
            // match vlan=10,dl_vlan_pcp=3
            flow.setMatch(createVlanMatch().build());
            // vlan_pcp=4
            flow.setInstructions(createAppyActionInstruction88().build());
            break;
        case "f85":
            // Test Tunnel IPv4 Src (e.g. set_field:172.16.100.200->tun_src)
            id += 85;
            flow.setMatch(createMatch3().build());
            flow.setInstructions(createTunnelIpv4SrcInstructions().build());
            break;
        case "f86":
            // Test Tunnel IPv4 Dst (e.g. set_field:172.16.100.100->tun_dst)
            id += 86;
            flow.setMatch(createMatch1().build());
            flow.setInstructions(createTunnelIpv4DstInstructions().build());
            break;
        default:
            LOG.warn("flow type not understood: {}", flowType);
    }
    final FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
    if (null == flow.isBarrier()) {
        flow.setBarrier(Boolean.FALSE);
    }
    final BigInteger value = BigInteger.valueOf(10);
    flow.setCookie(new FlowCookie(value));
    flow.setCookieMask(new FlowCookie(value));
    flow.setHardTimeout(0);
    flow.setIdleTimeout(0);
    flow.setInstallHw(false);
    flow.setStrict(false);
    flow.setContainerName(null);
    flow.setFlags(new FlowModFlags(false, false, false, false, true));
    flow.setId(new FlowId("12"));
    flow.setTableId(getTableId(tableId));
    flow.setKey(key);
    flow.setFlowName(ORIGINAL_FLOW_NAME + "X" + flowType);
    return flow;
}
Also used : FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) FlowKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey) FlowCookie(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie) FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) FlowModFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags) BigInteger(java.math.BigInteger) ArpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder) Icmpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder) TunnelIpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder) VlanMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder) TcpFlagsMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagsMatchBuilder) Ipv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder) IpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder) Icmpv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder) SctpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder) UdpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder) TcpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)

Example 17 with InPort

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPort in project openflowplugin by opendaylight.

the class OF10PacketOutInputMessageFactoryTest method test.

@Test
public void test() {
    ByteBuf bb = BufferHelper.buildBuffer("00 00 01 00 01 01 00 10 00 00 00 08 " + "00 2a 00 32 00 03 00 08 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14");
    PacketOutInput deserializedMessage = BufferHelper.deserialize(factory, bb);
    BufferHelper.checkHeaderV10(deserializedMessage);
    Assert.assertEquals("Wrong bufferId ", 256L, deserializedMessage.getBufferId().longValue());
    Assert.assertEquals("Wrong inPort ", new PortNumber(257L), deserializedMessage.getInPort());
    Assert.assertEquals("Wrong action ", createActionList().get(0), deserializedMessage.getAction().get(0));
    Assert.assertEquals("Wrong action ", createActionList().get(1), deserializedMessage.getAction().get(1));
    Assert.assertArrayEquals("Wrong data ", ByteBufUtils.hexStringToBytes("00 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14"), deserializedMessage.getData());
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) PacketOutInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput) Test(org.junit.Test)

Example 18 with InPort

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPort in project openflowplugin by opendaylight.

the class InPortEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    processHeader(message);
    final long port = message.readUnsignedInt();
    if (Objects.isNull(builder.getInPort())) {
        builder.setInPort(new NodeConnectorId(OpenflowPortsUtil.getProtocolAgnosticPortUri(EncodeConstants.OF13_VERSION_ID, port)));
    } else {
        throwErrorOnMalformed(builder, "inPort");
    }
}
Also used : NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)

Example 19 with InPort

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPort in project openflowplugin by opendaylight.

the class MatchV10Convertor method convert.

@Override
public MatchV10 convert(final Match source, final VersionConvertorData data) {
    MatchV10Builder matchBuilder = new MatchV10Builder();
    boolean dlDst = true;
    boolean dlSsc = true;
    boolean dlType = true;
    boolean dlVlan = true;
    boolean dlVlanPcp = true;
    boolean ipPort = true;
    boolean nwProto = true;
    boolean nwTos = true;
    boolean tpDst = true;
    boolean tpSrc = true;
    matchBuilder.setInPort(0);
    matchBuilder.setDlDst(ZERO_MAC);
    matchBuilder.setDlSrc(ZERO_MAC);
    matchBuilder.setDlType(0);
    matchBuilder.setDlVlan(OFP_VLAN_NONE);
    matchBuilder.setDlVlanPcp((short) 0);
    matchBuilder.setNwDst(ZERO_IPV4);
    matchBuilder.setNwDstMask((short) 0);
    matchBuilder.setNwSrc(ZERO_IPV4);
    matchBuilder.setNwSrcMask((short) 0);
    matchBuilder.setNwProto((short) 0);
    matchBuilder.setNwTos((short) 0);
    matchBuilder.setTpSrc(0);
    matchBuilder.setTpDst(0);
    if (source != null) {
        EthernetMatch ethernetMatch = source.getEthernetMatch();
        if (ethernetMatch != null) {
            dlDst = convertEthernetDlDst(matchBuilder, ethernetMatch);
            dlSsc = convertEthernetDlSrc(matchBuilder, ethernetMatch);
            dlType = convertEthernetDlType(matchBuilder, ethernetMatch);
        }
        VlanMatch vlanMatch = source.getVlanMatch();
        if (vlanMatch != null) {
            dlVlan = convertDlVlan(matchBuilder, vlanMatch);
            dlVlanPcp = convertDlVlanPcp(matchBuilder, vlanMatch);
        }
        NodeConnectorId inPort = source.getInPort();
        if (inPort != null) {
            ipPort = convertInPortMatch(matchBuilder, inPort);
        }
        Layer3Match l3Match = source.getLayer3Match();
        if (l3Match != null) {
            if (l3Match instanceof Ipv4Match) {
                Ipv4Match ipv4 = (Ipv4Match) l3Match;
                convertL3Ipv4SrcMatch(matchBuilder, ipv4);
                convertL3Ipv4DstMatch(matchBuilder, ipv4);
            }
        }
        IpMatch ipMatch = source.getIpMatch();
        if (ipMatch != null) {
            nwProto = convertNwProto(matchBuilder, ipMatch);
            nwTos = convertNwTos(matchBuilder, ipMatch);
        }
        Layer4Match layer4Match = source.getLayer4Match();
        if (layer4Match != null) {
            if (layer4Match instanceof TcpMatch) {
                TcpMatch tcpMatch = (TcpMatch) layer4Match;
                tpSrc = convertL4TpSrcMatch(matchBuilder, tcpMatch);
                tpDst = convertL4TpDstMatch(matchBuilder, tcpMatch);
            } else if (layer4Match instanceof UdpMatch) {
                UdpMatch udpMatch = (UdpMatch) layer4Match;
                tpSrc = convertL4UdpSrcMatch(matchBuilder, udpMatch);
                tpDst = convertL4UdpDstMatch(matchBuilder, udpMatch);
            }
        } else {
            Icmpv4Match icmpv4Match = source.getIcmpv4Match();
            if (icmpv4Match != null) {
                Short type = icmpv4Match.getIcmpv4Type();
                if (type != null) {
                    matchBuilder.setTpSrc(type.intValue());
                    tpSrc = false;
                }
                Short code = icmpv4Match.getIcmpv4Code();
                if (code != null) {
                    matchBuilder.setTpDst(code.intValue());
                    tpDst = false;
                }
            }
        }
    }
    FlowWildcardsV10 wildCards = new FlowWildcardsV10(dlDst, dlSsc, dlType, dlVlan, dlVlanPcp, ipPort, nwProto, nwTos, tpDst, tpSrc);
    matchBuilder.setWildcards(wildCards);
    return matchBuilder.build();
}
Also used : Icmpv4Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4Match) Layer3Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer3Match) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) Ipv4Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match) IpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatch) EthernetMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch) TcpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch) FlowWildcardsV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10) MatchV10Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder) Layer4Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer4Match) UdpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch) VlanMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatch)

Example 20 with InPort

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPort in project genius by opendaylight.

the class MdSalUtilTest method createGroupEntity.

public GroupEntity createGroupEntity(String nodeid, String inport, int vlanid) {
    List<BucketInfo> listBucketInfo = new ArrayList<>();
    List<ActionInfo> listActionInfo = new ArrayList<>();
    if (vlanid > 0) {
        listActionInfo.add(new ActionPushVlan());
        listActionInfo.add(new ActionSetFieldVlanVid(vlanid));
    }
    listActionInfo.add(new ActionOutput(new Uri(inport), 65535));
    listBucketInfo.add(new BucketInfo(listActionInfo));
    String groupName = "Test Group";
    BigInteger dpnId = new BigInteger(nodeid.split(":")[1]);
    long id = getUniqueValue(nodeid, inport);
    return MDSALUtil.buildGroupEntity(dpnId, id, groupName, GroupTypes.GroupIndirect, listBucketInfo);
}
Also used : ArrayList(java.util.ArrayList) ActionSetFieldVlanVid(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldVlanVid) BigInteger(java.math.BigInteger) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) BucketInfo(org.opendaylight.genius.mdsalutil.BucketInfo) ActionPushVlan(org.opendaylight.genius.mdsalutil.actions.ActionPushVlan) ActionOutput(org.opendaylight.genius.mdsalutil.actions.ActionOutput) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)

Aggregations

Test (org.junit.Test)10 BigInteger (java.math.BigInteger)6 ByteBuf (io.netty.buffer.ByteBuf)5 ArrayList (java.util.ArrayList)5 Uri (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)4 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)3 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)3 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)3 ActionOutput (org.opendaylight.genius.mdsalutil.actions.ActionOutput)2 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)2 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)2 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)2 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)2 NodeConnectorRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef)2 EthernetMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch)2 FlowWildcardsV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10)2 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)2 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)2 MatchV10Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder)2 TableFeatureProperties (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties)2