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