Search in sources :

Example 1 with LocalUcastCmd

use of org.opendaylight.netvirt.elan.l2gw.ha.commands.LocalUcastCmd in project netvirt by opendaylight.

the class TestComparators method compareLocalUcastMacs.

public static void compareLocalUcastMacs(Node d1, Node d2, Node ha, InstanceIdentifier<Node> nodePath) {
    LocalUcastCmd cmd = new LocalUcastCmd();
    HwvtepGlobalAugmentation d1Aug = d1.getAugmentation(HwvtepGlobalAugmentation.class);
    HwvtepGlobalAugmentation d2Aug = d2.getAugmentation(HwvtepGlobalAugmentation.class);
    HwvtepGlobalAugmentation haAug = ha.getAugmentation(HwvtepGlobalAugmentation.class);
    List<LocalUcastMacs> d1Values = d1Aug.getLocalUcastMacs() != null ? d1Aug.getLocalUcastMacs() : new ArrayList<>();
    List<LocalUcastMacs> result1 = cmd.transform(nodePath, d1Values);
    List<LocalUcastMacs> d2Values = d2Aug.getLocalUcastMacs() != null ? d2Aug.getLocalUcastMacs() : new ArrayList<>();
    List<LocalUcastMacs> result2 = cmd.transform(nodePath, d2Values);
    List<LocalUcastMacs> result = cmd.transform(nodePath, haAug.getLocalUcastMacs());
    List<LocalUcastMacs> luMacList = new ArrayList<>();
    luMacList.addAll(result1);
    luMacList.addAll(result2);
    Set<LocalUcastMacs> set1 = Sets.newHashSet(luMacList);
    Set<LocalUcastMacs> set2 = Sets.newHashSet(result);
    assertEquals("should have equal Local ucast macs ", 0, Sets.symmetricDifference(set1, set2).size());
}
Also used : LocalUcastMacs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacs) HwvtepGlobalAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation) ArrayList(java.util.ArrayList) LocalUcastCmd(org.opendaylight.netvirt.elan.l2gw.ha.commands.LocalUcastCmd)

Aggregations

ArrayList (java.util.ArrayList)1 LocalUcastCmd (org.opendaylight.netvirt.elan.l2gw.ha.commands.LocalUcastCmd)1 HwvtepGlobalAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation)1 LocalUcastMacs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacs)1