Jian Li | 58b3398 | 2020-07-01 19:07:02 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2020-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.k8snode.api; |
| 17 | |
| 18 | import org.onlab.packet.IpAddress; |
| 19 | import org.onlab.packet.MacAddress; |
| 20 | |
| 21 | /** |
| 22 | * Representation of an external network. |
| 23 | */ |
| 24 | public interface K8sExternalNetwork { |
| 25 | |
| 26 | /** |
| 27 | * Returns the external bridge's IP address. |
| 28 | * |
| 29 | * @return IP address; null if the IP address does not exist |
| 30 | */ |
| 31 | IpAddress extBridgeIp(); |
| 32 | |
| 33 | /** |
| 34 | * Returns the external gateway IP address. |
| 35 | * |
| 36 | * @return IP address; null if the IP address does not exist |
| 37 | */ |
| 38 | IpAddress extGatewayIp(); |
| 39 | |
| 40 | /** |
| 41 | * Returns the external gateway MAC address. |
| 42 | * |
| 43 | * @return MAC address; null if the MAC address does not exist |
| 44 | */ |
| 45 | MacAddress extGatewayMac(); |
| 46 | |
| 47 | /** |
Jian Li | 9bc6777 | 2020-10-07 02:12:33 +0900 | [diff] [blame^] | 48 | * Returns the external interface name. |
| 49 | * |
| 50 | * @return interface name |
| 51 | */ |
| 52 | String extIntf(); |
| 53 | |
| 54 | /** |
Jian Li | 58b3398 | 2020-07-01 19:07:02 +0900 | [diff] [blame] | 55 | * Builder of new network entity. |
| 56 | */ |
| 57 | interface Builder { |
| 58 | |
| 59 | /** |
| 60 | * Builds an immutable kubernetes external network instance. |
| 61 | * |
| 62 | * @return kubernetes external network |
| 63 | */ |
| 64 | K8sExternalNetwork build(); |
| 65 | |
| 66 | /** |
Jian Li | 9bc6777 | 2020-10-07 02:12:33 +0900 | [diff] [blame^] | 67 | * Returns kubernetes external network builder with supplied external bridge IP. |
Jian Li | 58b3398 | 2020-07-01 19:07:02 +0900 | [diff] [blame] | 68 | * |
| 69 | * @param extBridgeIp external bridge IP |
Jian Li | 9bc6777 | 2020-10-07 02:12:33 +0900 | [diff] [blame^] | 70 | * @return kubernetes external network builder |
Jian Li | 58b3398 | 2020-07-01 19:07:02 +0900 | [diff] [blame] | 71 | */ |
| 72 | Builder extBridgeIp(IpAddress extBridgeIp); |
| 73 | |
| 74 | /** |
Jian Li | 9bc6777 | 2020-10-07 02:12:33 +0900 | [diff] [blame^] | 75 | * Returns kubernetes external network builder with supplied gateway IP. |
Jian Li | 58b3398 | 2020-07-01 19:07:02 +0900 | [diff] [blame] | 76 | * |
| 77 | * @param extGatewayIp external gateway IP |
Jian Li | 9bc6777 | 2020-10-07 02:12:33 +0900 | [diff] [blame^] | 78 | * @return kubernetes external network builder |
Jian Li | 58b3398 | 2020-07-01 19:07:02 +0900 | [diff] [blame] | 79 | */ |
| 80 | Builder extGatewayIp(IpAddress extGatewayIp); |
| 81 | |
| 82 | /** |
Jian Li | 9bc6777 | 2020-10-07 02:12:33 +0900 | [diff] [blame^] | 83 | * Returns kubernetes external network builder with supplied external gateway MAC. |
Jian Li | 58b3398 | 2020-07-01 19:07:02 +0900 | [diff] [blame] | 84 | * |
| 85 | * @param extGatewayMac external gateway MAC address |
Jian Li | 9bc6777 | 2020-10-07 02:12:33 +0900 | [diff] [blame^] | 86 | * @return kubernetes external network builder |
Jian Li | 58b3398 | 2020-07-01 19:07:02 +0900 | [diff] [blame] | 87 | */ |
| 88 | Builder extGatewayMac(MacAddress extGatewayMac); |
Jian Li | 9bc6777 | 2020-10-07 02:12:33 +0900 | [diff] [blame^] | 89 | |
| 90 | /** |
| 91 | * Returns kubernetes external network builder with supplied external interface. |
| 92 | * |
| 93 | * @param extIntf external interface name |
| 94 | * @return kubernetes external network builder |
| 95 | */ |
| 96 | Builder extIntf(String extIntf); |
Jian Li | 58b3398 | 2020-07-01 19:07:02 +0900 | [diff] [blame] | 97 | } |
| 98 | } |