blob: 850ac6f448814efd2face407af0c349e4e905d99 [file] [log] [blame]
Jian Lie1fe06a2021-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
23/**
24 * Representation of virtual port.
25 */
26public interface KubevirtPort {
27
28 /**
Jian Li7bca1272021-01-14 11:30:36 +090029 * Returns the network identifier associated with the port.
30 *
31 * @return network identifier
32 */
33 String networkId();
34
35 /**
Jian Lie1fe06a2021-01-08 03:18:35 +090036 * Returns the MAC address of the port.
37 *
38 * @return MAC address
39 */
40 MacAddress macAddress();
41
42 /**
43 * Returns the IP address of the port.
44 *
45 * @return IP address
46 */
47 IpAddress ipAddress();
48
49 /**
50 * Returns the device ID of the port.
51 *
52 * @return device ID
53 */
54 DeviceId deviceId();
55
56 /**
57 * Returns the port number of the port.
58 *
59 * @return port number
60 */
61 PortNumber portNumber();
62
63 /**
Jian Lid5e8ea82021-01-18 00:19:31 +090064 * Returns new port instance with the given IP address.
Jian Lie1fe06a2021-01-08 03:18:35 +090065 *
Jian Lid5e8ea82021-01-18 00:19:31 +090066 * @param updatedIpAddress updated ip address
Jian Lie1fe06a2021-01-08 03:18:35 +090067 * @return updated port
68 */
Jian Lid5e8ea82021-01-18 00:19:31 +090069 KubevirtPort updateIpAddress(IpAddress updatedIpAddress);
70
71 /**
72 * Returns new port instance with the given port number.
73 *
74 * @param updatedPortNumber updated port number
75 * @return updated port
76 */
77 KubevirtPort updatePortNumber(PortNumber updatedPortNumber);
Jian Lie1fe06a2021-01-08 03:18:35 +090078
79 /**
80 * Returns new port instance with the given device ID.
81 *
Jian Lid5e8ea82021-01-18 00:19:31 +090082 * @param updatedDeviceId device identifier
Jian Lie1fe06a2021-01-08 03:18:35 +090083 * @return updated port
84 */
Jian Lid5e8ea82021-01-18 00:19:31 +090085 KubevirtPort updateDeviceId(DeviceId updatedDeviceId);
Jian Lie1fe06a2021-01-08 03:18:35 +090086
87 /**
88 * Builder of new port.
89 */
90 interface Builder {
91
92 /**
93 * Builds an immutable port instance.
94 *
95 * @return kubernetes port
96 */
97 KubevirtPort build();
98
99 /**
Jian Li7bca1272021-01-14 11:30:36 +0900100 * Returns port builder with supplied network identifier.
101 *
102 * @param networkId network identifier
103 * @return port builder
104 */
105 Builder networkId(String networkId);
106
107 /**
Jian Lie1fe06a2021-01-08 03:18:35 +0900108 * Returns port builder with supplied MAC address.
109 *
110 * @param macAddress MAC address
111 * @return port builder
112 */
113 Builder macAddress(MacAddress macAddress);
114
115 /**
116 * Returns port builder with supplied IP address.
117 *
118 * @param ipAddress IP address
119 * @return port builder
120 */
121 Builder ipAddress(IpAddress ipAddress);
122
123 /**
124 * Returns port builder with supplied device ID.
125 *
126 * @param deviceId device ID
127 * @return port builder
128 */
129 Builder deviceId(DeviceId deviceId);
130
131 /**
132 * Returns port builder with supplied port number.
133 *
134 * @param portNumber port number
135 * @return port builder
136 */
137 Builder portNumber(PortNumber portNumber);
138 }
139}