alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 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.AbstractEvent; |
| 19 | |
| 20 | /** |
| 21 | * Entity that represents Meter events. |
| 22 | */ |
alshabib | eadfc8e | 2015-08-18 15:40:46 -0700 | [diff] [blame] | 23 | public class MeterEvent extends AbstractEvent<MeterEvent.Type, Meter> { |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 24 | |
| 25 | |
alshabib | 7bb0501 | 2015-08-05 10:15:09 -0700 | [diff] [blame] | 26 | public enum Type { |
alshabib | eadfc8e | 2015-08-18 15:40:46 -0700 | [diff] [blame] | 27 | /** |
| 28 | * A meter addition was requested. |
| 29 | */ |
| 30 | METER_ADD_REQ, |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 31 | |
| 32 | /** |
alshabib | eadfc8e | 2015-08-18 15:40:46 -0700 | [diff] [blame] | 33 | * A meter removal was requested. |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 34 | */ |
Jordi Ortiz | df28ecd | 2017-03-25 19:22:36 +0100 | [diff] [blame] | 35 | METER_REM_REQ, |
| 36 | |
| 37 | /** |
| 38 | * A meter was finally added to device. |
| 39 | */ |
| 40 | METER_ADDED, |
| 41 | |
| 42 | /** |
| 43 | * A meter was finally removed from device. |
| 44 | */ |
Gamze Abaka | dadae72 | 2018-09-12 10:55:35 +0000 | [diff] [blame] | 45 | METER_REMOVED, |
| 46 | |
| 47 | /** |
| 48 | * Meter is not used by any flow. It can be deleted. |
| 49 | */ |
| 50 | METER_REFERENCE_COUNT_ZERO |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | |
| 54 | /** |
| 55 | * Creates an event of a given type and for the specified meter and the |
| 56 | * current time. |
| 57 | * |
| 58 | * @param type meter event type |
alshabib | eadfc8e | 2015-08-18 15:40:46 -0700 | [diff] [blame] | 59 | * @param meter event subject |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 60 | */ |
alshabib | eadfc8e | 2015-08-18 15:40:46 -0700 | [diff] [blame] | 61 | public MeterEvent(Type type, Meter meter) { |
| 62 | super(type, meter); |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Creates an event of a given type and for the specified meter and time. |
| 67 | * |
| 68 | * @param type meter event type |
alshabib | eadfc8e | 2015-08-18 15:40:46 -0700 | [diff] [blame] | 69 | * @param meter event subject |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 70 | * @param time occurrence time |
| 71 | */ |
alshabib | eadfc8e | 2015-08-18 15:40:46 -0700 | [diff] [blame] | 72 | public MeterEvent(Type type, Meter meter, long time) { |
| 73 | super(type, meter, time); |
alshabib | 7bb0501 | 2015-08-05 10:15:09 -0700 | [diff] [blame] | 74 | } |
| 75 | |
alshabib | 1d2bc40 | 2015-07-31 17:04:11 -0700 | [diff] [blame] | 76 | |
| 77 | } |