1.add a flag that allow igmp join/leave with out ssm translate; 2.catch the exception while configured an invalid igmp global connect point

Change-Id: Ie60e9e61f638982fc90bdef818fcd7d9bf36e082
diff --git a/src/main/java/org/opencord/igmpproxy/IgmpManager.java b/src/main/java/org/opencord/igmpproxy/IgmpManager.java
index 1b4285b..6063b96 100644
--- a/src/main/java/org/opencord/igmpproxy/IgmpManager.java
+++ b/src/main/java/org/opencord/igmpproxy/IgmpManager.java
@@ -111,6 +111,8 @@
     public static boolean connectPointMode = true;
     public static ConnectPoint connectPoint = null;
 
+    private static boolean pimSSmInterworking = false;
+    private static final String DEFAULT_PIMSSM_HOST = "127.0.0.1";
     private final ScheduledExecutorService scheduledExecutorService =
             Executors.newScheduledThreadPool(1);
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
@@ -296,10 +298,15 @@
                 join = true;
             }
         } else {
-            IpAddress src = ssmTranslateRoute(groupIp);
-            if (src == null) {
-                log.info("no ssm translate for group " + groupIp.toString());
-                return;
+            IpAddress src = null;
+            if (pimSSmInterworking) {
+                src = ssmTranslateRoute(groupIp);
+                if (src == null) {
+                    log.info("no ssm translate for group " + groupIp.toString());
+                    return;
+                }
+            } else {
+                src = IpAddress.valueOf(DEFAULT_PIMSSM_HOST);
             }
             sourceList.add(src.getIp4Address());
             if (recordType == IGMPMembership.CHANGE_TO_EXCLUDE_MODE ||
@@ -672,7 +679,7 @@
             igmpCos = newCfg.igmpCos();
             periodicQuery = newCfg.periodicQuery();
             fastLeave = newCfg.fastLeave();
-
+            pimSSmInterworking = newCfg.pimSsmInterworking();
             connectPoint = newCfg.connectPoint();
             if (connectPointMode != newCfg.connectPointMode()) {
                 connectPointMode = newCfg.connectPointMode();
diff --git a/src/main/java/org/opencord/igmpproxy/IgmpproxyConfig.java b/src/main/java/org/opencord/igmpproxy/IgmpproxyConfig.java
index 107c262..efd39ba 100644
--- a/src/main/java/org/opencord/igmpproxy/IgmpproxyConfig.java
+++ b/src/main/java/org/opencord/igmpproxy/IgmpproxyConfig.java
@@ -35,6 +35,9 @@
     protected static final Boolean DEFAULT_PERIODIC_QUERY = true;
     protected static final String DEFAULT_WITH_RA_UPLINK = "true";
     protected static final String DEFAULT_WITH_RA_DOWNLINK = "true";
+    private static final Boolean DEFAULT_CONNECT_POINT_MODE = true;
+    private static final Boolean DEFAULT_PIMSSM_INTERWORKING = false;
+
     protected static final String CONNECT_POINT_MODE = "globalConnectPointMode";
     protected static final String CONNECT_POINT = "globalConnectPoint";
     private static final String UNSOLICITED_TIMEOUT = "UnsolicitedTimeOut";
@@ -48,7 +51,7 @@
     private static final String IGMP_COS = "IgmpCos";
     private static final String WITH_RA_UPLINK = "withRAUpLink";
     private static final String WITH_RA_DOWN_LINK = "withRADownLink";
-    private static final Boolean DEFAULT_CONNECT_POINT_MODE = true;
+    private static final String PIMSSM_INTERWORKING = "pimSSmInterworking";
 
     /**
      * Gets the value of a string property, protecting for an empty
@@ -165,6 +168,17 @@
             return null;
         }
 
-        return ConnectPoint.deviceConnectPoint(getStringProperty(CONNECT_POINT, ""));
+        try {
+            return ConnectPoint.deviceConnectPoint(getStringProperty(CONNECT_POINT, ""));
+        } catch (Exception ex) {
+            return null;
+        }
+    }
+
+    public boolean pimSsmInterworking() {
+        if (object == null || object.path(PIMSSM_INTERWORKING) == null) {
+            return DEFAULT_PIMSSM_INTERWORKING;
+        }
+        return Boolean.parseBoolean(getStringProperty(PIMSSM_INTERWORKING, DEFAULT_PIMSSM_INTERWORKING.toString()));
     }
 }