itm and mdsal porting
[vpnservice.git] / itm / itm-impl / src / main / java / org / opendaylight / vpnservice / itm / confighelpers / ItmInternalTunnelAddWorker.java
index c7c5ae726bc7b3c9e6eefe17c3935605593ab4e8..c1850200f8c5e9bd5a5463fbc8ad0911d450ad92 100644 (file)
@@ -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,
@@ -64,7 +64,7 @@ public class ItmInternalTunnelAddWorker {
         WriteTransaction t = dataBroker.newWriteOnlyTransaction();
         if( null == cfgdDpnList || cfgdDpnList.isEmpty()) {
             logger.error(" Build Tunnels was invoked with empty list");
-            return null;
+            return futures;
          }
 
         for( DPNTEPsInfo dpn : cfgdDpnList) {
@@ -152,7 +152,9 @@ public class ItmInternalTunnelAddWorker {
         String trunkInterfaceName = ItmUtils.getTrunkInterfaceName(idManagerService, interfaceName,srcte.getIpAddress().getIpv4Address().getValue(), dstte.getIpAddress().getIpv4Address().getValue()) ;
         IpAddress gwyIpAddress = ( srcte.getSubnetMask().equals(dstte.getSubnetMask()) ) ? null : srcte.getGwIpAddress() ;
         logger.debug(  " Creating Trunk Interface with parameters trunk I/f Name - {}, parent I/f name - {}, source IP - {}, destination IP - {} gateway IP - {}",trunkInterfaceName, interfaceName, srcte.getIpAddress(), dstte.getIpAddress(), gwyIpAddress ) ;
-        Interface iface = ItmUtils.buildTunnelInterface(srcDpnId, trunkInterfaceName, String.format( "%s %s",ifDescription, "Trunk Interface"), true, tunType, srcte.getIpAddress(), dstte.getIpAddress(), gwyIpAddress, true) ;
+        Interface iface = ItmUtils.buildTunnelInterface(srcDpnId, trunkInterfaceName,
+                        String.format("%s %s", ifDescription, "Trunk Interface"), true, tunType, srcte.getIpAddress(),
+                        dstte.getIpAddress(), gwyIpAddress, srcte.getVLANID(), true, false, null);
         logger.debug(  " Trunk Interface builder - {} ", iface ) ;
         InstanceIdentifier<Interface> trunkIdentifier = ItmUtils.buildId(trunkInterfaceName);
         logger.debug(  " Trunk Interface Identifier - {} ", trunkIdentifier ) ;
@@ -161,7 +163,7 @@ public class ItmInternalTunnelAddWorker {
         // also update itm-state ds?
         InstanceIdentifier<InternalTunnel> path = InstanceIdentifier.create(
                 TunnelList.class)
-                    .child(InternalTunnel.class, new InternalTunnelKey( srcDpnId, dstDpnId));   
+                    .child(InternalTunnel.class, new InternalTunnelKey( dstDpnId,srcDpnId ));
         InternalTunnel tnl = ItmUtils.buildInternalTunnel(srcDpnId, dstDpnId, trunkInterfaceName);
         //ItmUtils.asyncUpdate(LogicalDatastoreType.CONFIGURATION, path, tnl, dataBroker, DEFAULT_CALLBACK);
         t.merge(LogicalDatastoreType.CONFIGURATION,path, tnl, true) ;