blob: 8677c020872ef7e16bb44ff55b1b6169c53b418a [file] [log] [blame]
Thomas Vachuska58de4162015-09-10 16:15:33 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Thomas Vachuska58de4162015-09-10 16:15:33 -07003 *
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.vtnrsc.virtualport;
17
18import java.util.Collection;
19
lishuai858efd32015-12-04 14:30:36 +080020import org.onlab.packet.IpAddress;
Phaneendra Mandabd09d6e2016-07-15 19:47:51 +053021import org.onlab.packet.MacAddress;
Phaneendra Mandab212bc92016-07-08 16:50:11 +053022import org.onosproject.event.ListenerService;
Thomas Vachuska58de4162015-09-10 16:15:33 -070023import org.onosproject.net.DeviceId;
lishuai69b36d52015-10-21 16:50:16 +080024import org.onosproject.vtnrsc.FixedIp;
Thomas Vachuska58de4162015-09-10 16:15:33 -070025import org.onosproject.vtnrsc.TenantId;
26import org.onosproject.vtnrsc.TenantNetworkId;
27import org.onosproject.vtnrsc.VirtualPort;
28import org.onosproject.vtnrsc.VirtualPortId;
29
30/**
31 * Service for interacting with the inventory of virtualPort.
32 */
Phaneendra Mandab212bc92016-07-08 16:50:11 +053033public interface VirtualPortService extends ListenerService<VirtualPortEvent, VirtualPortListener> {
Thomas Vachuska58de4162015-09-10 16:15:33 -070034 /**
35 * Returns if the virtualPort is existed.
36 *
37 * @param virtualPortId virtualPort identifier
38 * @return true or false if one with the given identifier is not existed.
39 */
40 boolean exists(VirtualPortId virtualPortId);
41
42 /**
43 * Returns the virtualPort with the identifier.
44 *
45 * @param virtualPortId virtualPort ID
46 * @return VirtualPort or null if one with the given ID is not know.
47 */
48 VirtualPort getPort(VirtualPortId virtualPortId);
49
50 /**
lishuai69b36d52015-10-21 16:50:16 +080051 * Returns the virtualPort associated with the fixedIP.
52 *
53 * @param fixedIP the fixedIP identifier
54 * @return virtualPort.
55 */
56 VirtualPort getPort(FixedIp fixedIP);
57
58 /**
Phaneendra Mandabd09d6e2016-07-15 19:47:51 +053059 * Returns the virtualPort associated with the mac address.
60 *
61 * @param mac the mac address
62 * @return virtualPort.
63 */
64 VirtualPort getPort(MacAddress mac);
65
66 /**
lishuai858efd32015-12-04 14:30:36 +080067 * Returns the virtualPort associated with the networkId and ip.
68 *
69 * @param networkId the TenantNetworkId identifier
70 * @param ip the ip identifier
71 * @return virtualPort.
72 */
73 VirtualPort getPort(TenantNetworkId networkId, IpAddress ip);
74
75 /**
Thomas Vachuska58de4162015-09-10 16:15:33 -070076 * Returns the collection of the currently known virtualPort.
77 * @return collection of VirtualPort.
78 */
79 Collection<VirtualPort> getPorts();
80
81 /**
82 * Returns the collection of the virtualPorts associated with the networkId.
83 *
84 * @param networkId the network identifer
85 * @return collection of virtualPort.
86 */
87 Collection<VirtualPort> getPorts(TenantNetworkId networkId);
88
89 /**
90 * Returns the collection of the virtualPorts associated with the tenantId.
91 *
92 * @param tenantId the tenant identifier
93 * @return collection of virtualPorts.
94 */
95 Collection<VirtualPort> getPorts(TenantId tenantId);
96
97 /**
98 * Returns the collection of the virtualPorts associated with the deviceId.
99 *
100 * @param deviceId the device identifier
101 * @return collection of virtualPort.
102 */
103 Collection<VirtualPort> getPorts(DeviceId deviceId);
104
105 /**
106 * Creates virtualPorts by virtualPorts.
107 *
108 * @param virtualPorts the iterable collection of virtualPorts
109 * @return true if all given identifiers created successfully.
110 */
111 boolean createPorts(Iterable<VirtualPort> virtualPorts);
112
113 /**
114 * Updates virtualPorts by virtualPorts.
115 *
116 * @param virtualPorts the iterable collection of virtualPorts
117 * @return true if all given identifiers updated successfully.
118 */
119 boolean updatePorts(Iterable<VirtualPort> virtualPorts);
120
121 /**
122 * Deletes virtualPortIds by virtualPortIds.
123 *
124 * @param virtualPortIds the iterable collection of virtualPort identifiers
125 * @return true or false if one with the given identifier to delete is
126 * successfully.
127 */
128 boolean removePorts(Iterable<VirtualPortId> virtualPortIds);
129}