Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 80dff97 | 2017-08-03 22:46:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -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 | */ |
Hyunsun Moon | fd5a24e | 2016-10-19 19:15:48 -0700 | [diff] [blame] | 16 | package org.opencord.cordvtn.api.net; |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 17 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 18 | import org.onlab.packet.IpAddress; |
| 19 | import org.onlab.packet.IpPrefix; |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 20 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 21 | import java.util.Map; |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 22 | |
| 23 | /** |
Hyunsun Moon | 851e57f | 2017-02-23 19:38:40 +0900 | [diff] [blame] | 24 | * Representation of a service network. |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 25 | */ |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 26 | public interface ServiceNetwork { |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 27 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 28 | enum NetworkType { |
Hyunsun Moon | 0d00fb4 | 2017-08-09 18:21:03 +0900 | [diff] [blame] | 29 | /** |
| 30 | * Isolated tenant network. |
| 31 | */ |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 32 | PRIVATE, |
Hyunsun Moon | 0d00fb4 | 2017-08-09 18:21:03 +0900 | [diff] [blame] | 33 | /** |
| 34 | * Provider network that offers connectivity to external network via L3. |
| 35 | * This network relies on the physical network infrastructure or vRouter |
| 36 | * for gateway and first hop routing service. |
| 37 | */ |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 38 | PUBLIC, |
Hyunsun Moon | 0d00fb4 | 2017-08-09 18:21:03 +0900 | [diff] [blame] | 39 | /** |
| 40 | * Provider network that offers connectivity to the physical network via L2. |
| 41 | * This network runs over the physical data network and allows physical |
| 42 | * machines and virtual instances in a same broadcast domain. |
| 43 | */ |
| 44 | FLAT, |
| 45 | /** |
| 46 | * Virtual instance management network that offers connectivity to head node. |
| 47 | * This network runs over the physical management network, and cannot be |
| 48 | * part of service chain. |
| 49 | */ |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 50 | MANAGEMENT_HOST, |
Hyunsun Moon | 0d00fb4 | 2017-08-09 18:21:03 +0900 | [diff] [blame] | 51 | /** |
| 52 | * Virtual instance management network that offers limited connectivity |
| 53 | * between the virtual instance and the host machine. |
| 54 | * This network does not span compute nodes, and cannot be part of |
| 55 | * service chain. |
| 56 | */ |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 57 | MANAGEMENT_LOCAL, |
Hyunsun Moon | 0d00fb4 | 2017-08-09 18:21:03 +0900 | [diff] [blame] | 58 | /** |
| 59 | * Special network for R-CORD vSG. |
| 60 | * This network type is deprecated in favor of ServicePort VLAN. |
| 61 | */ |
Hyunsun Moon | d02a5a7 | 2017-02-05 22:00:05 +0900 | [diff] [blame] | 62 | @Deprecated |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 63 | VSG, |
Hyunsun Moon | 0d00fb4 | 2017-08-09 18:21:03 +0900 | [diff] [blame] | 64 | /** |
| 65 | * Special network for R-CORD access agent. |
| 66 | * This network cannot be part of service chain. |
| 67 | */ |
| 68 | ACCESS_AGENT, |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 69 | } |
| 70 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 71 | enum DependencyType { |
| 72 | BIDIRECTIONAL, |
| 73 | UNIDIRECTIONAL |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | /** |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 77 | * Returns the service network identifier. |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 78 | * |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 79 | * @return service network identifier |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 80 | */ |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 81 | NetworkId id(); |
| 82 | |
| 83 | /** |
| 84 | * Returns the service network name. |
| 85 | * |
| 86 | * @return service network name. |
| 87 | */ |
| 88 | String name(); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 89 | |
| 90 | /** |
| 91 | * Returns the type of the service network. |
| 92 | * |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 93 | * @return service network type; empty value if type is not set |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 94 | */ |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 95 | NetworkType type(); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 96 | |
| 97 | /** |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 98 | * Returns the service network segmentation identifier. |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 99 | * |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 100 | * @return segmentation id; empty value if segment id is not set |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 101 | */ |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 102 | SegmentId segmentId(); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 103 | |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 104 | /** |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 105 | * Returns the subnet of the service network. |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 106 | * |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 107 | * @return subnet ip prefix; empty value if subnet is not set |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 108 | */ |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 109 | IpPrefix subnet(); |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 110 | |
Hyunsun Moon | 0984cbd | 2016-12-01 17:34:11 -0800 | [diff] [blame] | 111 | /** |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 112 | * Returns the service IP address of the service network. |
Hyunsun Moon | 0984cbd | 2016-12-01 17:34:11 -0800 | [diff] [blame] | 113 | * |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 114 | * @return service ip; empty value if service ip is not set |
Hyunsun Moon | 0984cbd | 2016-12-01 17:34:11 -0800 | [diff] [blame] | 115 | */ |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 116 | IpAddress serviceIp(); |
Hyunsun Moon | 0984cbd | 2016-12-01 17:34:11 -0800 | [diff] [blame] | 117 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 118 | /** |
| 119 | * Returns the providers of the service network. |
| 120 | * |
| 121 | * @return set of provider networks; empty map if no providers exist |
| 122 | */ |
| 123 | Map<NetworkId, DependencyType> providers(); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 124 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 125 | /** |
| 126 | * Builder of new service network entities. |
| 127 | */ |
| 128 | interface Builder { |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 129 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 130 | /** |
| 131 | * Builds an immutable service network instance. |
| 132 | * |
| 133 | * @return service network instance |
| 134 | */ |
| 135 | ServiceNetwork build(); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 136 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 137 | /** |
| 138 | * Returns service network builder with the supplied identifier. |
| 139 | * |
| 140 | * @param networkId network id |
| 141 | * @return service network builder |
| 142 | */ |
| 143 | Builder id(NetworkId networkId); |
| 144 | |
| 145 | /** |
| 146 | * Returns service network builder with the supplied name. |
| 147 | * |
| 148 | * @param name network name |
| 149 | * @return service network builder |
| 150 | */ |
| 151 | Builder name(String name); |
| 152 | |
| 153 | /** |
| 154 | * Returns service network builder with the supplied type. |
| 155 | * |
| 156 | * @param type service network type |
| 157 | * @return service network builder |
| 158 | */ |
| 159 | Builder type(NetworkType type); |
| 160 | |
| 161 | /** |
| 162 | * Returns service network builder with the supplied segmentation id. |
| 163 | * |
| 164 | * @param segmentId segmentation id |
| 165 | * @return service network builder |
| 166 | */ |
| 167 | Builder segmentId(SegmentId segmentId); |
| 168 | |
| 169 | /** |
| 170 | * Returns service network builder with the supplied subnet. |
| 171 | * |
| 172 | * @param subnet subnet |
| 173 | * @return service network builder |
| 174 | */ |
| 175 | Builder subnet(IpPrefix subnet); |
| 176 | |
| 177 | /** |
| 178 | * Returns service network builder with the supplied service IP address. |
| 179 | * |
| 180 | * @param serviceIp service ip address |
| 181 | * @return service network builder |
| 182 | */ |
| 183 | Builder serviceIp(IpAddress serviceIp); |
| 184 | |
| 185 | /** |
| 186 | * Returns service network builder with the supplied providers. |
| 187 | * |
| 188 | * @param providers set of provider network |
| 189 | * @return service network builder |
| 190 | */ |
| 191 | Builder providers(Map<NetworkId, DependencyType> providers); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 192 | } |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 193 | } |