use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelIps in project netvirt by opendaylight.
the class L2GatewayConnectionListener method addL2DeviceToCache.
void addL2DeviceToCache(InstanceIdentifier<Node> psIid, Node globalNode, Node psNode) {
LOG.trace("Adding device to cache {}", psNode.getNodeId().getValue());
String deviceName = HwvtepHAUtil.getPsName(psIid);
L2GatewayDevice l2GwDevice = l2GatewayCache.addOrGet(deviceName);
l2GwDevice.setConnected(true);
l2GwDevice.setHwvtepNodeId(globalNode.getNodeId().getValue());
List<TunnelIps> tunnelIps = psNode.getAugmentation(PhysicalSwitchAugmentation.class) != null ? psNode.getAugmentation(PhysicalSwitchAugmentation.class).getTunnelIps() : null;
if (tunnelIps != null) {
for (TunnelIps tunnelIp : tunnelIps) {
IpAddress tunnelIpAddr = tunnelIp.getTunnelIpsKey();
l2GwDevice.addTunnelIp(tunnelIpAddr);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelIps in project netvirt by opendaylight.
the class TestComparators method comparePhysicalSwitches.
public static void comparePhysicalSwitches(Node d1ps, Node haps, InstanceIdentifier<Node> d1psnodePath, InstanceIdentifier<Node> haPsnodePath, ReadWriteTransaction readWriteTransaction, String switchName, Node d1, Node ha) throws ReadFailedException {
// Compare Physical Augmentation data
PhysicalSwitchAugmentation d1PsAug = d1ps.getAugmentation(PhysicalSwitchAugmentation.class);
PhysicalSwitchAugmentation haPsAug = haps.getAugmentation(PhysicalSwitchAugmentation.class);
HwvtepGlobalRef managerd1Ps = d1PsAug.getManagedBy();
assertEquals("Hwvtep node name should be same", d1PsAug.getHwvtepNodeName().getValue(), haPsAug.getHwvtepNodeName().getValue());
assertEquals("Managers should be equal for d1 ", d1ps.getNodeId().getValue(), managerd1Ps.getValue().firstKeyOf(Node.class).getNodeId().getValue() + "/physicalswitch/" + switchName);
HwvtepGlobalRef managerhaPs = haPsAug.getManagedBy();
assertEquals("Managers should be equal for ha ", haps.getNodeId().getValue(), managerhaPs.getValue().firstKeyOf(Node.class).getNodeId().getValue() + "/physicalswitch/" + switchName);
assertEquals("Should have equal number TunnelIps", d1PsAug.getTunnelIps().size(), haPsAug.getTunnelIps().size());
if (d1PsAug.getTunnelIps().size() == haPsAug.getTunnelIps().size()) {
assertTrue(d1PsAug.getTunnelIps().containsAll(haPsAug.getTunnelIps()));
}
// Compare Termination point
assertTerminationPoint(DataProvider.getPortNameListD1(), d1psnodePath, haPsnodePath, readWriteTransaction, d1, ha);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelIps in project netvirt by opendaylight.
the class L2GatewayListener method removeL2Device.
private void removeL2Device(Devices l2Device, L2gateway input) {
final String l2DeviceName = l2Device.getDeviceName();
L2GatewayDevice l2GwDevice = l2GatewayCache.get(l2DeviceName);
if (l2GwDevice != null) {
// Also, do not delete device from cache if it's connected
if (L2GatewayUtils.isLastL2GatewayBeingDeleted(l2GwDevice)) {
if (l2GwDevice.isConnected()) {
l2GwDevice.removeL2GatewayId(input.getUuid());
// Delete ITM tunnels
final String hwvtepId = l2GwDevice.getHwvtepNodeId();
final Set<IpAddress> tunnelIps = l2GwDevice.getTunnelIps();
jobCoordinator.enqueueJob(hwvtepId, () -> {
if (entityOwnershipUtils.isEntityOwner(HwvtepSouthboundConstants.ELAN_ENTITY_TYPE, HwvtepSouthboundConstants.ELAN_ENTITY_NAME)) {
LOG.info("Deleting ITM Tunnels for {} connected to cluster node owner", l2DeviceName);
for (IpAddress tunnelIp : tunnelIps) {
L2GatewayUtils.deleteItmTunnels(itmRpcService, hwvtepId, l2DeviceName, tunnelIp);
}
} else {
LOG.info("ITM Tunnels are not deleted on the cluster node as this is not owner for {}", l2DeviceName);
}
return null;
});
} else {
l2GatewayCache.remove(l2DeviceName);
// Cleaning up the config DS
NodeId nodeId = new NodeId(l2GwDevice.getHwvtepNodeId());
NodeId psNodeId = HwvtepSouthboundUtils.createManagedNodeId(nodeId, l2DeviceName);
// FIXME: These should be removed
MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, HwvtepSouthboundUtils.createInstanceIdentifier(nodeId));
MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, HwvtepSouthboundUtils.createInstanceIdentifier(psNodeId));
}
} else {
l2GwDevice.removeL2GatewayId(input.getUuid());
LOG.trace("ITM tunnels are not deleted for {} as this device has other L2gateway associations", l2DeviceName);
}
} else {
LOG.error("Unable to find L2 Gateway details for {}", l2DeviceName);
}
}
Aggregations