Search in sources :

Example 1 with SwitchesBuilder

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

the class GlobalAugmentationHelper method addSwitches.

public static void addSwitches(HwvtepGlobalAugmentationBuilder augmentationBuilder, InstanceIdentifier<Node> psId) {
    List<Switches> switches = new ArrayList<>();
    SwitchesBuilder switchesBuilder = new SwitchesBuilder();
    switchesBuilder.setKey(new SwitchesKey(new HwvtepPhysicalSwitchRef(psId)));
    switchesBuilder.setSwitchRef(new HwvtepPhysicalSwitchRef(psId));
    switches.add(switchesBuilder.build());
    augmentationBuilder.setSwitches(switches);
}
Also used : HwvtepPhysicalSwitchRef(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalSwitchRef) SwitchesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.SwitchesKey) LogicalSwitches(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches) Switches(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.Switches) ArrayList(java.util.ArrayList) SwitchesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.SwitchesBuilder)

Example 2 with SwitchesBuilder

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

the class SwitchesCmd method transform.

@Override
public Switches transform(InstanceIdentifier<Node> nodePath, Switches src) {
    SwitchesBuilder builder = new SwitchesBuilder(src);
    InstanceIdentifier<Node> psNodeIid = (InstanceIdentifier<Node>) src.getSwitchRef().getValue();
    String psNodeId = psNodeIid.firstKeyOf(Node.class).getNodeId().getValue();
    String nodeId = nodePath.firstKeyOf(Node.class).getNodeId().getValue();
    int idx = nodeId.indexOf("/physicalswitch/");
    if (idx > 0) {
        nodeId = nodeId.substring(0, idx);
    }
    idx = psNodeId.indexOf("/physicalswitch/") + "/physicalswitch/".length();
    String switchName = psNodeId.substring(idx);
    String dstNodeId = nodeId + "/physicalswitch/" + switchName;
    InstanceIdentifier<Node> id2 = HwvtepHAUtil.convertToInstanceIdentifier(dstNodeId);
    builder.setSwitchRef(new HwvtepPhysicalSwitchRef(id2));
    builder.setKey(new SwitchesKey(new HwvtepPhysicalSwitchRef(id2)));
    return builder.build();
}
Also used : HwvtepPhysicalSwitchRef(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalSwitchRef) SwitchesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.SwitchesKey) 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) SwitchesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.SwitchesBuilder)

Aggregations

HwvtepPhysicalSwitchRef (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalSwitchRef)2 SwitchesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.SwitchesBuilder)2 SwitchesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.SwitchesKey)2 ArrayList (java.util.ArrayList)1 LogicalSwitches (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches)1 Switches (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.Switches)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