ITM module sync-up 28/42228/2
authorSuraj Ranjan <suraj.ranjan@ericsson.com>
Thu, 21 Jul 2016 10:31:23 +0000 (16:01 +0530)
committerSuraj Ranjan <suraj.ranjan@ericsson.com>
Thu, 21 Jul 2016 11:06:56 +0000 (16:36 +0530)
Below review gives a fix for the following issue:

FIB and Routes are not re-written on TEP Changes

Change-Id: Ia628bac6e44bef4c3e44bd4cc136386143c126e9
Signed-off-by: Suraj Ranjan <suraj.ranjan@ericsson.com>
itm/itm-api/src/main/yang/itm-rpc.yang
itm/itm-impl/src/main/java/org/opendaylight/genius/itm/listeners/InterfaceStateListener.java
itm/itm-impl/src/main/java/org/opendaylight/genius/itm/rpc/ItmManagerRpcService.java

index 868256a2a352a8e0baec18ec17d98c696e3411c1..d20c358398635779fef7ad2987ae0a34c84d4c9f 100644 (file)
@@ -255,4 +255,19 @@ module itm-rpc {
                 }
             }
         }
+
+        rpc is-dcgw-present {
+            description "Used for determining whether tunnel is an internal or an external tunnel";
+                input {
+                    leaf dcgw-ip {
+                        type string;
+                    }
+                }
+                output {
+                    leaf retVal {
+                        type uint32;
+                }
+            }
+        }
+
     }
index 689ad8a463d1b57aede219e7c3bca64633f1302f..cd5c889e7a6195569215c12337e153d1cedc4e79 100644 (file)
@@ -177,7 +177,7 @@ public class InterfaceStateListener extends AbstractDataChangeListener<Interface
             srcInfoBuilder.setTepDeviceId(tunnel.getSourceDevice())
                 .setTepDeviceType(getDeviceType(tunnel.getSourceDevice()));
             dstInfoBuilder.setTepDeviceId(tunnel.getDestinationDevice())
-                .setTepDeviceType(getDeviceType(tunnel.getSourceDevice()))
+                .setTepDeviceType(getDeviceType(tunnel.getDestinationDevice()))
                 .setTepIp(ifTunnel.getTunnelDestination());
             stlBuilder.setTransportType(tunnel.getTransportType());
         }
@@ -189,7 +189,7 @@ public class InterfaceStateListener extends AbstractDataChangeListener<Interface
     private Class<? extends TepTypeBase> getDeviceType(String device) {
         if(device.startsWith("hwvtep")) {
             return TepTypeHwvtep.class;
-        } else if(InetAddresses.isInetAddress(device)) {
+        } else if(device.contains("IpAddress")) {
             return TepTypeExternal.class;
         } else {
             return TepTypeInternal.class;
index a657d42989e12484ee4a94bafda0a24ad2329cab..a28cc91815609f6d03b6ac89e211cbf8930e90b9 100644 (file)
@@ -675,4 +675,29 @@ public class ItmManagerRpcService implements ItmRpcService {
         return Futures.immediateFuture(resultBld.build());
     }
 
+    @Override
+    public Future<RpcResult<IsDcgwPresentOutput>> isDcgwPresent(IsDcgwPresentInput input) {
+        RpcResultBuilder<IsDcgwPresentOutput> resultBld = RpcResultBuilder.success();
+
+        List<DcGatewayIp> dcGatewayIpList = ItmUtils.getDcGatewayIpList(dataBroker);
+        String dcgwIpStr = input.getDcgwIp();
+        IpAddress dcgwIpAddr = new IpAddress(dcgwIpStr.toCharArray());
+        long retVal;
+
+        if((dcGatewayIpList != null) &&
+                (!dcGatewayIpList.isEmpty()) &&
+                (dcGatewayIpList.contains(dcgwIpAddr))) {
+            //Match found
+            retVal = 1;
+            IsDcgwPresentOutputBuilder output = new IsDcgwPresentOutputBuilder().setRetVal(retVal);
+            resultBld.withResult(output.build());
+        } else {
+            //Match not found
+            retVal = 2;
+            IsDcgwPresentOutputBuilder output = new IsDcgwPresentOutputBuilder().setRetVal(retVal);
+            resultBld.withResult(output.build());
+        }
+        return Futures.immediateFuture(resultBld.build());
+    }
+
 }