use of org.opendaylight.netvirt.elan.l2gw.ha.commands.LogicalSwitchesCmd in project netvirt by opendaylight.
the class TestComparators method compareLogicalSwitches.
public static void compareLogicalSwitches(Node d1, Node d2, Node ha, InstanceIdentifier<Node> nodePath) {
LogicalSwitchesCmd cmd = new LogicalSwitchesCmd();
HwvtepGlobalAugmentation d1Aug = d1.getAugmentation(HwvtepGlobalAugmentation.class);
HwvtepGlobalAugmentation d2Aug = d2.getAugmentation(HwvtepGlobalAugmentation.class);
HwvtepGlobalAugmentation haAug = ha.getAugmentation(HwvtepGlobalAugmentation.class);
List<LogicalSwitches> d1Values = d1Aug.getLogicalSwitches() != null ? d1Aug.getLogicalSwitches() : new ArrayList<>();
List<LogicalSwitches> result1 = cmd.transform(nodePath, d1Values);
List<LogicalSwitches> d2Values = d2Aug.getLogicalSwitches() != null ? d2Aug.getLogicalSwitches() : new ArrayList<>();
List<LogicalSwitches> result2 = cmd.transform(nodePath, d2Values);
// Merge data of both d1 and d2 logical switch info should be same as ha
Set<LogicalSwitches> set1 = new HashSet<>();
set1.addAll(result1);
set1.addAll(result2);
List<LogicalSwitches> result = cmd.transform(nodePath, haAug.getLogicalSwitches());
Set<LogicalSwitches> set2 = Sets.newHashSet(result);
assertEquals("should have equal logical switches", 0, Sets.symmetricDifference(set1, set2).size());
}
Aggregations