use of org.projectfloodlight.openflow.protocol.OFBucket in project open-kilda by telstra.
the class OfGroupConverterTest method testConvertInstallGroupCommand.
@Test
public void testConvertInstallGroupCommand() {
List<Bucket> buckets = new ArrayList<>();
buckets.add(Bucket.builder().watchPort(WatchPort.ANY).watchGroup(WatchGroup.ALL).writeActions(Sets.newHashSet(new PortOutAction(new PortNumber(2, null)))).build());
buckets.add(Bucket.builder().watchPort(WatchPort.ANY).watchGroup(WatchGroup.ALL).writeActions(Sets.newHashSet(new PortOutAction(new PortNumber(1, null)))).build());
GroupSpeakerData groupSpeakerData = GroupSpeakerData.builder().groupId(new GroupId(GROUP_ID)).type(GroupType.ALL).buckets(buckets).build();
OFFactoryVer13 factory = new OFFactoryVer13();
OFGroupAdd ofGroupAdd = OfGroupConverter.INSTANCE.convertInstallGroupCommand(groupSpeakerData, factory);
assertEquals(OFGroup.of(GROUP_ID), ofGroupAdd.getGroup());
assertEquals(OFGroupType.ALL, ofGroupAdd.getGroupType());
assertEquals(2, ofGroupAdd.getBuckets().size());
List<OFBucket> expectedBuckets = new ArrayList<>();
expectedBuckets.add(factory.buildBucket().setWatchPort(OFPort.ANY).setWatchGroup(OFGroup.ALL).setActions(getActions(factory, 2)).build());
expectedBuckets.add(factory.buildBucket().setWatchPort(OFPort.ANY).setWatchGroup(OFGroup.ALL).setActions(getActions(factory, 1)).build());
assertEquals(expectedBuckets, ofGroupAdd.getBuckets());
}
use of org.projectfloodlight.openflow.protocol.OFBucket in project open-kilda by telstra.
the class VerificationFlowGenerator method getInstallRoundTripLatencyGroupInstruction.
private static OFGroupAdd getInstallRoundTripLatencyGroupInstruction(IOFSwitch sw) {
OFFactory ofFactory = sw.getOFFactory();
List<OFBucket> bucketList = new ArrayList<>();
bucketList.add(ofFactory.buildBucket().setActions(Lists.newArrayList(actionSetDstMac(sw.getOFFactory(), convertDpIdToMac(sw.getId())), actionSendToController(sw.getOFFactory()))).setWatchGroup(OFGroup.ANY).build());
TransportPort udpPort = TransportPort.of(LATENCY_PACKET_UDP_PORT);
List<OFAction> latencyActions = ImmutableList.of(ofFactory.actions().setField(ofFactory.oxms().udpDst(udpPort)), actionSetOutputPort(ofFactory));
bucketList.add(ofFactory.buildBucket().setActions(latencyActions).setWatchGroup(OFGroup.ANY).build());
return ofFactory.buildGroupAdd().setGroup(OFGroup.of(GroupId.ROUND_TRIP_LATENCY_GROUP_ID.intValue())).setGroupType(OFGroupType.ALL).setBuckets(bucketList).build();
}
Aggregations