Jian Li | e2a04ce | 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 | |
| 20 | import java.util.Set; |
| 21 | |
| 22 | /** |
| 23 | * Representation of host and kubernetes nodes mapping info. |
| 24 | */ |
| 25 | public interface HostNodesInfo { |
| 26 | |
| 27 | /** |
| 28 | * Returns the host's IP address. |
| 29 | * |
| 30 | * @return host IP address |
| 31 | */ |
| 32 | IpAddress hostIp(); |
| 33 | |
| 34 | /** |
| 35 | * Returns the list of nodes associated with the host. |
| 36 | * |
| 37 | * @return a set of node's names |
| 38 | */ |
| 39 | Set<String> nodes(); |
| 40 | |
| 41 | /** |
| 42 | * Builder of new HostNodesInfo entity. |
| 43 | */ |
| 44 | interface Builder { |
| 45 | |
| 46 | /** |
| 47 | * Builds an immutable host IP to nodes mapping instance. |
| 48 | * |
| 49 | * @return HostNodesInfo instance |
| 50 | */ |
| 51 | HostNodesInfo build(); |
| 52 | |
| 53 | /** |
| 54 | * Returns HostNodesInfo builder with host IP address. |
| 55 | * |
| 56 | * @param hostIp host IP address |
| 57 | * @return HostNodesInfo builder |
| 58 | */ |
| 59 | Builder hostIp(IpAddress hostIp); |
| 60 | |
| 61 | /** |
| 62 | * Returns HostNodesInfo builder with nodes. |
| 63 | * |
| 64 | * @param nodes a set of node's names |
| 65 | * @return HostNodesInfo builder |
| 66 | */ |
| 67 | Builder nodes(Set<String> nodes); |
| 68 | } |
| 69 | } |