alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 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 | */ |
alshabib | 10c810b | 2015-08-18 16:59:04 -0700 | [diff] [blame] | 16 | package org.onosproject.net.meter; |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 17 | |
| 18 | import org.onosproject.event.ListenerService; |
| 19 | |
alshabib | 58fe6dc | 2015-08-19 17:16:13 -0700 | [diff] [blame] | 20 | import java.util.Collection; |
| 21 | |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 22 | /** |
| 23 | * Service for add/updating and removing meters. Meters are |
| 24 | * are assigned to flow to rate limit them and provide a certain |
| 25 | * quality of service. |
| 26 | */ |
| 27 | public interface MeterService |
| 28 | extends ListenerService<MeterEvent, MeterListener> { |
| 29 | |
| 30 | /** |
| 31 | * Adds a meter to the system and performs it installation. |
| 32 | * |
| 33 | * @param meter a meter. |
| 34 | */ |
alshabib | eadfc8e | 2015-08-18 15:40:46 -0700 | [diff] [blame] | 35 | void addMeter(MeterOperation meter); |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 36 | |
| 37 | /** |
| 38 | * Updates a meter by adding statistic information to the meter. |
| 39 | * |
| 40 | * @param meter an updated meter |
| 41 | */ |
alshabib | eadfc8e | 2015-08-18 15:40:46 -0700 | [diff] [blame] | 42 | void updateMeter(MeterOperation meter); |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 43 | |
| 44 | /** |
| 45 | * Remove a meter from the system and the dataplane. |
| 46 | * |
| 47 | * @param meter a meter to remove |
| 48 | */ |
alshabib | eadfc8e | 2015-08-18 15:40:46 -0700 | [diff] [blame] | 49 | void removeMeter(MeterOperation meter); |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 50 | |
| 51 | /** |
| 52 | * Fetch the meter by the meter id. |
| 53 | * |
| 54 | * @param id a meter id |
| 55 | * @return a meter |
| 56 | */ |
| 57 | Meter getMeter(MeterId id); |
| 58 | |
| 59 | /** |
alshabib | 58fe6dc | 2015-08-19 17:16:13 -0700 | [diff] [blame] | 60 | * Fetches all the meters. |
| 61 | * |
| 62 | * @return a collection of meters |
| 63 | */ |
| 64 | Collection<Meter> getAllMeters(); |
| 65 | |
| 66 | /** |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 67 | * Allocate a meter id which must be used to create the meter. |
| 68 | * |
| 69 | * @return a meter id |
| 70 | */ |
| 71 | MeterId allocateMeterId(); |
| 72 | } |