protected void addToNeutronRouterDpnsMap(String routerName, String vpnInterfaceName, WriteTransaction writeOperTxn) { BigInteger dpId = InterfaceUtils.getDpnForInterface(ifaceMgrRpcService, vpnInterfaceName); if(dpId.equals(BigInteger.ZERO)) { LOG.warn("Could not retrieve dp id for interface {} to handle router {} association model", vpnInterfaceName, routerName); return; } InstanceIdentifier<DpnVpninterfacesList> routerDpnListIdentifier = getRouterDpnId(routerName, dpId); Optional<DpnVpninterfacesList> optionalRouterDpnList = VpnUtil.read(dataBroker, LogicalDatastoreType .OPERATIONAL, routerDpnListIdentifier); RouterInterfaces routerInterface = new RouterInterfacesBuilder().setKey(new RouterInterfacesKey(vpnInterfaceName)).setInterface(vpnInterfaceName).build(); if (optionalRouterDpnList.isPresent()) { writeOperTxn.merge(LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier.child( RouterInterfaces.class, new RouterInterfacesKey(vpnInterfaceName)), routerInterface, true); } else { RouterDpnListBuilder builder = new RouterDpnListBuilder(); builder.setRouterId(routerName); DpnVpninterfacesListBuilder dpnVpnList = new DpnVpninterfacesListBuilder().setDpnId(dpId); List<RouterInterfaces> routerInterfaces = new ArrayList<>(); routerInterfaces.add(routerInterface); builder.setDpnVpninterfacesList(Arrays.asList(dpnVpnList.build())); writeOperTxn.merge(LogicalDatastoreType.OPERATIONAL, getRouterId(routerName), builder.build(), true); } }