blob: 3a00a3ddb907e6f50a8e037b663331db6eca5e9a [file] [log] [blame]
Hyunsun Moon395542a2016-09-01 13:53:08 -07001/*
Brian O'Connor80dff972017-08-03 22:46:30 -07002 * Copyright 2017-present Open Networking Foundation
Hyunsun Moon395542a2016-09-01 13:53:08 -07003 *
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 Moonfd5a24e2016-10-19 19:15:48 -070016package org.opencord.cordvtn.api.net;
Hyunsun Moon395542a2016-09-01 13:53:08 -070017
Hyunsun Moon187bf532017-01-19 10:57:40 +090018import org.onlab.packet.IpAddress;
19import org.onlab.packet.IpPrefix;
Hyunsun Moon395542a2016-09-01 13:53:08 -070020
Hyunsun Moon187bf532017-01-19 10:57:40 +090021import java.util.Map;
Hyunsun Moon395542a2016-09-01 13:53:08 -070022
23/**
Hyunsun Moon851e57f2017-02-23 19:38:40 +090024 * Representation of a service network.
Hyunsun Moon395542a2016-09-01 13:53:08 -070025 */
Hyunsun Moon187bf532017-01-19 10:57:40 +090026public interface ServiceNetwork {
Hyunsun Mooneaf75e62016-09-27 16:40:23 -070027
Hyunsun Moon187bf532017-01-19 10:57:40 +090028 enum NetworkType {
Hyunsun Moon0d00fb42017-08-09 18:21:03 +090029 /**
30 * Isolated tenant network.
31 */
Hyunsun Moon395542a2016-09-01 13:53:08 -070032 PRIVATE,
Hyunsun Moon0d00fb42017-08-09 18:21:03 +090033 /**
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 Moon395542a2016-09-01 13:53:08 -070038 PUBLIC,
Hyunsun Moon0d00fb42017-08-09 18:21:03 +090039 /**
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 Moon395542a2016-09-01 13:53:08 -070050 MANAGEMENT_HOST,
Hyunsun Moon0d00fb42017-08-09 18:21:03 +090051 /**
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 Moon395542a2016-09-01 13:53:08 -070057 MANAGEMENT_LOCAL,
Hyunsun Moon0d00fb42017-08-09 18:21:03 +090058 /**
59 * Special network for R-CORD vSG.
60 * This network type is deprecated in favor of ServicePort VLAN.
61 */
Hyunsun Moond02a5a72017-02-05 22:00:05 +090062 @Deprecated
Hyunsun Moon395542a2016-09-01 13:53:08 -070063 VSG,
Hyunsun Moon0d00fb42017-08-09 18:21:03 +090064 /**
65 * Special network for R-CORD access agent.
66 * This network cannot be part of service chain.
67 */
68 ACCESS_AGENT,
Hyunsun Moon395542a2016-09-01 13:53:08 -070069 }
70
Hyunsun Moon187bf532017-01-19 10:57:40 +090071 enum DependencyType {
72 BIDIRECTIONAL,
73 UNIDIRECTIONAL
Hyunsun Moon395542a2016-09-01 13:53:08 -070074 }
75
76 /**
Hyunsun Moon187bf532017-01-19 10:57:40 +090077 * Returns the service network identifier.
Hyunsun Moon395542a2016-09-01 13:53:08 -070078 *
Hyunsun Moon187bf532017-01-19 10:57:40 +090079 * @return service network identifier
Hyunsun Moon395542a2016-09-01 13:53:08 -070080 */
Hyunsun Moon187bf532017-01-19 10:57:40 +090081 NetworkId id();
82
83 /**
84 * Returns the service network name.
85 *
86 * @return service network name.
87 */
88 String name();
Hyunsun Moon395542a2016-09-01 13:53:08 -070089
90 /**
91 * Returns the type of the service network.
92 *
Hyunsun Moon187bf532017-01-19 10:57:40 +090093 * @return service network type; empty value if type is not set
Hyunsun Moon395542a2016-09-01 13:53:08 -070094 */
Hyunsun Moon187bf532017-01-19 10:57:40 +090095 NetworkType type();
Hyunsun Moon395542a2016-09-01 13:53:08 -070096
97 /**
Hyunsun Moon187bf532017-01-19 10:57:40 +090098 * Returns the service network segmentation identifier.
Hyunsun Moon395542a2016-09-01 13:53:08 -070099 *
Hyunsun Moon187bf532017-01-19 10:57:40 +0900100 * @return segmentation id; empty value if segment id is not set
Hyunsun Moon395542a2016-09-01 13:53:08 -0700101 */
Hyunsun Moon187bf532017-01-19 10:57:40 +0900102 SegmentId segmentId();
Hyunsun Moon395542a2016-09-01 13:53:08 -0700103
Hyunsun Mooneaf75e62016-09-27 16:40:23 -0700104 /**
Hyunsun Moon187bf532017-01-19 10:57:40 +0900105 * Returns the subnet of the service network.
Hyunsun Mooneaf75e62016-09-27 16:40:23 -0700106 *
Hyunsun Moon187bf532017-01-19 10:57:40 +0900107 * @return subnet ip prefix; empty value if subnet is not set
Hyunsun Mooneaf75e62016-09-27 16:40:23 -0700108 */
Hyunsun Moon187bf532017-01-19 10:57:40 +0900109 IpPrefix subnet();
Hyunsun Mooneaf75e62016-09-27 16:40:23 -0700110
Hyunsun Moon0984cbd2016-12-01 17:34:11 -0800111 /**
Hyunsun Moon187bf532017-01-19 10:57:40 +0900112 * Returns the service IP address of the service network.
Hyunsun Moon0984cbd2016-12-01 17:34:11 -0800113 *
Hyunsun Moon187bf532017-01-19 10:57:40 +0900114 * @return service ip; empty value if service ip is not set
Hyunsun Moon0984cbd2016-12-01 17:34:11 -0800115 */
Hyunsun Moon187bf532017-01-19 10:57:40 +0900116 IpAddress serviceIp();
Hyunsun Moon0984cbd2016-12-01 17:34:11 -0800117
Hyunsun Moon187bf532017-01-19 10:57:40 +0900118 /**
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 Moon395542a2016-09-01 13:53:08 -0700124
Hyunsun Moon187bf532017-01-19 10:57:40 +0900125 /**
126 * Builder of new service network entities.
127 */
128 interface Builder {
Hyunsun Moon395542a2016-09-01 13:53:08 -0700129
Hyunsun Moon187bf532017-01-19 10:57:40 +0900130 /**
131 * Builds an immutable service network instance.
132 *
133 * @return service network instance
134 */
135 ServiceNetwork build();
Hyunsun Moon395542a2016-09-01 13:53:08 -0700136
Hyunsun Moon187bf532017-01-19 10:57:40 +0900137 /**
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 Moon395542a2016-09-01 13:53:08 -0700192 }
Hyunsun Moon395542a2016-09-01 13:53:08 -0700193}