Search in sources :

Example 1 with HwvtepHACache

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);
            }
        }
    }
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) HwvtepHACache(org.opendaylight.genius.utils.hwvtep.HwvtepHACache)

Aggregations

HwvtepHACache (org.opendaylight.genius.utils.hwvtep.HwvtepHACache)1 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)1 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)1