blob: a7ae75eeaec025dcc9b97d1cce2e8a324c931004 [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 /**
64 * Returns new port instance with the given port number.
65 *
66 * @param portNumber updated port number
67 * @return updated port
68 */
69 KubevirtPort updatePortNumber(PortNumber portNumber);
70
71 /**
72 * Returns new port instance with the given device ID.
73 *
74 * @param deviceId device identifier
75 * @return updated port
76 */
77 KubevirtPort updateDeviceId(DeviceId deviceId);
78
79 /**
80 * Builder of new port.
81 */
82 interface Builder {
83
84 /**
85 * Builds an immutable port instance.
86 *
87 * @return kubernetes port
88 */
89 KubevirtPort build();
90
91 /**
Jian Li7bca1272021-01-14 11:30:36 +090092 * Returns port builder with supplied network identifier.
93 *
94 * @param networkId network identifier
95 * @return port builder
96 */
97 Builder networkId(String networkId);
98
99 /**
Jian Lie1fe06a2021-01-08 03:18:35 +0900100 * Returns port builder with supplied MAC address.
101 *
102 * @param macAddress MAC address
103 * @return port builder
104 */
105 Builder macAddress(MacAddress macAddress);
106
107 /**
108 * Returns port builder with supplied IP address.
109 *
110 * @param ipAddress IP address
111 * @return port builder
112 */
113 Builder ipAddress(IpAddress ipAddress);
114
115 /**
116 * Returns port builder with supplied device ID.
117 *
118 * @param deviceId device ID
119 * @return port builder
120 */
121 Builder deviceId(DeviceId deviceId);
122
123 /**
124 * Returns port builder with supplied port number.
125 *
126 * @param portNumber port number
127 * @return port builder
128 */
129 Builder portNumber(PortNumber portNumber);
130 }
131}