private final VpnInterfaceManager vpnInterfaceManager;
private final VpnSubnetRouteHandler vpnSubnetRouteHandler;
private final JobCoordinator jobCoordinator;
+ private final VpnUtil vpnUtil;
protected enum UpdateRouteAction {
ADVERTISE_ROUTE, WITHDRAW_ROUTE
/**
* Responsible for listening to tunnel interface state change.
+ * @param dataBroker Data Broker
+ * @param fibManager FIB APIs
+ * @param ifaceMgrRpcService Interface Manager RPC
+ * @param vpnInterfaceManager Vpn Interface APIs
+ * @param vpnSubnetRouteHandler Subnet-Route APIs
+ * @param jobCoordinator Key based job serialization mechanism
+ * @param vpnUtil Vpn Utility
*/
@Inject
public TunnelInterfaceStateListener(final DataBroker dataBroker,
final OdlInterfaceRpcService ifaceMgrRpcService,
final VpnInterfaceManager vpnInterfaceManager,
final VpnSubnetRouteHandler vpnSubnetRouteHandler,
- final JobCoordinator jobCoordinator) {
+ final JobCoordinator jobCoordinator,
+ VpnUtil vpnUtil) {
super(StateTunnelList.class, TunnelInterfaceStateListener.class);
this.dataBroker = dataBroker;
this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
this.vpnInterfaceManager = vpnInterfaceManager;
this.vpnSubnetRouteHandler = vpnSubnetRouteHandler;
this.jobCoordinator = jobCoordinator;
+ this.vpnUtil = vpnUtil;
}
@PostConstruct
//Remove the corresponding nexthop from the routepath under extraroute in fibentries.
BigInteger srcDpnId = new BigInteger(update.getSrcInfo().getTepDeviceId());
String srcTepIp = String.valueOf(update.getSrcInfo().getTepIp().getValue());
- List<VpnInstanceOpDataEntry> vpnInstanceOpData = VpnUtil.getAllVpnInstanceOpData(dataBroker);
+ List<VpnInstanceOpDataEntry> vpnInstanceOpData = vpnUtil.getAllVpnInstanceOpData();
if (vpnInstanceOpData == null) {
LOG.trace("update: No vpnInstanceOpdata present");
return;
List<DestPrefixes> prefixes = VpnExtraRouteHelper.getExtraRouteDestPrefixes(dataBroker,
opData.getVpnId());
prefixes.forEach(destPrefix -> {
- VrfEntry vrfEntry = VpnUtil.getVrfEntry(dataBroker, opData.getVrfId(),
+ VrfEntry vrfEntry = vpnUtil.getVrfEntry(opData.getVrfId(),
destPrefix.getDestPrefix());
if (vrfEntry == null || vrfEntry.getRoutePaths() == null) {
return;
}
intfName = interfaces.getInterfaceName();
VpnInterface vpnInterface =
- VpnUtil.getConfiguredVpnInterface(dataBroker, intfName);
+ vpnUtil.getConfiguredVpnInterface(intfName);
if (vpnInterface != null && !Boolean.TRUE.equals(vpnInterface.isScheduledForRemove())) {
listVpnName.addAll(VpnHelper
.getVpnInterfaceVpnInstanceNamesString(vpnInterface.getVpnInstanceNames()));
}
intfName = interfaces.getInterfaceName();
VpnInterface vpnInterface =
- VpnUtil.getConfiguredVpnInterface(dataBroker, intfName);
+ vpnUtil.getConfiguredVpnInterface(intfName);
if (vpnInterface != null) {
handleTunnelEventForDPNVpn(stateTunnelList, vpnIdRdMap,
tunnelAction, isTepDeletedOnDpn,
for (VpnInstanceNames vpnInstance : cfgVpnInterface.getVpnInstanceNames()) {
String vpnName = vpnInstance.getVpnName();
if (method == TunnelEventProcessingMethod.POPULATESUBNETS) {
- Optional<VpnInterfaceOpDataEntry> opVpnInterface = VpnUtil
- .getVpnInterfaceOpDataEntry(dataBroker, intfName, vpnName);
+ Optional<VpnInterfaceOpDataEntry> opVpnInterface = vpnUtil
+ .getVpnInterfaceOpDataEntry(intfName, vpnName);
if (opVpnInterface.isPresent() && !opVpnInterface.get().isScheduledForRemove()) {
VpnInterfaceOpDataEntry vpnInterface = opVpnInterface.get();
jobCoordinator.enqueueJob("VPNINTERFACE-" + intfName,
}
}
//Populate the map for VpnId-to-Rd
- long vpnId = VpnUtil.getVpnId(dataBroker, vpnName);
- rd = VpnUtil.getVpnRd(dataBroker, vpnName);
+ long vpnId = vpnUtil.getVpnId(vpnName);
+ rd = vpnUtil.getVpnRd(vpnName);
vpnIdRdMap.put(vpnId, rd);
}
} else if (method == TunnelEventProcessingMethod.MANAGEREMOTEROUTES) {
- Optional<VpnInterfaceOpDataEntry> opVpnInterface = VpnUtil.getVpnInterfaceOpDataEntry(dataBroker,
- intfName, vpnName);
+ Optional<VpnInterfaceOpDataEntry> opVpnInterface = vpnUtil.getVpnInterfaceOpDataEntry(intfName,
+ vpnName);
if (opVpnInterface.isPresent()) {
VpnInterfaceOpDataEntry vpnInterface = opVpnInterface.get();
AdjacenciesOp adjacencies = vpnInterface.augmentation(AdjacenciesOp.class);
List<Adjacency> adjList = adjacencies != null ? adjacencies.getAdjacency()
: Collections.emptyList();
String prefix = null;
- long vpnId = VpnUtil.getVpnId(dataBroker, vpnInterface.getVpnInstanceName());
+ long vpnId = vpnUtil.getVpnId(vpnInterface.getVpnInstanceName());
if (vpnIdRdMap.containsKey(vpnId)) {
rd = vpnIdRdMap.get(vpnId);
LOG.info("handleTunnelEventForDPN: Remote DpnId {} VpnId {} rd {} VpnInterface {}"