Matteo Scandolo | aa2adde | 2021-09-13 12:45:32 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2021-present Open Networking Foundation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Gustavo Silva | 29fb20e | 2022-05-26 09:59:54 -0300 | [diff] [blame] | 17 | package org.opencord.olt; |
Matteo Scandolo | aa2adde | 2021-09-13 12:45:32 -0700 | [diff] [blame] | 18 | |
| 19 | import org.onosproject.net.DeviceId; |
| 20 | import org.onosproject.net.meter.MeterId; |
| 21 | import org.opencord.sadis.SubscriberAndDeviceInformation; |
| 22 | |
| 23 | import java.util.Map; |
| 24 | |
| 25 | /** |
| 26 | * Interface for meter installation/removal methods |
| 27 | * for different types of bandwidth profiles. |
| 28 | */ |
| 29 | public interface OltMeterServiceInterface { |
| 30 | /** |
| 31 | * Checks for a meter, if not present it will create it and return false. |
| 32 | * @param deviceId DeviceId |
| 33 | * @param bandwidthProfile Bandwidth Profile Id |
| 34 | * @return boolean |
| 35 | */ |
| 36 | boolean createMeter(DeviceId deviceId, String bandwidthProfile); |
| 37 | |
| 38 | /** |
| 39 | * Checks for all the meters specified in the sadis uniTagList, |
| 40 | * if not present it will create them and return false. |
| 41 | * @param deviceId DeviceId |
| 42 | * @param si SubscriberAndDeviceInformation |
Matteo Scandolo | 88df8ae | 2021-11-23 13:12:29 -0800 | [diff] [blame] | 43 | * @param multicastServiceName The multicast service name |
Matteo Scandolo | aa2adde | 2021-09-13 12:45:32 -0700 | [diff] [blame] | 44 | * @return boolean |
| 45 | */ |
Matteo Scandolo | 88df8ae | 2021-11-23 13:12:29 -0800 | [diff] [blame] | 46 | boolean createMeters(DeviceId deviceId, SubscriberAndDeviceInformation si, String multicastServiceName); |
Matteo Scandolo | aa2adde | 2021-09-13 12:45:32 -0700 | [diff] [blame] | 47 | |
| 48 | /** |
| 49 | * Checks if a meter for the specified bandwidthProfile exists |
| 50 | * and is in ADDED state. |
| 51 | * @param deviceId DeviceId |
| 52 | * @param bandwidthProfileId bandwidth profile id |
| 53 | * @return true if present and in ADDED state |
| 54 | */ |
| 55 | boolean hasMeterByBandwidthProfile(DeviceId deviceId, String bandwidthProfileId); |
| 56 | |
| 57 | /** |
| 58 | * Checks if a meter for the specified bandwidthProfile exists |
| 59 | * and is in PENDING_ADD state. |
| 60 | * @param deviceId DeviceId |
| 61 | * @param bandwidthProfileId bandwidth profile id |
| 62 | * @return true if present and in PENDING_ADD state |
| 63 | */ |
| 64 | boolean hasPendingMeterByBandwidthProfile(DeviceId deviceId, String bandwidthProfileId); |
| 65 | |
| 66 | /** |
| 67 | * Creates a meter on a device for the given BandwidthProfile Id. |
| 68 | * @param deviceId the device id |
| 69 | * @param bandwidthProfileId the bandwidth profile Id |
| 70 | */ |
| 71 | void createMeterForBp(DeviceId deviceId, String bandwidthProfileId); |
| 72 | |
| 73 | /** |
| 74 | * Returns the meter Id for a given bandwidth profile Id. |
| 75 | * @param deviceId the device id |
| 76 | * @param bandwidthProfileId the bandwidth profile Id |
| 77 | * @return the meter Id |
| 78 | */ |
| 79 | MeterId getMeterIdForBandwidthProfile(DeviceId deviceId, String bandwidthProfileId); |
| 80 | |
| 81 | /** |
| 82 | * Purges all the meters on a device. |
| 83 | * @param deviceId the device |
| 84 | */ |
| 85 | void purgeDeviceMeters(DeviceId deviceId); |
| 86 | |
| 87 | /** |
| 88 | * Return all programmed meters for all OLTs controlled by this ONOS cluster. |
| 89 | * @return a map, with the device keys, and entry of map with bp Id and corresponding meter |
| 90 | */ |
| 91 | Map<DeviceId, Map<String, MeterData>> getProgrammedMeters(); |
| 92 | |
| 93 | } |