blob: f971cb9833efb8c468bf967a31cb53cc56db07a4 [file] [log] [blame]
Jian Lifc55e422019-01-21 14:39:34 +09001/*
2 * Copyright 2019-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.k8snetworking.api;
17
18import org.onlab.packet.IpAddress;
19
20/**
21 * Representation of kubernetes network.
22 */
23public interface K8sNetwork {
24
25 /**
26 * Lists of network type.
27 */
28 enum Type {
29
30 /**
31 * VXLAN typed virtual network.
32 */
33 VXLAN,
34
35 /**
36 * GRE typed virtual network.
37 */
38 GRE,
39
40 /**
41 * GENEVE typed virtual network.
42 */
43 GENEVE,
44 }
45
46 /**
47 * Returns the kubernetes network ID.
48 *
49 * @return kubernetes network ID
50 */
51 String networkId();
52
53 /**
54 * Returns kubernetes network type.
55 *
56 * @return kubernetes network type
57 */
58 Type type();
59
60 /**
61 * Returns maximum transmission unit (MTU) value to address fragmentation.
62 *
63 * @return maximum transmission unit (MTU) value to address fragmentation
64 */
65 Integer mtu();
66
67 /**
68 * Returns segmentation ID.
69 *
70 * @return segmentation ID
71 */
72 String segmentId();
73
74 /**
75 * Returns gateway IP address.
76 *
77 * @return gateway IP address
78 */
79 IpAddress gatewayIp();
80
81 /**
82 * Returns network CIDR.
83 *
84 * @return network CIDR
85 */
86 String cidr();
87
88 /**
89 * Builder of new network.
90 */
91 interface Builder {
92
93 /**
94 * Builds an immutable network instance.
95 *
96 * @return kubernetes network
97 */
98 K8sNetwork build();
99
100 /**
101 * Returns network builder with supplied network ID.
102 *
103 * @param networkId network ID
104 * @return network builder
105 */
106 Builder networkId(String networkId);
107
108 /**
109 * Returns network builder with supplied network type.
110 *
111 * @param type network type
112 * @return network builder
113 */
114 Builder type(Type type);
115
116 /**
117 * Returns network builder with supplied MTU.
118 *
119 * @param mtu maximum transmission unit
120 * @return network builder
121 */
122 Builder mtu(Integer mtu);
123
124 /**
125 * Returns network builder with supplied segment ID.
126 *
127 * @param segmentId segment ID
128 * @return network builder
129 */
130 Builder segmentId(String segmentId);
131
132 /**
133 * Returns network builder with supplied gateway IP address.
134 *
135 * @param ipAddress gateway IP address
136 * @return network builder
137 */
138 Builder gatewayIp(IpAddress ipAddress);
139
140 /**
141 * Returns network builder with supplied network CIDR.
142 *
143 * @param cidr Classless Inter-Domain Routing
144 * @return network builder
145 */
146 Builder cidr(String cidr);
147 }
148}