use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation in project netvirt by opendaylight.
the class HAOpClusteredListener method addToHACacheIfBecameHAChild.
/**
* If Normal non-ha node changes to HA node , its added to HA cache.
*
* @param childPath HA child path which got converted to HA node
* @param updatedChildNode updated Child node
* @param beforeChildNode non-ha node before updated to HA node
*/
public static void addToHACacheIfBecameHAChild(InstanceIdentifier<Node> childPath, Node updatedChildNode, Node beforeChildNode) {
HwvtepGlobalAugmentation updatedAugmentaion = updatedChildNode.getAugmentation(HwvtepGlobalAugmentation.class);
HwvtepGlobalAugmentation beforeAugmentaion = null;
if (beforeChildNode != null) {
beforeAugmentaion = beforeChildNode.getAugmentation(HwvtepGlobalAugmentation.class);
}
List<Managers> up = null;
List<Managers> be = null;
if (updatedAugmentaion != null) {
up = updatedAugmentaion.getManagers();
}
if (beforeAugmentaion != null) {
be = beforeAugmentaion.getManagers();
}
if (up != null) {
if (be != null) {
if (up.size() > 0) {
if (be.size() > 0) {
Managers m1 = up.get(0);
Managers m2 = be.get(0);
if (!m1.equals(m2)) {
LOG.trace("Manager entry updated for node {} ", updatedChildNode.getNodeId().getValue());
addToCacheIfHAChildNode(childPath, updatedChildNode);
}
}
}
}
// TODO handle unhaed case
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation in project netvirt by opendaylight.
the class NodeConnectedHandler method deleteChildPSConfigIfHAPSConfigIsMissing.
private void deleteChildPSConfigIfHAPSConfigIsMissing(Optional<Node> haPSCfg, Node childNode, ReadWriteTransaction tx) throws ReadFailedException {
if (haPSCfg.isPresent()) {
return;
}
LOG.info("HA ps node not present cleanup child {}", childNode);
HwvtepGlobalAugmentation augmentation = childNode.getAugmentation(HwvtepGlobalAugmentation.class);
if (augmentation != null) {
List<Switches> switches = augmentation.getSwitches();
if (switches != null) {
for (Switches ps : switches) {
HwvtepHAUtil.deleteNodeIfPresent(tx, CONFIGURATION, ps.getSwitchRef().getValue());
}
}
} else {
LOG.info("Global augumentation not present for connected ha child node {}", childNode);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation 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());
}
Aggregations