use of org.openkilda.messaging.info.switches.GroupInfoEntry.BucketEntry in project open-kilda by telstra.
the class ValidationServiceImpl method calculateMisconfiguredGroups.
private Set<GroupInfoEntry> calculateMisconfiguredGroups(Set<GroupInfoEntry> expected, Set<GroupInfoEntry> actual) {
Set<GroupInfoEntry> misconfiguredGroups = new HashSet<>();
Map<Integer, GroupInfoEntry> actualEntries = actual.stream().collect(Collectors.toMap(GroupInfoEntry::getGroupId, entry -> entry));
for (GroupInfoEntry expectedEntry : expected) {
GroupInfoEntry actualEntry = actualEntries.get(expectedEntry.getGroupId());
if (actualEntry == null || actualEntry.equals(expectedEntry)) {
continue;
}
List<BucketEntry> missingData = new ArrayList<>(expectedEntry.getGroupBuckets());
missingData.removeAll(actualEntry.getGroupBuckets());
List<BucketEntry> excessData = new ArrayList<>(actualEntry.getGroupBuckets());
excessData.removeAll(expectedEntry.getGroupBuckets());
misconfiguredGroups.add(actualEntry.toBuilder().missingGroupBuckets(missingData).excessGroupBuckets(excessData).build());
}
return misconfiguredGroups;
}
Aggregations