Jian Li | 4f368e8 | 2018-07-02 14:22:22 +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 | |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 18 | import org.onlab.packet.IpAddress; |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 19 | import org.onosproject.event.ListenerService; |
| 20 | import org.onosproject.net.DeviceId; |
| 21 | |
| 22 | import java.util.Set; |
| 23 | |
Jian Li | 4f368e8 | 2018-07-02 14:22:22 +0900 | [diff] [blame] | 24 | /** |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 25 | * Service for interacting with the inventory of openstack vtap. |
Jian Li | 4f368e8 | 2018-07-02 14:22:22 +0900 | [diff] [blame] | 26 | */ |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 27 | public interface OpenstackVtapService |
| 28 | extends ListenerService<OpenstackVtapEvent, OpenstackVtapListener> { |
Jian Li | 4f368e8 | 2018-07-02 14:22:22 +0900 | [diff] [blame] | 29 | |
| 30 | /** |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 31 | * Creates a new openstack vtap network based on the specified description. |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 32 | * |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 33 | * @param mode mode of vtap network |
| 34 | * @param networkId network id of the vtap tunneling network |
| 35 | * @param serverIp server IP address used for tunneling |
| 36 | * @return created openstack vtap network object or null if error occurred |
| 37 | */ |
| 38 | OpenstackVtapNetwork createVtapNetwork(OpenstackVtapNetwork.Mode mode, Integer networkId, IpAddress serverIp); |
| 39 | |
| 40 | /** |
| 41 | * Updates the openstack vtap network based on the specified description. |
| 42 | * |
| 43 | * @param description description of vtap network |
| 44 | * @return updated openstack vtap network object or null if error occurred |
| 45 | */ |
| 46 | OpenstackVtapNetwork updateVtapNetwork(OpenstackVtapNetwork description); |
| 47 | |
| 48 | /** |
| 49 | * Removes the specified openstack vtap network. |
| 50 | * |
| 51 | * @return removed openstack vtap network object or null if error occurred |
| 52 | */ |
| 53 | OpenstackVtapNetwork removeVtapNetwork(); |
| 54 | |
| 55 | /** |
| 56 | * Returns the openstack vtap network. |
| 57 | * |
| 58 | * @return openstack vtap network or null if not exists |
| 59 | */ |
| 60 | OpenstackVtapNetwork getVtapNetwork(); |
| 61 | |
| 62 | /** |
| 63 | * Returns a set of devices which are associated with the openstack vtap network. |
| 64 | * |
| 65 | * @return set of devices |
| 66 | */ |
| 67 | Set<DeviceId> getVtapNetworkDevices(); |
| 68 | |
| 69 | /** |
| 70 | * Creates a new openstack vtap based on the specified type and criterion. |
| 71 | * |
| 72 | * @param type type of vtap (all,rx,tx) |
| 73 | * @param vtapCriterion criterion of vtap |
| 74 | * @return created openstack vtap object or null if error occurred |
| 75 | */ |
| 76 | OpenstackVtap createVtap(OpenstackVtap.Type type, OpenstackVtapCriterion vtapCriterion); |
| 77 | |
| 78 | /** |
| 79 | * Updates the openstack vtap with specified description. |
| 80 | * |
| 81 | * @param description description of vtap |
| 82 | * @return updated openstack vtap object or null if error occurred |
| 83 | */ |
| 84 | OpenstackVtap updateVtap(OpenstackVtap description); |
| 85 | |
| 86 | /** |
| 87 | * Removes the specified openstack vtap with given vtap identifier. |
| 88 | * |
| 89 | * @param vtapId vtap identifier |
| 90 | * @return removed openstack vtap object or null if error occurred |
| 91 | */ |
| 92 | OpenstackVtap removeVtap(OpenstackVtapId vtapId); |
| 93 | |
| 94 | /** |
| 95 | * Returns the number of openstack vtaps for the given type. |
| 96 | * |
| 97 | * @param type type of vtap (any,rx,tx,all) |
| 98 | * @return number of openstack vtaps |
Jian Li | 4f368e8 | 2018-07-02 14:22:22 +0900 | [diff] [blame] | 99 | */ |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 100 | int getVtapCount(OpenstackVtap.Type type); |
| 101 | |
| 102 | /** |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 103 | * Returns a set of openstack vtaps for the given type. |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 104 | * |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 105 | * @param type type of vtap (any,rx,tx,all) |
| 106 | * @return set of openstack vtaps |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 107 | */ |
| 108 | Set<OpenstackVtap> getVtaps(OpenstackVtap.Type type); |
| 109 | |
| 110 | /** |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 111 | * Returns the openstack vtap with the specified identifier. |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 112 | * |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 113 | * @param vtapId vtap identifier |
| 114 | * @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] | 115 | */ |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 116 | OpenstackVtap getVtap(OpenstackVtapId vtapId); |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 117 | |
| 118 | /** |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 119 | * Returns a set of openstack vtaps which are associated with the given device. |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 120 | * |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 121 | * @param deviceId device identifier |
| 122 | * @return set of openstack vtaps |
Jian Li | 38e4d94 | 2018-07-03 22:19:16 +0900 | [diff] [blame] | 123 | */ |
Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +0900 | [diff] [blame] | 124 | Set<OpenstackVtap> getVtapsByDeviceId(DeviceId deviceId); |
Jian Li | 4f368e8 | 2018-07-02 14:22:22 +0900 | [diff] [blame] | 125 | } |