use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan in project genius by opendaylight.
the class FlowBasedServicesUtils method getMatchInfoForVlanPortAtIngressTable.
public static List<MatchInfo> getMatchInfoForVlanPortAtIngressTable(BigInteger dpId, long portNo, Interface iface) {
List<MatchInfo> matches = new ArrayList<>();
matches.add(new MatchInPort(dpId, portNo));
int vlanId = 0;
IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class);
if (l2vlan != null) {
vlanId = l2vlan.getVlanId() == null ? 0 : l2vlan.getVlanId().getValue();
}
if (vlanId >= 0 && l2vlan.getL2vlanMode() != IfL2vlan.L2vlanMode.Transparent) {
matches.add(new MatchVlanVid(vlanId));
}
return matches;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan in project genius by opendaylight.
the class InterfaceManagerConfigurationTest method checkVlanApis.
private void checkVlanApis() throws Exception {
// 1. Test port-no corresponding to interface
long portNo = interfaceManager.getPortForInterface(INTERFACE_NAME);
Assert.assertEquals(PORT_NO_1, portNo);
// 2. fetch interface config from datastore API
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface interfaceInfo = interfaceManager.getInterfaceInfoFromConfigDataStore(INTERFACE_NAME);
// FIXME change this once augmentation sorting fix lands
assertEqualBeans(INTERFACE_NAME, interfaceInfo.getName());
assertEqualBeans(PARENT_INTERFACE, interfaceInfo.getAugmentation(ParentRefs.class).getParentInterface());
// 3. fetch dpn-id corresponding to an interface
BigInteger dpnId = interfaceManager.getDpnForInterface(INTERFACE_NAME);
Assert.assertEquals(DPN_ID_1, dpnId);
// 4. fetch parent-interface corresponding to an interface
Assert.assertEquals(PARENT_INTERFACE, interfaceManager.getParentRefNameForInterface(INTERFACE_NAME));
// 5. get interface information
assertEqualBeans(ExpectedInterfaceInfo.newVlanInterfaceInfo(), interfaceManager.getInterfaceInfo(INTERFACE_NAME));
Assert.assertEquals(org.opendaylight.genius.interfacemanager.globals.IfmConstants.VXLAN_GROUPID_MIN + 1, interfaceManager.getLogicalTunnelSelectGroupId(1));
// 6. Test bind ingress service
BoundServices serviceInfo = InterfaceManagerTestUtil.buildServicesInfo("ELAN", NwConstants.ELAN_SERVICE_INDEX);
interfaceManager.bindService(INTERFACE_NAME, ServiceModeIngress.class, serviceInfo);
waitTillOperationCompletes("test bind ingress service api", coordinatorEventsWaiter, 1, asyncEventsWaiter);
String lportDispatcherFlowRef = String.valueOf(dpnId) + NwConstants.FLOWID_SEPARATOR + NwConstants.LPORT_DISPATCHER_TABLE + NwConstants.FLOWID_SEPARATOR + INTERFACE_NAME + NwConstants.FLOWID_SEPARATOR + NwConstants.DEFAULT_SERVICE_INDEX;
FlowKey lportDispatcherFlowKey = new FlowKey(new FlowId(lportDispatcherFlowRef));
Node nodeDpn = InterfaceManagerTestUtil.buildInventoryDpnNode(dpnId);
InstanceIdentifier<Flow> lportDispatcherFlowId = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class).child(Table.class, new TableKey(NwConstants.LPORT_DISPATCHER_TABLE)).child(Flow.class, lportDispatcherFlowKey).build();
flowAssertTestUtils.assertFlowsInAnyOrder(ExpectedFlowEntries.newLportDispatcherFlow(), dataBroker.newReadOnlyTransaction().read(CONFIGURATION, lportDispatcherFlowId).checkedGet().get());
// check whether service-binding state cache is populated
assertEqualBeans(ExpectedBoundServiceState.newBoundServiceState(), FlowBasedServicesUtils.getBoundServicesState(dataBroker.newReadOnlyTransaction(), INTERFACE_NAME, ServiceModeIngress.class));
// 7. test check whether service is bound on ingress
Assert.assertTrue(interfaceManager.isServiceBoundOnInterfaceForIngress(NwConstants.ELAN_SERVICE_INDEX, INTERFACE_NAME));
// 8. test unbind ingress service
interfaceManager.unbindService(INTERFACE_NAME, ServiceModeIngress.class, serviceInfo);
waitTillOperationCompletes("test unbind ingress service api", coordinatorEventsWaiter, 2, asyncEventsWaiter);
Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(CONFIGURATION, lportDispatcherFlowId).get());
// check service-state cache is cleaned up
// 9. Test bind egress service
short egressACLIndex = ServiceIndex.getIndex(NwConstants.EGRESS_ACL_SERVICE_NAME, NwConstants.EGRESS_ACL_SERVICE_INDEX);
serviceInfo = InterfaceManagerTestUtil.buildServicesInfo("EGRESS_ACL", egressACLIndex);
interfaceManager.bindService(INTERFACE_NAME, ServiceModeEgress.class, serviceInfo);
waitTillOperationCompletes("test bind egress service api", coordinatorEventsWaiter, 1, asyncEventsWaiter);
String egressDispatcherFlowRef = String.valueOf(dpnId) + NwConstants.FLOWID_SEPARATOR + NwConstants.EGRESS_LPORT_DISPATCHER_TABLE + NwConstants.FLOWID_SEPARATOR + INTERFACE_NAME + NwConstants.FLOWID_SEPARATOR + NwConstants.DEFAULT_EGRESS_SERVICE_INDEX;
FlowKey egressDispatcherFlowKey = new FlowKey(new FlowId(egressDispatcherFlowRef));
InstanceIdentifier<Flow> egressDispatcherFlowId = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class).child(Table.class, new TableKey(NwConstants.EGRESS_LPORT_DISPATCHER_TABLE)).child(Flow.class, egressDispatcherFlowKey).build();
// FIXME the extend file getting generated had some import issues, will revist later
// assertEqualBeans(null,
// dataBroker.newReadOnlyTransaction().read(CONFIGURATION, egressDispatcherFlowId).checkedGet().get());
Assert.assertNotNull(dataBroker.newReadOnlyTransaction().read(CONFIGURATION, egressDispatcherFlowId).checkedGet().get());
// 10. test check whether service is bound on egress
Assert.assertTrue(interfaceManager.isServiceBoundOnInterfaceForEgress(NwConstants.EGRESS_ACL_SERVICE_INDEX, INTERFACE_NAME));
// 11. Test unbinding of egress service
interfaceManager.unbindService(INTERFACE_NAME, ServiceModeEgress.class, serviceInfo);
waitTillOperationCompletes("test unbind egress service api", coordinatorEventsWaiter, 2, asyncEventsWaiter);
Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(CONFIGURATION, egressDispatcherFlowId).get());
// 12. Test fetching child interfaces of an interface
// FIXME change the below assert once sorted augmentation fix lands
assertEqualBeans(INTERFACE_NAME, interfaceManager.getChildInterfaces(PARENT_INTERFACE).get(0).getName());
// 13. Test fetching interface-info from operational DS
assertEqualBeans(ExpectedInterfaceInfo.newInterfaceInfo(1, INTERFACE_NAME, PARENT_INTERFACE, null), interfaceManager.getInterfaceInfoFromOperationalDataStore(INTERFACE_NAME));
// 14. Test fetching of interface-info from oper DS, given interface-type
assertEqualBeans(ExpectedInterfaceInfo.newInterfaceInfo(1, INTERFACE_NAME, INTERFACE_NAME, InterfaceInfo.InterfaceType.VLAN_INTERFACE), interfaceManager.getInterfaceInfoFromOperationalDataStore(INTERFACE_NAME, InterfaceInfo.InterfaceType.VLAN_INTERFACE));
// 15.Test fetching of interface-info from cache
assertEqualBeans(ExpectedInterfaceInfo.newInterfaceInfo(1, INTERFACE_NAME, PARENT_INTERFACE, null), interfaceManager.getInterfaceInfoFromOperationalDSCache(INTERFACE_NAME));
// 16. Test creation of VLAN interface
// FIXME Make IInterfaceManager truly async
interfaceManager.createVLANInterface(INTERFACE_NAME_1, PARENT_INTERFACE_1, null, INTERFACE_NAME_1, IfL2vlan.L2vlanMode.Trunk);
// waitTillOperationCompletes(coordinatorEventsWaiter, 1, asyncEventsWaiter);
// assertEqualBeans(ExpectedInterfaceConfig.newVlanInterfaceConfig(INTERFACE_NAME_1, null),
// dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, IfmUtil.buildId(
// INTERFACE_NAME_1)).checkedGet().get());
// 17. Update Parent Refs for VLAN interface
// FIXME Make IInterfaceManager truly async
// interfaceManager.updateInterfaceParentRef(INTERFACE_NAME_1, PARENT_INTERFACE_1);
waitTillOperationCompletes("create vlan interface api", coordinatorEventsWaiter, 4, asyncEventsWaiter);
assertEqualBeans(ExpectedInterfaceConfig.newVlanInterfaceConfig(INTERFACE_NAME_1, PARENT_INTERFACE_1), dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, IfmUtil.buildId(INTERFACE_NAME_1)).checkedGet().get());
// 18. Test creation of external l2vlan interfaces
// FIXME Make IInterfaceManager truly async
interfaceManager.createVLANInterface(INTERFACE_NAME_2, PARENT_INTERFACE_2, null, INTERFACE_NAME_2, IfL2vlan.L2vlanMode.Trunk, true);
// waitTillOperationCompletes(coordinatorEventsWaiter, 1, asyncEventsWaiter);
// FIXME need to wait for https://git.opendaylight.org/gerrit/#/c/54811/ this to land
// to do proper assertion
// Assert.assertNotNull(dataBroker
// .newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, IfmUtil
// .buildId(INTERFACE_NAME_2)).checkedGet().get().getAugmentation(IfExternal.class));
// 19. update parent-refs
// interfaceManager.updateInterfaceParentRef(INTERFACE_NAME_2, PARENT_INTERFACE_2, true);
waitTillOperationCompletes("create external vlan interface api", coordinatorEventsWaiter, 4, asyncEventsWaiter);
Assert.assertEquals(PARENT_INTERFACE_2, dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, IfmUtil.buildId(INTERFACE_NAME_2)).checkedGet().get().getAugmentation(ParentRefs.class).getParentInterface());
// 20. get list of vlan interfaces
// FIXME need to wait for https://git.opendaylight.org/gerrit/#/c/54811/ this to land
// to do proper assertion
assertEqualBeans(3, interfaceManager.getVlanInterfaces().size());
// 21. check if an interface is external interface
Assert.assertTrue(interfaceManager.isExternalInterface(INTERFACE_NAME_2));
// 22. check port name for an interface, given dpn-id and interface-name
assertEqualBeans(PARENT_INTERFACE, interfaceManager.getPortNameForInterface(DPN_ID_1.toString(), PARENT_INTERFACE));
// 23. check port name for an interface, given nodeconnectorid
assertEqualBeans(PARENT_INTERFACE, interfaceManager.getPortNameForInterface(new NodeConnectorId("openflow:1:2"), PARENT_INTERFACE));
// 24. get termination-points from cache
Assert.assertNotNull(interfaceManager.getTerminationPointCache().get(INTERFACE_NAME));
// 25. fetch termination point for interface
assertEqualBeans(ExpectedTerminationPoint.newOvsdbTerminationPointAugmentation(), interfaceManager.getTerminationPointForInterface(INTERFACE_NAME));
// 26. fetch ovsdb bridge corresponding to an interface
assertEqualBeans(ExpectedOvsdbBridge.newOvsdbBridge(), interfaceManager.getOvsdbBridgeForInterface(INTERFACE_NAME));
// 27. fetch ovsdb bridge corresponding to nodeIid
assertEqualBeans(ExpectedOvsdbBridge.newOvsdbBridge(), interfaceManager.getOvsdbBridgeForNodeIid(OvsdbSouthboundTestUtil.createInstanceIdentifier("192.168.56.101", 6640, "s2")));
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan in project genius by opendaylight.
the class IfmUtil method getEgressActionInfosForInterface.
/**
* Returns the list of egress actions for a given interface.
*
* @param interfaceInfo the interface to look up
* @param portNo port number
* @param ifaceType the type of the interface
* @param tunnelKey the tunnel key
* @param actionKeyStart the start for the first key assigned for the new actions
* @param isDefaultEgress if it is the default egress
* @param ifIndex interface index
* @param groupId group Id
* @return list of actions for the interface
*/
// The following suppression is for javac, not for checkstyle
@SuppressWarnings("fallthrough")
@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH")
public static List<ActionInfo> getEgressActionInfosForInterface(Interface interfaceInfo, String portNo, InterfaceInfo.InterfaceType ifaceType, Long tunnelKey, int actionKeyStart, boolean isDefaultEgress, int ifIndex, long groupId) {
List<ActionInfo> result = new ArrayList<>();
switch(ifaceType) {
case MPLS_OVER_GRE:
// fall through
case GRE_TRUNK_INTERFACE:
if (!isDefaultEgress) {
// stores the value coming from a VXLAN tunnel
if (tunnelKey == null) {
tunnelKey = 0L;
}
}
// fall through
case VXLAN_TRUNK_INTERFACE:
if (!isDefaultEgress) {
if (tunnelKey != null) {
result.add(new ActionSetFieldTunnelId(actionKeyStart++, BigInteger.valueOf(tunnelKey)));
}
} else {
// For OF Tunnels default egress actions need to set tunnelIps
IfTunnel ifTunnel = interfaceInfo.getAugmentation(IfTunnel.class);
if (BooleanUtils.isTrue(ifTunnel.isTunnelRemoteIpFlow() && ifTunnel.getTunnelDestination() != null)) {
result.add(new ActionSetTunnelDestinationIp(actionKeyStart++, ifTunnel.getTunnelDestination()));
}
if (BooleanUtils.isTrue(ifTunnel.isTunnelSourceIpFlow() && ifTunnel.getTunnelSource() != null)) {
result.add(new ActionSetTunnelSourceIp(actionKeyStart++, ifTunnel.getTunnelSource()));
}
}
// fall through
case VLAN_INTERFACE:
if (isDefaultEgress) {
IfL2vlan vlanIface = interfaceInfo.getAugmentation(IfL2vlan.class);
LOG.trace("get egress actions for l2vlan interface: {}", vlanIface);
boolean isVlanTransparent = false;
int vlanVid = 0;
if (vlanIface != null) {
vlanVid = vlanIface.getVlanId() == null ? 0 : vlanIface.getVlanId().getValue();
isVlanTransparent = vlanIface.getL2vlanMode() == IfL2vlan.L2vlanMode.Transparent;
}
if (vlanVid != 0 && !isVlanTransparent) {
result.add(new ActionPushVlan(actionKeyStart++));
result.add(new ActionSetFieldVlanVid(actionKeyStart++, vlanVid));
}
result.add(new ActionOutput(actionKeyStart++, new Uri(portNo)));
} else {
addEgressActionInfosForInterface(ifIndex, actionKeyStart, result);
}
break;
case LOGICAL_GROUP_INTERFACE:
if (isDefaultEgress) {
result.add(new ActionGroup(groupId));
} else {
addEgressActionInfosForInterface(ifIndex, actionKeyStart, result);
}
break;
default:
LOG.warn("Interface Type {} not handled yet", ifaceType);
break;
}
return result;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan in project genius by opendaylight.
the class IfmCLIUtil method showVlanOutput.
static void showVlanOutput(InterfaceInfo ifaceInfo, Interface iface, CommandSession session) {
StringBuilder sb = new StringBuilder();
Formatter fmt = new Formatter(sb);
IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class);
int vlanId = l2vlan != null ? l2vlan.getVlanId() != null ? l2vlan.getVlanId().getValue() : 0 : 0;
session.getConsole().println(fmt.format(VLAN_OUTPUT_FORMAT_LINE1, iface.getName()));
sb.setLength(0);
session.getConsole().println(fmt.format(VLAN_OUTPUT_FORMAT, "", ifaceInfo == null ? UNSET : ifaceInfo.getDpId(), ifaceInfo == null ? UNSET : ifaceInfo.getPortName(), vlanId));
sb.setLength(0);
session.getConsole().println(fmt.format(VLAN_OUTPUT_FORMAT, ifaceInfo == null ? UNSET : ifaceInfo.getInterfaceTag(), ifaceInfo == null ? UNSET : ifaceInfo.getPortNo(), ifaceInfo == null ? UNSET : ifaceInfo.getAdminState(), ifaceInfo == null ? UNSET : ifaceInfo.getOpState()));
sb.setLength(0);
session.getConsole().println(fmt.format(VLAN_OUTPUT_FORMAT + "%n", iface.getDescription(), "", "", ""));
sb.setLength(0);
fmt.close();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan in project netvirt by opendaylight.
the class TunnelInterfaceStateListener method handleTunnelEventForDPN.
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
private void handleTunnelEventForDPN(StateTunnelList stateTunnelList, TunnelAction tunnelAction) {
final BigInteger srcDpnId = new BigInteger(stateTunnelList.getSrcInfo().getTepDeviceId());
final String srcTepIp = String.valueOf(stateTunnelList.getSrcInfo().getTepIp().getValue());
String destTepIp = String.valueOf(stateTunnelList.getDstInfo().getTepIp().getValue());
String rd;
BigInteger remoteDpnId = null;
boolean isTepDeletedOnDpn = false;
LOG.info("handleTunnelEventForDPN: Handle tunnel event for srcDpn {} SrcTepIp {} DestTepIp {} ", srcDpnId, srcTepIp, destTepIp);
int tunTypeVal = getTunnelType(stateTunnelList);
LOG.trace("handleTunnelEventForDPN: tunTypeVal is {}", tunTypeVal);
try {
if (tunnelAction == TunnelAction.TUNNEL_EP_ADD) {
LOG.info("handleTunnelEventForDPN: Tunnel ADD event received for Dpn {} VTEP Ip {} destTepIp {}", srcDpnId, srcTepIp, destTepIp);
if (isTunnelInLogicalGroup(stateTunnelList)) {
return;
}
} else if (tunnelAction == TunnelAction.TUNNEL_EP_DELETE) {
LOG.info("handleTunnelEventForDPN: Tunnel DELETE event received for Dpn {} VTEP Ip {} DestTepIp {}", srcDpnId, srcTepIp, destTepIp);
// When tunnel EP is deleted on a DPN , VPN gets two deletion event.
// One for a DPN on which tunnel EP was deleted and another for other-end DPN.
// Update the adj for the vpninterfaces for a DPN on which TEP is deleted.
// Update the adj & VRF for the vpninterfaces for a DPN on which TEP is deleted.
// Dont update the adj & VRF for vpninterfaces for a DPN on which TEP is not deleted.
String endpointIpForDPN = null;
try {
endpointIpForDPN = InterfaceUtils.getEndpointIpAddressForDPN(dataBroker, srcDpnId);
} catch (Exception e) {
LOG.error("handleTunnelEventForDPN: Unable to resolve endpoint IP for srcDpn {}", srcDpnId);
/* this dpn does not have the VTEP */
endpointIpForDPN = null;
}
if (endpointIpForDPN == null) {
LOG.info("handleTunnelEventForDPN: Tunnel TEP is deleted on Dpn {} VTEP Ip {} destTepIp {}", srcDpnId, srcTepIp, destTepIp);
isTepDeletedOnDpn = true;
}
}
// Get the list of VpnInterfaces from Intf Mgr for a SrcDPN on which TEP is added/deleted
Future<RpcResult<GetDpnInterfaceListOutput>> result;
List<Interfaces> srcDpninterfacelist = new ArrayList<>();
List<Interfaces> destDpninterfacelist = new ArrayList<>();
try {
result = intfRpcService.getDpnInterfaceList(new GetDpnInterfaceListInputBuilder().setDpid(srcDpnId).build());
RpcResult<GetDpnInterfaceListOutput> rpcResult = result.get();
if (!rpcResult.isSuccessful()) {
LOG.error("handleTunnelEventForDPN: RPC Call to GetDpnInterfaceList for srcDpnid {} srcTepIp {}" + " destTepIP {} returned with Errors {}", srcDpnId, srcTepIp, destTepIp, rpcResult.getErrors());
} else {
srcDpninterfacelist = rpcResult.getResult().getInterfaces();
}
} catch (Exception e) {
LOG.error("handleTunnelEventForDPN: Exception when querying for GetDpnInterfaceList for srcDpnid {}" + " srcTepIp {} destTepIp {}", srcDpnId, srcTepIp, destTepIp, e);
}
// Get the list of VpnInterfaces from Intf Mgr for a destDPN only for internal tunnel.
if (tunTypeVal == VpnConstants.ITMTunnelLocType.Internal.getValue()) {
remoteDpnId = new BigInteger(stateTunnelList.getDstInfo().getTepDeviceId());
try {
result = intfRpcService.getDpnInterfaceList(new GetDpnInterfaceListInputBuilder().setDpid(remoteDpnId).build());
RpcResult<GetDpnInterfaceListOutput> rpcResult = result.get();
if (!rpcResult.isSuccessful()) {
LOG.error("handleTunnelEventForDPN: RPC Call to GetDpnInterfaceList for remoteDpnid {}" + " srcTepIP {} destTepIp {} returned with Errors {}", remoteDpnId, srcTepIp, destTepIp, rpcResult.getErrors());
} else {
destDpninterfacelist = rpcResult.getResult().getInterfaces();
}
} catch (Exception e) {
LOG.error("handleTunnelEventForDPN: Exception when querying for GetDpnInterfaceList" + " for remoteDpnid {} srcTepIp {} destTepIp {}", remoteDpnId, srcTepIp, destTepIp, e);
}
}
/*
* Iterate over the list of VpnInterface for a SrcDpn on which TEP is added or deleted and read the adj.
* Update the adjacencies with the updated nexthop.
*/
Iterator<Interfaces> interfacelistIter = srcDpninterfacelist.iterator();
Interfaces interfaces = null;
String intfName = null;
List<Uuid> subnetList = new ArrayList<>();
Map<Long, String> vpnIdRdMap = new HashMap<>();
Set<String> listVpnName = new HashSet<>();
while (interfacelistIter.hasNext()) {
interfaces = interfacelistIter.next();
if (!L2vlan.class.equals(interfaces.getInterfaceType())) {
LOG.info("handleTunnelEventForDPN: Interface {} not of type L2Vlan", interfaces.getInterfaceName());
return;
}
intfName = interfaces.getInterfaceName();
VpnInterface vpnInterface = VpnUtil.getConfiguredVpnInterface(dataBroker, intfName);
if (vpnInterface != null && !Boolean.TRUE.equals(vpnInterface.isScheduledForRemove())) {
listVpnName.addAll(VpnHelper.getVpnInterfaceVpnInstanceNamesString(vpnInterface.getVpnInstanceNames()));
handleTunnelEventForDPNVpn(stateTunnelList, vpnIdRdMap, tunnelAction, isTepDeletedOnDpn, subnetList, TunnelEventProcessingMethod.POPULATESUBNETS, vpnInterface);
}
}
/*
* Iterate over the list of VpnInterface for destDPN and get the prefix .
* Create remote rule for each of those prefix on srcDPN.
*/
interfacelistIter = destDpninterfacelist.iterator();
while (interfacelistIter.hasNext()) {
interfaces = interfacelistIter.next();
if (!L2vlan.class.equals(interfaces.getInterfaceType())) {
LOG.info("handleTunnelEventForDPN: Interface {} not of type L2Vlan", interfaces.getInterfaceName());
return;
}
intfName = interfaces.getInterfaceName();
VpnInterface vpnInterface = VpnUtil.getConfiguredVpnInterface(dataBroker, intfName);
if (vpnInterface != null) {
handleTunnelEventForDPNVpn(stateTunnelList, vpnIdRdMap, tunnelAction, isTepDeletedOnDpn, subnetList, TunnelEventProcessingMethod.MANAGEREMOTEROUTES, vpnInterface);
}
}
// Iterate over the VpnId-to-Rd map.
for (Map.Entry<Long, String> entry : vpnIdRdMap.entrySet()) {
Long vpnId = entry.getKey();
rd = entry.getValue();
if (tunnelAction == TunnelAction.TUNNEL_EP_ADD && tunTypeVal == VpnConstants.ITMTunnelLocType.External.getValue()) {
fibManager.populateExternalRoutesOnDpn(srcDpnId, vpnId, rd, srcTepIp, destTepIp);
} else if (tunnelAction == TunnelAction.TUNNEL_EP_DELETE && tunTypeVal == VpnConstants.ITMTunnelLocType.External.getValue()) {
fibManager.cleanUpExternalRoutesOnDpn(srcDpnId, vpnId, rd, srcTepIp, destTepIp);
}
}
if (listVpnName.size() >= 1) {
if (tunnelAction == TunnelAction.TUNNEL_EP_ADD) {
for (Uuid subnetId : subnetList) {
// Populate the List of subnets
vpnSubnetRouteHandler.updateSubnetRouteOnTunnelUpEvent(subnetId, srcDpnId);
}
}
if (tunnelAction == TunnelAction.TUNNEL_EP_DELETE && isTepDeletedOnDpn) {
for (Uuid subnetId : subnetList) {
// Populate the List of subnets
vpnSubnetRouteHandler.updateSubnetRouteOnTunnelDownEvent(subnetId, srcDpnId);
}
}
}
} catch (RuntimeException e) {
LOG.error("handleTunnelEventForDpn: Unable to handle the tunnel event for srcDpnId {} srcTepIp {}" + " remoteDpnId {} destTepIp {}", srcDpnId, srcTepIp, remoteDpnId, destTepIp, e);
}
}
Aggregations