blob: 31aa17f229d915feb5c131e80488acbf4962971a [file] [log] [blame]
alshabib1d2bc402015-07-31 17:04:11 -07001/*
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 */
alshabib10c810b2015-08-18 16:59:04 -070016package org.onosproject.net.meter;
alshabib1d2bc402015-07-31 17:04:11 -070017
18import org.onosproject.event.ListenerService;
19
alshabib58fe6dc2015-08-19 17:16:13 -070020import java.util.Collection;
21
alshabib1d2bc402015-07-31 17:04:11 -070022/**
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 */
27public 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 */
alshabibeadfc8e2015-08-18 15:40:46 -070035 void addMeter(MeterOperation meter);
alshabib1d2bc402015-07-31 17:04:11 -070036
37 /**
38 * Updates a meter by adding statistic information to the meter.
39 *
40 * @param meter an updated meter
41 */
alshabibeadfc8e2015-08-18 15:40:46 -070042 void updateMeter(MeterOperation meter);
alshabib1d2bc402015-07-31 17:04:11 -070043
44 /**
45 * Remove a meter from the system and the dataplane.
46 *
47 * @param meter a meter to remove
48 */
alshabibeadfc8e2015-08-18 15:40:46 -070049 void removeMeter(MeterOperation meter);
alshabib1d2bc402015-07-31 17:04:11 -070050
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 /**
alshabib58fe6dc2015-08-19 17:16:13 -070060 * Fetches all the meters.
61 *
62 * @return a collection of meters
63 */
64 Collection<Meter> getAllMeters();
65
66 /**
alshabib1d2bc402015-07-31 17:04:11 -070067 * Allocate a meter id which must be used to create the meter.
68 *
69 * @return a meter id
70 */
71 MeterId allocateMeterId();
72}