blob: b2140706243c3edb0344d752f401d78d1c413b49 [file] [log] [blame]
Carmelo Casconee5b28722018-06-22 17:28:28 +02001/*
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 */
16package org.onosproject.net.device;
17
18import org.onosproject.event.AbstractEvent;
19import org.onosproject.net.DeviceId;
20
21/**
22 * Describes and event related to a protocol agent used to interact with an
23 * infrastructure device.
24 */
25public 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 Cascone3977ea42019-02-28 13:43:42 -080057 * Signifies that the agent has acquired standby/slave mastership role.
Carmelo Casconee5b28722018-06-22 17:28:28 +020058 */
59 ROLE_STANDBY,
60
61 /**
Carmelo Cascone3977ea42019-02-28 13:43:42 -080062 * Signifies that the agent doesn't have any valid mastership role for
Carmelo Casconee5b28722018-06-22 17:28:28 +020063 * the device.
64 */
65 ROLE_NONE,
66
Carmelo Casconede3b6842018-09-05 17:45:10 -070067 /**
Carmelo Cascone3977ea42019-02-28 13:43:42 -080068 * Signifies that the agent tried to perform some operations on the
69 * device that requires master role.
Carmelo Casconede3b6842018-09-05 17:45:10 -070070 */
71 NOT_MASTER,
72
Carmelo Casconee5b28722018-06-22 17:28:28 +020073 }
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 Casconee5b28722018-06-22 17:28:28 +020084}