blob: 48c75d4919ac38dde92c0929e6ea1ebf0c571f40 [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 Li9557e902021-06-08 10:12:52 +090031 * Returns the name of VM where the kubevirt port is attached.
32 *
33 * @return VM name
34 */
35 String vmName();
36
37 /**
Jian Li3ba5c582021-01-14 11:30:36 +090038 * Returns the network identifier associated with the port.
39 *
40 * @return network identifier
41 */
42 String networkId();
43
44 /**
Jian Lib9642832021-01-08 03:18:35 +090045 * Returns the MAC address of the port.
46 *
47 * @return MAC address
48 */
49 MacAddress macAddress();
50
51 /**
52 * Returns the IP address of the port.
53 *
54 * @return IP address
55 */
56 IpAddress ipAddress();
57
58 /**
59 * Returns the device ID of the port.
60 *
61 * @return device ID
62 */
63 DeviceId deviceId();
64
65 /**
Jian Li8f944d42021-03-23 00:43:29 +090066 * Returns the tenant device ID of the port.
67 *
68 * @return device ID
69 */
70 DeviceId tenantDeviceId();
71
72 /**
73 * Returns the result whether the port is associated with the tenant network.
74 *
75 * @return true if the port is associated with tenant network, false otherwise
76 */
77 boolean isTenant();
78
79 /**
Jian Lib9642832021-01-08 03:18:35 +090080 * Returns the port number of the port.
81 *
82 * @return port number
83 */
84 PortNumber portNumber();
85
86 /**
Jian Lica20b712021-01-18 00:19:31 +090087 * Returns new port instance with the given IP address.
Jian Lib9642832021-01-08 03:18:35 +090088 *
Jian Lica20b712021-01-18 00:19:31 +090089 * @param updatedIpAddress updated ip address
Jian Lib9642832021-01-08 03:18:35 +090090 * @return updated port
91 */
Jian Lica20b712021-01-18 00:19:31 +090092 KubevirtPort updateIpAddress(IpAddress updatedIpAddress);
93
94 /**
95 * Returns new port instance with the given port number.
96 *
97 * @param updatedPortNumber updated port number
98 * @return updated port
99 */
100 KubevirtPort updatePortNumber(PortNumber updatedPortNumber);
Jian Lib9642832021-01-08 03:18:35 +0900101
102 /**
103 * Returns new port instance with the given device ID.
104 *
Jian Lica20b712021-01-18 00:19:31 +0900105 * @param updatedDeviceId device identifier
Jian Lib9642832021-01-08 03:18:35 +0900106 * @return updated port
107 */
Jian Lica20b712021-01-18 00:19:31 +0900108 KubevirtPort updateDeviceId(DeviceId updatedDeviceId);
Jian Lib9642832021-01-08 03:18:35 +0900109
110 /**
Jian Li8f944d42021-03-23 00:43:29 +0900111 * Returns the security group IDs.
112 *
113 * @return security group identifiers.
114 */
115 Set<String> securityGroups();
116
117 /**
118 * Returns new port instance with the given security groups.
119 *
120 * @param sgs security groups
121 * @return updated port
122 */
123 KubevirtPort updateSecurityGroups(Set<String> sgs);
124
125 /**
Jian Lib9642832021-01-08 03:18:35 +0900126 * Builder of new port.
127 */
128 interface Builder {
129
130 /**
131 * Builds an immutable port instance.
132 *
133 * @return kubernetes port
134 */
135 KubevirtPort build();
136
137 /**
Jian Li9557e902021-06-08 10:12:52 +0900138 * Returns port builder with supplied VM name.
139 *
140 * @param vmName VM name
141 * @return port builder
142 */
143 Builder vmName(String vmName);
144
145 /**
Jian Li3ba5c582021-01-14 11:30:36 +0900146 * Returns port builder with supplied network identifier.
147 *
148 * @param networkId network identifier
149 * @return port builder
150 */
151 Builder networkId(String networkId);
152
153 /**
Jian Lib9642832021-01-08 03:18:35 +0900154 * Returns port builder with supplied MAC address.
155 *
156 * @param macAddress MAC address
157 * @return port builder
158 */
159 Builder macAddress(MacAddress macAddress);
160
161 /**
162 * Returns port builder with supplied IP address.
163 *
164 * @param ipAddress IP address
165 * @return port builder
166 */
167 Builder ipAddress(IpAddress ipAddress);
168
169 /**
170 * Returns port builder with supplied device ID.
171 *
172 * @param deviceId device ID
173 * @return port builder
174 */
175 Builder deviceId(DeviceId deviceId);
176
177 /**
178 * Returns port builder with supplied port number.
179 *
180 * @param portNumber port number
181 * @return port builder
182 */
183 Builder portNumber(PortNumber portNumber);
Jian Li8f944d42021-03-23 00:43:29 +0900184
185 /**
186 * Returns port builder with supplied security group identifiers.
187 *
188 * @param securityGroups security group identifiers
189 * @return port builder
190 */
191 Builder securityGroups(Set<String> securityGroups);
Jian Lib9642832021-01-08 03:18:35 +0900192 }
193}