[ONOS-4849] NETCONF function for FUJITSU OLT #6
- Add alart command for FUJITSU OLT
volt-notification-alertfilter <netconf:target>
volt-notification-setalertfilter <netconf:target> <alert-severity>
volt-notification-subscribe <netconf:target> {disable}
- Update fujitsu-drivers.xml and shell-config.xml in FUJITSU directory
- Apply Yuta's and Andrea's suggestion to startSubscription method and other methods which related to startSubscription method.
-> Remove startSubscriptionConnection() and createSubscriptionString() method in 4th patch-set.
-> Modify cosmetic issue related to Static-string.
-> Update "No replay" to "No reply" in VoltGetPonLinksCommand.java
Change-Id: I2c8d5484ea0ff9f0b1b970fe8b183bec12193c46
diff --git a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/cli/VoltGetAlertFilterCommand.java b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/cli/VoltGetAlertFilterCommand.java
new file mode 100644
index 0000000..334c750
--- /dev/null
+++ b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/cli/VoltGetAlertFilterCommand.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.drivers.fujitsu.cli;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.net.DeviceId;
+import org.onosproject.drivers.fujitsu.behaviour.VoltAlertConfig;
+import org.onosproject.net.driver.DriverHandler;
+import org.onosproject.net.driver.DriverService;
+
+/**
+ * Gets alert filter severity level in vOLT.
+ */
+@Command(scope = "onos", name = "volt-notification-alertfilter",
+ description = "Gets alert filter severity level in vOLT")
+public class VoltGetAlertFilterCommand extends AbstractShellCommand {
+
+ @Argument(index = 0, name = "uri", description = "Device ID",
+ required = true, multiValued = false)
+ String uri = null;
+
+ private DeviceId deviceId;
+
+ @Override
+ protected void execute() {
+ DriverService service = get(DriverService.class);
+ deviceId = DeviceId.deviceId(uri);
+ DriverHandler h = service.createHandler(deviceId);
+ VoltAlertConfig voltNe = h.behaviour(VoltAlertConfig.class);
+ String reply = voltNe.getAlertFilter();
+ if (reply != null) {
+ print("%s", reply);
+ } else {
+ print("No reply from %s", deviceId.toString());
+ }
+ }
+}
diff --git a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/cli/VoltGetPonLinksCommand.java b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/cli/VoltGetPonLinksCommand.java
index 9129d94..1cb73ca 100644
--- a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/cli/VoltGetPonLinksCommand.java
+++ b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/cli/VoltGetPonLinksCommand.java
@@ -50,7 +50,7 @@
if (reply != null) {
print("%s", reply);
} else {
- print("No replay from %s", deviceId.toString());
+ print("No reply from %s", deviceId.toString());
}
}
diff --git a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/cli/VoltSetAlertFilterCommand.java b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/cli/VoltSetAlertFilterCommand.java
new file mode 100644
index 0000000..2719f31
--- /dev/null
+++ b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/cli/VoltSetAlertFilterCommand.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.drivers.fujitsu.cli;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.net.DeviceId;
+import org.onosproject.drivers.fujitsu.behaviour.VoltAlertConfig;
+import org.onosproject.net.driver.DriverHandler;
+import org.onosproject.net.driver.DriverService;
+
+/**
+ * Sets alert filter severity level in vOLT.
+ */
+@Command(scope = "onos", name = "volt-notification-setalertfilter",
+ description = "Sets alert filter severity level in vOLT")
+public class VoltSetAlertFilterCommand extends AbstractShellCommand {
+
+ @Argument(index = 0, name = "uri", description = "Device ID",
+ required = true, multiValued = false)
+ String uri = null;
+
+ @Argument(index = 1, name = "target", description = "Severity level",
+ required = true, multiValued = false)
+ String severity = null;
+
+ private DeviceId deviceId;
+
+ @Override
+ protected void execute() {
+ DriverService service = get(DriverService.class);
+ deviceId = DeviceId.deviceId(uri);
+ DriverHandler h = service.createHandler(deviceId);
+ VoltAlertConfig volt = h.behaviour(VoltAlertConfig.class);
+ volt.setAlertFilter(severity);
+ }
+}
diff --git a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/cli/VoltSubscribeCommand.java b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/cli/VoltSubscribeCommand.java
new file mode 100644
index 0000000..3ed1ada
--- /dev/null
+++ b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/cli/VoltSubscribeCommand.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.drivers.fujitsu.cli;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.net.DeviceId;
+import org.onosproject.drivers.fujitsu.behaviour.VoltAlertConfig;
+import org.onosproject.net.driver.DriverHandler;
+import org.onosproject.net.driver.DriverService;
+
+/**
+ * Subscribes to receive notifications of vOLT or unsubscribes.
+ */
+@Command(scope = "onos", name = "volt-notification-subscribe",
+ description = "Subscribes to receive notifications of vOLT")
+public class VoltSubscribeCommand extends AbstractShellCommand {
+
+ @Argument(index = 0, name = "uri", description = "Device ID",
+ required = true, multiValued = false)
+ String uri = null;
+
+ @Argument(index = 1, name = "mode", description = "Disable subscription",
+ required = false, multiValued = false)
+ String mode = null;
+
+ private DeviceId deviceId;
+
+ @Override
+ protected void execute() {
+ DriverService service = get(DriverService.class);
+ deviceId = DeviceId.deviceId(uri);
+ DriverHandler h = service.createHandler(deviceId);
+ VoltAlertConfig volt = h.behaviour(VoltAlertConfig.class);
+ volt.subscribe(mode);
+ }
+}