Jian Li | e2d8751 | 2018-08-23 17:33:05 +0900 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2018-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 | |
| 17 | package org.onosproject.simplefabric.api; |
| 18 | |
| 19 | import org.onlab.packet.IpAddress; |
| 20 | import org.onlab.packet.IpPrefix; |
| 21 | import org.onlab.packet.MacAddress; |
| 22 | import org.onosproject.net.EncapsulationType; |
| 23 | |
| 24 | /** |
| 25 | * Interface of FabricSubnet. |
| 26 | */ |
| 27 | public interface FabricSubnet { |
| 28 | |
| 29 | /** |
| 30 | * Gets the IP subnet of the IP subnet entry. |
| 31 | * |
| 32 | * @return the IP subnet |
| 33 | */ |
| 34 | IpPrefix prefix(); |
| 35 | |
| 36 | /** |
| 37 | * Gets the virtual gateway IP address of the IP subnet entry. |
| 38 | * |
| 39 | * @return the virtual gateway IP address |
| 40 | */ |
| 41 | IpAddress gatewayIp(); |
| 42 | |
| 43 | /** |
| 44 | * Gets the virtual gateway Mac address of the IP subnet entry. |
| 45 | * |
| 46 | * @return the virtuai gateway Mac address |
| 47 | */ |
| 48 | MacAddress gatewayMac(); |
| 49 | |
| 50 | /** |
| 51 | * Gets the encapsulation type of IP subnet entry. |
| 52 | * |
| 53 | * @return the encapsulation type |
| 54 | */ |
| 55 | EncapsulationType encapsulation(); |
| 56 | |
| 57 | /** |
| 58 | * Gets the subnet name. |
| 59 | * |
| 60 | * @return the subnet name |
| 61 | */ |
| 62 | String name(); |
| 63 | |
| 64 | /** |
| 65 | * Tests whether the IP version of this entry is IPv4. |
| 66 | * |
| 67 | * @return true if the IP version of this entry is IPv4, otherwise false. |
| 68 | */ |
| 69 | boolean isIp4(); |
| 70 | |
| 71 | /** |
| 72 | * Tests whether the IP version of this entry is IPv6. |
| 73 | * |
| 74 | * @return true if the IP version of this entry is IPv6, otherwise false. |
| 75 | */ |
| 76 | boolean isIp6(); |
| 77 | |
| 78 | /** |
| 79 | * Builder of Ip Subnet. |
| 80 | */ |
| 81 | interface Builder { |
| 82 | |
| 83 | /** |
| 84 | * Returns FabricSubnet builder with supplied IpPrefix. |
| 85 | * |
| 86 | * @param ipPrefix IP prefix |
| 87 | * @return FabricSubnet instance builder |
| 88 | */ |
| 89 | Builder ipPrefix(IpPrefix ipPrefix); |
| 90 | |
| 91 | /** |
| 92 | * Returns FabricSubnet builder with supplied gatewayIp. |
| 93 | * |
| 94 | * @param gatewayIp gateway IP |
| 95 | * @return FabricSubnet instance builder |
| 96 | */ |
| 97 | Builder gatewayIp(IpAddress gatewayIp); |
| 98 | |
| 99 | /** |
| 100 | * Returns FabricSubnet builder with supplied gatewayMac. |
| 101 | * |
| 102 | * @param gatewayMac gateway MAC |
| 103 | * @return FabricSubnet instance builder |
| 104 | */ |
| 105 | Builder gatewayMac(MacAddress gatewayMac); |
| 106 | |
| 107 | /** |
| 108 | * Returns FabricSubnet builder with supplied encapsulation type. |
| 109 | * |
| 110 | * @param encapsulation encapsulation type |
| 111 | * @return FabricSubnet instance builder |
| 112 | */ |
| 113 | Builder encapsulation(EncapsulationType encapsulation); |
| 114 | |
| 115 | /** |
| 116 | * Returns FabricSubnet builder with supplied subnet name. |
| 117 | * |
| 118 | * @param name subnet name |
| 119 | * @return FabricSubnet instance builder |
| 120 | */ |
| 121 | Builder name(String name); |
| 122 | |
| 123 | /** |
| 124 | * Builds an immutable FabricSubnet instance. |
| 125 | * |
| 126 | * @return FabricSubnet instance |
| 127 | */ |
| 128 | FabricSubnet build(); |
| 129 | } |
| 130 | } |