[VOL-4707] Expose programmed subscribers via REST and move classes and interfaces to the API.
Change-Id: Ibfb9caa48455fd349932297cb9191ee0f0341ffa
Signed-off-by: Gustavo Silva <gsilva@furukawalatam.com>
diff --git a/impl/src/main/java/org/opencord/olt/cli/OltUniPortCompleter.java b/impl/src/main/java/org/opencord/olt/cli/OltUniPortCompleter.java
index 98301db..bda36b6 100644
--- a/impl/src/main/java/org/opencord/olt/cli/OltUniPortCompleter.java
+++ b/impl/src/main/java/org/opencord/olt/cli/OltUniPortCompleter.java
@@ -22,7 +22,7 @@
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
import org.onosproject.net.device.DeviceService;
-import org.opencord.olt.impl.OltDeviceServiceInterface;
+import org.opencord.olt.OltDeviceServiceInterface;
import java.util.Collections;
import java.util.List;
diff --git a/impl/src/main/java/org/opencord/olt/cli/ShowMeterMappings.java b/impl/src/main/java/org/opencord/olt/cli/ShowMeterMappings.java
index 7e2175d..9d0e2ad 100644
--- a/impl/src/main/java/org/opencord/olt/cli/ShowMeterMappings.java
+++ b/impl/src/main/java/org/opencord/olt/cli/ShowMeterMappings.java
@@ -20,8 +20,8 @@
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
-import org.opencord.olt.impl.MeterData;
-import org.opencord.olt.impl.OltMeterServiceInterface;
+import org.opencord.olt.MeterData;
+import org.opencord.olt.OltMeterServiceInterface;
import java.util.Map;
/**
diff --git a/impl/src/main/java/org/opencord/olt/cli/ShowPortStatus.java b/impl/src/main/java/org/opencord/olt/cli/ShowPortStatus.java
index f3b35a0..d82ec33 100644
--- a/impl/src/main/java/org/opencord/olt/cli/ShowPortStatus.java
+++ b/impl/src/main/java/org/opencord/olt/cli/ShowPortStatus.java
@@ -25,9 +25,9 @@
import org.onosproject.cli.net.PortNumberCompleter;
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
-import org.opencord.olt.impl.OltFlowServiceInterface;
-import org.opencord.olt.impl.OltPortStatus;
-import org.opencord.olt.impl.ServiceKey;
+import org.opencord.olt.OltFlowServiceInterface;
+import org.opencord.olt.OltPortStatus;
+import org.opencord.olt.ServiceKey;
import org.opencord.sadis.UniTagInformation;
import java.util.HashMap;
diff --git a/impl/src/main/java/org/opencord/olt/cli/ShowProgrammedMeters.java b/impl/src/main/java/org/opencord/olt/cli/ShowProgrammedMeters.java
index da2307e..dbb390e 100644
--- a/impl/src/main/java/org/opencord/olt/cli/ShowProgrammedMeters.java
+++ b/impl/src/main/java/org/opencord/olt/cli/ShowProgrammedMeters.java
@@ -20,8 +20,8 @@
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
-import org.opencord.olt.impl.MeterData;
-import org.opencord.olt.impl.OltMeterServiceInterface;
+import org.opencord.olt.MeterData;
+import org.opencord.olt.OltMeterServiceInterface;
import java.util.Map;
/**
diff --git a/impl/src/main/java/org/opencord/olt/cli/ShowProgrammedSubscribersCommand.java b/impl/src/main/java/org/opencord/olt/cli/ShowProgrammedSubscribersCommand.java
index ac8d00d..a32fcc3 100644
--- a/impl/src/main/java/org/opencord/olt/cli/ShowProgrammedSubscribersCommand.java
+++ b/impl/src/main/java/org/opencord/olt/cli/ShowProgrammedSubscribersCommand.java
@@ -24,8 +24,8 @@
import org.onosproject.cli.net.DeviceIdCompleter;
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
-import org.opencord.olt.impl.OltFlowServiceInterface;
-import org.opencord.olt.impl.ServiceKey;
+import org.opencord.olt.OltFlowServiceInterface;
+import org.opencord.olt.ServiceKey;
import org.opencord.sadis.UniTagInformation;
import java.util.Map;
diff --git a/impl/src/main/java/org/opencord/olt/cli/ShowRequestedSubscribersCommand.java b/impl/src/main/java/org/opencord/olt/cli/ShowRequestedSubscribersCommand.java
index 37ef532..067bc18 100644
--- a/impl/src/main/java/org/opencord/olt/cli/ShowRequestedSubscribersCommand.java
+++ b/impl/src/main/java/org/opencord/olt/cli/ShowRequestedSubscribersCommand.java
@@ -24,8 +24,8 @@
import org.onosproject.cli.net.DeviceIdCompleter;
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
-import org.opencord.olt.impl.OltFlowServiceInterface;
-import org.opencord.olt.impl.ServiceKey;
+import org.opencord.olt.OltFlowServiceInterface;
+import org.opencord.olt.ServiceKey;
import java.util.Map;
import java.util.Set;
diff --git a/impl/src/main/java/org/opencord/olt/impl/AccessDevicePort.java b/impl/src/main/java/org/opencord/olt/impl/AccessDevicePort.java
deleted file mode 100644
index b6d2213..0000000
--- a/impl/src/main/java/org/opencord/olt/impl/AccessDevicePort.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2021-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.impl;
-
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.Port;
-
-import java.util.Objects;
-
-/**
- * OLT device port.
- */
-public class AccessDevicePort {
-
- private ConnectPoint cp;
- private String name;
-
- /**
- * Creates an AccessDevicePort with given ONOS port.
- *
- * @param port ONOS port
- */
- public AccessDevicePort(Port port) {
- this.cp = ConnectPoint.deviceConnectPoint(port.element().id() + "/" + port.number().toLong());
- this.name = OltUtils.getPortName(port);
- }
-
- /**
- * Creates an AccessDevicePort with given ONOS connectPoint and name.
- *
- * @param cp ONOS connect point
- * @param name OLT port name
- */
- public AccessDevicePort(ConnectPoint cp, String name) {
- this.cp = cp;
- this.name = name;
- }
-
- /**
- * Get ONOS ConnectPoint object.
- *
- * @return ONOS connect point
- */
- public ConnectPoint connectPoint() {
- return this.cp;
- }
-
- /**
- * Get OLT port name which is combination of serial number and uni index.
- *
- * @return OLT port name (ex: BBSM00010001-1)
- */
- public String name() {
- return this.name;
- }
-
- @Override
- public String toString() {
- return cp.toString() + '[' + name + ']';
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- AccessDevicePort that = (AccessDevicePort) o;
- return Objects.equals(cp, that.cp) &&
- Objects.equals(name, that.name);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(cp, name);
- }
-}
diff --git a/impl/src/main/java/org/opencord/olt/impl/DiscoveredSubscriber.java b/impl/src/main/java/org/opencord/olt/impl/DiscoveredSubscriber.java
deleted file mode 100644
index 226f1b5..0000000
--- a/impl/src/main/java/org/opencord/olt/impl/DiscoveredSubscriber.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright 2021-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.impl;
-
-import org.onosproject.net.Device;
-import org.onosproject.net.Port;
-import org.opencord.sadis.SubscriberAndDeviceInformation;
-
-import java.util.Objects;
-
-import static org.opencord.olt.impl.OltUtils.portWithName;
-
-/**
- * Contains a subscriber's information and status for a specific device and port.
- */
-public class DiscoveredSubscriber {
-
- /**
- * Describe whether the subscriber needs to be added or removed.
- */
- public enum Status {
- ADDED,
- REMOVED,
- // Used for the remove subscriber calls from REST/CLI
- ADMIN_REMOVED,
- }
-
- public Port port;
- public Device device;
- public Enum<Status> status;
- public boolean hasSubscriber;
- public SubscriberAndDeviceInformation subscriberAndDeviceInformation;
-
- /**
- * Creates the class with the proper information.
- *
- * @param device the device of the subscriber
- * @param port the port
- * @param status the status for this specific subscriber
- * @param hasSubscriber is the subscriber present
- * @param si the information about the tags/dhcp and other info.
- */
- public DiscoveredSubscriber(Device device, Port port, Status status, boolean hasSubscriber,
- SubscriberAndDeviceInformation si) {
- this.device = device;
- this.port = port;
- this.status = status;
- this.hasSubscriber = hasSubscriber;
- subscriberAndDeviceInformation = si;
- }
-
- /**
- * Returns the port name for the subscriber.
- *
- * @return the port name.
- */
- public String portName() {
- return OltUtils.getPortName(port);
- }
-
- @Override
- public String toString() {
-
- return String.format("%s (status: %s, provisionSubscriber: %s)",
- portWithName(this.port),
- this.status, this.hasSubscriber
- );
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- DiscoveredSubscriber that = (DiscoveredSubscriber) o;
- return hasSubscriber == that.hasSubscriber &&
- port.equals(that.port) &&
- device.equals(that.device) &&
- status.equals(that.status);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(port, device, status, hasSubscriber, subscriberAndDeviceInformation);
- }
-}
diff --git a/impl/src/main/java/org/opencord/olt/impl/MeterData.java b/impl/src/main/java/org/opencord/olt/impl/MeterData.java
deleted file mode 100644
index 208383d..0000000
--- a/impl/src/main/java/org/opencord/olt/impl/MeterData.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2021-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.impl;
-
-import org.onosproject.net.meter.MeterCellId;
-import org.onosproject.net.meter.MeterId;
-import org.onosproject.net.meter.MeterState;
-
-import java.util.Objects;
-
-/**
- * Class containing Meter Data.
- */
-public class MeterData {
- private MeterCellId meterCellId;
- private MeterState meterStatus;
- private String bandwidthProfileName;
-
- public MeterData(MeterCellId meterCellId, MeterState meterStatus, String bandwidthProfile) {
- this.meterCellId = meterCellId;
- this.meterStatus = meterStatus;
- this.bandwidthProfileName = bandwidthProfile;
- }
-
- public void setMeterCellId(MeterCellId meterCellId) {
- this.meterCellId = meterCellId;
- }
-
- public void setMeterStatus(MeterState meterStatus) {
- this.meterStatus = meterStatus;
- }
-
- public MeterId getMeterId() {
- return (MeterId) meterCellId;
- }
-
- public MeterCellId getMeterCellId() {
- return meterCellId;
- }
-
- public MeterState getMeterStatus() {
- return meterStatus;
- }
-
- public String getBandwidthProfileName() {
- return bandwidthProfileName;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- MeterData meterData = (MeterData) o;
- return Objects.equals(meterCellId, meterData.meterCellId) &&
- meterStatus == meterData.meterStatus &&
- Objects.equals(bandwidthProfileName, meterData.bandwidthProfileName);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(meterCellId, meterStatus, bandwidthProfileName);
- }
-
- @Override
- public String toString() {
- return "MeterData{" +
- "meterCellId=" + meterCellId +
- ", meterStatus=" + meterStatus +
- ", bandwidthProfile='" + bandwidthProfileName + '\'' +
- '}';
- }
-}
diff --git a/impl/src/main/java/org/opencord/olt/impl/Olt.java b/impl/src/main/java/org/opencord/olt/impl/Olt.java
index 7b9dc75..d744c1e 100644
--- a/impl/src/main/java/org/opencord/olt/impl/Olt.java
+++ b/impl/src/main/java/org/opencord/olt/impl/Olt.java
@@ -38,7 +38,14 @@
import org.onosproject.store.service.StorageService;
import org.opencord.olt.AccessDeviceEvent;
import org.opencord.olt.AccessDeviceListener;
+import org.opencord.olt.AccessDevicePort;
import org.opencord.olt.AccessDeviceService;
+import org.opencord.olt.DiscoveredSubscriber;
+import org.opencord.olt.OltDeviceServiceInterface;
+import org.opencord.olt.OltFlowServiceInterface;
+import org.opencord.olt.OltMeterServiceInterface;
+import org.opencord.olt.ServiceKey;
+import org.opencord.olt.FlowOperation;
import org.opencord.sadis.BaseInformationService;
import org.opencord.sadis.SadisService;
import org.opencord.sadis.SubscriberAndDeviceInformation;
@@ -879,7 +886,7 @@
if (port.isEnabled()) {
if (isNni) {
- OltFlowService.FlowOperation action = OltFlowService.FlowOperation.ADD;
+ FlowOperation action = FlowOperation.ADD;
// NOTE the NNI is only disabled if the OLT shuts down (reboot or failure).
// In that case the flows are purged anyway, so there's no need to deal with them,
// it would actually be counter-productive as the openflow connection is severed and they won't
diff --git a/impl/src/main/java/org/opencord/olt/impl/OltDeviceService.java b/impl/src/main/java/org/opencord/olt/impl/OltDeviceService.java
index b336c28..6b11802 100644
--- a/impl/src/main/java/org/opencord/olt/impl/OltDeviceService.java
+++ b/impl/src/main/java/org/opencord/olt/impl/OltDeviceService.java
@@ -25,6 +25,7 @@
import org.onosproject.net.Port;
import org.onosproject.net.PortNumber;
import org.onosproject.net.device.DeviceService;
+import org.opencord.olt.OltDeviceServiceInterface;
import org.opencord.sadis.BaseInformationService;
import org.opencord.sadis.SadisService;
import org.opencord.sadis.SubscriberAndDeviceInformation;
diff --git a/impl/src/main/java/org/opencord/olt/impl/OltDeviceServiceInterface.java b/impl/src/main/java/org/opencord/olt/impl/OltDeviceServiceInterface.java
deleted file mode 100644
index e8fcccb..0000000
--- a/impl/src/main/java/org/opencord/olt/impl/OltDeviceServiceInterface.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2021-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.impl;
-
-import org.onosproject.net.Device;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.Port;
-import org.onosproject.net.PortNumber;
-
-import java.util.Optional;
-
-/**
- * Service for olt device handling.
- */
-public interface OltDeviceServiceInterface {
- /**
- * Returns true if the device is a known OLT to sadis/config.
- * @param device the device
- * @return true if a configured olt
- */
- boolean isOlt(Device device);
-
- /**
- * Returns true if the port is an NNI port of the OLT device.
- * @param device the device
- * @param port the port
- * @return true if an NNI port of that OLT
- */
- boolean isNniPort(Device device, PortNumber port);
-
- /**
- * Returns the NNi port fo the OLT device if present.
- * @param device the device
- * @return the nni Port, if present
- */
- Optional<Port> getNniPort(Device device);
-
- /**
- * Returns true if the instance is leader for the OLT device.
- * @param deviceId the device
- * @return true if master, false otherwise.
- */
- boolean isLocalLeader(DeviceId deviceId);
-}
diff --git a/impl/src/main/java/org/opencord/olt/impl/OltFlowService.java b/impl/src/main/java/org/opencord/olt/impl/OltFlowService.java
index ebe0505..04ea492 100644
--- a/impl/src/main/java/org/opencord/olt/impl/OltFlowService.java
+++ b/impl/src/main/java/org/opencord/olt/impl/OltFlowService.java
@@ -64,6 +64,16 @@
import org.onosproject.store.serializers.KryoNamespaces;
import org.onosproject.store.service.Serializer;
import org.onosproject.store.service.StorageService;
+import org.opencord.olt.AccessDevicePort;
+import org.opencord.olt.DiscoveredSubscriber;
+import org.opencord.olt.OltDeviceServiceInterface;
+import org.opencord.olt.OltFlowServiceInterface;
+import org.opencord.olt.OltMeterServiceInterface;
+import org.opencord.olt.OltPortStatus;
+import org.opencord.olt.ServiceKey;
+import org.opencord.olt.OltFlowsStatus;
+import org.opencord.olt.FlowDirection;
+import org.opencord.olt.FlowOperation;
import org.opencord.olt.impl.fttb.FttbUtils;
import org.opencord.sadis.BandwidthProfileInformation;
import org.opencord.sadis.BaseInformationService;
@@ -262,31 +272,6 @@
protected boolean waitForRemoval = WAIT_FOR_REMOVAL_DEFAULT;
- public enum FlowOperation {
- ADD,
- REMOVE;
-
-
- @Override
- public String toString() {
- return super.toString().toLowerCase();
- }
- }
-
- public enum FlowDirection {
- UPSTREAM,
- DOWNSTREAM,
- }
-
- public enum OltFlowsStatus {
- NONE,
- PENDING_ADD,
- ADDED,
- PENDING_REMOVE,
- REMOVED,
- ERROR
- }
-
protected InternalFlowListener internalFlowListener;
@Activate
diff --git a/impl/src/main/java/org/opencord/olt/impl/OltFlowServiceInterface.java b/impl/src/main/java/org/opencord/olt/impl/OltFlowServiceInterface.java
deleted file mode 100644
index b00594f..0000000
--- a/impl/src/main/java/org/opencord/olt/impl/OltFlowServiceInterface.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright 2021-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.impl;
-
-import org.onosproject.net.Device;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.Port;
-import org.opencord.sadis.UniTagInformation;
-
-import java.util.Map;
-
-/**
- * Interface for flow installation/removal methods for different types of traffic.
- */
-public interface OltFlowServiceInterface {
- /**
- * Installs or removes default flows for the port to trap to controller.
- * @param sub the information about the port
- * @param defaultBpId the default bandwidth profile
- * @param oltBandwidthProfile the olt bandwidth profile.
- * @return true if successful
- */
- boolean handleBasicPortFlows(
- DiscoveredSubscriber sub, String defaultBpId, String oltBandwidthProfile);
-
- /**
- * Installs or removes subscriber specific flows.
- * @param sub the information about the subscriber
- * @param defaultBpId the default bandwidth profile
- * @param multicastServiceName the multicast service name.
- * @return true if successful
- */
- boolean handleSubscriberFlows(DiscoveredSubscriber sub, String defaultBpId, String multicastServiceName);
-
- /**
- * Installs or removes flows on the NNI port.
- * @param device the OLT
- * @param port the NNI port
- * @param action the operatio, ADD or REMOVE.
- */
- void handleNniFlows(Device device, Port port, OltFlowService.FlowOperation action);
-
- /**
- * Checks if the default eapol flow is already installed.
- * @param port the port
- * @return true if installed, false otherwise.
- */
- boolean hasDefaultEapol(Port port);
-
- /**
- * Checks if the dhcp flows are installed.
- * @param port the port
- * @param uti the UniTagInformation to check for
- * @return true if installed, false otherwise.
- */
- boolean hasDhcpFlows(Port port, UniTagInformation uti);
-
- /**
- * Checks if the pppoe flows are installed.
- * @param port the port
- * @param uti the UniTagInformation to check for
- * @return true if installed, false otherwise.
- */
- boolean hasPppoeFlows(Port port, UniTagInformation uti);
-
- /**
- * Checks if the subscriber flows are installed.
- * @param port the port
- * @param uti the UniTagInformation to check for
- * @return true if installed, false otherwise.
- */
- boolean hasSubscriberFlows(Port port, UniTagInformation uti);
-
- /**
- * Removes all device flows.
- * @param deviceId the olt.
- */
- void purgeDeviceFlows(DeviceId deviceId);
-
- /**
- * Return the status of installation on the connect points.
- * @return the status map
- */
- Map<ServiceKey, OltPortStatus> getConnectPointStatus();
-
- /**
- * Returns all the programmed subscribers.
- * @return the subscribers
- */
- Map<ServiceKey, UniTagInformation> getProgrammedSubscribers();
-
- /**
- * Returns the list of requested subscribers to be installed with status.
- * @return the list
- */
- Map<ServiceKey, Boolean> getRequestedSubscribers();
-
- /**
- * Returns if a subscriber on a port is provisioned or not.
- * @param cp the port
- * @return true if any service on that port is provisioned, false otherwise
- */
- boolean isSubscriberServiceProvisioned(AccessDevicePort cp);
-
- /**
- * Returns if a subscriber on a port is provisioned or not.
- * @param sk the SubscriberKey
- * @return true if provisioned, false otherwise
- */
- boolean isSubscriberServiceProvisioned(ServiceKey sk);
-
- /**
- * Updates the subscriber provisioning status.
- * @param sk the SubscriberKey
- * @param status the next status
- */
- void updateProvisionedSubscriberStatus(ServiceKey sk, Boolean status);
-}
diff --git a/impl/src/main/java/org/opencord/olt/impl/OltFlowServiceUtils.java b/impl/src/main/java/org/opencord/olt/impl/OltFlowServiceUtils.java
index 7099b1b..883c198 100644
--- a/impl/src/main/java/org/opencord/olt/impl/OltFlowServiceUtils.java
+++ b/impl/src/main/java/org/opencord/olt/impl/OltFlowServiceUtils.java
@@ -30,6 +30,7 @@
import org.onosproject.net.flow.criteria.UdpPortCriterion;
import org.onosproject.net.flow.instructions.L2ModificationInstruction;
import org.onosproject.net.meter.MeterId;
+import org.opencord.olt.OltFlowsStatus;
import org.opencord.sadis.UniTagInformation;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -78,18 +79,18 @@
* @param type FlowRuleEvent type
* @return OltFlowService.OltFlowsStatus
*/
- public static OltFlowService.OltFlowsStatus flowRuleStatusToOltFlowStatus(FlowRuleEvent.Type type) {
+ public static OltFlowsStatus flowRuleStatusToOltFlowStatus(FlowRuleEvent.Type type) {
switch (type) {
case RULE_ADD_REQUESTED:
- return OltFlowService.OltFlowsStatus.PENDING_ADD;
+ return OltFlowsStatus.PENDING_ADD;
case RULE_ADDED:
- return OltFlowService.OltFlowsStatus.ADDED;
+ return OltFlowsStatus.ADDED;
case RULE_REMOVE_REQUESTED:
- return OltFlowService.OltFlowsStatus.PENDING_REMOVE;
+ return OltFlowsStatus.PENDING_REMOVE;
case RULE_REMOVED:
- return OltFlowService.OltFlowsStatus.REMOVED;
+ return OltFlowsStatus.REMOVED;
default:
- return OltFlowService.OltFlowsStatus.NONE;
+ return OltFlowsStatus.NONE;
}
}
diff --git a/impl/src/main/java/org/opencord/olt/impl/OltMeterService.java b/impl/src/main/java/org/opencord/olt/impl/OltMeterService.java
index 3c7410b..c6f2709 100644
--- a/impl/src/main/java/org/opencord/olt/impl/OltMeterService.java
+++ b/impl/src/main/java/org/opencord/olt/impl/OltMeterService.java
@@ -39,6 +39,9 @@
import org.onosproject.store.serializers.KryoNamespaces;
import org.onosproject.store.service.Serializer;
import org.onosproject.store.service.StorageService;
+import org.opencord.olt.MeterData;
+import org.opencord.olt.OltDeviceServiceInterface;
+import org.opencord.olt.OltMeterServiceInterface;
import org.opencord.sadis.BandwidthProfileInformation;
import org.opencord.sadis.BaseInformationService;
import org.opencord.sadis.SadisService;
diff --git a/impl/src/main/java/org/opencord/olt/impl/OltMeterServiceInterface.java b/impl/src/main/java/org/opencord/olt/impl/OltMeterServiceInterface.java
deleted file mode 100644
index 16d78ef..0000000
--- a/impl/src/main/java/org/opencord/olt/impl/OltMeterServiceInterface.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2021-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.impl;
-
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.meter.MeterId;
-import org.opencord.sadis.SubscriberAndDeviceInformation;
-
-import java.util.Map;
-
-/**
- * Interface for meter installation/removal methods
- * for different types of bandwidth profiles.
- */
-public interface OltMeterServiceInterface {
- /**
- * Checks for a meter, if not present it will create it and return false.
- * @param deviceId DeviceId
- * @param bandwidthProfile Bandwidth Profile Id
- * @return boolean
- */
- boolean createMeter(DeviceId deviceId, String bandwidthProfile);
-
- /**
- * Checks for all the meters specified in the sadis uniTagList,
- * if not present it will create them and return false.
- * @param deviceId DeviceId
- * @param si SubscriberAndDeviceInformation
- * @param multicastServiceName The multicast service name
- * @return boolean
- */
- boolean createMeters(DeviceId deviceId, SubscriberAndDeviceInformation si, String multicastServiceName);
-
- /**
- * Checks if a meter for the specified bandwidthProfile exists
- * and is in ADDED state.
- * @param deviceId DeviceId
- * @param bandwidthProfileId bandwidth profile id
- * @return true if present and in ADDED state
- */
- boolean hasMeterByBandwidthProfile(DeviceId deviceId, String bandwidthProfileId);
-
- /**
- * Checks if a meter for the specified bandwidthProfile exists
- * and is in PENDING_ADD state.
- * @param deviceId DeviceId
- * @param bandwidthProfileId bandwidth profile id
- * @return true if present and in PENDING_ADD state
- */
- boolean hasPendingMeterByBandwidthProfile(DeviceId deviceId, String bandwidthProfileId);
-
- /**
- * Creates a meter on a device for the given BandwidthProfile Id.
- * @param deviceId the device id
- * @param bandwidthProfileId the bandwidth profile Id
- */
- void createMeterForBp(DeviceId deviceId, String bandwidthProfileId);
-
- /**
- * Returns the meter Id for a given bandwidth profile Id.
- * @param deviceId the device id
- * @param bandwidthProfileId the bandwidth profile Id
- * @return the meter Id
- */
- MeterId getMeterIdForBandwidthProfile(DeviceId deviceId, String bandwidthProfileId);
-
- /**
- * Purges all the meters on a device.
- * @param deviceId the device
- */
- void purgeDeviceMeters(DeviceId deviceId);
-
- /**
- * Return all programmed meters for all OLTs controlled by this ONOS cluster.
- * @return a map, with the device keys, and entry of map with bp Id and corresponding meter
- */
- Map<DeviceId, Map<String, MeterData>> getProgrammedMeters();
-
-}
diff --git a/impl/src/main/java/org/opencord/olt/impl/OltPortStatus.java b/impl/src/main/java/org/opencord/olt/impl/OltPortStatus.java
deleted file mode 100644
index 3ef348a..0000000
--- a/impl/src/main/java/org/opencord/olt/impl/OltPortStatus.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2021-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.impl;
-
-import java.util.Objects;
-
-/**
- * OltPortStatus is used to keep track of the flow status for a subscriber service.
- */
-public class OltPortStatus {
- // TODO consider adding a lastUpdated field, it may help with debugging
- public OltFlowService.OltFlowsStatus defaultEapolStatus;
- public OltFlowService.OltFlowsStatus subscriberEapolStatus;
- public OltFlowService.OltFlowsStatus subscriberFlowsStatus;
- // NOTE we need to keep track of the DHCP status as that is installed before the other flows
- // if macLearning is enabled (DHCP is needed to learn the MacAddress from the host)
- public OltFlowService.OltFlowsStatus dhcpStatus;
- public OltFlowService.OltFlowsStatus pppoeStatus;
-
- public OltPortStatus(OltFlowService.OltFlowsStatus defaultEapolStatus,
- OltFlowService.OltFlowsStatus subscriberEapolStatus,
- OltFlowService.OltFlowsStatus subscriberFlowsStatus,
- OltFlowService.OltFlowsStatus dhcpStatus,
- OltFlowService.OltFlowsStatus pppoeStatus) {
- this.defaultEapolStatus = defaultEapolStatus;
- this.subscriberEapolStatus = subscriberEapolStatus;
- this.subscriberFlowsStatus = subscriberFlowsStatus;
- this.dhcpStatus = dhcpStatus;
- this.pppoeStatus = pppoeStatus;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- OltPortStatus that = (OltPortStatus) o;
- return defaultEapolStatus == that.defaultEapolStatus
- && subscriberEapolStatus == that.subscriberEapolStatus
- && subscriberFlowsStatus == that.subscriberFlowsStatus
- && dhcpStatus == that.dhcpStatus;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(defaultEapolStatus, subscriberEapolStatus,
- subscriberFlowsStatus, dhcpStatus);
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder("OltPortStatus{");
- sb.append("defaultEapolStatus=").append(defaultEapolStatus);
- sb.append(", subscriberEapolStatus=").append(subscriberEapolStatus);
- sb.append(", subscriberFlowsStatus=").append(subscriberFlowsStatus);
- sb.append(", dhcpStatus=").append(dhcpStatus);
- sb.append('}');
- return sb.toString();
- }
-}
diff --git a/impl/src/main/java/org/opencord/olt/impl/OltUtils.java b/impl/src/main/java/org/opencord/olt/impl/OltUtils.java
index 869a01d..45d684e 100644
--- a/impl/src/main/java/org/opencord/olt/impl/OltUtils.java
+++ b/impl/src/main/java/org/opencord/olt/impl/OltUtils.java
@@ -19,15 +19,14 @@
import org.onlab.packet.VlanId;
import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.Port;
+import org.opencord.olt.FlowOperation;
import org.opencord.sadis.SubscriberAndDeviceInformation;
import org.opencord.sadis.UniTagInformation;
-import static org.opencord.olt.impl.OltFlowService.FlowOperation.ADD;
-
/**
* Utility class for OLT app.
*/
-final class OltUtils {
+public final class OltUtils {
private OltUtils() {
}
@@ -37,7 +36,7 @@
* @param port the port
* @return the annotated port name
*/
- static String getPortName(Port port) {
+ public static String getPortName(Port port) {
String name = port.annotations().value(AnnotationKeys.PORT_NAME);
return name == null ? "" : name;
}
@@ -47,18 +46,18 @@
* @param port the port
* @return the formatted string
*/
- static String portWithName(Port port) {
+ public static String portWithName(Port port) {
return port.element().id().toString() + '/' +
port.number() + '[' +
getPortName(port) + ']';
}
- static String flowOpToString(OltFlowService.FlowOperation op) {
- return op == ADD ? "Adding" : "Removing";
+ public static String flowOpToString(FlowOperation op) {
+ return op == FlowOperation.ADD ? "Adding" : "Removing";
}
- static String completeFlowOpToString(OltFlowService.FlowOperation op) {
- return op == ADD ? "Added" : "Removed";
+ public static String completeFlowOpToString(FlowOperation op) {
+ return op == FlowOperation.ADD ? "Added" : "Removed";
}
/**
@@ -72,7 +71,7 @@
* @param tpId Techprofile Id
* @return UniTagInformation
*/
- static UniTagInformation getUniTagInformation(SubscriberAndDeviceInformation subInfo, VlanId innerVlan,
+ public static UniTagInformation getUniTagInformation(SubscriberAndDeviceInformation subInfo, VlanId innerVlan,
VlanId outerVlan, int tpId) {
UniTagInformation service = null;
for (UniTagInformation tagInfo : subInfo.uniTagList()) {
diff --git a/impl/src/main/java/org/opencord/olt/impl/ServiceKey.java b/impl/src/main/java/org/opencord/olt/impl/ServiceKey.java
deleted file mode 100644
index c878062..0000000
--- a/impl/src/main/java/org/opencord/olt/impl/ServiceKey.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2021-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.impl;
-
-import org.opencord.sadis.UniTagInformation;
-
-import java.util.Objects;
-
-/**
- * SubscriberKey is used to identify the combination of a subscriber and a service.
- */
-public class ServiceKey {
- private AccessDevicePort port;
- private UniTagInformation service;
-
- public ServiceKey(AccessDevicePort port, UniTagInformation service) {
- this.port = port;
- this.service = service;
- }
-
- public AccessDevicePort getPort() {
- return port;
- }
-
- public void setPort(AccessDevicePort port) {
- this.port = port;
- }
-
- public UniTagInformation getService() {
- return service;
- }
-
- public void setService(UniTagInformation service) {
- this.service = service;
- }
-
- @Override
- public String toString() {
- return this.port.toString() + " - " + this.service.getServiceName();
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- ServiceKey that = (ServiceKey) o;
- boolean isPortEqual = Objects.equals(port, that.port);
- boolean isServiceEqual = Objects.equals(service, that.service);
-
- return isPortEqual && isServiceEqual;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(port, service);
- }
-}
diff --git a/impl/src/main/java/org/opencord/olt/impl/ServiceKeySerializer.java b/impl/src/main/java/org/opencord/olt/impl/ServiceKeySerializer.java
index 4035bdd..6e0c85b 100644
--- a/impl/src/main/java/org/opencord/olt/impl/ServiceKeySerializer.java
+++ b/impl/src/main/java/org/opencord/olt/impl/ServiceKeySerializer.java
@@ -23,6 +23,8 @@
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
+import org.opencord.olt.AccessDevicePort;
+import org.opencord.olt.ServiceKey;
import org.opencord.sadis.UniTagInformation;
/**
diff --git a/impl/src/test/java/org/opencord/olt/impl/OltDeviceListenerTest.java b/impl/src/test/java/org/opencord/olt/impl/OltDeviceListenerTest.java
index 576053a..86bfcd8 100644
--- a/impl/src/test/java/org/opencord/olt/impl/OltDeviceListenerTest.java
+++ b/impl/src/test/java/org/opencord/olt/impl/OltDeviceListenerTest.java
@@ -36,6 +36,8 @@
import org.onosproject.net.device.DeviceEvent;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.provider.ProviderId;
+import org.opencord.olt.DiscoveredSubscriber;
+import org.opencord.olt.FlowOperation;
import org.opencord.sadis.BaseInformationService;
import org.opencord.sadis.SubscriberAndDeviceInformation;
import org.opencord.sadis.UniTagInformation;
@@ -143,7 +145,7 @@
// NNI events are straight forward, we can provision the flows directly
assert olt.eventsQueues.isEmpty();
verify(olt.oltFlowService, times(1))
- .handleNniFlows(testDevice, enabledNniPort, OltFlowService.FlowOperation.ADD);
+ .handleNniFlows(testDevice, enabledNniPort, FlowOperation.ADD);
Port disabledNniPort = new OltPort(testDevice, false, PortNumber.portNumber(1048576),
DefaultAnnotations.builder().set(AnnotationKeys.PORT_NAME, "nni-1").build());
@@ -153,7 +155,7 @@
// when the NNI goes down we ignore the event
assert olt.eventsQueues.isEmpty();
verify(olt.oltFlowService, never())
- .handleNniFlows(testDevice, disabledNniPort, OltFlowService.FlowOperation.REMOVE);
+ .handleNniFlows(testDevice, disabledNniPort, FlowOperation.REMOVE);
// if the NNI is removed we ignore the event
Port removedNniPort = new OltPort(testDevice, true, PortNumber.portNumber(1048576),
@@ -163,7 +165,7 @@
assert olt.eventsQueues.isEmpty();
verify(olt.oltFlowService, never())
- .handleNniFlows(testDevice, removedNniPort, OltFlowService.FlowOperation.REMOVE);
+ .handleNniFlows(testDevice, removedNniPort, FlowOperation.REMOVE);
}
@Test
diff --git a/impl/src/test/java/org/opencord/olt/impl/OltFlowServiceTest.java b/impl/src/test/java/org/opencord/olt/impl/OltFlowServiceTest.java
index 35474b7..94f36a3 100644
--- a/impl/src/test/java/org/opencord/olt/impl/OltFlowServiceTest.java
+++ b/impl/src/test/java/org/opencord/olt/impl/OltFlowServiceTest.java
@@ -63,6 +63,11 @@
import org.onosproject.net.meter.MeterId;
import org.onosproject.net.provider.ProviderId;
import org.onosproject.store.service.TestStorageService;
+import org.opencord.olt.AccessDevicePort;
+import org.opencord.olt.DiscoveredSubscriber;
+import org.opencord.olt.OltPortStatus;
+import org.opencord.olt.ServiceKey;
+import org.opencord.olt.FlowOperation;
import org.opencord.olt.impl.fttb.FttbUtils;
import org.opencord.sadis.BaseInformationService;
import org.opencord.sadis.SadisService;
@@ -88,12 +93,12 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.onosproject.net.AnnotationKeys.PORT_NAME;
-import static org.opencord.olt.impl.OltFlowService.OltFlowsStatus.ERROR;
-import static org.opencord.olt.impl.OltFlowService.OltFlowsStatus.NONE;
-import static org.opencord.olt.impl.OltFlowService.OltFlowsStatus.ADDED;
-import static org.opencord.olt.impl.OltFlowService.OltFlowsStatus.PENDING_ADD;
-import static org.opencord.olt.impl.OltFlowService.OltFlowsStatus.PENDING_REMOVE;
-import static org.opencord.olt.impl.OltFlowService.OltFlowsStatus.REMOVED;
+import static org.opencord.olt.OltFlowsStatus.ERROR;
+import static org.opencord.olt.OltFlowsStatus.NONE;
+import static org.opencord.olt.OltFlowsStatus.ADDED;
+import static org.opencord.olt.OltFlowsStatus.PENDING_ADD;
+import static org.opencord.olt.OltFlowsStatus.PENDING_REMOVE;
+import static org.opencord.olt.OltFlowsStatus.REMOVED;
import static org.opencord.olt.impl.OsgiPropertyConstants.DEFAULT_BP_ID_DEFAULT;
import static org.opencord.olt.impl.OsgiPropertyConstants.DEFAULT_MCAST_SERVICE_NAME;
import static org.opencord.olt.impl.OsgiPropertyConstants.DEFAULT_MCAST_SERVICE_NAME_DEFAULT;
@@ -294,7 +299,7 @@
DefaultAnnotations.builder().set(PORT_NAME, "name-1").build());
OltPortStatus portStatusAdded = new OltPortStatus(
- OltFlowService.OltFlowsStatus.ADDED,
+ ADDED,
NONE,
null,
null,
@@ -514,7 +519,7 @@
@Test
public void testHandleNniFlowsOnlyLldp() {
component.enableDhcpOnNni = false;
- component.handleNniFlows(testDevice, nniPort, OltFlowService.FlowOperation.ADD);
+ component.handleNniFlows(testDevice, nniPort, FlowOperation.ADD);
FilteringObjective expectedFilter = DefaultFilteringObjective.builder()
.permit()
@@ -535,7 +540,7 @@
public void testHandleNniFlowsDhcpV4() {
component.enableDhcpOnNni = true;
component.enableDhcpV4 = true;
- component.handleNniFlows(testDevice, nniPort, OltFlowService.FlowOperation.ADD);
+ component.handleNniFlows(testDevice, nniPort, FlowOperation.ADD);
FilteringObjective expectedFilter = DefaultFilteringObjective.builder()
.permit()
@@ -561,7 +566,7 @@
public void testRemoveNniFlowsDhcpV4() {
component.enableDhcpOnNni = true;
component.enableDhcpV4 = true;
- component.handleNniFlows(testDevice, nniPortDisabled, OltFlowService.FlowOperation.REMOVE);
+ component.handleNniFlows(testDevice, nniPortDisabled, FlowOperation.REMOVE);
FilteringObjective expectedFilter = DefaultFilteringObjective.builder()
.deny()
@@ -588,7 +593,7 @@
component.enableDhcpOnNni = true;
component.enableDhcpV4 = false;
component.enableDhcpV6 = true;
- component.handleNniFlows(testDevice, nniPort, OltFlowService.FlowOperation.ADD);
+ component.handleNniFlows(testDevice, nniPort, FlowOperation.ADD);
FilteringObjective expectedFilter = DefaultFilteringObjective.builder()
.permit()
@@ -614,7 +619,7 @@
public void testHandleNniFlowsIgmp() {
component.enableDhcpOnNni = false;
component.enableIgmpOnNni = true;
- component.handleNniFlows(testDevice, nniPort, OltFlowService.FlowOperation.ADD);
+ component.handleNniFlows(testDevice, nniPort, FlowOperation.ADD);
FilteringObjective expectedFilter = DefaultFilteringObjective.builder()
.permit()
@@ -638,7 +643,7 @@
component.enableDhcpOnNni = false;
component.enablePppoeOnNni = true;
component.enablePppoe = true;
- component.handleNniFlows(testDevice, nniPort, OltFlowService.FlowOperation.ADD);
+ component.handleNniFlows(testDevice, nniPort, FlowOperation.ADD);
FilteringObjective expectedFilter = DefaultFilteringObjective.builder()
.permit()
@@ -662,7 +667,7 @@
component.enableDhcpOnNni = false;
component.enablePppoeOnNni = true;
component.enablePppoe = true;
- component.handleNniFlows(testDevice, nniPortDisabled, OltFlowService.FlowOperation.REMOVE);
+ component.handleNniFlows(testDevice, nniPortDisabled, FlowOperation.REMOVE);
FilteringObjective expectedFilter = DefaultFilteringObjective.builder()
.deny()
@@ -789,7 +794,7 @@
.add();
component.handleSubscriberDhcpFlows(addedSub.device.id(), addedSub.port,
- OltFlowService.FlowOperation.ADD, si);
+ FlowOperation.ADD, si);
verify(component.flowObjectiveService, times(1))
.filter(eq(addedSub.device.id()), argThat(new FilteringObjectiveMatcher(expectedFilter)));
}
@@ -839,7 +844,7 @@
.add();
component.handleSubscriberPppoeFlows(addedSub.device.id(), addedSub.port,
- OltFlowService.FlowOperation.ADD, si);
+ FlowOperation.ADD, si);
verify(component.flowObjectiveService, times(1))
.filter(eq(addedSub.device.id()), argThat(new FilteringObjectiveMatcher(expectedFilter)));
}
@@ -915,17 +920,17 @@
doReturn(true).when(oltFlowService).areSubscriberFlowsPendingRemoval(any(), any(), eq(true));
boolean res = oltFlowService.removeSubscriberFlows(sub, DEFAULT_BP_ID_DEFAULT, DEFAULT_MCAST_SERVICE_NAME);
verify(oltFlowService, times(1))
- .handleSubscriberDhcpFlows(deviceId, port, OltFlowService.FlowOperation.REMOVE, si);
+ .handleSubscriberDhcpFlows(deviceId, port, FlowOperation.REMOVE, si);
verify(oltFlowService, times(1))
- .handleSubscriberEapolFlows(sub, OltFlowService.FlowOperation.REMOVE, si);
+ .handleSubscriberEapolFlows(sub, FlowOperation.REMOVE, si);
verify(oltFlowService, times(1))
- .handleSubscriberDataFlows(device, port, OltFlowService.FlowOperation.REMOVE,
+ .handleSubscriberDataFlows(device, port, FlowOperation.REMOVE,
si, DEFAULT_MCAST_SERVICE_NAME);
verify(oltFlowService, times(1))
- .handleSubscriberIgmpFlows(sub, OltFlowService.FlowOperation.REMOVE);
+ .handleSubscriberIgmpFlows(sub, FlowOperation.REMOVE);
verify(oltFlowService, never())
.handleEapolFlow(any(), any(), any(),
- eq(OltFlowService.FlowOperation.ADD), eq(VlanId.vlanId(OltFlowService.EAPOL_DEFAULT_VLAN)));
+ eq(FlowOperation.ADD), eq(VlanId.vlanId(OltFlowService.EAPOL_DEFAULT_VLAN)));
Assert.assertFalse(res);
// then test that if the tagged EAPOL is not there we install the default EAPOL
@@ -935,7 +940,7 @@
res = oltFlowService.removeSubscriberFlows(sub, DEFAULT_BP_ID_DEFAULT, DEFAULT_MCAST_SERVICE_NAME);
verify(oltFlowService, times(1))
.handleEapolFlow(any(), any(), any(),
- eq(OltFlowService.FlowOperation.ADD), eq(VlanId.vlanId(OltFlowService.EAPOL_DEFAULT_VLAN)));
+ eq(FlowOperation.ADD), eq(VlanId.vlanId(OltFlowService.EAPOL_DEFAULT_VLAN)));
Assert.assertTrue(res);
}
@@ -1011,7 +1016,7 @@
when(component.sadisService.getSubscriberInfoService().get(testDevice.serialNumber())).
thenReturn(testOltFttbSadis);
- component.handleNniFlows(testDevice, nniPort, OltFlowService.FlowOperation.ADD);
+ component.handleNniFlows(testDevice, nniPort, FlowOperation.ADD);
FilteringObjective expectedFilter = DefaultFilteringObjective.builder()
.permit()
@@ -1087,7 +1092,7 @@
.add();
component.handleSubscriberDhcpFlows(addedSub.device.id(), addedSub.port,
- OltFlowService.FlowOperation.ADD, si);
+ FlowOperation.ADD, si);
verify(component.flowObjectiveService, times(1))
.filter(eq(addedSub.device.id()), argThat(new FilteringObjectiveMatcher(expectedFilter)));
}
@@ -1144,7 +1149,7 @@
.add();
component.handleSubscriberDhcpFlows(removedSub.device.id(), removedSub.port,
- OltFlowService.FlowOperation.REMOVE, si);
+ FlowOperation.REMOVE, si);
verify(component.flowObjectiveService, times(1))
.filter(eq(removedSub.device.id()), argThat(new FilteringObjectiveMatcher(expectedFilter)));
}
@@ -1251,7 +1256,7 @@
.add();
component.handleSubscriberDataFlows(addedSub.device, addedSub.port,
- OltFlowService.FlowOperation.ADD, si, DEFAULT_MCAST_SERVICE_NAME_DEFAULT);
+ FlowOperation.ADD, si, DEFAULT_MCAST_SERVICE_NAME_DEFAULT);
verify(component.flowObjectiveService, times(1))
.forward(eq(addedSub.device.id()), eq(expected));
}
@@ -1371,7 +1376,7 @@
.remove();
component.handleSubscriberDataFlows(removedSub.device, removedSub.port,
- OltFlowService.FlowOperation.REMOVE, si, DEFAULT_MCAST_SERVICE_NAME_DEFAULT);
+ FlowOperation.REMOVE, si, DEFAULT_MCAST_SERVICE_NAME_DEFAULT);
verify(component.flowObjectiveService, times(1))
.forward(eq(removedSub.device.id()), eq(expected));
}
@@ -1467,7 +1472,7 @@
.add();
component.handleSubscriberDataFlows(addedSub.device, addedSub.port,
- OltFlowService.FlowOperation.ADD, si, DEFAULT_MCAST_SERVICE_NAME_DEFAULT);
+ FlowOperation.ADD, si, DEFAULT_MCAST_SERVICE_NAME_DEFAULT);
verify(component.flowObjectiveService, times(1))
.forward(eq(addedSub.device.id()), eq(expected));
}
@@ -1570,7 +1575,7 @@
.remove();
component.handleSubscriberDataFlows(removedSub.device, removedSub.port,
- OltFlowService.FlowOperation.REMOVE, si, DEFAULT_MCAST_SERVICE_NAME_DEFAULT);
+ FlowOperation.REMOVE, si, DEFAULT_MCAST_SERVICE_NAME_DEFAULT);
verify(component.flowObjectiveService, times(1))
.forward(eq(removedSub.device.id()), eq(expected));
}
diff --git a/impl/src/test/java/org/opencord/olt/impl/OltMeterServiceTest.java b/impl/src/test/java/org/opencord/olt/impl/OltMeterServiceTest.java
index a7d653c..8e90a2b 100644
--- a/impl/src/test/java/org/opencord/olt/impl/OltMeterServiceTest.java
+++ b/impl/src/test/java/org/opencord/olt/impl/OltMeterServiceTest.java
@@ -29,6 +29,7 @@
import org.onosproject.net.meter.MeterState;
import org.onosproject.store.service.StorageServiceAdapter;
import org.onosproject.store.service.TestStorageService;
+import org.opencord.olt.MeterData;
import org.opencord.sadis.SadisService;
import java.util.HashMap;
diff --git a/impl/src/test/java/org/opencord/olt/impl/OltTest.java b/impl/src/test/java/org/opencord/olt/impl/OltTest.java
index d968c24..9197297 100644
--- a/impl/src/test/java/org/opencord/olt/impl/OltTest.java
+++ b/impl/src/test/java/org/opencord/olt/impl/OltTest.java
@@ -39,6 +39,7 @@
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.provider.ProviderId;
import org.onosproject.store.service.TestStorageService;
+import org.opencord.olt.DiscoveredSubscriber;
import org.opencord.sadis.SadisService;
import org.opencord.sadis.SubscriberAndDeviceInformation;
import org.opencord.sadis.UniTagInformation;