return false; if (!Objects.equals(_vpnInstanceList, other.getVpnInstanceList())) { return false;
private boolean deleteLabelRouteInfo(LabelRouteInfo lri, String vpnInstanceName) { LOG.debug("deleting LRI : for label {} vpninstancename {}", lri.getLabel(), vpnInstanceName); InstanceIdentifier<LabelRouteInfo> lriId = InstanceIdentifier.builder(LabelRouteMap.class) .child(LabelRouteInfo.class, new LabelRouteInfoKey((long) lri.getLabel())).build(); if (lri == null) { return true; } List<String> vpnInstancesList = lri.getVpnInstanceList(); if (vpnInstancesList.contains(vpnInstanceName)) { LOG.debug("vpninstance {} name is present", vpnInstanceName); vpnInstancesList.remove(vpnInstanceName); } if (vpnInstancesList.size() == 0) { LOG.debug("deleting LRI instance object for label {}", lri.getLabel()); FibUtil.delete(dataBroker, LogicalDatastoreType.OPERATIONAL, lriId); return true; } else { LOG.debug("updating LRI instance object for label {}", lri.getLabel()); LabelRouteInfoBuilder builder = new LabelRouteInfoBuilder(lri).setVpnInstanceList(vpnInstancesList); FibUtil.syncWrite(dataBroker, LogicalDatastoreType.OPERATIONAL, lriId, builder.build(), FibUtil.DEFAULT_CALLBACK); } return false; }
if (vpnInstanceOpDataEntryOptional.isPresent()) { String vpnInstanceName = vpnInstanceOpDataEntryOptional.get().getVpnInstanceName(); if (!lri.getVpnInstanceList().contains(vpnInstanceName)) { updateVpnReferencesInLri(lri, vpnInstanceName, false);
this._parentVpnid = base.getParentVpnid(); this._prefix = base.getPrefix(); this._vpnInstanceList = base.getVpnInstanceList(); this._vpnInterfaceName = base.getVpnInterfaceName(); this._isSubnetRoute = base.isIsSubnetRoute();
if (vpnInstanceOpDataEntryOptional.isPresent()) { String vpnInstanceName = vpnInstanceOpDataEntryOptional.get().getVpnInstanceName(); if (lri.getVpnInstanceList().contains(vpnInstanceName)) { localNextHopInfo = updateVpnReferencesInLri(lri, vpnInstanceName, true); localNextHopIP = lri.getPrefix();
private Prefixes updateVpnReferencesInLri(LabelRouteInfo lri, String vpnInstanceName, boolean isPresentInList) { LOG.debug("updating LRI : for label {} vpninstancename {}", lri.getLabel(), vpnInstanceName); PrefixesBuilder prefixBuilder = new PrefixesBuilder(); prefixBuilder.setDpnId(lri.getDpnId()); prefixBuilder.setVpnInterfaceName(lri.getVpnInterfaceName()); prefixBuilder.setIpAddress(lri.getPrefix()); // Increment the refCount here InstanceIdentifier<LabelRouteInfo> lriId = InstanceIdentifier.builder(LabelRouteMap.class) .child(LabelRouteInfo.class, new LabelRouteInfoKey((long)lri.getLabel())).build(); LabelRouteInfoBuilder builder = new LabelRouteInfoBuilder(lri); if (!isPresentInList) { LOG.debug("vpnName {} is not present in LRI with label {}..", vpnInstanceName, lri.getLabel()); List<String> vpnInstanceNames = lri.getVpnInstanceList(); vpnInstanceNames.add(vpnInstanceName); builder.setVpnInstanceList(vpnInstanceNames); FibUtil.syncWrite(dataBroker, LogicalDatastoreType.OPERATIONAL, lriId, builder.build(), FibUtil.DEFAULT_CALLBACK); } else { LOG.debug("vpnName {} is present in LRI with label {}..", vpnInstanceName, lri.getLabel()); } return prefixBuilder.build(); }