use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalMcastMacs in project netvirt by opendaylight.
the class LocalMcastCmd method transform.
@Override
public LocalMcastMacs transform(InstanceIdentifier<Node> nodePath, LocalMcastMacs src) {
LocalMcastMacsBuilder ucmlBuilder = new LocalMcastMacsBuilder(src);
List<LocatorSet> locatorSet = new ArrayList<>();
for (LocatorSet locator : src.getLocatorSet()) {
locatorSet.add(new LocatorSetBuilder().setLocatorRef(HwvtepHAUtil.buildLocatorRef(nodePath, HwvtepHAUtil.getTepIpVal(locator.getLocatorRef()))).build());
}
ucmlBuilder.setLocatorSet(locatorSet);
ucmlBuilder.setLogicalSwitchRef(HwvtepHAUtil.convertLogicalSwitchRef(src.getLogicalSwitchRef(), nodePath));
ucmlBuilder.setMacEntryUuid(HwvtepHAUtil.getUUid(src.getMacEntryKey().getValue()));
LocalMcastMacsKey key = new LocalMcastMacsKey(ucmlBuilder.getLogicalSwitchRef(), ucmlBuilder.getMacEntryKey());
ucmlBuilder.setKey(key);
return ucmlBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalMcastMacs in project netvirt by opendaylight.
the class TestBuilders method buildLocalMcastMacs.
public static LocalMcastMacs buildLocalMcastMacs(InstanceIdentifier<Node> iid, String mac, String logicalSwitchName, String tepIp) {
LocalMcastMacsBuilder localMcastMacsBuilder = new LocalMcastMacsBuilder();
if (mac.equals("unknown-dst")) {
localMcastMacsBuilder.setMacEntryKey(new MacAddress("00:00:00:00:00:00"));
} else {
localMcastMacsBuilder.setMacEntryKey(new MacAddress(mac));
}
localMcastMacsBuilder.setMacEntryUuid(getUUid(mac));
// mMacLocalBuilder.setIpaddr(new IpAddress(ip.toCharArray()));
localMcastMacsBuilder.setLogicalSwitchRef(buildLogicalSwitchesRef(iid, logicalSwitchName));
List<LocatorSet> locatorSets = new ArrayList<>();
locatorSets.add(new LocatorSetBuilder().setLocatorRef(buildLocatorRef(iid, tepIp)).build());
localMcastMacsBuilder.setLocatorSet(locatorSets);
return localMcastMacsBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalMcastMacs in project netvirt by opendaylight.
the class TestComparators method compareLocalMcastMacs.
public static void compareLocalMcastMacs(Node src, Node dst, InstanceIdentifier<Node> nodePath) {
LocalMcastCmd cmd = new LocalMcastCmd();
HwvtepGlobalAugmentation d1Aug = src.getAugmentation(HwvtepGlobalAugmentation.class);
HwvtepGlobalAugmentation haAug = dst.getAugmentation(HwvtepGlobalAugmentation.class);
List<LocalMcastMacs> d1Values = d1Aug.getLocalUcastMacs() != null ? d1Aug.getLocalMcastMacs() : new ArrayList<>();
List<LocalMcastMacs> result1 = cmd.transform(nodePath, d1Values);
List<LocalMcastMacs> result2 = cmd.transform(nodePath, haAug.getLocalMcastMacs());
Set<LocalMcastMacs> set1 = Sets.newHashSet(result1);
Set<LocalMcastMacs> set2 = Sets.newHashSet(result2);
assertEquals("should have equal remote ucast macs ", 0, Sets.symmetricDifference(set1, set2).size());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalMcastMacs in project netvirt by opendaylight.
the class LocalMcastCmd method generateId.
@Override
public InstanceIdentifier<LocalMcastMacs> generateId(InstanceIdentifier<Node> id, LocalMcastMacs node) {
HwvtepLogicalSwitchRef lsRef = HwvtepHAUtil.convertLogicalSwitchRef(node.getKey().getLogicalSwitchRef(), id);
LocalMcastMacsKey key = new LocalMcastMacsKey(lsRef, node.getMacEntryKey());
return id.augmentation(HwvtepGlobalAugmentation.class).child(LocalMcastMacs.class, key);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalMcastMacs in project netvirt by opendaylight.
the class LocalMcastCmd method areEqual.
@Override
public boolean areEqual(LocalMcastMacs updated, LocalMcastMacs orig) {
InstanceIdentifier<?> updatedMacRefIdentifier = updated.getLogicalSwitchRef().getValue();
HwvtepNodeName updatedMacNodeName = updatedMacRefIdentifier.firstKeyOf(LogicalSwitches.class).getHwvtepNodeName();
InstanceIdentifier<?> origMacRefIdentifier = orig.getLogicalSwitchRef().getValue();
HwvtepNodeName origMacNodeName = origMacRefIdentifier.firstKeyOf(LogicalSwitches.class).getHwvtepNodeName();
if (updated.getMacEntryKey().equals(orig.getMacEntryKey()) && updatedMacNodeName.equals(origMacNodeName)) {
List<LocatorSet> updatedLocatorSet = updated.getLocatorSet();
List<LocatorSet> origLocatorSet = orig.getLocatorSet();
if (!areSameSize(updatedLocatorSet, origLocatorSet)) {
return false;
}
List<LocatorSet> added = diffOf(updatedLocatorSet, origLocatorSet, locatorSetComparator);
if (!HwvtepHAUtil.isEmptyList(added)) {
return false;
}
List<LocatorSet> removed = diffOf(origLocatorSet, updatedLocatorSet, locatorSetComparator);
if (!HwvtepHAUtil.isEmptyList(removed)) {
return false;
}
return true;
}
return false;
}
Aggregations