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