+ LOG.warn("Unable to find nexthopip for rd {} subnetroute subnetip {} for dpnid {}",
+ subOpBuilder.getVrfId(), subOpBuilder.getSubnetCidr(),
+ subOpBuilder.getNhDpnId().toString());
+ electNewDpnForSubnetRoute(subOpBuilder, null /* oldDpnId */, subnetId, null /*networkId*/, true);
+ }
+ }
+
+ // TODO Clean up the exception handling
+ @SuppressWarnings("checkstyle:IllegalCatch")
+ private boolean addSubnetRouteToFib(String rd, String subnetIp, BigInteger nhDpnId, String nextHopIp,
+ String vpnName, Long elanTag, long label, long l3vni,
+ Uuid subnetId, boolean isBgpVpn, String networkName) {
+
+ Preconditions.checkNotNull(rd,
+ LOGGING_PREFIX + " addSubnetRouteToFib: RouteDistinguisher cannot be null or empty!");
+ Preconditions.checkNotNull(subnetIp,
+ LOGGING_PREFIX + " addSubnetRouteToFib: SubnetRouteIp cannot be null or empty!");
+ Preconditions.checkNotNull(vpnName, LOGGING_PREFIX + " addSubnetRouteToFib: vpnName cannot be null or empty!");
+ Preconditions.checkNotNull(elanTag, LOGGING_PREFIX + " addSubnetRouteToFib: elanTag cannot be null or empty!");
+ Preconditions.checkNotNull(label, LOGGING_PREFIX + " addSubnetRouteToFib: label cannot be null or empty!");
+ VrfEntry.EncapType encapType = VpnUtil.getEncapType(VpnUtil.isL3VpnOverVxLan(l3vni));
+ VpnPopulator vpnPopulator = L3vpnRegistry.getRegisteredPopulator(encapType);
+ LOG.info("{} addSubnetRouteToFib: Adding SubnetRoute fib entry for vpnName {}, subnetIP {}, elanTag {}",
+ LOGGING_PREFIX, vpnName, subnetIp, elanTag);
+ L3vpnInput input = new L3vpnInput().setRouteOrigin(RouteOrigin.CONNECTED).setRd(rd).setVpnName(vpnName)
+ .setSubnetIp(subnetIp).setNextHopIp(nextHopIp).setL3vni(l3vni).setLabel(label).setElanTag(elanTag)
+ .setDpnId(nhDpnId).setEncapType(encapType).setNetworkName(networkName).setPrimaryRd(rd);
+ if (!isBgpVpn) {
+ vpnPopulator.populateFib(input, null /*writeCfgTxn*/, null /*writeOperTxn*/);
+ return true;
+ }
+ Preconditions.checkNotNull(nextHopIp, LOGGING_PREFIX + "NextHopIp cannot be null or empty!");
+ VpnUtil.syncWrite(dataBroker, LogicalDatastoreType.OPERATIONAL, VpnUtil
+ .getPrefixToInterfaceIdentifier(VpnUtil.getVpnId(dataBroker, vpnName), subnetIp), VpnUtil
+ .getPrefixToInterface(nhDpnId, subnetId.getValue(), subnetIp, subnetId,
+ Prefixes.PrefixCue.SubnetRoute));
+ vpnPopulator.populateFib(input, null /*writeCfgTxn*/, null /*writeOperTxn*/);
+ try {
+ // BGP manager will handle withdraw and advertise internally if prefix
+ // already exist
+ bgpManager.advertisePrefix(rd, null /*macAddress*/, subnetIp, Collections.singletonList(nextHopIp),
+ encapType, label, l3vni, 0 /*l2vni*/, null /*gatewayMacAddress*/);
+ } catch (Exception e) {
+ LOG.error("{} addSubnetRouteToFib: Subnet route not advertised for subnet {} subnetIp {} vpnName {} rd {} "
+ + "with dpnid {}", LOGGING_PREFIX, subnetId.getValue(), subnetIp, vpnName, rd, nhDpnId, e);