Revert "CORD-247 Add host management network interface to integration bridge"

This reverts commit 3ef5249acd9f3ff82dd1c18ec0a09038709c7f3f.

Change-Id: I053e97d49bbef14e764a776cd37dd9d13ddea39e
diff --git a/src/main/java/org/opencord/cordvtn/cli/CordVtnNodeCheckCommand.java b/src/main/java/org/opencord/cordvtn/cli/CordVtnNodeCheckCommand.java
index d0189e4..6d591b0 100644
--- a/src/main/java/org/opencord/cordvtn/cli/CordVtnNodeCheckCommand.java
+++ b/src/main/java/org/opencord/cordvtn/cli/CordVtnNodeCheckCommand.java
@@ -16,23 +16,14 @@
 
 package org.opencord.cordvtn.cli;
 
-import com.jcraft.jsch.Session;
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
-import org.onlab.packet.IpAddress;
 import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.Port;
 import org.opencord.cordvtn.api.CordVtnNode;
 import org.opencord.cordvtn.impl.CordVtnNodeManager;
 import org.onosproject.net.Device;
 import org.onosproject.net.device.DeviceService;
-
-import java.util.Set;
-
-import static org.onosproject.net.AnnotationKeys.PORT_NAME;
-import static org.opencord.cordvtn.api.Constants.*;
-import static org.opencord.cordvtn.impl.RemoteIpCommandUtil.*;
+import org.onosproject.net.driver.DriverService;
 
 /**
  * Checks detailed node init state.
@@ -61,74 +52,23 @@
             return;
         }
 
-        print("%n[Integration Bridge Status]");
-        Device device = deviceService.getDevice(node.integrationBridgeId());
-        if (device != null) {
-            print("%s %s=%s available=%s %s",
-                  deviceService.isAvailable(device.id()) ? MSG_OK : MSG_NO,
-                  INTEGRATION_BRIDGE,
-                  device.id(),
-                  deviceService.isAvailable(device.id()),
-                  device.annotations());
+        print(nodeManager.checkNodeInitState(node));
 
-            node.systemIfaces().stream().forEach(iface -> print(
-                    getPortState(deviceService, node.integrationBridgeId(), iface)));
-        } else {
-            print("%s %s=%s is not available",
-                  MSG_NO,
-                  INTEGRATION_BRIDGE,
-                  node.integrationBridgeId());
-        }
+        print("%n[DEBUG]");
+        Device device = deviceService.getDevice(node.intBrId());
+        String driver = get(DriverService.class).getDriver(device.id()).name();
+        print("%s available=%s driver=%s %s",
+              device.id(),
+              deviceService.isAvailable(device.id()),
+              driver,
+              device.annotations());
 
-        print("%n[Interfaces and IP setup]");
-        Session session = connect(node.sshInfo());
-        if (session != null) {
-            Set<IpAddress> ips = getCurrentIps(session, INTEGRATION_BRIDGE);
-            boolean isUp = isInterfaceUp(session, INTEGRATION_BRIDGE);
-            boolean isIp = ips.contains(node.dataIp().ip()) && ips.contains(node.localMgmtIp().ip());
-
-            print("%s %s up=%s Ips=%s",
-                  isUp && isIp ? MSG_OK : MSG_NO,
-                  INTEGRATION_BRIDGE,
-                  isUp ? Boolean.TRUE : Boolean.FALSE,
-                  getCurrentIps(session, INTEGRATION_BRIDGE));
-
-            print(getSystemIfaceState(session, node.dataIface()));
-            if (node.hostMgmtIface().isPresent()) {
-                print(getSystemIfaceState(session, node.hostMgmtIface().get()));
-            }
-
-            disconnect(session);
-        } else {
-            print("%s Unable to SSH to %s", MSG_NO, node.hostname());
-        }
-    }
-
-    private String getPortState(DeviceService deviceService, DeviceId deviceId, String portName) {
-        Port port = deviceService.getPorts(deviceId).stream()
-                .filter(p -> p.annotations().value(PORT_NAME).equals(portName) &&
-                        p.isEnabled())
-                .findAny().orElse(null);
-
-        if (port != null) {
-            return String.format("%s %s portNum=%s enabled=%s %s",
-                                 port.isEnabled() ? MSG_OK : MSG_NO,
-                                 portName,
-                                 port.number(),
-                                 port.isEnabled() ? Boolean.TRUE : Boolean.FALSE,
-                                 port.annotations());
-        } else {
-            return String.format("%s %s does not exist", MSG_NO, portName);
-        }
-    }
-
-    private String getSystemIfaceState(Session session, String iface) {
-        boolean isUp = isInterfaceUp(session, iface);
-        boolean isIp = getCurrentIps(session, iface).isEmpty();
-        return String.format("%s %s up=%s IpFlushed=%s",
-              isUp && isIp ? MSG_OK : MSG_NO,
-              iface,
-              isUp ? Boolean.TRUE : Boolean.FALSE,
-              isIp ? Boolean.TRUE : Boolean.FALSE);
+        deviceService.getPorts(node.intBrId()).forEach(port -> {
+            Object portIsEnabled = port.isEnabled() ? "enabled" : "disabled";
+            print("port=%s state=%s %s",
+                  port.number(),
+                  portIsEnabled,
+                  port.annotations());
+        });
     }
 }