Search in sources :

Example 1 with RemoteUcastCmd

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

the class TestComparators method compareRemoteUcastMacs.

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

Aggregations

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