Added a wipe-out command; we need to revisit how to either make the devices come back or the links not come back.
diff --git a/cli/src/main/java/org/onlab/onos/cli/net/WipeOutCommand.java b/cli/src/main/java/org/onlab/onos/cli/net/WipeOutCommand.java
new file mode 100644
index 0000000..51a0fce
--- /dev/null
+++ b/cli/src/main/java/org/onlab/onos/cli/net/WipeOutCommand.java
@@ -0,0 +1,35 @@
+package org.onlab.onos.cli.net;
+
+import org.apache.karaf.shell.commands.Command;
+import org.onlab.onos.net.Device;
+import org.onlab.onos.net.Host;
+import org.onlab.onos.net.device.DeviceAdminService;
+import org.onlab.onos.net.device.DeviceService;
+import org.onlab.onos.net.host.HostAdminService;
+import org.onlab.onos.net.host.HostService;
+
+/**
+ * Wipes-out the entire network information base, i.e. devices, links, hosts.
+ */
+@Command(scope = "onos", name = "wipe-out",
+ description = "Wipes-out the entire network information base, i.e. devices, links, hosts")
+public class WipeOutCommand extends ClustersListCommand {
+
+ @Override
+ protected Object doExecute() throws Exception {
+ DeviceAdminService deviceAdminService = get(DeviceAdminService.class);
+ DeviceService deviceService = get(DeviceService.class);
+ for (Device device : deviceService.getDevices()) {
+ deviceAdminService.removeDevice(device.id());
+ }
+
+ HostAdminService hostAdminService = get(HostAdminService.class);
+ HostService hostService = get(HostService.class);
+ for (Host host : hostService.getHosts()) {
+ hostAdminService.removeHost(host.id());
+ }
+ return null;
+ }
+
+
+}
diff --git a/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index 55fec58..4494709 100644
--- a/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -58,11 +58,11 @@
<command>
<action class="org.onlab.onos.cli.net.HostsListCommand"/>
- <completers>
- <ref component-id="hostIdCompleter"/>
- </completers>
</command>
+ <command>
+ <action class="org.onlab.onos.cli.net.WipeOutCommand"/>
+ </command>
</command-bundle>
<bean id="deviceIdCompleter" class="org.onlab.onos.cli.net.DeviceIdCompleter"/>