use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService in project netvirt by opendaylight.
the class L2GatewayUtils method deleteItmTunnels.
public static void deleteItmTunnels(ItmRpcService itmRpcService, String hwvtepId, String psName, IpAddress tunnelIp) {
DeleteL2GwDeviceInputBuilder builder = new DeleteL2GwDeviceInputBuilder();
builder.setTopologyId(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID.getValue());
builder.setNodeId(HwvtepSouthboundUtils.createManagedNodeId(new NodeId(hwvtepId), psName).getValue());
builder.setIpAddress(tunnelIp);
try {
Future<RpcResult<Void>> result = itmRpcService.deleteL2GwDevice(builder.build());
RpcResult<Void> rpcResult = result.get();
if (rpcResult.isSuccessful()) {
LOG.info("Deleted ITM tunnels for {}", hwvtepId);
} else {
LOG.error("Failed to delete ITM Tunnels: {}", rpcResult.getErrors());
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("RPC to delete ITM tunnels failed", e);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService 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);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService in project netvirt by opendaylight.
the class L2GatewayUtils method deleteItmTunnels.
protected static void deleteItmTunnels(ItmRpcService itmRpcService, String hwvtepId, String psName, IpAddress tunnelIp) {
DeleteL2GwDeviceInputBuilder builder = new DeleteL2GwDeviceInputBuilder();
builder.setTopologyId(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID.getValue());
builder.setNodeId(HwvtepSouthboundUtils.createManagedNodeId(new NodeId(hwvtepId), psName).getValue());
builder.setIpAddress(tunnelIp);
try {
Future<RpcResult<Void>> result = itmRpcService.deleteL2GwDevice(builder.build());
RpcResult<Void> rpcResult = result.get();
if (rpcResult.isSuccessful()) {
LOG.info("Deleted ITM tunnels for {}", hwvtepId);
} else {
LOG.error("Failed to delete ITM Tunnels: {}", rpcResult.getErrors());
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("RPC to delete ITM tunnels failed", e);
}
}
Aggregations