Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 1 | /* |
| 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 | package org.onosproject.openstackvtap.api; |
| 17 | |
| 18 | import org.onosproject.net.DeviceId; |
| 19 | import org.onosproject.store.Store; |
| 20 | |
| 21 | import java.util.Set; |
| 22 | |
| 23 | /** |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 24 | * Manages inventory of openstack vtap datum; not intended for direct use. |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 25 | */ |
| 26 | public interface OpenstackVtapStore |
| 27 | extends Store<OpenstackVtapEvent, OpenstackVtapStoreDelegate> { |
| 28 | |
| 29 | /** |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 30 | * Creates a new openstack vtap network based on the specified description. |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 31 | * |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 32 | * @param key vtap network identifier |
| 33 | * @param description description of vtap network |
| 34 | * @return created openstack vtap network object or null if error occurred |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 35 | */ |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 36 | OpenstackVtapNetwork createVtapNetwork(Integer key, OpenstackVtapNetwork description); |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 37 | |
| 38 | /** |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 39 | * Updates the openstack vtap network based on the specified description. |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 40 | * |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 41 | * @param key vtap network identifier |
| 42 | * @param description description of vtap network |
| 43 | * @return updated openstack vtap network object or null if error occurred |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 44 | */ |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 45 | OpenstackVtapNetwork updateVtapNetwork(Integer key, OpenstackVtapNetwork description); |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 46 | |
| 47 | /** |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 48 | * Removes the specified openstack vtap network with the specified identifier. |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 49 | * |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 50 | * @param key vtap network identifier |
| 51 | * @return removed openstack vtap network object or null if error occurred |
| 52 | */ |
| 53 | OpenstackVtapNetwork removeVtapNetwork(Integer key); |
| 54 | |
| 55 | /** |
| 56 | * Removes all openstack vtap networks. |
| 57 | */ |
| 58 | void clearVtapNetworks(); |
| 59 | |
| 60 | /** |
| 61 | * Returns the number of openstack vtap networks. |
| 62 | * |
| 63 | * @return number of openstack vtap networks |
| 64 | */ |
| 65 | int getVtapNetworkCount(); |
| 66 | |
| 67 | /** |
| 68 | * Returns the openstack vtap network with the specified identifier. |
| 69 | * |
| 70 | * @param key vtap network identifier |
| 71 | * @return openstack vtap or null if one with the given identifier is not known |
| 72 | */ |
| 73 | OpenstackVtapNetwork getVtapNetwork(Integer key); |
| 74 | |
| 75 | /** |
| 76 | * Adds the specified device id to the specified vtap network entry. |
| 77 | * |
| 78 | * @param key vtap network identifier |
| 79 | * @param deviceId device identifier to be added |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 80 | * @return true on success, false otherwise |
| 81 | */ |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 82 | boolean addDeviceToVtapNetwork(Integer key, DeviceId deviceId); |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 83 | |
| 84 | /** |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 85 | * Removes the specified device id from the specified vtap network entry. |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 86 | * |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 87 | * @param key vtap network identifier |
| 88 | * @param deviceId device identifier to be removed |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 89 | * @return true on success, false otherwise |
| 90 | */ |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 91 | boolean removeDeviceFromVtapNetwork(Integer key, DeviceId deviceId); |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 92 | |
| 93 | /** |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 94 | * Returns a set of device identifiers from the specified vtap network entry. |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 95 | * |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 96 | * @param key vtap network identifier |
| 97 | * @return set of device identifier |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 98 | */ |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 99 | Set<DeviceId> getVtapNetworkDevices(Integer key); |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 100 | |
| 101 | /** |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 102 | * Creates a new openstack vtap based on the specified description. |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 103 | * |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 104 | * @param description description of vtap |
| 105 | * @return created openstack vtap object or null if error occurred |
| 106 | */ |
| 107 | OpenstackVtap createVtap(OpenstackVtap description); |
| 108 | |
| 109 | /** |
| 110 | * Updates the openstack vtap with specified description. |
| 111 | * |
| 112 | * @param description description of vtap |
| 113 | * @param replaceDevices replace device set if true, merge device set otherwise |
| 114 | * @return updated openstack vtap object or null if error occurred |
| 115 | */ |
| 116 | OpenstackVtap updateVtap(OpenstackVtap description, boolean replaceDevices); |
| 117 | |
| 118 | /** |
| 119 | * Removes the specified openstack vtap with given vtap identifier. |
| 120 | * |
| 121 | * @param vtapId vtap identifier |
| 122 | * @return removed openstack vtap object or null if error occurred |
| 123 | */ |
| 124 | OpenstackVtap removeVtap(OpenstackVtapId vtapId); |
| 125 | |
| 126 | /** |
| 127 | * Removes all openstack vtaps. |
| 128 | */ |
| 129 | void clearVtaps(); |
| 130 | |
| 131 | /** |
| 132 | * Returns the number of openstack vtaps for the given type. |
| 133 | * |
| 134 | * @param type type of vtap (any,rx,tx,all) |
| 135 | * @return number of openstack vtaps |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 136 | */ |
| 137 | int getVtapCount(OpenstackVtap.Type type); |
| 138 | |
| 139 | /** |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 140 | * Returns a set of openstack vtaps for the given type. |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 141 | * |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 142 | * @param type type of vtap (any,rx,tx,all) |
| 143 | * @return set of openstack vtaps |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 144 | */ |
| 145 | Set<OpenstackVtap> getVtaps(OpenstackVtap.Type type); |
| 146 | |
| 147 | /** |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 148 | * Returns the openstack vtap with the specified identifier. |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 149 | * |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 150 | * @param vtapId vtap identifier |
| 151 | * @return openstack vtap or null if one with the given identifier is not known |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 152 | */ |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 153 | OpenstackVtap getVtap(OpenstackVtapId vtapId); |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 154 | |
| 155 | /** |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 156 | * Adds the specified device id to the specified vtap entry. |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 157 | * |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 158 | * @param vtapId vtap identifier |
| 159 | * @param type type of vtap (any,rx,tx,all) |
| 160 | * @param deviceId device identifier to be added |
| 161 | * @return true on success, false otherwise |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 162 | */ |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 163 | boolean addDeviceToVtap(OpenstackVtapId vtapId, OpenstackVtap.Type type, DeviceId deviceId); |
| 164 | |
| 165 | /** |
| 166 | * Removes the specified device id from the vtap entry. |
| 167 | * |
| 168 | * @param vtapId vtap identifier |
| 169 | * @param type type of vtap (any,rx,tx,all) |
| 170 | * @param deviceId device identifier to be removed |
| 171 | * @return true on success, false otherwise |
| 172 | */ |
| 173 | boolean removeDeviceFromVtap(OpenstackVtapId vtapId, OpenstackVtap.Type type, DeviceId deviceId); |
| 174 | |
| 175 | /** |
| 176 | * Returns a set of openstack vtaps which are associated with the given device. |
| 177 | * |
| 178 | * @param deviceId device identifier |
| 179 | * @return set of openstack vtaps |
| 180 | */ |
| 181 | Set<OpenstackVtap> getVtapsByDeviceId(DeviceId deviceId); |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 182 | } |