0a3ea2cd4403419343bb084a4cf4324009b66810
[onosfw.git] /
1 /*
2  * Copyright 2015 Open Networking Laboratory
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  */
16 package org.onosproject.vtnrsc.virtualport;
17
18 import java.util.Collection;
19
20 import org.onosproject.net.DeviceId;
21 import org.onosproject.vtnrsc.FixedIp;
22 import org.onosproject.vtnrsc.TenantId;
23 import org.onosproject.vtnrsc.TenantNetworkId;
24 import org.onosproject.vtnrsc.VirtualPort;
25 import org.onosproject.vtnrsc.VirtualPortId;
26
27 /**
28  * Service for interacting with the inventory of virtualPort.
29  */
30 public interface VirtualPortService {
31     /**
32      * Returns if the virtualPort is existed.
33      *
34      * @param virtualPortId virtualPort identifier
35      * @return true or false if one with the given identifier is not existed.
36      */
37     boolean exists(VirtualPortId virtualPortId);
38
39     /**
40      * Returns the virtualPort with the identifier.
41      *
42      * @param virtualPortId virtualPort ID
43      * @return VirtualPort or null if one with the given ID is not know.
44      */
45     VirtualPort getPort(VirtualPortId virtualPortId);
46
47     /**
48      * Returns the virtualPort associated with the fixedIP.
49      *
50      * @param fixedIP the fixedIP identifier
51      * @return virtualPort.
52      */
53     VirtualPort getPort(FixedIp fixedIP);
54
55     /**
56      * Returns the collection of the currently known virtualPort.
57      * @return collection of VirtualPort.
58      */
59     Collection<VirtualPort> getPorts();
60
61     /**
62      * Returns the collection of the virtualPorts associated with the networkId.
63      *
64      * @param networkId  the network identifer
65      * @return collection of virtualPort.
66      */
67     Collection<VirtualPort> getPorts(TenantNetworkId networkId);
68
69     /**
70      * Returns the collection of the virtualPorts associated with the tenantId.
71      *
72      * @param tenantId   the tenant identifier
73      * @return collection of virtualPorts.
74      */
75     Collection<VirtualPort> getPorts(TenantId tenantId);
76
77     /**
78      * Returns the collection of the virtualPorts associated with the deviceId.
79      *
80      * @param deviceId   the device identifier
81      * @return collection of virtualPort.
82      */
83     Collection<VirtualPort> getPorts(DeviceId deviceId);
84
85     /**
86      * Creates virtualPorts by virtualPorts.
87      *
88      * @param virtualPorts the iterable collection of virtualPorts
89      * @return true if all given identifiers created successfully.
90      */
91     boolean createPorts(Iterable<VirtualPort> virtualPorts);
92
93     /**
94      * Updates virtualPorts by virtualPorts.
95      *
96      * @param virtualPorts the iterable  collection of virtualPorts
97      * @return true if all given identifiers updated successfully.
98      */
99     boolean updatePorts(Iterable<VirtualPort> virtualPorts);
100
101     /**
102      * Deletes virtualPortIds by virtualPortIds.
103      *
104      * @param virtualPortIds the iterable collection of virtualPort identifiers
105      * @return true or false if one with the given identifier to delete is
106      *         successfully.
107      */
108     boolean removePorts(Iterable<VirtualPortId> virtualPortIds);
109 }