Jimo Jung | 14e87bf | 2018-09-03 16:28:13 +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.onlab.packet.IpAddress; |
| 19 | import org.onosproject.net.Annotated; |
| 20 | import org.onosproject.net.SparseAnnotations; |
| 21 | |
| 22 | /** |
| 23 | * Abstraction of an openstack vtap network. |
| 24 | */ |
| 25 | public interface OpenstackVtapNetwork extends Annotated { |
| 26 | |
| 27 | /** |
| 28 | * List of valid openstack vtap tunneling modes. |
| 29 | */ |
| 30 | enum Mode { |
| 31 | /** |
| 32 | * Indicates GRE tunneling. |
| 33 | */ |
| 34 | GRE, |
| 35 | |
| 36 | /** |
| 37 | * Indicates VXLAN tunneling. |
| 38 | */ |
| 39 | VXLAN |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Returns the OpenstackVtapNetwork mode. |
| 44 | * |
| 45 | * @return mode of vtap tunneling |
| 46 | */ |
| 47 | Mode mode(); |
| 48 | |
| 49 | /** |
| 50 | * Returns the network id of the vtap tunneling. |
| 51 | * |
| 52 | * @return networkId (e.g., gre key, vxlan vni) |
| 53 | */ |
| 54 | Integer networkId(); |
| 55 | |
| 56 | /** |
| 57 | * Returns the vtap server IP address used for tunneling. |
| 58 | * |
| 59 | * @return ip address for vtap server |
| 60 | */ |
| 61 | IpAddress serverIp(); |
| 62 | |
| 63 | /** |
| 64 | * Builder of new OpenstackVtapNetwork instance. |
| 65 | */ |
| 66 | interface Builder { |
| 67 | /** |
| 68 | * Returns openstack vtap network builder with supplied OpenstackVtapNetwork mode. |
| 69 | * |
| 70 | * @param mode mode of vtap tunneling |
| 71 | * @return openstack vtap network builder |
| 72 | */ |
| 73 | Builder mode(Mode mode); |
| 74 | |
| 75 | /** |
| 76 | * Returns openstack vtap network builder with supplied networkId for tunneling. |
| 77 | * |
| 78 | * @param networkId (e.g., gre key, vxlan vni) |
| 79 | * @return openstack vtap network builder |
| 80 | */ |
| 81 | Builder networkId(Integer networkId); |
| 82 | |
| 83 | /** |
| 84 | * Returns openstack vtap network builder with supplied server IP address. |
| 85 | * |
| 86 | * @param serverIp ip address for vtap server |
| 87 | * @return openstack vtap network builder |
| 88 | */ |
| 89 | Builder serverIp(IpAddress serverIp); |
| 90 | |
| 91 | /** |
| 92 | * Returns openstack vtap network builder with supplied annotations. |
| 93 | * |
| 94 | * @param annotations a set of annotations |
| 95 | * @return openstack vtap network builder |
| 96 | */ |
| 97 | Builder annotations(SparseAnnotations annotations); |
| 98 | |
| 99 | /** |
| 100 | * Builds an immutable OpenstackVtapNetwork instance. |
| 101 | * |
| 102 | * @return OpenstackVtapNetwork instance |
| 103 | */ |
| 104 | OpenstackVtapNetwork build(); |
| 105 | } |
| 106 | } |