Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Ray Milkey | 34c9590 | 2015-04-15 09:47:53 -0700 | [diff] [blame] | 2 | * Copyright 2014-2015 Open Networking Laboratory |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.device; |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 17 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 18 | import org.onosproject.net.Device; |
| 19 | import org.onosproject.net.DeviceId; |
| 20 | import org.onosproject.net.Port; |
| 21 | import org.onosproject.net.PortNumber; |
| 22 | import org.onosproject.net.provider.ProviderId; |
| 23 | import org.onosproject.store.Store; |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 24 | |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 25 | import java.util.Collection; |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 26 | import java.util.List; |
| 27 | |
| 28 | /** |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 29 | * Manages inventory of infrastructure devices; not intended for direct use. |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 30 | */ |
tom | f80c972 | 2014-09-24 14:49:18 -0700 | [diff] [blame] | 31 | public interface DeviceStore extends Store<DeviceEvent, DeviceStoreDelegate> { |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 32 | |
| 33 | /** |
| 34 | * Returns the number of devices known to the system. |
| 35 | * |
| 36 | * @return number of devices |
| 37 | */ |
| 38 | int getDeviceCount(); |
| 39 | |
| 40 | /** |
| 41 | * Returns an iterable collection of all devices known to the system. |
| 42 | * |
| 43 | * @return device collection |
| 44 | */ |
| 45 | Iterable<Device> getDevices(); |
| 46 | |
| 47 | /** |
Yuta HIGUCHI | f1f2ac0 | 2014-11-26 14:02:22 -0800 | [diff] [blame] | 48 | * Returns an iterable collection of all devices currently available to the system. |
| 49 | * |
| 50 | * @return device collection |
| 51 | */ |
| 52 | Iterable<Device> getAvailableDevices(); |
| 53 | |
| 54 | |
| 55 | |
| 56 | /** |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 57 | * Returns the device with the specified identifier. |
| 58 | * |
| 59 | * @param deviceId device identifier |
| 60 | * @return device |
| 61 | */ |
| 62 | Device getDevice(DeviceId deviceId); |
| 63 | |
| 64 | /** |
| 65 | * Creates a new infrastructure device, or updates an existing one using |
| 66 | * the supplied device description. |
| 67 | * |
| 68 | * @param providerId provider identifier |
| 69 | * @param deviceId device identifier |
| 70 | * @param deviceDescription device description |
| 71 | * @return ready to send event describing what occurred; null if no change |
| 72 | */ |
| 73 | DeviceEvent createOrUpdateDevice(ProviderId providerId, DeviceId deviceId, |
| 74 | DeviceDescription deviceDescription); |
| 75 | |
Yuta HIGUCHI | 5f6739c | 2014-10-01 14:04:01 -0700 | [diff] [blame] | 76 | // TODO: We may need to enforce that ancillary cannot interfere this state |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 77 | /** |
| 78 | * Removes the specified infrastructure device. |
| 79 | * |
| 80 | * @param deviceId device identifier |
| 81 | * @return ready to send event describing what occurred; null if no change |
| 82 | */ |
| 83 | DeviceEvent markOffline(DeviceId deviceId); |
| 84 | |
| 85 | /** |
| 86 | * Updates the ports of the specified infrastructure device using the given |
| 87 | * list of port descriptions. The list is assumed to be comprehensive. |
| 88 | * |
Yuta HIGUCHI | 5f6739c | 2014-10-01 14:04:01 -0700 | [diff] [blame] | 89 | * @param providerId provider identifier |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 90 | * @param deviceId device identifier |
| 91 | * @param portDescriptions list of port descriptions |
| 92 | * @return ready to send events describing what occurred; empty list if no change |
| 93 | */ |
Yuta HIGUCHI | 5f6739c | 2014-10-01 14:04:01 -0700 | [diff] [blame] | 94 | List<DeviceEvent> updatePorts(ProviderId providerId, DeviceId deviceId, |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 95 | List<PortDescription> portDescriptions); |
| 96 | |
| 97 | /** |
| 98 | * Updates the port status of the specified infrastructure device using the |
| 99 | * given port description. |
| 100 | * |
Yuta HIGUCHI | 5f6739c | 2014-10-01 14:04:01 -0700 | [diff] [blame] | 101 | * @param providerId provider identifier |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 102 | * @param deviceId device identifier |
| 103 | * @param portDescription port description |
| 104 | * @return ready to send event describing what occurred; null if no change |
| 105 | */ |
Yuta HIGUCHI | 5f6739c | 2014-10-01 14:04:01 -0700 | [diff] [blame] | 106 | DeviceEvent updatePortStatus(ProviderId providerId, DeviceId deviceId, |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 107 | PortDescription portDescription); |
| 108 | |
| 109 | /** |
| 110 | * Returns the list of ports that belong to the specified device. |
| 111 | * |
| 112 | * @param deviceId device identifier |
| 113 | * @return list of device ports |
| 114 | */ |
| 115 | List<Port> getPorts(DeviceId deviceId); |
| 116 | |
| 117 | /** |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 118 | * Updates the port statistics of the specified device using the give port |
| 119 | * statistics. |
| 120 | * |
| 121 | * @param providerId provider identifier |
| 122 | * @param deviceId device identifier |
| 123 | * @param portStats list of port statistics |
| 124 | * @return ready to send event describing what occurred; |
| 125 | */ |
| 126 | DeviceEvent updatePortStatistics(ProviderId providerId, DeviceId deviceId, |
| 127 | Collection<PortStatistics> portStats); |
| 128 | |
| 129 | /** |
| 130 | * Returns the list of port statistics of the specified device. |
| 131 | * |
| 132 | * @param deviceId device identifier |
| 133 | * @return list of port statistics of all ports of the device |
| 134 | */ |
| 135 | List<PortStatistics> getPortStatistics(DeviceId deviceId); |
| 136 | |
| 137 | /** |
Dusan Pajin | 11ff4a8 | 2015-08-20 18:03:05 +0200 | [diff] [blame] | 138 | * Returns the list of delta port statistics of the specified device. |
| 139 | * |
Madan Jampani | f97edc1 | 2015-08-31 14:41:01 -0700 | [diff] [blame] | 140 | * @param deviceId device identifier |
Dusan Pajin | 11ff4a8 | 2015-08-20 18:03:05 +0200 | [diff] [blame] | 141 | * @return list of delta port statistics of all ports of the device |
| 142 | */ |
| 143 | List<PortStatistics> getPortDeltaStatistics(DeviceId deviceId); |
| 144 | |
| 145 | /** |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 146 | * Returns the specified device port. |
| 147 | * |
| 148 | * @param deviceId device identifier |
| 149 | * @param portNumber port number |
| 150 | * @return device port |
| 151 | */ |
| 152 | Port getPort(DeviceId deviceId, PortNumber portNumber); |
| 153 | |
| 154 | /** |
| 155 | * Indicates whether the specified device is available/online. |
| 156 | * |
| 157 | * @param deviceId device identifier |
| 158 | * @return true if device is available |
| 159 | */ |
| 160 | boolean isAvailable(DeviceId deviceId); |
| 161 | |
| 162 | /** |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 163 | * Administratively removes the specified device from the store. |
| 164 | * |
| 165 | * @param deviceId device to be removed |
Yuta HIGUCHI | 5c94727 | 2014-11-03 21:39:21 -0800 | [diff] [blame] | 166 | * @return null if no such device, or was forwarded to remove master |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 167 | */ |
| 168 | DeviceEvent removeDevice(DeviceId deviceId); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 169 | |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 170 | } |