Adding get flow by table REST api, fixing exceptions in dhcp

Change-Id: Idc07992a91c79f594c998b2d78b980036077c0ad
diff --git a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/cli/DhcpRelayCommand.java b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/cli/DhcpRelayCommand.java
index 6bf46b8..90816b0 100644
--- a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/cli/DhcpRelayCommand.java
+++ b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/cli/DhcpRelayCommand.java
@@ -109,7 +109,7 @@
         boolean toResetFlag;
 
         if (counter != null) {
-            if (counter.equals("counter") || reset.equals("[counter]")) {
+            if (counter.equals("counter") || counter.equals("[counter]")) {
                 print(CONUTER_HEADER);
             } else {
                 print("first parameter is [counter]");
diff --git a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/config/DhcpServerConfig.java b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/config/DhcpServerConfig.java
index cf71aa2a..d60c6b0 100644
--- a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/config/DhcpServerConfig.java
+++ b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/config/DhcpServerConfig.java
@@ -76,10 +76,18 @@
             if (node.isTextual()) {
                 IpAddress ip = IpAddress.valueOf(node.asText());
                 if (ip.isIp4() && serverIp4Addr == null) {
-                    serverIp4Addr = ip.getIp4Address();
+                  try {
+                      serverIp4Addr = ip.getIp4Address();
+                  } catch (IllegalArgumentException iae) {
+                      log.warn("Invalid IPv4 address {} found in DHCP server config. Ignored.", ip.toString());
+                  }
                 }
                 if (ip.isIp6() && serverIp6Addr == null) {
+                  try {
                     serverIp6Addr = ip.getIp6Address();
+                  } catch (IllegalArgumentException iae) {
+                      log.warn("Invalid IPv6 address {} found in DHCP server config. Ignored.", ip.toString());
+                  }
                 }
             }
         });
@@ -90,10 +98,18 @@
                 if (node.isTextual()) {
                     IpAddress ip = IpAddress.valueOf(node.asText());
                     if (ip.isIp4() && gatewayIp4Addr == null) {
-                        gatewayIp4Addr = ip.getIp4Address();
+                      try {
+                          gatewayIp4Addr = ip.getIp4Address();
+                      } catch (IllegalArgumentException iae) {
+                          log.warn("Invalid IPv4 address {} found in DHCP gateway config. Ignored.", ip.toString());
+                      }
                     }
                     if (ip.isIp6() && gatewayIp6Addr == null) {
-                        gatewayIp6Addr = ip.getIp6Address();
+                      try {
+                          gatewayIp6Addr = ip.getIp6Address();
+                      } catch (IllegalArgumentException iae) {
+                          log.warn("Invalid IPv6 address {} found in DHCP gateway config. Ignored.", ip.toString());
+                      }
                     }
                 }
             });