blob: 22eab99cb41745116a20ade99ee7f5470c8778d4 [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 /**
57 * Signifies that the agent has standby/slave mastership role.
58 */
59 ROLE_STANDBY,
60
61 /**
62 * Signifies that the agent cannot acquire any valid mastership role for
63 * the device.
64 */
65 ROLE_NONE,
66
67 }
68
69 /**
70 * Creates a new device agent event for the given type and device ID.
71 *
72 * @param type event type
73 * @param deviceId device ID
74 */
75 public DeviceAgentEvent(Type type, DeviceId deviceId) {
76 super(type, deviceId);
77 }
78
79 /**
80 * Creates a new device agent event for the given type, device ID and time.
81 *
82 * @param type event type
83 * @param deviceId device ID
84 * @param time occurrence time
85 */
86 public DeviceAgentEvent(Type type, DeviceId deviceId, long time) {
87 super(type, deviceId, time);
88 }
89}