use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentationBuilder in project netvirt by opendaylight.
the class TerminationPointCmd method transform.
@Override
public TerminationPoint transform(InstanceIdentifier<Node> nodePath, TerminationPoint src) {
HwvtepPhysicalPortAugmentation augmentation = src.getAugmentation(HwvtepPhysicalPortAugmentation.class);
if (augmentation == null) {
return new TerminationPointBuilder(src).build();
}
String nodeIdVal = nodePath.firstKeyOf(Node.class).getNodeId().getValue();
int idx = nodeIdVal.indexOf("/physicalswitch");
if (idx > 0) {
nodeIdVal = nodeIdVal.substring(0, idx);
nodePath = HwvtepHAUtil.convertToInstanceIdentifier(nodeIdVal);
}
final InstanceIdentifier<Node> path = nodePath;
TerminationPointBuilder tpBuilder = new TerminationPointBuilder(src);
tpBuilder.removeAugmentation(HwvtepPhysicalPortAugmentation.class);
HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder = new HwvtepPhysicalPortAugmentationBuilder(augmentation);
if (augmentation.getVlanBindings() != null && augmentation.getVlanBindings().size() > 0) {
tpAugmentationBuilder.setVlanBindings(augmentation.getVlanBindings().stream().map(vlanBindings -> {
VlanBindingsBuilder vlanBindingsBuilder = new VlanBindingsBuilder(vlanBindings);
vlanBindingsBuilder.setLogicalSwitchRef(HwvtepHAUtil.convertLogicalSwitchRef(vlanBindings.getLogicalSwitchRef(), path));
return vlanBindingsBuilder.build();
}).collect(Collectors.toList()));
}
tpBuilder.addAugmentation(HwvtepPhysicalPortAugmentation.class, tpAugmentationBuilder.build());
return tpBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentationBuilder in project netvirt by opendaylight.
the class PhysicalSwitchHelper method updatePort.
public static void updatePort(String portName, HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder, Map<Long, String> vlanBindings) {
updateVlanBindings(vlanBindings, tpAugmentationBuilder);
tpAugmentationBuilder.setPhysicalPortUuid(new Uuid(UUID.randomUUID().toString()));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentationBuilder in project netvirt by opendaylight.
the class PhysicalSwitchHelper method updatePhysicalPortId.
public static void updatePhysicalPortId(String portName, HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder) {
tpAugmentationBuilder.setHwvtepNodeName(new HwvtepNodeName(portName));
tpAugmentationBuilder.setHwvtepNodeDescription("");
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentationBuilder in project netvirt by opendaylight.
the class PhysicalSwitchHelper method buildTerminationPointForPhysicalSwitch.
public static TerminationPoint buildTerminationPointForPhysicalSwitch(InstanceIdentifier<Node> switchIid, String portName, WriteTransaction transaction, Map<Long, String> vlanBindingData) {
TerminationPointKey tpKey = new TerminationPointKey(new TpId(portName));
TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
tpBuilder.setKey(tpKey);
tpBuilder.setTpId(tpKey.getTpId());
switchIid.firstKeyOf(Node.class);
InstanceIdentifier<TerminationPoint> tpPath = switchIid.child(TerminationPoint.class, new TerminationPointKey(new TpId(portName)));
HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder = new HwvtepPhysicalPortAugmentationBuilder();
buildTerminationPoint(tpAugmentationBuilder, portName, vlanBindingData);
tpBuilder.addAugmentation(HwvtepPhysicalPortAugmentation.class, tpAugmentationBuilder.build());
return tpBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentationBuilder in project genius by opendaylight.
the class HwvtepUtils method mergeVlanBindings.
/**
* Merge vlan bindings in the transaction.
*
* @param transaction
* the transaction
* @param physicalSwitchNodeId
* the physical switch node id
* @param phyPortName
* the phy port name
* @param vlanBindings
* the vlan bindings
*/
public static void mergeVlanBindings(final WriteTransaction transaction, final NodeId physicalSwitchNodeId, final String phyPortName, final List<VlanBindings> vlanBindings) {
HwvtepPhysicalPortAugmentation phyPortAug = new HwvtepPhysicalPortAugmentationBuilder().setHwvtepNodeName(new HwvtepNodeName(phyPortName)).setVlanBindings(vlanBindings).build();
final InstanceIdentifier<HwvtepPhysicalPortAugmentation> iid = HwvtepSouthboundUtils.createPhysicalPortInstanceIdentifier(physicalSwitchNodeId, phyPortName);
transaction.merge(LogicalDatastoreType.CONFIGURATION, iid, phyPortAug, true);
}
Aggregations