Add the logic of generating ovs bridges on bootstrap kubevirt node

Change-Id: Id691738ee31b509a143143103152111dfb47a606
diff --git a/apps/kubevirt-node/app/src/main/java/org/onosproject/kubevirtnode/cli/KubevirtListApiConfigsCommand.java b/apps/kubevirt-node/app/src/main/java/org/onosproject/kubevirtnode/cli/KubevirtListApiConfigsCommand.java
new file mode 100644
index 0000000..d01c33a
--- /dev/null
+++ b/apps/kubevirt-node/app/src/main/java/org/onosproject/kubevirtnode/cli/KubevirtListApiConfigsCommand.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2020-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.kubevirtnode.cli;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.kubevirtnode.api.KubevirtApiConfig;
+import org.onosproject.kubevirtnode.api.KubevirtApiConfigService;
+
+import static org.onosproject.kubevirtnode.util.KubevirtNodeUtil.prettyJson;
+
+/**
+ * Lists all KubeVirt API server configs registered to the service.
+ */
+@Service
+@Command(scope = "onos", name = "kubevirt-api-configs",
+        description = "Lists all KubeVirt API server configs registered to the service")
+public class KubevirtListApiConfigsCommand extends AbstractShellCommand {
+
+    private static final String FORMAT = "%-10s%-25s%-10s%-10s";
+
+    @Override
+    protected void doExecute() throws Exception {
+        KubevirtApiConfigService service = get(KubevirtApiConfigService.class);
+        KubevirtApiConfig config = service.apiConfig();
+
+        if (outputJson()) {
+            print("%s", json(config));
+        } else {
+            print(FORMAT, "Scheme", "IpAddress", "Port", "State");
+            if (config != null) {
+                print(FORMAT, config.scheme().name(), config.ipAddress().toString(),
+                        config.port(), config.state().name());
+            } else {
+                print("Kubevirt config not found!");
+            }
+
+        }
+    }
+
+    private String json(KubevirtApiConfig config) {
+        ObjectMapper mapper = new ObjectMapper();
+        ObjectNode node = jsonForEntity(config, KubevirtApiConfig.class);
+        return prettyJson(mapper, node.toString());
+    }
+}