blob: 3f196407b596857981b8565a6765b216aafe1261 [file] [log] [blame]
Jian Lib9642832021-01-08 03:18:35 +09001/*
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 */
16package org.onosproject.kubevirtnetworking.api;
17
18import org.onlab.packet.IpAddress;
19import org.onlab.packet.MacAddress;
20import org.onosproject.net.DeviceId;
21import org.onosproject.net.PortNumber;
22
Jian Li8f944d42021-03-23 00:43:29 +090023import java.util.Set;
24
Jian Lib9642832021-01-08 03:18:35 +090025/**
26 * Representation of virtual port.
27 */
28public interface KubevirtPort {
29
30 /**
Jian Li3ba5c582021-01-14 11:30:36 +090031 * Returns the network identifier associated with the port.
32 *
33 * @return network identifier
34 */
35 String networkId();
36
37 /**
Jian Lib9642832021-01-08 03:18:35 +090038 * Returns the MAC address of the port.
39 *
40 * @return MAC address
41 */
42 MacAddress macAddress();
43
44 /**
45 * Returns the IP address of the port.
46 *
47 * @return IP address
48 */
49 IpAddress ipAddress();
50
51 /**
52 * Returns the device ID of the port.
53 *
54 * @return device ID
55 */
56 DeviceId deviceId();
57
58 /**
Jian Li8f944d42021-03-23 00:43:29 +090059 * Returns the tenant device ID of the port.
60 *
61 * @return device ID
62 */
63 DeviceId tenantDeviceId();
64
65 /**
66 * Returns the result whether the port is associated with the tenant network.
67 *
68 * @return true if the port is associated with tenant network, false otherwise
69 */
70 boolean isTenant();
71
72 /**
Jian Lib9642832021-01-08 03:18:35 +090073 * Returns the port number of the port.
74 *
75 * @return port number
76 */
77 PortNumber portNumber();
78
79 /**
Jian Lica20b712021-01-18 00:19:31 +090080 * Returns new port instance with the given IP address.
Jian Lib9642832021-01-08 03:18:35 +090081 *
Jian Lica20b712021-01-18 00:19:31 +090082 * @param updatedIpAddress updated ip address
Jian Lib9642832021-01-08 03:18:35 +090083 * @return updated port
84 */
Jian Lica20b712021-01-18 00:19:31 +090085 KubevirtPort updateIpAddress(IpAddress updatedIpAddress);
86
87 /**
88 * Returns new port instance with the given port number.
89 *
90 * @param updatedPortNumber updated port number
91 * @return updated port
92 */
93 KubevirtPort updatePortNumber(PortNumber updatedPortNumber);
Jian Lib9642832021-01-08 03:18:35 +090094
95 /**
96 * Returns new port instance with the given device ID.
97 *
Jian Lica20b712021-01-18 00:19:31 +090098 * @param updatedDeviceId device identifier
Jian Lib9642832021-01-08 03:18:35 +090099 * @return updated port
100 */
Jian Lica20b712021-01-18 00:19:31 +0900101 KubevirtPort updateDeviceId(DeviceId updatedDeviceId);
Jian Lib9642832021-01-08 03:18:35 +0900102
103 /**
Jian Li8f944d42021-03-23 00:43:29 +0900104 * Returns the security group IDs.
105 *
106 * @return security group identifiers.
107 */
108 Set<String> securityGroups();
109
110 /**
111 * Returns new port instance with the given security groups.
112 *
113 * @param sgs security groups
114 * @return updated port
115 */
116 KubevirtPort updateSecurityGroups(Set<String> sgs);
117
118 /**
Jian Lib9642832021-01-08 03:18:35 +0900119 * Builder of new port.
120 */
121 interface Builder {
122
123 /**
124 * Builds an immutable port instance.
125 *
126 * @return kubernetes port
127 */
128 KubevirtPort build();
129
130 /**
Jian Li3ba5c582021-01-14 11:30:36 +0900131 * Returns port builder with supplied network identifier.
132 *
133 * @param networkId network identifier
134 * @return port builder
135 */
136 Builder networkId(String networkId);
137
138 /**
Jian Lib9642832021-01-08 03:18:35 +0900139 * Returns port builder with supplied MAC address.
140 *
141 * @param macAddress MAC address
142 * @return port builder
143 */
144 Builder macAddress(MacAddress macAddress);
145
146 /**
147 * Returns port builder with supplied IP address.
148 *
149 * @param ipAddress IP address
150 * @return port builder
151 */
152 Builder ipAddress(IpAddress ipAddress);
153
154 /**
155 * Returns port builder with supplied device ID.
156 *
157 * @param deviceId device ID
158 * @return port builder
159 */
160 Builder deviceId(DeviceId deviceId);
161
162 /**
163 * Returns port builder with supplied port number.
164 *
165 * @param portNumber port number
166 * @return port builder
167 */
168 Builder portNumber(PortNumber portNumber);
Jian Li8f944d42021-03-23 00:43:29 +0900169
170 /**
171 * Returns port builder with supplied security group identifiers.
172 *
173 * @param securityGroups security group identifiers
174 * @return port builder
175 */
176 Builder securityGroups(Set<String> securityGroups);
Jian Lib9642832021-01-08 03:18:35 +0900177 }
178}