Refer to external bridge and gateway IP from k8s node store
Change-Id: I7dab97ead59e3746b67e6e3bedc3a2c6fea41bf1
diff --git a/apps/k8s-node/app/src/main/java/org/onosproject/k8snode/codec/K8sNodeCodec.java b/apps/k8s-node/app/src/main/java/org/onosproject/k8snode/codec/K8sNodeCodec.java
index 6676847..7c7b32b 100644
--- a/apps/k8s-node/app/src/main/java/org/onosproject/k8snode/codec/K8sNodeCodec.java
+++ b/apps/k8s-node/app/src/main/java/org/onosproject/k8snode/codec/K8sNodeCodec.java
@@ -44,6 +44,9 @@
private static final String INTEGRATION_BRIDGE = "integrationBridge";
private static final String EXTERNAL_BRIDGE = "externalBridge";
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 static final String MISSING_MESSAGE = " is required in K8sNode";
@@ -69,6 +72,18 @@
result.put(DATA_IP, node.dataIp().toString());
}
+ if (node.extIntf() != null) {
+ result.put(EXTERNAL_INTF, node.extIntf());
+ }
+
+ if (node.extBridgeIp() != null) {
+ result.put(EXTERNAL_BRIDGE_IP, node.extBridgeIp().toString());
+ }
+
+ if (node.extGatewayIp() != null) {
+ result.put(EXTERNAL_GATEWAY_IP, node.extGatewayIp().toString());
+ }
+
return result;
}
@@ -105,6 +120,21 @@
nodeBuilder.extBridge(DeviceId.deviceId(extBridgeJson.asText()));
}
+ JsonNode extIntfJson = json.get(EXTERNAL_INTF);
+ if (extIntfJson != null) {
+ nodeBuilder.extIntf(extIntfJson.asText());
+ }
+
+ JsonNode extBridgeIpJson = json.get(EXTERNAL_BRIDGE_IP);
+ if (extBridgeIpJson != null) {
+ nodeBuilder.extBridgeIp(IpAddress.valueOf(extBridgeIpJson.asText()));
+ }
+
+ JsonNode extGatewayIpJson = json.get(EXTERNAL_GATEWAY_IP);
+ if (extGatewayIpJson != null) {
+ nodeBuilder.extGatewayIp(IpAddress.valueOf(extGatewayIpJson.asText()));
+ }
+
log.trace("node is {}", nodeBuilder.build().toString());
return nodeBuilder.build();