Fix: retrieve port bridge port MAC from deviceService rather via ovsdb
1. Derive gateway IP address from POD subnet CIDR.
2. Remove the logic of injecting gateway IP address.
Change-Id: Ice44c1c4b41bc1689954041aee6441a379e5bacd
diff --git a/apps/k8s-networking/app/src/test/java/org/onosproject/k8snetworking/codec/K8sNetworkJsonMatcher.java b/apps/k8s-networking/app/src/test/java/org/onosproject/k8snetworking/codec/K8sNetworkJsonMatcher.java
index 73f2e58..1f3526f 100644
--- a/apps/k8s-networking/app/src/test/java/org/onosproject/k8snetworking/codec/K8sNetworkJsonMatcher.java
+++ b/apps/k8s-networking/app/src/test/java/org/onosproject/k8snetworking/codec/K8sNetworkJsonMatcher.java
@@ -32,7 +32,6 @@
private static final String TYPE = "type";
private static final String MTU = "mtu";
private static final String SEGMENT_ID = "segmentId";
- private static final String GATEWAY_IP = "gatewayIp";
private static final String CIDR = "cidr";
private K8sNetworkJsonMatcher(K8sNetwork network) {
@@ -59,11 +58,13 @@
}
// check type
- String jsonType = jsonNode.get(TYPE).asText();
- String type = network.type().name();
- if (!jsonType.equals(type)) {
- description.appendText("network type was " + jsonType);
- return false;
+ JsonNode jsonType = jsonNode.get(TYPE);
+ if (jsonType != null) {
+ String type = network.type().name();
+ if (!jsonType.asText().equals(type)) {
+ description.appendText("network type was " + jsonType);
+ return false;
+ }
}
// check MTU
@@ -75,19 +76,13 @@
}
// check segment ID
- String jsonSegmentId = jsonNode.get(SEGMENT_ID).asText();
- String segmentId = network.segmentId();
- if (!jsonSegmentId.equals(segmentId)) {
- description.appendText("segment ID was " + jsonSegmentId);
- return false;
- }
-
- // check gateway IP
- String jsonGatewayIp = jsonNode.get(GATEWAY_IP).asText();
- String gatewayIp = network.gatewayIp().toString();
- if (!jsonGatewayIp.equals(gatewayIp)) {
- description.appendText("gateway IP was " + jsonGatewayIp);
- return false;
+ JsonNode jsonSegmentId = jsonNode.get(SEGMENT_ID);
+ if (jsonSegmentId != null) {
+ String segmentId = network.segmentId();
+ if (!jsonSegmentId.asText().equals(segmentId)) {
+ description.appendText("segment ID was " + jsonSegmentId);
+ return false;
+ }
}
// check CIDR