Andrea Campanella | 945ded2 | 2016-01-07 13:17:43 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Andrea Campanella | 945ded2 | 2016-01-07 13:17:43 -0800 | [diff] [blame] | 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 | |
| 17 | package org.onosproject.protocol.rest; |
| 18 | |
| 19 | import org.onlab.packet.IpAddress; |
| 20 | import org.onosproject.net.DeviceId; |
| 21 | |
Michele Santuari | c372c22 | 2017-01-12 09:41:25 +0100 | [diff] [blame] | 22 | import java.util.Optional; |
| 23 | |
Andrea Campanella | 945ded2 | 2016-01-07 13:17:43 -0800 | [diff] [blame] | 24 | /** |
| 25 | * Represents an abstraction of a Rest Device in ONOS. |
| 26 | */ |
| 27 | public interface RestSBDevice { |
| 28 | /** |
fahadnaeemkhan | 02ffa71 | 2017-12-01 19:49:45 -0800 | [diff] [blame] | 29 | * REST Authentication schemes. |
| 30 | */ |
| 31 | public enum AuthenticationScheme { |
| 32 | NO_AUTHENTICATION, |
| 33 | BASIC, |
| 34 | OAUTH, |
| 35 | OAUTH2, |
| 36 | } |
| 37 | |
| 38 | /** |
Andrea Campanella | 945ded2 | 2016-01-07 13:17:43 -0800 | [diff] [blame] | 39 | * Returns the ip of this device. |
| 40 | * |
| 41 | * @return ip |
| 42 | */ |
| 43 | IpAddress ip(); |
| 44 | |
| 45 | /** |
Georgios Katsikas | 80e0b9f | 2018-07-21 20:29:18 +0200 | [diff] [blame^] | 46 | * Returns the port of this device. |
Andrea Campanella | 945ded2 | 2016-01-07 13:17:43 -0800 | [diff] [blame] | 47 | * |
| 48 | * @return port |
| 49 | */ |
| 50 | int port(); |
| 51 | |
| 52 | /** |
fahadnaeemkhan | 02ffa71 | 2017-12-01 19:49:45 -0800 | [diff] [blame] | 53 | * 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 Campanella | 784ee0f | 2016-02-17 15:50:59 -0800 | [diff] [blame] | 67 | * Returns the username of this device. |
Andrea Campanella | 945ded2 | 2016-01-07 13:17:43 -0800 | [diff] [blame] | 68 | * |
Andrea Campanella | 784ee0f | 2016-02-17 15:50:59 -0800 | [diff] [blame] | 69 | * @return username |
Andrea Campanella | 945ded2 | 2016-01-07 13:17:43 -0800 | [diff] [blame] | 70 | */ |
Andrea Campanella | 784ee0f | 2016-02-17 15:50:59 -0800 | [diff] [blame] | 71 | String username(); |
Andrea Campanella | 945ded2 | 2016-01-07 13:17:43 -0800 | [diff] [blame] | 72 | |
| 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 Campanella | 2947e62 | 2016-01-27 09:23:46 -0800 | [diff] [blame] | 108 | /** |
| 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 Santuari | c372c22 | 2017-01-12 09:41:25 +0100 | [diff] [blame] | 114 | |
| 115 | /** |
| 116 | * Returns the proxy state of this device |
| 117 | * (if true, the device is proxying multiple ONOS devices). |
fahadnaeemkhan | 02ffa71 | 2017-12-01 19:49:45 -0800 | [diff] [blame] | 118 | * |
Michele Santuari | c372c22 | 2017-01-12 09:41:25 +0100 | [diff] [blame] | 119 | * @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(); |
fahadnaeemkhan | 02ffa71 | 2017-12-01 19:49:45 -0800 | [diff] [blame] | 150 | |
Andrea Campanella | 945ded2 | 2016-01-07 13:17:43 -0800 | [diff] [blame] | 151 | } |