blob: d7c1ff29d07d95ce5b04aa8781e0b39f9c107b05 [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 /**
29 * Returns the MAC address of the port.
30 *
31 * @return MAC address
32 */
33 MacAddress macAddress();
34
35 /**
36 * Returns the IP address of the port.
37 *
38 * @return IP address
39 */
40 IpAddress ipAddress();
41
42 /**
43 * Returns the device ID of the port.
44 *
45 * @return device ID
46 */
47 DeviceId deviceId();
48
49 /**
50 * Returns the port number of the port.
51 *
52 * @return port number
53 */
54 PortNumber portNumber();
55
56 /**
57 * Returns new port instance with the given port number.
58 *
59 * @param portNumber updated port number
60 * @return updated port
61 */
62 KubevirtPort updatePortNumber(PortNumber portNumber);
63
64 /**
65 * Returns new port instance with the given device ID.
66 *
67 * @param deviceId device identifier
68 * @return updated port
69 */
70 KubevirtPort updateDeviceId(DeviceId deviceId);
71
72 /**
73 * Builder of new port.
74 */
75 interface Builder {
76
77 /**
78 * Builds an immutable port instance.
79 *
80 * @return kubernetes port
81 */
82 KubevirtPort build();
83
84 /**
85 * Returns port builder with supplied MAC address.
86 *
87 * @param macAddress MAC address
88 * @return port builder
89 */
90 Builder macAddress(MacAddress macAddress);
91
92 /**
93 * Returns port builder with supplied IP address.
94 *
95 * @param ipAddress IP address
96 * @return port builder
97 */
98 Builder ipAddress(IpAddress ipAddress);
99
100 /**
101 * Returns port builder with supplied device ID.
102 *
103 * @param deviceId device ID
104 * @return port builder
105 */
106 Builder deviceId(DeviceId deviceId);
107
108 /**
109 * Returns port builder with supplied port number.
110 *
111 * @param portNumber port number
112 * @return port builder
113 */
114 Builder portNumber(PortNumber portNumber);
115 }
116}