blob: a10455b1fff74a4587c7c193b01584de39b4f799 [file] [log] [blame]
Matteo Scandoloaa2adde2021-09-13 12:45:32 -07001/*
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
17package org.opencord.olt.impl;
18
19import org.onosproject.net.DeviceId;
20import org.onosproject.net.meter.MeterId;
21import org.opencord.sadis.SubscriberAndDeviceInformation;
22
23import java.util.Map;
24
25/**
26 * Interface for meter installation/removal methods
27 * for different types of bandwidth profiles.
28 */
29public 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
43 * @return boolean
44 */
45 boolean createMeters(DeviceId deviceId, SubscriberAndDeviceInformation si);
46
47 /**
48 * Checks if a meter for the specified bandwidthProfile exists
49 * and is in ADDED state.
50 * @param deviceId DeviceId
51 * @param bandwidthProfileId bandwidth profile id
52 * @return true if present and in ADDED state
53 */
54 boolean hasMeterByBandwidthProfile(DeviceId deviceId, String bandwidthProfileId);
55
56 /**
57 * Checks if a meter for the specified bandwidthProfile exists
58 * and is in PENDING_ADD state.
59 * @param deviceId DeviceId
60 * @param bandwidthProfileId bandwidth profile id
61 * @return true if present and in PENDING_ADD state
62 */
63 boolean hasPendingMeterByBandwidthProfile(DeviceId deviceId, String bandwidthProfileId);
64
65 /**
66 * Creates a meter on a device for the given BandwidthProfile Id.
67 * @param deviceId the device id
68 * @param bandwidthProfileId the bandwidth profile Id
69 */
70 void createMeterForBp(DeviceId deviceId, String bandwidthProfileId);
71
72 /**
73 * Returns the meter Id for a given bandwidth profile Id.
74 * @param deviceId the device id
75 * @param bandwidthProfileId the bandwidth profile Id
76 * @return the meter Id
77 */
78 MeterId getMeterIdForBandwidthProfile(DeviceId deviceId, String bandwidthProfileId);
79
80 /**
81 * Purges all the meters on a device.
82 * @param deviceId the device
83 */
84 void purgeDeviceMeters(DeviceId deviceId);
85
86 /**
87 * Return all programmed meters for all OLTs controlled by this ONOS cluster.
88 * @return a map, with the device keys, and entry of map with bp Id and corresponding meter
89 */
90 Map<DeviceId, Map<String, MeterData>> getProgrammedMeters();
91
92}