blob: 10c5d8b644840da3f1d167f9f9812d22a3ae5dcb [file] [log] [blame]
Shubham Sharma4900ce62019-06-19 14:18:50 +00001/*
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
17package org.opencord.aaa;
18
19import org.onlab.packet.RADIUS;
20import org.onosproject.event.ListenerService;
21
22/**
23 * Service for interacting with operational status module.
24 */
25
26public interface RadiusOperationalStatusService extends
27 ListenerService<RadiusOperationalStatusEvent, RadiusOperationalStatusEventListener> {
28 /**
29 * Return RadiusOperationalStatusEventDelegate object.
30 *
31 * @return RadiusOperationalStatusEventDelegate
32 */
33 RadiusOperationalStatusEventDelegate getRadiusOprStDelegate();
34
35 /**
36 * Return String object.
37 *
38 * @return String
39 */
40 String getRadiusServerOperationalStatus();
41
42 /**
43 * Set the value of statusServerReqSent flag.
44 *
45 * @param statusServerReqSent statusServerReqSent flag
46 */
47 void setStatusServerReqSent(boolean statusServerReqSent);
48
49 /**
50 * Set the value of radiusOperationalStatus Evaluation Mode.
51 *
52 * @param radiusOperationalStatusEvaluationMode radiusOperationalStatusEvaluationMode value
53 */
54 void setRadiusOperationalStatusEvaluationMode(
55 RadiusOperationalStatusEvaluationMode radiusOperationalStatusEvaluationMode);
56
57 /**
58 * Set the value of Operational Status Server Timeout In Milliseconds.
59 *
60 * @param operationalStatusServerTimeoutInMillis operationalStatusServerTimeoutInMillis
61 */
62 void setOperationalStatusServerTimeoutInMillis(long operationalStatusServerTimeoutInMillis);
63
64 /**
65 * Determine the operational status of server.
66 */
67 void checkServerOperationalStatus();
68
69 /**
70 * Check if radius response is for operational status.
71 *
72 * @param identifier identifier value of radius packet
73 * @return boolean
74 */
75 boolean isRadiusResponseForOperationalStatus(byte identifier);
76
77 /**
78 * handle incoming radius packet for operational status.
79 *
80 * @param radiusPacket radiusPacket of incoming operational status
81 */
82 void handleRadiusPacketForOperationalStatus(RADIUS radiusPacket);
83
84 /**
85 * initialize radiusOperationalStatusService.
86 *
87 * @param address address of radius server
88 * @param secret secret key for radius server
89 * @param impl impl of RadiusCommunicator
90 */
91 void initialize(byte[] address, String secret, RadiusCommunicator impl);
92
93 /**
94 * set packet outgoing time in milliseconds.
95 *
96 * @param identifier identifier of outgoing packet
97 */
98 void setOutTimeInMillis(byte identifier);
99
100 enum OperationalStatus {
101 UNAVAILABLE,
102 UNKNOWN,
103 IN_USE,
104 }
105
106 enum RadiusOperationalStatusEvaluationMode {
107
108 STATUS_REQUEST, ACCESS_REQUEST, AUTO;
109
110 public static RadiusOperationalStatusEvaluationMode getValue(String value) {
111
112 for (RadiusOperationalStatusEvaluationMode mode: RadiusOperationalStatusEvaluationMode.values()) {
113 if (mode.toString().equalsIgnoreCase(value)) {
114 return mode;
115 }
116 }
117 return null;
118 }
119 }
120
121}