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 | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 29 | PRIVATE, |
| 30 | PUBLIC, |
| 31 | MANAGEMENT_HOST, |
| 32 | MANAGEMENT_LOCAL, |
Hyunsun Moon | d02a5a7 | 2017-02-05 22:00:05 +0900 | [diff] [blame] | 33 | @Deprecated |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 34 | VSG, |
| 35 | ACCESS_AGENT |
| 36 | } |
| 37 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 38 | enum DependencyType { |
| 39 | BIDIRECTIONAL, |
| 40 | UNIDIRECTIONAL |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | /** |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 44 | * Returns the service network identifier. |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 45 | * |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 46 | * @return service network identifier |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 47 | */ |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 48 | NetworkId id(); |
| 49 | |
| 50 | /** |
| 51 | * Returns the service network name. |
| 52 | * |
| 53 | * @return service network name. |
| 54 | */ |
| 55 | String name(); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 56 | |
| 57 | /** |
| 58 | * Returns the type of the service network. |
| 59 | * |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 60 | * @return service network type; empty value if type is not set |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 61 | */ |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 62 | NetworkType type(); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 63 | |
| 64 | /** |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 65 | * Returns the service network segmentation identifier. |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 66 | * |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 67 | * @return segmentation id; empty value if segment id is not set |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 68 | */ |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 69 | SegmentId segmentId(); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 70 | |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 71 | /** |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 72 | * Returns the subnet of the service network. |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 73 | * |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 74 | * @return subnet ip prefix; empty value if subnet is not set |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 75 | */ |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 76 | IpPrefix subnet(); |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 77 | |
Hyunsun Moon | 0984cbd | 2016-12-01 17:34:11 -0800 | [diff] [blame] | 78 | /** |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 79 | * Returns the service IP address of the service network. |
Hyunsun Moon | 0984cbd | 2016-12-01 17:34:11 -0800 | [diff] [blame] | 80 | * |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 81 | * @return service ip; empty value if service ip is not set |
Hyunsun Moon | 0984cbd | 2016-12-01 17:34:11 -0800 | [diff] [blame] | 82 | */ |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 83 | IpAddress serviceIp(); |
Hyunsun Moon | 0984cbd | 2016-12-01 17:34:11 -0800 | [diff] [blame] | 84 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 85 | /** |
| 86 | * Returns the providers of the service network. |
| 87 | * |
| 88 | * @return set of provider networks; empty map if no providers exist |
| 89 | */ |
| 90 | Map<NetworkId, DependencyType> providers(); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 91 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 92 | /** |
| 93 | * Builder of new service network entities. |
| 94 | */ |
| 95 | interface Builder { |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 96 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 97 | /** |
| 98 | * Builds an immutable service network instance. |
| 99 | * |
| 100 | * @return service network instance |
| 101 | */ |
| 102 | ServiceNetwork build(); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 103 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 104 | /** |
| 105 | * Returns service network builder with the supplied identifier. |
| 106 | * |
| 107 | * @param networkId network id |
| 108 | * @return service network builder |
| 109 | */ |
| 110 | Builder id(NetworkId networkId); |
| 111 | |
| 112 | /** |
| 113 | * Returns service network builder with the supplied name. |
| 114 | * |
| 115 | * @param name network name |
| 116 | * @return service network builder |
| 117 | */ |
| 118 | Builder name(String name); |
| 119 | |
| 120 | /** |
| 121 | * Returns service network builder with the supplied type. |
| 122 | * |
| 123 | * @param type service network type |
| 124 | * @return service network builder |
| 125 | */ |
| 126 | Builder type(NetworkType type); |
| 127 | |
| 128 | /** |
| 129 | * Returns service network builder with the supplied segmentation id. |
| 130 | * |
| 131 | * @param segmentId segmentation id |
| 132 | * @return service network builder |
| 133 | */ |
| 134 | Builder segmentId(SegmentId segmentId); |
| 135 | |
| 136 | /** |
| 137 | * Returns service network builder with the supplied subnet. |
| 138 | * |
| 139 | * @param subnet subnet |
| 140 | * @return service network builder |
| 141 | */ |
| 142 | Builder subnet(IpPrefix subnet); |
| 143 | |
| 144 | /** |
| 145 | * Returns service network builder with the supplied service IP address. |
| 146 | * |
| 147 | * @param serviceIp service ip address |
| 148 | * @return service network builder |
| 149 | */ |
| 150 | Builder serviceIp(IpAddress serviceIp); |
| 151 | |
| 152 | /** |
| 153 | * Returns service network builder with the supplied providers. |
| 154 | * |
| 155 | * @param providers set of provider network |
| 156 | * @return service network builder |
| 157 | */ |
| 158 | Builder providers(Map<NetworkId, DependencyType> providers); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 159 | } |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 160 | } |