Removing json package dependency due to licensing issues
Change-Id: Iabd2f0343ca42a1956c1f7c6e471d8e141d29bc7
diff --git a/apps/kubevirt-node/BUILD b/apps/kubevirt-node/BUILD
index 922b5ea..85da1d0 100644
--- a/apps/kubevirt-node/BUILD
+++ b/apps/kubevirt-node/BUILD
@@ -1,7 +1,6 @@
BUNDLES = JACKSON + [
"//apps/kubevirt-node/api:onos-apps-kubevirt-node-api",
"//apps/kubevirt-node/app:onos-apps-kubevirt-node-app",
- "@json//jar",
"@commons_net//jar",
"@k8s_client//jar",
"@k8s_model//jar",
diff --git a/apps/kubevirt-node/app/BUILD b/apps/kubevirt-node/app/BUILD
index ee9e94e..0a3705b 100644
--- a/apps/kubevirt-node/app/BUILD
+++ b/apps/kubevirt-node/app/BUILD
@@ -3,7 +3,7 @@
"//protocols/ovsdb/api:onos-protocols-ovsdb-api",
"//protocols/ovsdb/rfc:onos-protocols-ovsdb-rfc",
"//apps/kubevirt-node/api:onos-apps-kubevirt-node-api",
- "@json//jar",
+ "@minimal_json//jar",
"@k8s_client//jar",
"@k8s_model//jar",
"@k8s_model_common//jar",
diff --git a/apps/kubevirt-node/app/src/main/java/org/onosproject/kubevirtnode/util/KubevirtNodeUtil.java b/apps/kubevirt-node/app/src/main/java/org/onosproject/kubevirtnode/util/KubevirtNodeUtil.java
index 7107285..46a5ea5 100644
--- a/apps/kubevirt-node/app/src/main/java/org/onosproject/kubevirtnode/util/KubevirtNodeUtil.java
+++ b/apps/kubevirt-node/app/src/main/java/org/onosproject/kubevirtnode/util/KubevirtNodeUtil.java
@@ -27,9 +27,8 @@
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClient;
import org.apache.commons.lang.StringUtils;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.eclipsesource.json.JsonArray;
+import com.eclipsesource.json.JsonObject;
import org.onlab.packet.IpAddress;
import org.onosproject.kubevirtnode.api.DefaultKubevirtNode;
import org.onosproject.kubevirtnode.api.DefaultKubevirtPhyInterface;
@@ -359,17 +358,17 @@
String gatewayBridgeName = null;
try {
if (physnetConfig != null) {
- JSONArray configJson = new JSONArray(physnetConfig);
+ JsonArray configJson = JsonArray.readFrom(physnetConfig);
- for (int i = 0; i < configJson.length(); i++) {
- JSONObject object = configJson.getJSONObject(i);
- String network = object.getString(NETWORK_KEY);
- String intf = object.getString(INTERFACE_KEY);
+ for (int i = 0; i < configJson.size(); i++) {
+ JsonObject object = configJson.get(i).asObject();
+ String network = object.get(NETWORK_KEY).asString();
+ String intf = object.get(INTERFACE_KEY).asString();
if (network != null && intf != null) {
String physBridgeId;
- if (object.has(PHYS_BRIDGE_ID)) {
- physBridgeId = object.getString(PHYS_BRIDGE_ID);
+ if (object.get(PHYS_BRIDGE_ID) != null) {
+ physBridgeId = object.get(PHYS_BRIDGE_ID).asString();
} else {
physBridgeId = genDpidFromName(network + intf + hostname);
log.trace("host {} physnet dpid for network {} intf {} is null so generate dpid {}",
@@ -395,7 +394,7 @@
nodeType = GATEWAY;
gatewayBridgeName = jsonNode.get(GATEWAY_BRIDGE_NAME).asText();
}
- } catch (JSONException | JsonProcessingException e) {
+ } catch (JsonProcessingException e) {
log.error("Failed to parse physnet config or gateway config object", e);
}