Jian Li | 3e81b18 | 2021-01-11 02:35:06 +0900 | [diff] [blame^] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.kubevirtnetworking.api; |
| 17 | |
| 18 | import org.onlab.packet.IpAddress; |
| 19 | |
| 20 | import java.util.Set; |
| 21 | |
| 22 | /** |
| 23 | * Representation of kubevirt network. |
| 24 | */ |
| 25 | public 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 | */ |
| 107 | Set<KubevirtHostRoute> hostRouts(); |
| 108 | |
| 109 | /** |
| 110 | * Returns the IP pool. |
| 111 | * |
| 112 | * @return IP pool |
| 113 | */ |
| 114 | KubevirtIpPool ipPool(); |
| 115 | |
| 116 | /** |
| 117 | * Builder of new network. |
| 118 | */ |
| 119 | interface Builder { |
| 120 | |
| 121 | /** |
| 122 | * Builds an immutable network instance. |
| 123 | * |
| 124 | * @return kubernetes network |
| 125 | */ |
| 126 | KubevirtNetwork build(); |
| 127 | |
| 128 | /** |
| 129 | * Returns network builder with supplied network ID. |
| 130 | * |
| 131 | * @param networkId network ID |
| 132 | * @return network builder |
| 133 | */ |
| 134 | Builder networkId(String networkId); |
| 135 | |
| 136 | /** |
| 137 | * Returns network builder with supplied network name. |
| 138 | * |
| 139 | * @param name network name |
| 140 | * @return network builder |
| 141 | */ |
| 142 | Builder name(String name); |
| 143 | |
| 144 | /** |
| 145 | * Returns network builder with supplied network type. |
| 146 | * |
| 147 | * @param type network type |
| 148 | * @return network builder |
| 149 | */ |
| 150 | Builder type(Type type); |
| 151 | |
| 152 | /** |
| 153 | * Returns network builder with supplied MTU. |
| 154 | * |
| 155 | * @param mtu maximum transmission unit |
| 156 | * @return network builder |
| 157 | */ |
| 158 | Builder mtu(Integer mtu); |
| 159 | |
| 160 | /** |
| 161 | * Returns network builder with supplied segment ID. |
| 162 | * |
| 163 | * @param segmentId segment ID |
| 164 | * @return network builder |
| 165 | */ |
| 166 | Builder segmentId(String segmentId); |
| 167 | |
| 168 | /** |
| 169 | * Returns network builder with supplied gateway IP address. |
| 170 | * |
| 171 | * @param ipAddress gateway IP address |
| 172 | * @return network builder |
| 173 | */ |
| 174 | Builder gatewayIp(IpAddress ipAddress); |
| 175 | |
| 176 | /** |
| 177 | * Returns network builder with supplied network CIDR. |
| 178 | * |
| 179 | * @param cidr Classless Inter-Domain Routing |
| 180 | * @return network builder |
| 181 | */ |
| 182 | Builder cidr(String cidr); |
| 183 | |
| 184 | /** |
| 185 | * Returns the IP pool. |
| 186 | * |
| 187 | * @param ipPool IP pool |
| 188 | * @return network builder |
| 189 | */ |
| 190 | Builder ipPool(KubevirtIpPool ipPool); |
| 191 | |
| 192 | /** |
| 193 | * Returns host routes. |
| 194 | * |
| 195 | * @param hostRoutes host routes |
| 196 | * @return network builder |
| 197 | */ |
| 198 | Builder hostRoutes(Set<KubevirtHostRoute> hostRoutes); |
| 199 | } |
| 200 | } |