SEBA-815 Multi Tcont support by OLT app.
Change-Id: I024ef2fcb3d3e59cc86bd2088726ae513fcff796
diff --git a/app/src/main/java/org/opencord/olt/cli/ShowBpMeterMappingsCommand.java b/app/src/main/java/org/opencord/olt/cli/ShowBpMeterMappingsCommand.java
index 83b518f..630ae4a 100644
--- a/app/src/main/java/org/opencord/olt/cli/ShowBpMeterMappingsCommand.java
+++ b/app/src/main/java/org/opencord/olt/cli/ShowBpMeterMappingsCommand.java
@@ -19,10 +19,10 @@
import org.apache.karaf.shell.commands.Command;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.meter.MeterKey;
-import org.opencord.olt.AccessDeviceService;
+import org.opencord.olt.internalapi.AccessDeviceMeterService;
-import java.util.List;
import java.util.Map;
+import java.util.Set;
@Command(scope = "onos", name = "volt-bpmeter-mappings",
description = "Shows information about bandwidthProfile-meterKey (device / meter) mappings")
@@ -30,12 +30,12 @@
@Override
protected void execute() {
- AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
- Map<String, List<MeterKey>> bpMeterMappings = service.getBpMeterMappings();
+ AccessDeviceMeterService service = AbstractShellCommand.get(AccessDeviceMeterService.class);
+ Map<String, Set<MeterKey>> bpMeterMappings = service.getBpMeterMappings();
bpMeterMappings.forEach(this::display);
}
- private void display(String bpInfo, List<MeterKey> meterKeyList) {
+ private void display(String bpInfo, Set<MeterKey> meterKeyList) {
meterKeyList.forEach(meterKey ->
print("bpInfo=%s deviceId=%s meterId=%s",
bpInfo, meterKey.deviceId(), meterKey.meterId()));
diff --git a/app/src/main/java/org/opencord/olt/cli/ShowOltCommand.java b/app/src/main/java/org/opencord/olt/cli/ShowOltCommand.java
index d01e8e2..0c0441f 100644
--- a/app/src/main/java/org/opencord/olt/cli/ShowOltCommand.java
+++ b/app/src/main/java/org/opencord/olt/cli/ShowOltCommand.java
@@ -30,8 +30,6 @@
@Override
protected void execute() {
AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
- service.fetchOlts().forEach(did -> {
- print("OLT %s", did);
- });
+ service.fetchOlts().forEach(did -> print("OLT %s", did));
}
}
diff --git a/app/src/main/java/org/opencord/olt/cli/ShowProgrammedMetersCommand.java b/app/src/main/java/org/opencord/olt/cli/ShowProgrammedMetersCommand.java
index 6fa8c9d..6615002 100644
--- a/app/src/main/java/org/opencord/olt/cli/ShowProgrammedMetersCommand.java
+++ b/app/src/main/java/org/opencord/olt/cli/ShowProgrammedMetersCommand.java
@@ -19,7 +19,7 @@
import org.apache.karaf.shell.commands.Command;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.meter.MeterKey;
-import org.opencord.olt.AccessDeviceService;
+import org.opencord.olt.internalapi.AccessDeviceMeterService;
import java.util.Set;
@@ -33,7 +33,7 @@
@Override
protected void execute() {
- AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
+ AccessDeviceMeterService service = AbstractShellCommand.get(AccessDeviceMeterService.class);
Set<MeterKey> programmedMeters = service.getProgMeters();
programmedMeters.forEach(this::display);
}
diff --git a/app/src/main/java/org/opencord/olt/cli/ShowProgrammedSubscribersCommand.java b/app/src/main/java/org/opencord/olt/cli/ShowProgrammedSubscribersCommand.java
index 2a4409e..be2b6dd 100644
--- a/app/src/main/java/org/opencord/olt/cli/ShowProgrammedSubscribersCommand.java
+++ b/app/src/main/java/org/opencord/olt/cli/ShowProgrammedSubscribersCommand.java
@@ -17,12 +17,13 @@
package org.opencord.olt.cli;
import java.util.Map;
+import java.util.Set;
import org.apache.karaf.shell.commands.Command;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.ConnectPoint;
import org.opencord.olt.AccessDeviceService;
-import org.opencord.sadis.SubscriberAndDeviceInformation;
+import org.opencord.sadis.UniTagInformation;
/**
* Shows subscriber information for those subscriber which have been programmed
@@ -35,11 +36,12 @@
@Override
protected void execute() {
AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
- Map<ConnectPoint, SubscriberAndDeviceInformation> info = service.getProgSubs();
+ Map<ConnectPoint, Set<UniTagInformation>> info = service.getProgSubs();
info.forEach(this::display);
}
- private void display(ConnectPoint cp, SubscriberAndDeviceInformation sub) {
- print("location=%s subscriber=%s", cp, sub);
+ private void display(ConnectPoint cp, Set<UniTagInformation> uniTagInformation) {
+ uniTagInformation.forEach(uniTag ->
+ print("location=%s tagInformation=%s", cp, uniTag));
}
}
diff --git a/app/src/main/java/org/opencord/olt/cli/ShowSubscribersCommand.java b/app/src/main/java/org/opencord/olt/cli/ShowSubscribersCommand.java
deleted file mode 100644
index 711d1fa..0000000
--- a/app/src/main/java/org/opencord/olt/cli/ShowSubscribersCommand.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2016-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.opencord.olt.cli;
-
-import java.util.Map;
-
-import org.apache.karaf.shell.commands.Command;
-import org.onlab.packet.VlanId;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.net.ConnectPoint;
-import org.opencord.olt.AccessDeviceService;
-
-/**
- * Shows provisioned (configured) subscribers. The data plane flows for the
- * subscribers may or may not have been programmed.
- */
-@Command(scope = "onos", name = "volt-subscribers",
- description = "Shows pre-provisioned subscribers")
-public class ShowSubscribersCommand extends AbstractShellCommand {
-
- private static final String FORMAT = "port=%s, svlan=%s, cvlan=%s";
-
- @Override
- protected void execute() {
- AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
- service.getSubscribers().forEach(this::display);
- }
-
- private void display(Map.Entry<ConnectPoint, Map.Entry<VlanId, VlanId>> subscriber) {
- print(FORMAT, subscriber.getKey(), subscriber.getValue().getKey(),
- subscriber.getValue().getValue());
- }
-}
diff --git a/app/src/main/java/org/opencord/olt/cli/UniTagAddCommand.java b/app/src/main/java/org/opencord/olt/cli/UniTagAddCommand.java
new file mode 100644
index 0000000..9ea5439
--- /dev/null
+++ b/app/src/main/java/org/opencord/olt/cli/UniTagAddCommand.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2016-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.opencord.olt.cli;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
+import org.onlab.packet.VlanId;
+import org.onosproject.cli.AbstractShellCommand;
+import org.opencord.olt.AccessDeviceService;
+import org.opencord.olt.AccessSubscriberId;
+
+import java.util.Optional;
+
+/**
+ * Adds a subscriber uni tag.
+ */
+@Command(scope = "onos", name = "volt-add-subscriber-unitag",
+ description = "Adds a uni tag to an access device")
+public class UniTagAddCommand extends AbstractShellCommand {
+
+ @Argument(index = 0, name = "portName", description = "Port name",
+ required = true, multiValued = false)
+ private String strPortName = null;
+
+ @Option(name = "--cTag", description = "Inner vlan id",
+ required = false, multiValued = false)
+ private String strCtag = null;
+
+ @Option(name = "--sTag", description = "Outer vlan id",
+ required = false, multiValued = false)
+ private String strStag = null;
+
+ @Option(name = "--tpId", description = "Technology profile id",
+ required = false, multiValued = false)
+ private String strTpId = null;
+
+ @Override
+ protected void execute() {
+
+ AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
+ AccessSubscriberId portName = new AccessSubscriberId(strPortName);
+
+ Optional<VlanId> cTag = strCtag == null ? Optional.empty() : Optional.of(VlanId.vlanId(strCtag));
+ Optional<VlanId> sTag = strStag == null ? Optional.empty() : Optional.of(VlanId.vlanId(strStag));
+ Optional<Integer> tpId = strTpId == null ? Optional.empty() : Optional.of(Integer.parseInt(strTpId));
+ service.provisionSubscriber(portName, sTag, cTag, tpId);
+ }
+}
diff --git a/app/src/main/java/org/opencord/olt/cli/UniTagRemoveCommand.java b/app/src/main/java/org/opencord/olt/cli/UniTagRemoveCommand.java
new file mode 100644
index 0000000..74d05b7
--- /dev/null
+++ b/app/src/main/java/org/opencord/olt/cli/UniTagRemoveCommand.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2016-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.opencord.olt.cli;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
+import org.onlab.packet.VlanId;
+import org.onosproject.cli.AbstractShellCommand;
+import org.opencord.olt.AccessDeviceService;
+import org.opencord.olt.AccessSubscriberId;
+
+import java.util.Optional;
+
+/**
+ * Removes a uni tag from a subscriber (portname).
+ */
+@Command(scope = "onos", name = "volt-remove-subscriber-unitag",
+ description = "Removes a uni tag from an access device")
+public class UniTagRemoveCommand extends AbstractShellCommand {
+
+ @Argument(index = 0, name = "portName", description = "Port name",
+ required = true, multiValued = false)
+ private String strPortName = null;
+
+ @Option(name = "--cTag", description = "Inner vlan id",
+ required = false, multiValued = false)
+ private String strCtag = null;
+
+ @Option(name = "--sTag", description = "Outer vlan id",
+ required = false, multiValued = false)
+ private String strStag = null;
+
+ @Option(name = "--tpId", description = "Technology profile id",
+ required = false, multiValued = false)
+ private String strTpId = null;
+
+ @Override
+ protected void execute() {
+
+ AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
+ AccessSubscriberId portName = new AccessSubscriberId(strPortName);
+
+ Optional<VlanId> cTag = strCtag == null ? Optional.empty() : Optional.of(VlanId.vlanId(strCtag));
+ Optional<VlanId> sTag = strStag == null ? Optional.empty() : Optional.of(VlanId.vlanId(strStag));
+ Optional<Integer> tpId = strTpId == null ? Optional.empty() : Optional.of(Integer.parseInt(strTpId));
+ service.removeSubscriber(portName, sTag, cTag, tpId);
+ }
+}