+ protected void processVpnInterfaceUp(BigInteger dpId, String interfaceName, int lPortTag) {
+
+ VpnInterface vpnInterface = VpnUtil.getConfiguredVpnInterface(broker, interfaceName);
+ if(vpnInterface == null) {
+ LOG.info("Unable to process add/up for interface {} as it is not configured", interfaceName);
+ return;
+ }
+ String vpnName = vpnInterface.getVpnInstanceName();
+ LOG.info("Binding vpn service to interface {} ", interfaceName);
+ long vpnId = VpnUtil.getVpnId(broker, vpnName);
+ if (vpnId == VpnConstants.INVALID_ID) {
+ LOG.trace("VpnInstance to VPNId mapping is not yet available, bailing out now.");
+ return;
+ }
+ synchronized (interfaceName.intern()) {
+ if (VpnUtil.getOperationalVpnInterface(broker, vpnInterface.getName()) != null) {
+ LOG.trace("VPN Interface already provisioned , bailing out from here.");
+ return;
+ }
+ bindService(dpId, vpnName, interfaceName, lPortTag);
+ updateDpnDbs(dpId, vpnName, interfaceName, true);
+ processVpnInterfaceAdjacencies(dpId, VpnUtil.getVpnInterfaceIdentifier(vpnInterface.getName()), vpnInterface);
+ }
+
+ }
+
+ private void updateDpnDbs(BigInteger dpId, String vpnName, String interfaceName, boolean add) {
+ long vpnId = VpnUtil.getVpnId(broker, vpnName);
+ if (dpId == null) {
+ dpId = InterfaceUtils.getDpnForInterface(interfaceManager, interfaceName);
+ }
+ if(!dpId.equals(BigInteger.ZERO)) {
+ if(add)
+ updateMappingDbs(vpnId, dpId, interfaceName, vpnName);
+ else
+ removeFromMappingDbs(vpnId, dpId, interfaceName, vpnName);
+ }
+
+ }
+
+ private void bindService(BigInteger dpId, String vpnInstanceName, String vpnInterfaceName, int lPortTag) {
+ int priority = VpnConstants.DEFAULT_FLOW_PRIORITY;
+ long vpnId = VpnUtil.getVpnId(broker, vpnInstanceName);
+
+ int instructionKey = 0;
+ List<Instruction> instructions = new ArrayList<Instruction>();
+
+ instructions.add(MDSALUtil.buildAndGetWriteMetadaInstruction(BigInteger.valueOf(vpnId), MetaDataUtil.METADATA_MASK_VRFID, ++instructionKey));
+ instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.L3_FIB_TABLE, ++instructionKey));
+
+ BoundServices
+ serviceInfo =
+ InterfaceUtils.getBoundServices(String.format("%s.%s.%s", "vpn",vpnInstanceName, vpnInterfaceName),
+ VpnConstants.L3VPN_SERVICE_IDENTIFIER, priority,
+ VpnConstants.COOKIE_VM_INGRESS_TABLE, instructions);
+ VpnUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION,
+ InterfaceUtils.buildServiceId(vpnInterfaceName, VpnConstants.L3VPN_SERVICE_IDENTIFIER), serviceInfo);
+ makeArpFlow(dpId, VpnConstants.L3VPN_SERVICE_IDENTIFIER, lPortTag, vpnInterfaceName,
+ vpnId, ArpReplyOrRequest.REQUEST, NwConstants.ADD_FLOW);
+
+ }
+
+ private void processVpnInterfaceAdjacencies(BigInteger dpnId, final InstanceIdentifier<VpnInterface> identifier, VpnInterface intf) {