Enhancing diagnostic and test facilities for troubleshooting
- added new CLI to list driver providers
- added ability to power on/off borrowed cells
- enabled ONOS service to restart on boot/death
Change-Id: Ifc889cdbc0740e5d3286c9836dfecc38d458bbc5
diff --git a/cli/src/main/java/org/onosproject/cli/net/DriverProvidersListCommand.java b/cli/src/main/java/org/onosproject/cli/net/DriverProvidersListCommand.java
new file mode 100644
index 0000000..3692c57
--- /dev/null
+++ b/cli/src/main/java/org/onosproject/cli/net/DriverProvidersListCommand.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2015-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.cli.net;
+
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.net.driver.Driver;
+import org.onosproject.net.driver.DriverAdminService;
+import org.onosproject.net.driver.DriverProvider;
+
+import java.util.stream.Collectors;
+
+/**
+ * Lists device drivers.
+ */
+@Command(scope = "onos", name = "driver-providers",
+ description = "Lists device driver providers")
+public class DriverProvidersListCommand extends AbstractShellCommand {
+
+ private static final String FMT = "provider=%s, drivers=%s";
+
+ @Override
+ protected void execute() {
+ DriverAdminService service = get(DriverAdminService.class);
+ service.getProviders().forEach(this::printDriverProvider);
+ }
+
+ private void printDriverProvider(DriverProvider provider) {
+ print(FMT, provider.getClass().getName(),
+ provider.getDrivers().stream()
+ .map(Driver::name)
+ .collect(Collectors.toSet()));
+ }
+
+}
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 82470e5..2571444 100644
--- a/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -129,6 +129,9 @@
</command>
<command>
+ <action class="org.onosproject.cli.net.DriverProvidersListCommand"/>
+ </command>
+ <command>
<action class="org.onosproject.cli.net.DriversListCommand"/>
<completers>
<ref component-id="driverNameCompleter"/>