Jian Li | 073f1ba | 2021-02-28 03:50:15 +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 | /** |
| 21 | * Representation of floating IP address. |
| 22 | */ |
| 23 | public interface KubevirtFloatingIp { |
| 24 | |
| 25 | /** |
| 26 | * Returns the floating IP identifier. |
| 27 | * |
| 28 | * @return floating IP identifier |
| 29 | */ |
| 30 | String id(); |
| 31 | |
| 32 | /** |
| 33 | * Returns the name of router where the floating IP is associated. |
| 34 | * |
| 35 | * @return name of router |
| 36 | */ |
| 37 | String routerName(); |
| 38 | |
| 39 | /** |
Jian Li | b636f70 | 2021-03-03 14:46:50 +0900 | [diff] [blame] | 40 | * Returns the name of network where the floating IPs are belong to. |
| 41 | * |
| 42 | * @return name of network |
| 43 | */ |
| 44 | String networkName(); |
| 45 | |
| 46 | /** |
Jian Li | 073f1ba | 2021-02-28 03:50:15 +0900 | [diff] [blame] | 47 | * Returns the floating IP address. |
| 48 | * |
| 49 | * @return floating IP address |
| 50 | */ |
| 51 | IpAddress floatingIp(); |
| 52 | |
| 53 | /** |
| 54 | * Returns the fixed IP address. |
| 55 | * |
| 56 | * @return fixed IP address |
| 57 | */ |
| 58 | IpAddress fixedIp(); |
| 59 | |
| 60 | /** |
| 61 | * Returns the name of POD where this floating IP is associated with. |
| 62 | * |
| 63 | * @return POD name |
| 64 | */ |
| 65 | String podName(); |
| 66 | |
| 67 | /** |
| 68 | * Updates the kubevirt floating IP with the supplied fixed IP address. |
| 69 | * |
| 70 | * @param ip fixed IP address |
| 71 | * @return kubevirt floating IP |
| 72 | */ |
| 73 | KubevirtFloatingIp updateFixedIp(IpAddress ip); |
| 74 | |
| 75 | /** |
| 76 | * Updates the kubevirt floating IP with the supplied pod Name. |
| 77 | * |
| 78 | * @param name POD name |
| 79 | * @return kubevirt floating IP |
| 80 | */ |
| 81 | KubevirtFloatingIp updatePodName(String name); |
| 82 | |
| 83 | interface Builder { |
| 84 | /** |
| 85 | * Builds an immutable floaing IP instance. |
| 86 | * |
| 87 | * @return kubevirt floating IP |
| 88 | */ |
| 89 | KubevirtFloatingIp build(); |
| 90 | |
| 91 | /** |
| 92 | * Returns kubevirt floating IP builder with supplied identifier. |
| 93 | * |
| 94 | * @param id floating IP identifier |
| 95 | * @return floating IP builder |
| 96 | */ |
| 97 | Builder id(String id); |
| 98 | |
| 99 | /** |
| 100 | * Returns kubevirt floating IP builder with supplied router name. |
| 101 | * |
| 102 | * @param name router name |
| 103 | * @return floating IP builder |
| 104 | */ |
| 105 | Builder routerName(String name); |
| 106 | |
| 107 | /** |
Jian Li | b636f70 | 2021-03-03 14:46:50 +0900 | [diff] [blame] | 108 | * Returns kubevirt floating IP builder with supplied network name. |
| 109 | * |
| 110 | * @param name network name |
| 111 | * @return floating IP builder |
| 112 | */ |
| 113 | Builder networkName(String name); |
| 114 | |
| 115 | /** |
Jian Li | 073f1ba | 2021-02-28 03:50:15 +0900 | [diff] [blame] | 116 | * Returns kubevirt floating IP builder with supplied floating IP address. |
| 117 | * |
| 118 | * @param ip floating IP address |
| 119 | * @return floating IP builder |
| 120 | */ |
| 121 | Builder floatingIp(IpAddress ip); |
| 122 | |
| 123 | /** |
| 124 | * Returns kubevirt floating IP builder with supplied fixed IP address. |
| 125 | * |
| 126 | * @param ip fixed IP address |
| 127 | * @return floating IP builder |
| 128 | */ |
| 129 | Builder fixedIp(IpAddress ip); |
| 130 | |
| 131 | /** |
| 132 | * Returns kubevirt floating IP builder with supplied POD name. |
| 133 | * |
| 134 | * @param name POD name |
| 135 | * @return floating IP builder |
| 136 | */ |
| 137 | Builder podName(String name); |
| 138 | } |
| 139 | } |