use of org.projectfloodlight.openflow.protocol.OFGroupDescStatsReply.Builder in project open-kilda by telstra.
the class OfGroupConverterTest method testConvertToGroupSpeakerData.
@Test
public void testConvertToGroupSpeakerData() {
OFFactoryVer13 factory = new OFFactoryVer13();
Builder builder = factory.buildGroupDescStatsReply();
List<OFGroupDescStatsEntry> entries = new ArrayList<>();
entries.add(getOfGroupEntry(factory));
builder.setEntries(entries);
List<GroupSpeakerData> groupSpeakerDataList = OfGroupConverter.INSTANCE.convertToGroupSpeakerData(builder.build());
assertEquals(1, groupSpeakerDataList.size());
GroupSpeakerData groupSpeakerData = groupSpeakerDataList.get(0);
assertEquals(new GroupId(GROUP_ID), groupSpeakerData.getGroupId());
assertEquals(GroupType.ALL, groupSpeakerData.getType());
List<Bucket> buckets = groupSpeakerData.getBuckets();
Set<Bucket> expectedBuckets = new HashSet<>();
expectedBuckets.add(Bucket.builder().watchPort(WatchPort.ANY).watchGroup(WatchGroup.ALL).writeActions(Sets.newHashSet(new PortOutAction(new PortNumber(2, null)))).build());
expectedBuckets.add(Bucket.builder().watchPort(WatchPort.ANY).watchGroup(WatchGroup.ALL).writeActions(Sets.newHashSet(new PortOutAction(new PortNumber(1, null)))).build());
assertEquals(expectedBuckets, new HashSet<>(buckets));
}
Aggregations