Search in sources :

Example 1 with ManagersBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.ManagersBuilder in project netvirt by opendaylight.

the class HwvtepHAUtil method buildManagersForHANode.

/**
 * Transform child managers (Source) to HA managers using HA node path.
 *
 * @param childNode Child Node
 * @param haGlobalCfg HA global config node
 * @return Transformed managers
 */
public static List<Managers> buildManagersForHANode(Node childNode, Optional<Node> haGlobalCfg) {
    Set<NodeId> nodeIds = new HashSet<>();
    nodeIds.add(childNode.getNodeId());
    List<NodeId> childNodeIds = getChildNodeIdsFromManagerOtherConfig(haGlobalCfg);
    nodeIds.addAll(childNodeIds);
    ManagersBuilder builder1 = new ManagersBuilder();
    builder1.setKey(new ManagersKey(new Uri(MANAGER_KEY)));
    List<ManagerOtherConfigs> otherConfigses = new ArrayList<>();
    StringBuffer stringBuffer = new StringBuffer();
    for (NodeId nodeId : nodeIds) {
        stringBuffer.append(nodeId.getValue());
        stringBuffer.append(",");
    }
    String children = stringBuffer.substring(0, stringBuffer.toString().length() - 1);
    otherConfigses.add(getOtherConfigBuilder(HA_CHILDREN, children).build());
    builder1.setManagerOtherConfigs(otherConfigses);
    List<Managers> managers = new ArrayList<>();
    managers.add(builder1.build());
    return managers;
}
Also used : ArrayList(java.util.ArrayList) ManagersBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.ManagersBuilder) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri) ManagerOtherConfigs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.managers.ManagerOtherConfigs) Managers(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.Managers) ManagersKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.ManagersKey) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) HashSet(java.util.HashSet)

Example 2 with ManagersBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.ManagersBuilder in project netvirt by opendaylight.

the class TestBuilders method buildManagers.

public static List<Managers> buildManagers() {
    ManagersBuilder builder1 = new ManagersBuilder();
    builder1.setKey(new ManagersKey(new Uri("test")));
    List<ManagerOtherConfigs> otherConfigses = new ArrayList<>();
    otherConfigses.add(buildOtherConfig("ha_enabled", "true"));
    otherConfigses.add(buildOtherConfig("ha_id", "switchxyz"));
    builder1.setManagerOtherConfigs(otherConfigses);
    List<Managers> managers = new ArrayList<>();
    managers.add(builder1.build());
    return managers;
}
Also used : Managers(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.Managers) ManagersKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.ManagersKey) ArrayList(java.util.ArrayList) ManagersBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.ManagersBuilder) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri) ManagerOtherConfigs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.managers.ManagerOtherConfigs)

Aggregations

ArrayList (java.util.ArrayList)2 Uri (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)2 Managers (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.Managers)2 ManagersBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.ManagersBuilder)2 ManagersKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.ManagersKey)2 ManagerOtherConfigs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.managers.ManagerOtherConfigs)2 HashSet (java.util.HashSet)1 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)1