blob: 97b2286456554db5b4a2990cbb49092f5cc8379f [file] [log] [blame]
Jian Li3e81b182021-01-11 02:35:06 +09001/*
2 * Copyright 2021-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 */
16package org.onosproject.kubevirtnetworking.api;
17
18import org.onlab.packet.IpAddress;
19
20import java.util.Set;
21
22/**
23 * Representation of kubevirt network.
24 */
25public interface KubevirtNetwork {
26
27 /**
28 * Lists of network type.
29 */
30 enum Type {
31
32 /**
33 * VXLAN typed virtual network.
34 */
35 VXLAN,
36
37 /**
38 * GRE typed virtual network.
39 */
40 GRE,
41
42 /**
43 * GENEVE typed virtual network.
44 */
45 GENEVE,
46
47 /**
48 * FLAT typed provider network.
49 */
50 FLAT,
51 }
52
53 /**
54 * Returns the kubernetes network ID.
55 *
56 * @return kubernetes network ID
57 */
58 String networkId();
59
60 /**
61 * Returns kubernetes network type.
62 *
63 * @return kubernetes network type
64 */
65 Type type();
66
67 /**
68 * Returns kubernetes network name.
69 *
70 * @return kubernetes network name
71 */
72 String name();
73
74 /**
75 * Returns maximum transmission unit (MTU) value to address fragmentation.
76 *
77 * @return maximum transmission unit (MTU) value to address fragmentation
78 */
79 Integer mtu();
80
81 /**
82 * Returns segmentation ID.
83 *
84 * @return segmentation ID
85 */
86 String segmentId();
87
88 /**
89 * Returns gateway IP address.
90 *
91 * @return gateway IP address
92 */
93 IpAddress gatewayIp();
94
95 /**
96 * Returns network CIDR.
97 *
98 * @return network CIDR
99 */
100 String cidr();
101
102 /**
103 * Returns host routes.
104 *
105 * @return host routes
106 */
Jian Lifeb84802021-01-12 16:34:49 +0900107 Set<KubevirtHostRoute> hostRoutes();
Jian Li3e81b182021-01-11 02:35:06 +0900108
109 /**
110 * Returns the IP pool.
111 *
112 * @return IP pool
113 */
114 KubevirtIpPool ipPool();
115
116 /**
Jian Li97e6fc32021-02-01 20:36:45 +0900117 * Returns a set of DNS.
118 *
119 * @return a set of DNS
120 */
121 Set<IpAddress> dnses();
122
123 /**
Jian Li3e81b182021-01-11 02:35:06 +0900124 * Builder of new network.
125 */
126 interface Builder {
127
128 /**
129 * Builds an immutable network instance.
130 *
131 * @return kubernetes network
132 */
133 KubevirtNetwork build();
134
135 /**
136 * Returns network builder with supplied network ID.
137 *
138 * @param networkId network ID
139 * @return network builder
140 */
141 Builder networkId(String networkId);
142
143 /**
144 * Returns network builder with supplied network name.
145 *
146 * @param name network name
147 * @return network builder
148 */
149 Builder name(String name);
150
151 /**
152 * Returns network builder with supplied network type.
153 *
154 * @param type network type
155 * @return network builder
156 */
157 Builder type(Type type);
158
159 /**
160 * Returns network builder with supplied MTU.
161 *
162 * @param mtu maximum transmission unit
163 * @return network builder
164 */
165 Builder mtu(Integer mtu);
166
167 /**
168 * Returns network builder with supplied segment ID.
169 *
170 * @param segmentId segment ID
171 * @return network builder
172 */
173 Builder segmentId(String segmentId);
174
175 /**
176 * Returns network builder with supplied gateway IP address.
177 *
178 * @param ipAddress gateway IP address
179 * @return network builder
180 */
181 Builder gatewayIp(IpAddress ipAddress);
182
183 /**
184 * Returns network builder with supplied network CIDR.
185 *
186 * @param cidr Classless Inter-Domain Routing
187 * @return network builder
188 */
189 Builder cidr(String cidr);
190
191 /**
Jian Li97e6fc32021-02-01 20:36:45 +0900192 * Returns network builder with the supplied IP pool.
Jian Li3e81b182021-01-11 02:35:06 +0900193 *
194 * @param ipPool IP pool
195 * @return network builder
196 */
197 Builder ipPool(KubevirtIpPool ipPool);
198
199 /**
Jian Li97e6fc32021-02-01 20:36:45 +0900200 * Returns network builder with the host routes.
Jian Li3e81b182021-01-11 02:35:06 +0900201 *
202 * @param hostRoutes host routes
203 * @return network builder
204 */
205 Builder hostRoutes(Set<KubevirtHostRoute> hostRoutes);
Jian Li97e6fc32021-02-01 20:36:45 +0900206
207 /**
208 * Returns network builder with supplied DNSes.
209 *
210 * @param dnses a set of DNS
211 * @return network builder
212 */
213 Builder dnses(Set<IpAddress> dnses);
Jian Li3e81b182021-01-11 02:35:06 +0900214 }
215}