Refer to external bridge and gateway IP from k8s node store

Change-Id: I7dab97ead59e3746b67e6e3bedc3a2c6fea41bf1
diff --git a/apps/k8s-node/app/src/test/java/org/onosproject/k8snode/codec/K8sNodeJsonMatcher.java b/apps/k8s-node/app/src/test/java/org/onosproject/k8snode/codec/K8sNodeJsonMatcher.java
index 58b15d2..b953f54 100644
--- a/apps/k8s-node/app/src/test/java/org/onosproject/k8snode/codec/K8sNodeJsonMatcher.java
+++ b/apps/k8s-node/app/src/test/java/org/onosproject/k8snode/codec/K8sNodeJsonMatcher.java
@@ -18,6 +18,7 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import org.hamcrest.Description;
 import org.hamcrest.TypeSafeDiagnosingMatcher;
+import org.onlab.packet.IpAddress;
 import org.onosproject.k8snode.api.K8sNode;
 
 /**
@@ -33,6 +34,9 @@
     private static final String DATA_IP = "dataIp";
     private static final String INTEGRATION_BRIDGE = "integrationBridge";
     private static final String STATE = "state";
+    private static final String EXTERNAL_INTF = "externalInterface";
+    private static final String EXTERNAL_BRIDGE_IP = "externalBridgeIp";
+    private static final String EXTERNAL_GATEWAY_IP = "externalGatewayIp";
 
     private K8sNodeJsonMatcher(K8sNode node) {
         this.node = node;
@@ -93,6 +97,36 @@
             }
         }
 
+        // check external interface
+        JsonNode jsonExtIntf = jsonNode.get(EXTERNAL_INTF);
+        if (jsonExtIntf != null) {
+            String extIntf = node.extIntf();
+            if (!jsonExtIntf.asText().equals(extIntf)) {
+                description.appendText("External interface was " + jsonExtIntf.asText());
+                return false;
+            }
+        }
+
+        // check external bridge IP
+        JsonNode jsonExtBridgeIp = jsonNode.get(EXTERNAL_BRIDGE_IP);
+        if (jsonExtBridgeIp != null) {
+            IpAddress extBridgeIp = node.extBridgeIp();
+            if (!jsonExtBridgeIp.asText().equals(extBridgeIp.toString())) {
+                description.appendText("External bridge IP was " + jsonExtBridgeIp.asText());
+                return false;
+            }
+        }
+
+        // check external gateway IP
+        JsonNode jsonExtGatewayIp = jsonNode.get(EXTERNAL_GATEWAY_IP);
+        if (jsonExtGatewayIp != null) {
+            IpAddress extGatewayIp = node.extGatewayIp();
+            if (!jsonExtGatewayIp.asText().equals(extGatewayIp.toString())) {
+                description.appendText("External gateway IP was " + jsonExtGatewayIp.asText());
+                return false;
+            }
+        }
+
         return true;
     }