blob: ca569467b332f9370a0302a1d14276b69d5d02ac [file] [log] [blame]
Jian Lie2d87512018-08-23 17:33:05 +09001/*
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
17package org.onosproject.simplefabric.api;
18
19import org.onlab.packet.IpAddress;
20import org.onlab.packet.IpPrefix;
21import org.onlab.packet.MacAddress;
22import org.onosproject.net.EncapsulationType;
23
24/**
25 * Interface of FabricSubnet.
26 */
27public 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 /**
Jian Lida0b4852018-08-29 20:40:44 +090058 * Gets the network name.
Jian Lie2d87512018-08-23 17:33:05 +090059 *
Jian Lida0b4852018-08-29 20:40:44 +090060 * @return the network name
Jian Lie2d87512018-08-23 17:33:05 +090061 */
Jian Lida0b4852018-08-29 20:40:44 +090062 String networkName();
Jian Lie2d87512018-08-23 17:33:05 +090063
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 */
Jian Lida0b4852018-08-29 20:40:44 +090089 Builder prefix(IpPrefix ipPrefix);
Jian Lie2d87512018-08-23 17:33:05 +090090
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 /**
Jian Lida0b4852018-08-29 20:40:44 +0900116 * Returns FabricSubnet builder with supplied network name.
Jian Lie2d87512018-08-23 17:33:05 +0900117 *
Jian Lida0b4852018-08-29 20:40:44 +0900118 * @param networkName network name
Jian Lie2d87512018-08-23 17:33:05 +0900119 * @return FabricSubnet instance builder
120 */
Jian Lida0b4852018-08-29 20:40:44 +0900121 Builder networkName(String networkName);
Jian Lie2d87512018-08-23 17:33:05 +0900122
123 /**
124 * Builds an immutable FabricSubnet instance.
125 *
126 * @return FabricSubnet instance
127 */
128 FabricSubnet build();
129 }
130}