blob: bdc90eb718c80f2f657a2d64af2ebd8e326e438c [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 *
alshabibe1248b62015-08-20 17:21:55 -070033 * @param meter a meter
34 * @return a meter (with a meter id)
alshabib1d2bc402015-07-31 17:04:11 -070035 */
alshabibe1248b62015-08-20 17:21:55 -070036 Meter submit(MeterRequest meter);
alshabib1d2bc402015-07-31 17:04:11 -070037
38 /**
39 * Remove a meter from the system and the dataplane.
40 *
41 * @param meter a meter to remove
alshabibe1248b62015-08-20 17:21:55 -070042 * @param meterId the meter id of the meter to remove.
alshabib1d2bc402015-07-31 17:04:11 -070043 */
alshabibe1248b62015-08-20 17:21:55 -070044 void withdraw(MeterRequest meter, MeterId meterId);
alshabib1d2bc402015-07-31 17:04:11 -070045
46 /**
47 * Fetch the meter by the meter id.
48 *
49 * @param id a meter id
50 * @return a meter
51 */
52 Meter getMeter(MeterId id);
53
54 /**
alshabib58fe6dc2015-08-19 17:16:13 -070055 * Fetches all the meters.
56 *
57 * @return a collection of meters
58 */
59 Collection<Meter> getAllMeters();
60
alshabib1d2bc402015-07-31 17:04:11 -070061}