use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.Tunnels in project netvirt by opendaylight.
the class TunnelInterfaceStateListener method isTunnelInLogicalGroup.
private boolean isTunnelInLogicalGroup(StateTunnelList stateTunnelList) {
String ifaceName = stateTunnelList.getTunnelInterfaceName();
if (getTunnelType(stateTunnelList) == VpnConstants.ITMTunnelLocType.Internal.getValue()) {
Interface configIface = InterfaceUtils.getInterface(dataBroker, stateTunnelList.getTunnelInterfaceName());
IfTunnel ifTunnel = configIface != null ? configIface.getAugmentation(IfTunnel.class) : null;
if (ifTunnel != null && ifTunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeVxlan.class)) {
ParentRefs refs = configIface.getAugmentation(ParentRefs.class);
if (refs != null && !Strings.isNullOrEmpty(refs.getParentInterface())) {
// multiple VxLAN tunnels enabled, i.e. only logical tunnel should be treated
return true;
}
}
}
LOG.trace("isTunnelInLogicalGroup: MULTIPLE_VxLAN_TUNNELS: ignoring the tunnel event for {}", ifaceName);
return false;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.Tunnels in project netvirt by opendaylight.
the class NatTunnelInterfaceStateListener method isTunnelInLogicalGroup.
protected boolean isTunnelInLogicalGroup(StateTunnelList stateTunnelList) {
String ifaceName = stateTunnelList.getTunnelInterfaceName();
if (getTunnelType(stateTunnelList) == NatConstants.ITMTunnelLocType.Internal.getValue()) {
Interface configIface = interfaceManager.getInterfaceInfoFromConfigDataStore(ifaceName);
IfTunnel ifTunnel = configIface != null ? configIface.getAugmentation(IfTunnel.class) : null;
if (ifTunnel != null && ifTunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeVxlan.class)) {
ParentRefs refs = configIface.getAugmentation(ParentRefs.class);
if (refs != null && !Strings.isNullOrEmpty(refs.getParentInterface())) {
// multiple VxLAN tunnels enabled, i.e. only logical tunnel should be treated
return true;
}
}
}
LOG.trace("isTunnelInLogicalGroup: ignoring the tunnel event for {}", ifaceName);
return false;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.Tunnels 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.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.Tunnels 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);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.Tunnels in project netvirt by opendaylight.
the class UnderlayNetworkDpnListener method update.
@Override
protected void update(InstanceIdentifier<DpnToInterface> key, DpnToInterface origDpnToInterface, DpnToInterface updatedDpnToInterface) {
String underlayNetwork = key.firstKeyOf(UnderlayNetwork.class).getNetworkName();
BigInteger dpId = updatedDpnToInterface.getDpId();
LOG.info("DPN {} updated to underlay network {} with tunnels {}", dpId, underlayNetwork, updatedDpnToInterface.getTunnelInterface());
List<PolicyProfile> profiles = policyServiceUtil.getUnderlayNetworkPolicyProfiles(underlayNetwork);
if (profiles == null || profiles.isEmpty()) {
LOG.debug("No policy profiles found for underlay network {}", underlayNetwork);
return;
}
List<TunnelInterface> origTunnelInterfaces = origDpnToInterface.getTunnelInterface();
if (origTunnelInterfaces == null) {
origTunnelInterfaces = Collections.emptyList();
}
List<TunnelInterface> updatedTunnelInterfaces = updatedDpnToInterface.getTunnelInterface();
if (updatedTunnelInterfaces == null) {
updatedTunnelInterfaces = Collections.emptyList();
}
List<TunnelInterface> removedTunnelInterfaces = new ArrayList<>(origTunnelInterfaces);
removedTunnelInterfaces.removeAll(updatedTunnelInterfaces);
List<TunnelInterface> addedTunnelInterfaces = new ArrayList<>(updatedTunnelInterfaces);
addedTunnelInterfaces.removeAll(origTunnelInterfaces);
populatePolicyGroupBucketsToDpn(underlayNetwork, profiles, removedTunnelInterfaces, dpId, NwConstants.DEL_FLOW);
populatePolicyGroupsToDpn(profiles, addedTunnelInterfaces, dpId, NwConstants.ADD_FLOW);
populatePolicyGroupBucketsToDpn(underlayNetwork, profiles, addedTunnelInterfaces, dpId, NwConstants.ADD_FLOW);
}
Aggregations