Thomas Vachuska | 58de416 | 2015-09-10 16:15:33 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Thomas Vachuska | 58de416 | 2015-09-10 16:15:33 -0700 | [diff] [blame] | 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 | |
lishuai | 858efd3 | 2015-12-04 14:30:36 +0800 | [diff] [blame] | 20 | import org.onlab.packet.IpAddress; |
Phaneendra Manda | bd09d6e | 2016-07-15 19:47:51 +0530 | [diff] [blame] | 21 | import org.onlab.packet.MacAddress; |
Phaneendra Manda | b212bc9 | 2016-07-08 16:50:11 +0530 | [diff] [blame] | 22 | import org.onosproject.event.ListenerService; |
Thomas Vachuska | 58de416 | 2015-09-10 16:15:33 -0700 | [diff] [blame] | 23 | import org.onosproject.net.DeviceId; |
lishuai | 69b36d5 | 2015-10-21 16:50:16 +0800 | [diff] [blame] | 24 | import org.onosproject.vtnrsc.FixedIp; |
Thomas Vachuska | 58de416 | 2015-09-10 16:15:33 -0700 | [diff] [blame] | 25 | import org.onosproject.vtnrsc.TenantId; |
| 26 | import org.onosproject.vtnrsc.TenantNetworkId; |
| 27 | import org.onosproject.vtnrsc.VirtualPort; |
| 28 | import org.onosproject.vtnrsc.VirtualPortId; |
| 29 | |
| 30 | /** |
| 31 | * Service for interacting with the inventory of virtualPort. |
| 32 | */ |
Phaneendra Manda | b212bc9 | 2016-07-08 16:50:11 +0530 | [diff] [blame] | 33 | public interface VirtualPortService extends ListenerService<VirtualPortEvent, VirtualPortListener> { |
Thomas Vachuska | 58de416 | 2015-09-10 16:15:33 -0700 | [diff] [blame] | 34 | /** |
| 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 | /** |
lishuai | 69b36d5 | 2015-10-21 16:50:16 +0800 | [diff] [blame] | 51 | * 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 Manda | bd09d6e | 2016-07-15 19:47:51 +0530 | [diff] [blame] | 59 | * 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 | /** |
lishuai | 858efd3 | 2015-12-04 14:30:36 +0800 | [diff] [blame] | 67 | * 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 Vachuska | 58de416 | 2015-09-10 16:15:33 -0700 | [diff] [blame] | 76 | * 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 | } |