blob: 25ef0289b13b4cbcc1ecb1d42228e380af93ea40 [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;
Thomas Vachuska58de4162015-09-10 16:15:33 -070021import org.onosproject.net.DeviceId;
lishuai69b36d52015-10-21 16:50:16 +080022import org.onosproject.vtnrsc.FixedIp;
Thomas Vachuska58de4162015-09-10 16:15:33 -070023import org.onosproject.vtnrsc.TenantId;
24import org.onosproject.vtnrsc.TenantNetworkId;
25import org.onosproject.vtnrsc.VirtualPort;
26import org.onosproject.vtnrsc.VirtualPortId;
27
28/**
29 * Service for interacting with the inventory of virtualPort.
30 */
31public interface VirtualPortService {
32 /**
33 * Returns if the virtualPort is existed.
34 *
35 * @param virtualPortId virtualPort identifier
36 * @return true or false if one with the given identifier is not existed.
37 */
38 boolean exists(VirtualPortId virtualPortId);
39
40 /**
41 * Returns the virtualPort with the identifier.
42 *
43 * @param virtualPortId virtualPort ID
44 * @return VirtualPort or null if one with the given ID is not know.
45 */
46 VirtualPort getPort(VirtualPortId virtualPortId);
47
48 /**
lishuai69b36d52015-10-21 16:50:16 +080049 * Returns the virtualPort associated with the fixedIP.
50 *
51 * @param fixedIP the fixedIP identifier
52 * @return virtualPort.
53 */
54 VirtualPort getPort(FixedIp fixedIP);
55
56 /**
lishuai858efd32015-12-04 14:30:36 +080057 * Returns the virtualPort associated with the networkId and ip.
58 *
59 * @param networkId the TenantNetworkId identifier
60 * @param ip the ip identifier
61 * @return virtualPort.
62 */
63 VirtualPort getPort(TenantNetworkId networkId, IpAddress ip);
64
65 /**
Thomas Vachuska58de4162015-09-10 16:15:33 -070066 * Returns the collection of the currently known virtualPort.
67 * @return collection of VirtualPort.
68 */
69 Collection<VirtualPort> getPorts();
70
71 /**
72 * Returns the collection of the virtualPorts associated with the networkId.
73 *
74 * @param networkId the network identifer
75 * @return collection of virtualPort.
76 */
77 Collection<VirtualPort> getPorts(TenantNetworkId networkId);
78
79 /**
80 * Returns the collection of the virtualPorts associated with the tenantId.
81 *
82 * @param tenantId the tenant identifier
83 * @return collection of virtualPorts.
84 */
85 Collection<VirtualPort> getPorts(TenantId tenantId);
86
87 /**
88 * Returns the collection of the virtualPorts associated with the deviceId.
89 *
90 * @param deviceId the device identifier
91 * @return collection of virtualPort.
92 */
93 Collection<VirtualPort> getPorts(DeviceId deviceId);
94
95 /**
96 * Creates virtualPorts by virtualPorts.
97 *
98 * @param virtualPorts the iterable collection of virtualPorts
99 * @return true if all given identifiers created successfully.
100 */
101 boolean createPorts(Iterable<VirtualPort> virtualPorts);
102
103 /**
104 * Updates virtualPorts by virtualPorts.
105 *
106 * @param virtualPorts the iterable collection of virtualPorts
107 * @return true if all given identifiers updated successfully.
108 */
109 boolean updatePorts(Iterable<VirtualPort> virtualPorts);
110
111 /**
112 * Deletes virtualPortIds by virtualPortIds.
113 *
114 * @param virtualPortIds the iterable collection of virtualPort identifiers
115 * @return true or false if one with the given identifier to delete is
116 * successfully.
117 */
118 boolean removePorts(Iterable<VirtualPortId> virtualPortIds);
119}