Carmelo Cascone | e5b2872 | 2018-06-22 17:28:28 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-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 | package org.onosproject.net.device; |
| 17 | |
| 18 | import org.onosproject.event.AbstractEvent; |
| 19 | import org.onosproject.net.DeviceId; |
| 20 | |
| 21 | /** |
| 22 | * Describes and event related to a protocol agent used to interact with an |
| 23 | * infrastructure device. |
| 24 | */ |
| 25 | public final class DeviceAgentEvent |
| 26 | extends AbstractEvent<DeviceAgentEvent.Type, DeviceId> { |
| 27 | |
| 28 | /** |
| 29 | * Type of device events. |
| 30 | */ |
| 31 | public enum Type { |
| 32 | /** |
| 33 | * Signifies that a channel between the agent and the device is open and |
| 34 | * the two can communicate. |
| 35 | */ |
| 36 | CHANNEL_OPEN, |
| 37 | |
| 38 | /** |
| 39 | * Signifies that a channel between the agent and the device is closed |
| 40 | * and the two cannot communicate. |
| 41 | */ |
| 42 | CHANNEL_CLOSED, |
| 43 | |
| 44 | /** |
| 45 | * Signifies that a channel error has been detected. Further |
| 46 | * investigation should be performed to check if the channel is still |
| 47 | * open or closed. |
| 48 | */ |
| 49 | CHANNEL_ERROR, |
| 50 | |
| 51 | /** |
| 52 | * Signifies that the agent has acquired master role. |
| 53 | */ |
| 54 | ROLE_MASTER, |
| 55 | |
| 56 | /** |
Carmelo Cascone | 3977ea4 | 2019-02-28 13:43:42 -0800 | [diff] [blame] | 57 | * Signifies that the agent has acquired standby/slave mastership role. |
Carmelo Cascone | e5b2872 | 2018-06-22 17:28:28 +0200 | [diff] [blame] | 58 | */ |
| 59 | ROLE_STANDBY, |
| 60 | |
| 61 | /** |
Carmelo Cascone | 3977ea4 | 2019-02-28 13:43:42 -0800 | [diff] [blame] | 62 | * Signifies that the agent doesn't have any valid mastership role for |
Carmelo Cascone | e5b2872 | 2018-06-22 17:28:28 +0200 | [diff] [blame] | 63 | * the device. |
| 64 | */ |
| 65 | ROLE_NONE, |
| 66 | |
Carmelo Cascone | de3b684 | 2018-09-05 17:45:10 -0700 | [diff] [blame] | 67 | /** |
Carmelo Cascone | 3977ea4 | 2019-02-28 13:43:42 -0800 | [diff] [blame] | 68 | * Signifies that the agent tried to perform some operations on the |
| 69 | * device that requires master role. |
Carmelo Cascone | de3b684 | 2018-09-05 17:45:10 -0700 | [diff] [blame] | 70 | */ |
| 71 | NOT_MASTER, |
| 72 | |
Carmelo Cascone | e5b2872 | 2018-06-22 17:28:28 +0200 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | /** |
| 76 | * Creates a new device agent event for the given type and device ID. |
| 77 | * |
| 78 | * @param type event type |
| 79 | * @param deviceId device ID |
| 80 | */ |
| 81 | public DeviceAgentEvent(Type type, DeviceId deviceId) { |
| 82 | super(type, deviceId); |
| 83 | } |
Carmelo Cascone | e5b2872 | 2018-06-22 17:28:28 +0200 | [diff] [blame] | 84 | } |