use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint in project netvirt by opendaylight.
the class HwvtepTerminationPointListener method handlePortAdded.
private List<ListenableFuture<Void>> handlePortAdded(TerminationPoint portAdded, NodeId psNodeId) {
Node psNode = HwvtepUtils.getHwVtepNode(broker, LogicalDatastoreType.OPERATIONAL, psNodeId);
if (psNode != null) {
String psName = psNode.getAugmentation(PhysicalSwitchAugmentation.class).getHwvtepNodeName().getValue();
L2GatewayDevice l2GwDevice = l2GatewayCache.get(psName);
if (l2GwDevice != null) {
if (isL2GatewayConfigured(l2GwDevice)) {
List<L2gatewayConnection> l2GwConns = L2GatewayConnectionUtils.getAssociatedL2GwConnections(broker, l2GwDevice.getL2GatewayIds());
String newPortId = portAdded.getTpId().getValue();
NodeId hwvtepNodeId = new NodeId(l2GwDevice.getHwvtepNodeId());
List<VlanBindings> vlanBindings = getVlanBindings(l2GwConns, hwvtepNodeId, psName, newPortId);
return Collections.singletonList(elanL2GatewayUtils.updateVlanBindingsInL2GatewayDevice(hwvtepNodeId, psName, newPortId, vlanBindings));
}
} else {
LOG.error("{} details are not present in L2Gateway Cache", psName);
}
} else {
LOG.error("{} entry not in config datastore", psNodeId);
}
return Collections.emptyList();
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint in project netvirt by opendaylight.
the class HwvtepHAUtil method convertLocatorRef.
/**
* Trnaform locator reference to nodepath passed .
*
* @param src {@link HwvtepPhysicalLocatorRef} Logical Switch Ref which needs to be transformed
* @param nodePath {@link InstanceIdentifier} src needs to be transformed to this path
* @return physicalLocatorRef {@link HwvtepPhysicalLocatorRef} the transforrmed result
*/
public static HwvtepPhysicalLocatorRef convertLocatorRef(HwvtepPhysicalLocatorRef src, InstanceIdentifier<Node> nodePath) {
InstanceIdentifier<TerminationPoint> srcTepPath = (InstanceIdentifier<TerminationPoint>) src.getValue();
TpId tpId = srcTepPath.firstKeyOf(TerminationPoint.class).getTpId();
InstanceIdentifier<TerminationPoint> tpPath = nodePath.child(TerminationPoint.class, new TerminationPointKey(tpId));
HwvtepPhysicalLocatorRef physicalLocatorRef = new HwvtepPhysicalLocatorRef(tpPath);
return physicalLocatorRef;
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint in project netvirt by opendaylight.
the class PhysicalLocatorCmd method areEqual.
@Override
public boolean areEqual(TerminationPoint updated, TerminationPoint orig) {
HwvtepPhysicalLocatorAugmentation updatedPhysicalLocator = updated.getAugmentation(HwvtepPhysicalLocatorAugmentation.class);
HwvtepPhysicalLocatorAugmentation origPhysicalLocator = orig.getAugmentation(HwvtepPhysicalLocatorAugmentation.class);
return updatedPhysicalLocator.getDstIp().equals(origPhysicalLocator.getDstIp()) && updatedPhysicalLocator.getEncapsulationType() == origPhysicalLocator.getEncapsulationType();
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint 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.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint in project netvirt by opendaylight.
the class TerminationPointCmd method areEqual.
@Override
public boolean areEqual(TerminationPoint updated, TerminationPoint orig) {
if (!updated.getKey().equals(orig.getKey())) {
return false;
}
HwvtepPhysicalPortAugmentation updatedAugmentation = updated.getAugmentation(HwvtepPhysicalPortAugmentation.class);
HwvtepPhysicalPortAugmentation origAugmentation = orig.getAugmentation(HwvtepPhysicalPortAugmentation.class);
List<VlanBindings> up = updatedAugmentation != null ? updatedAugmentation.getVlanBindings() : null;
List<VlanBindings> or = origAugmentation != null ? origAugmentation.getVlanBindings() : null;
if (!areSameSize(up, or)) {
return false;
}
List<VlanBindings> added = diffOf(up, or, bindingsComparator);
if (added.size() != 0) {
return false;
}
List<VlanBindings> removed = diffOf(or, up, bindingsComparator);
if (removed.size() != 0) {
return false;
}
return true;
}
Aggregations