blob: 122ccfe75cce06975fafd521273893a7005a90e3 [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 Moon395542a2016-09-01 13:53:08 -070029 PRIVATE,
30 PUBLIC,
31 MANAGEMENT_HOST,
32 MANAGEMENT_LOCAL,
Hyunsun Moond02a5a72017-02-05 22:00:05 +090033 @Deprecated
Hyunsun Moon395542a2016-09-01 13:53:08 -070034 VSG,
35 ACCESS_AGENT
36 }
37
Hyunsun Moon187bf532017-01-19 10:57:40 +090038 enum DependencyType {
39 BIDIRECTIONAL,
40 UNIDIRECTIONAL
Hyunsun Moon395542a2016-09-01 13:53:08 -070041 }
42
43 /**
Hyunsun Moon187bf532017-01-19 10:57:40 +090044 * Returns the service network identifier.
Hyunsun Moon395542a2016-09-01 13:53:08 -070045 *
Hyunsun Moon187bf532017-01-19 10:57:40 +090046 * @return service network identifier
Hyunsun Moon395542a2016-09-01 13:53:08 -070047 */
Hyunsun Moon187bf532017-01-19 10:57:40 +090048 NetworkId id();
49
50 /**
51 * Returns the service network name.
52 *
53 * @return service network name.
54 */
55 String name();
Hyunsun Moon395542a2016-09-01 13:53:08 -070056
57 /**
58 * Returns the type of the service network.
59 *
Hyunsun Moon187bf532017-01-19 10:57:40 +090060 * @return service network type; empty value if type is not set
Hyunsun Moon395542a2016-09-01 13:53:08 -070061 */
Hyunsun Moon187bf532017-01-19 10:57:40 +090062 NetworkType type();
Hyunsun Moon395542a2016-09-01 13:53:08 -070063
64 /**
Hyunsun Moon187bf532017-01-19 10:57:40 +090065 * Returns the service network segmentation identifier.
Hyunsun Moon395542a2016-09-01 13:53:08 -070066 *
Hyunsun Moon187bf532017-01-19 10:57:40 +090067 * @return segmentation id; empty value if segment id is not set
Hyunsun Moon395542a2016-09-01 13:53:08 -070068 */
Hyunsun Moon187bf532017-01-19 10:57:40 +090069 SegmentId segmentId();
Hyunsun Moon395542a2016-09-01 13:53:08 -070070
Hyunsun Mooneaf75e62016-09-27 16:40:23 -070071 /**
Hyunsun Moon187bf532017-01-19 10:57:40 +090072 * Returns the subnet of the service network.
Hyunsun Mooneaf75e62016-09-27 16:40:23 -070073 *
Hyunsun Moon187bf532017-01-19 10:57:40 +090074 * @return subnet ip prefix; empty value if subnet is not set
Hyunsun Mooneaf75e62016-09-27 16:40:23 -070075 */
Hyunsun Moon187bf532017-01-19 10:57:40 +090076 IpPrefix subnet();
Hyunsun Mooneaf75e62016-09-27 16:40:23 -070077
Hyunsun Moon0984cbd2016-12-01 17:34:11 -080078 /**
Hyunsun Moon187bf532017-01-19 10:57:40 +090079 * Returns the service IP address of the service network.
Hyunsun Moon0984cbd2016-12-01 17:34:11 -080080 *
Hyunsun Moon187bf532017-01-19 10:57:40 +090081 * @return service ip; empty value if service ip is not set
Hyunsun Moon0984cbd2016-12-01 17:34:11 -080082 */
Hyunsun Moon187bf532017-01-19 10:57:40 +090083 IpAddress serviceIp();
Hyunsun Moon0984cbd2016-12-01 17:34:11 -080084
Hyunsun Moon187bf532017-01-19 10:57:40 +090085 /**
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 Moon395542a2016-09-01 13:53:08 -070091
Hyunsun Moon187bf532017-01-19 10:57:40 +090092 /**
93 * Builder of new service network entities.
94 */
95 interface Builder {
Hyunsun Moon395542a2016-09-01 13:53:08 -070096
Hyunsun Moon187bf532017-01-19 10:57:40 +090097 /**
98 * Builds an immutable service network instance.
99 *
100 * @return service network instance
101 */
102 ServiceNetwork build();
Hyunsun Moon395542a2016-09-01 13:53:08 -0700103
Hyunsun Moon187bf532017-01-19 10:57:40 +0900104 /**
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 Moon395542a2016-09-01 13:53:08 -0700159 }
Hyunsun Moon395542a2016-09-01 13:53:08 -0700160}