Search in sources :

Example 11 with PacketInReason

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason in project openflowplugin by opendaylight.

the class SetAsyncInputMessageFactory method serializePacketInMask.

private static void serializePacketInMask(List<PacketInMask> packetInMask, ByteBuf outBuffer) {
    if (packetInMask != null) {
        for (PacketInMask currentPacketMask : packetInMask) {
            List<PacketInReason> mask = currentPacketMask.getMask();
            if (mask != null) {
                Map<Integer, Boolean> packetInReasonMap = new HashMap<>();
                for (PacketInReason packetInReason : mask) {
                    if (PacketInReason.OFPRNOMATCH.equals(packetInReason)) {
                        packetInReasonMap.put(PacketInReason.OFPRNOMATCH.getIntValue(), true);
                    } else if (PacketInReason.OFPRACTION.equals(packetInReason)) {
                        packetInReasonMap.put(PacketInReason.OFPRACTION.getIntValue(), true);
                    } else if (PacketInReason.OFPRINVALIDTTL.equals(packetInReason)) {
                        packetInReasonMap.put(PacketInReason.OFPRINVALIDTTL.getIntValue(), true);
                    }
                }
                outBuffer.writeInt(ByteBufUtils.fillBitMaskFromMap(packetInReasonMap));
            }
        }
    }
}
Also used : PacketInMask(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.async.body.grouping.PacketInMask) HashMap(java.util.HashMap) PacketInReason(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason)

Example 12 with PacketInReason

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason in project openflowplugin by opendaylight.

the class SetAsyncInputMessageFactory method serializePortStatusMask.

private static void serializePortStatusMask(List<PortStatusMask> portStatusMask, ByteBuf outBuffer) {
    if (portStatusMask != null) {
        for (PortStatusMask currentPortStatusMask : portStatusMask) {
            List<PortReason> mask = currentPortStatusMask.getMask();
            if (mask != null) {
                Map<Integer, Boolean> portStatusReasonMap = new HashMap<>();
                for (PortReason packetInReason : mask) {
                    if (PortReason.OFPPRADD.equals(packetInReason)) {
                        portStatusReasonMap.put(PortReason.OFPPRADD.getIntValue(), true);
                    } else if (PortReason.OFPPRDELETE.equals(packetInReason)) {
                        portStatusReasonMap.put(PortReason.OFPPRDELETE.getIntValue(), true);
                    } else if (PortReason.OFPPRMODIFY.equals(packetInReason)) {
                        portStatusReasonMap.put(PortReason.OFPPRMODIFY.getIntValue(), true);
                    }
                }
                outBuffer.writeInt(ByteBufUtils.fillBitMaskFromMap(portStatusReasonMap));
            }
        }
    }
}
Also used : HashMap(java.util.HashMap) PortReason(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortReason) PortStatusMask(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.async.body.grouping.PortStatusMask)

Example 13 with PacketInReason

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason in project openflowplugin by opendaylight.

the class PacketReceivedTranslatorTest method createPacketInMessage.

private static PacketInMessage createPacketInMessage(final byte[] data, final long port) {
    final PacketInReason reason = PacketInReason.OFPRACTION;
    MatchEntryBuilder matchEntryBuilder = assembleMatchEntryBld(port);
    MatchBuilder packetInMatchBld = new MatchBuilder().setMatchEntry(Lists.newArrayList(matchEntryBuilder.build()));
    return new PacketInMessageBuilder().setVersion(OFConstants.OFP_VERSION_1_0).setData(data).setReason(reason).setMatch(packetInMatchBld.build()).setVersion(OFConstants.OFP_VERSION_1_3).setCookie(BigInteger.ZERO).setTableId(new TableId(42L)).build();
}
Also used : TableId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId) PacketInMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessageBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) PacketInReason(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder)

Example 14 with PacketInReason

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason in project openflowplugin by opendaylight.

the class SetAsyncInputMessageFactoryTest method createPacketInMask.

private static List<PacketInMask> createPacketInMask() {
    final List<PacketInMask> masks = new ArrayList<>();
    PacketInMaskBuilder builder;
    // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
    builder = new PacketInMaskBuilder();
    List<PacketInReason> packetInReasonList = new ArrayList<>();
    packetInReasonList.add(PacketInReason.OFPRNOMATCH);
    packetInReasonList.add(PacketInReason.OFPRACTION);
    packetInReasonList.add(PacketInReason.OFPRINVALIDTTL);
    builder.setMask(packetInReasonList);
    masks.add(builder.build());
    // OFPCR_ROLE_SLAVE
    builder = new PacketInMaskBuilder();
    packetInReasonList = new ArrayList<>();
    builder.setMask(packetInReasonList);
    masks.add(builder.build());
    return masks;
}
Also used : PacketInMask(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.async.body.grouping.PacketInMask) PacketInReason(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason) PacketInMaskBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.async.body.grouping.PacketInMaskBuilder) ArrayList(java.util.ArrayList)

Aggregations

PacketInReason (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason)7 HashMap (java.util.HashMap)6 PacketInMask (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.async.body.grouping.PacketInMask)6 ArrayList (java.util.ArrayList)4 PacketInMaskBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.async.body.grouping.PacketInMaskBuilder)4 Ethernet (org.opendaylight.genius.mdsalutil.packet.Ethernet)3 PacketException (org.opendaylight.openflowplugin.libraries.liblldp.PacketException)3 BigInteger (java.math.BigInteger)2 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)2 FlowRemovedReason (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowRemovedReason)2 PortReason (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortReason)2 FlowRemovedMask (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.async.body.grouping.FlowRemovedMask)2 PortStatusMask (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.async.body.grouping.PortStatusMask)2 InetAddress (java.net.InetAddress)1 UnknownHostException (java.net.UnknownHostException)1 ExecutionException (java.util.concurrent.ExecutionException)1 ARP (org.opendaylight.genius.mdsalutil.packet.ARP)1 DHCP (org.opendaylight.netvirt.dhcpservice.api.DHCP)1 Packet (org.opendaylight.openflowplugin.libraries.liblldp.Packet)1 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)1