X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=vpnmanager%2Fvpnmanager-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fvpnservice%2FVpnserviceProvider.java;h=3dd6644554d671afff0f5336afe80d608b56f0d7;hb=3e477025479db59022496cabca5e85c79e70fc5a;hp=a5198ba74d77f56b2a02b0e2d47054315aa79de4;hpb=8e7149129d3918e86e9b8c7866c8df0d22d536d4;p=vpnservice.git diff --git a/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/vpnservice/VpnserviceProvider.java b/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/vpnservice/VpnserviceProvider.java index a5198ba7..3dd66445 100644 --- a/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/vpnservice/VpnserviceProvider.java +++ b/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/vpnservice/VpnserviceProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved. + * Copyright (c) 2015 - 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -8,19 +8,20 @@ package org.opendaylight.vpnservice; import java.math.BigInteger; -import java.util.Collection; -import java.util.Collections; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import org.opendaylight.bgpmanager.api.IBgpManager; import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.NotificationService; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; import org.opendaylight.controller.sal.binding.api.BindingAwareProvider; import org.opendaylight.fibmanager.api.IFibManager; import org.opendaylight.vpnmanager.api.IVpnManager; -import org.opendaylight.vpnservice.interfacemgr.interfaces.IInterfaceManager; +import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.itm.rpcs.rev151217.ItmRpcService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.interfacemgr.rpcs.rev151003.OdlInterfaceRpcService; import org.opendaylight.vpnservice.mdsalutil.interfaces.IMdsalApiManager; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.arputil.rev151126.OdlArputilService; import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.idmanager.rev150403.CreateIdPoolInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.idmanager.rev150403.CreateIdPoolInputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.idmanager.rev150403.IdManagerService; @@ -37,8 +38,11 @@ public class VpnserviceProvider implements BindingAwareProvider, IVpnManager, private IBgpManager bgpManager; private IFibManager fibManager; private IMdsalApiManager mdsalManager; - private IInterfaceManager interfaceManager; + private OdlInterfaceRpcService interfaceManager; + private ItmRpcService itmProvider; private IdManagerService idManager; + private OdlArputilService arpManager; + private NotificationService notificationService; @Override public void onSessionInitiated(ProviderContext session) { @@ -47,10 +51,12 @@ public class VpnserviceProvider implements BindingAwareProvider, IVpnManager, final DataBroker dataBroker = session.getSALService(DataBroker.class); vpnManager = new VpnManager(dataBroker, bgpManager); vpnManager.setIdManager(idManager); - vpnInterfaceManager = new VpnInterfaceManager(dataBroker, bgpManager); + vpnInterfaceManager = new VpnInterfaceManager(dataBroker, bgpManager, notificationService); vpnInterfaceManager.setMdsalManager(mdsalManager); vpnInterfaceManager.setInterfaceManager(interfaceManager); + vpnInterfaceManager.setITMProvider(itmProvider); vpnInterfaceManager.setIdManager(idManager); + vpnInterfaceManager.setArpManager(arpManager); vpnManager.setVpnInterfaceManager(vpnInterfaceManager); createIdPool(); } catch (Exception e) { @@ -58,6 +64,10 @@ public class VpnserviceProvider implements BindingAwareProvider, IVpnManager, } } + public void setNotificationService(NotificationService notificationService) { + this.notificationService = notificationService; + } + public void setBgpManager(IBgpManager bgpManager) { LOG.debug("BGP Manager reference initialized"); this.bgpManager = bgpManager; @@ -71,19 +81,27 @@ public class VpnserviceProvider implements BindingAwareProvider, IVpnManager, this.fibManager = fibManager; } - public void setInterfaceManager(IInterfaceManager interfaceManager) { + public void setInterfaceManager(OdlInterfaceRpcService interfaceManager) { this.interfaceManager = interfaceManager; } + public void setITMProvider(ItmRpcService itmProvider) { + this.itmProvider = itmProvider; + } + public void setIdManager(IdManagerService idManager) { this.idManager = idManager; } + public void setArpManager(OdlArputilService arpManager) { + this.arpManager = arpManager; + } + private void createIdPool() { CreateIdPoolInput createPool = new CreateIdPoolInputBuilder() .setPoolName(VpnConstants.VPN_IDPOOL_NAME) - .setIdStart(VpnConstants.VPN_IDPOOL_START) - .setPoolSize(new BigInteger(VpnConstants.VPN_IDPOOL_SIZE)) + .setLow(VpnConstants.VPN_IDPOOL_START) + .setHigh(new BigInteger(VpnConstants.VPN_IDPOOL_SIZE).longValue()) .build(); try { Future> result = idManager.createIdPool(createPool); @@ -99,11 +117,7 @@ public class VpnserviceProvider implements BindingAwareProvider, IVpnManager, public void close() throws Exception { vpnManager.close(); vpnInterfaceManager.close(); - } - @Override - public Collection getDpnsForVpn(long vpnId) { - return vpnInterfaceManager.getDpnsForVpn(vpnId); } @Override @@ -112,4 +126,16 @@ public class VpnserviceProvider implements BindingAwareProvider, IVpnManager, this.fibManager = fibManager; vpnInterfaceManager.setFibManager(fibManager); } + + @Override + public void addExtraRoute(String destination, String nextHop, String rd, String routerID, int label) { + LOG.info("Adding extra route with destination {} and nexthop {}", destination, nextHop); + vpnInterfaceManager.addExtraRoute(destination, nextHop, rd, routerID, label); + } + + @Override + public void delExtraRoute(String destination, String rd, String routerID) { + LOG.info("Deleting extra route with destination {}", destination); + vpnInterfaceManager.delExtraRoute(destination, rd, routerID); + } }