use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalSwitchRef 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);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalSwitchRef 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();
}
Aggregations