use of org.opendaylight.genius.utils.hwvtep.HwvtepHACache in project netvirt by opendaylight.
the class L2GwValidateCli method verifyHANodes.
/**
* Checks the diff between HA parent and child nodes.
* Whatever config data in parent should be present in child nodes
* Whatever operational data in child should be present in parent node
*/
private void verifyHANodes() {
pw.println("Verifying HA nodes");
boolean parentChildComparison = true;
HwvtepHACache haCache = HwvtepHACache.getInstance();
Set<InstanceIdentifier<Node>> parentNodes = HwvtepHACache.getInstance().getHAParentNodes();
if (HwvtepHAUtil.isEmpty(parentNodes)) {
return;
}
for (InstanceIdentifier<Node> parentNodeIid : parentNodes) {
String parentNodeId = parentNodeIid.firstKeyOf(Node.class).getNodeId().getValue();
Node parentOpNode = operationalNodes.get(parentNodeIid);
Node parentCfgNode = configNodes.get(parentNodeIid);
Set<InstanceIdentifier<Node>> childNodeIids = haCache.getChildrenForHANode(parentNodeIid);
if (HwvtepHAUtil.isEmpty(childNodeIids)) {
pw.println("No child nodes could be found for parent node " + parentNodeId);
continue;
}
for (InstanceIdentifier<Node> childNodeIid : childNodeIids) {
String childNodeId = childNodeIid.firstKeyOf(Node.class).getNodeId().getValue();
if (parentOpNode != null) {
compareNodes(parentOpNode, operationalNodes.get(childNodeIid), parentChildComparison, LogicalDatastoreType.OPERATIONAL);
} else {
pw.println("Missing parent operational node for id " + parentNodeId);
}
if (parentCfgNode != null) {
if (configNodes.get(childNodeIid) == null) {
if (containsLogicalSwitch(parentCfgNode)) {
pw.println("Missing child config data " + childNodeId);
}
} else {
compareNodes(parentCfgNode, configNodes.get(childNodeIid), parentChildComparison, LogicalDatastoreType.CONFIGURATION);
}
} else {
pw.println("Missing parent config node for id " + parentNodeId);
}
}
}
}
Aggregations