blob: 0a22764ad768d7a1ca77d290427345e313cf5e9c [file] [log] [blame]
Andrea Campanella945ded22016-01-07 13:17:43 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Andrea Campanella945ded22016-01-07 13:17:43 -08003 *
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.onosproject.protocol.rest;
18
19import org.onlab.packet.IpAddress;
20import org.onosproject.net.DeviceId;
21
Michele Santuaric372c222017-01-12 09:41:25 +010022import java.util.Optional;
23
Andrea Campanella945ded22016-01-07 13:17:43 -080024/**
25 * Represents an abstraction of a Rest Device in ONOS.
26 */
27public interface RestSBDevice {
28 /**
fahadnaeemkhan02ffa712017-12-01 19:49:45 -080029 * REST Authentication schemes.
30 */
31 public enum AuthenticationScheme {
32 NO_AUTHENTICATION,
33 BASIC,
34 OAUTH,
35 OAUTH2,
36 }
37
38 /**
Andrea Campanella945ded22016-01-07 13:17:43 -080039 * Returns the ip of this device.
40 *
41 * @return ip
42 */
43 IpAddress ip();
44
45 /**
Georgios Katsikas80e0b9f2018-07-21 20:29:18 +020046 * Returns the port of this device.
Andrea Campanella945ded22016-01-07 13:17:43 -080047 *
48 * @return port
49 */
50 int port();
51
52 /**
fahadnaeemkhan02ffa712017-12-01 19:49:45 -080053 * The authentication scheme of rest device.
54 *
55 * @return authentication
56 */
57 AuthenticationScheme authentication();
58
59 /**
60 * The access token of rest device if authentication is OAuth2.
61 *
62 * @return token
63 */
64 String token();
65
66 /**
Andrea Campanella784ee0f2016-02-17 15:50:59 -080067 * Returns the username of this device.
Andrea Campanella945ded22016-01-07 13:17:43 -080068 *
Andrea Campanella784ee0f2016-02-17 15:50:59 -080069 * @return username
Andrea Campanella945ded22016-01-07 13:17:43 -080070 */
Andrea Campanella784ee0f2016-02-17 15:50:59 -080071 String username();
Andrea Campanella945ded22016-01-07 13:17:43 -080072
73 /**
74 * Returns the password of this device.
75 *
76 * @return password
77 */
78 String password();
79
80 /**
81 * Returns the ONOS deviceID for this device.
82 *
83 * @return DeviceId
84 */
85 DeviceId deviceId();
86
87 /**
88 * Sets or unsets the state of the device.
89 *
90 * @param active boolean
91 */
92 void setActive(boolean active);
93
94 /**
95 * Returns the state of this device.
96 *
97 * @return state
98 */
99 boolean isActive();
100
101 /**
102 * Returns the protocol for the REST request, usually HTTP o HTTPS.
103 *
104 * @return protocol
105 */
106 String protocol();
107
Andrea Campanella2947e622016-01-27 09:23:46 -0800108 /**
109 * Returns the url for the REST requests, to be used instead of IP and PORT.
110 *
111 * @return url
112 */
113 String url();
Michele Santuaric372c222017-01-12 09:41:25 +0100114
115 /**
116 * Returns the proxy state of this device
117 * (if true, the device is proxying multiple ONOS devices).
fahadnaeemkhan02ffa712017-12-01 19:49:45 -0800118 *
Michele Santuaric372c222017-01-12 09:41:25 +0100119 * @return proxy state
120 */
121 boolean isProxy();
122
123 /**
124 * Returns the url for the REST TEST requests.
125 *
126 * @return testUrl
127 */
128 Optional<String> testUrl();
129
130 /**
131 * The manufacturer of the rest device.
132 *
133 * @return the name of the manufacturer
134 */
135 Optional<String> manufacturer();
136
137 /**
138 * The hardware version of the rest device.
139 *
140 * @return the hardware version
141 */
142 Optional<String> hwVersion();
143
144 /**
145 * The software version of rest device.
146 *
147 * @return the software version.
148 */
149 Optional<String> swVersion();
fahadnaeemkhan02ffa712017-12-01 19:49:45 -0800150
Andrea Campanella945ded22016-01-07 13:17:43 -0800151}