blob: c3bdb2b74f654c21ea86153ee77f8ff590194ad9 [file] [log] [blame]
Mohammad Shahid4c30ea32017-08-09 18:02:10 +05301/*
2 * Copyright 2017-present Open Networking Foundation
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
17package org.onosproject.evpnopenflow.rsc.baseport;
18
19import com.fasterxml.jackson.databind.JsonNode;
20import org.onlab.packet.IpAddress;
21import org.onlab.packet.MacAddress;
22import org.onosproject.evpnopenflow.rsc.BasePort;
23import org.onosproject.evpnopenflow.rsc.BasePortId;
24import org.onosproject.net.DeviceId;
25import org.onosproject.vtnrsc.FixedIp;
26import org.onosproject.vtnrsc.TenantId;
27import org.onosproject.vtnrsc.TenantNetworkId;
28
29import java.util.Collection;
30
31
32/**
33 * Service for interacting with the inventory of basePort.
34 */
35public interface BasePortService {
36 /**
37 * Returns if the basePort is existed.
38 *
39 * @param basePortId basePort identifier
40 * @return true or false if one with the given identifier is not existed.
41 */
42 boolean exists(BasePortId basePortId);
43
44 /**
45 * Returns the basePort with the identifier.
46 *
47 * @param basePortId basePort ID
48 * @return BasePort or null if one with the given ID is not know.
49 */
50 BasePort getPort(BasePortId basePortId);
51
52 /**
53 * Returns the basePort associated with the fixedIP.
54 *
55 * @param fixedIP the fixedIP identifier
56 * @return basePort.
57 */
58 BasePort getPort(FixedIp fixedIP);
59
60 /**
61 * Returns the basePort associated with the mac address.
62 *
63 * @param mac the mac address
64 * @return basePort.
65 */
66 BasePort getPort(MacAddress mac);
67
68 /**
69 * Returns the basePort associated with the networkId and ip.
70 *
71 * @param networkId the TenantNetworkId identifier
72 * @param ip the ip identifier
73 * @return basePort.
74 */
75 BasePort getPort(TenantNetworkId networkId, IpAddress ip);
76
77 /**
78 * Returns the collection of the currently known basePort.
79 *
80 * @return collection of BasePort.
81 */
82 Collection<BasePort> getPorts();
83
84 /**
85 * Returns the collection of the basePorts associated with the networkId.
86 *
87 * @param networkId the network identifer
88 * @return collection of basePort.
89 */
90 Collection<BasePort> getPorts(TenantNetworkId networkId);
91
92 /**
93 * Returns the collection of the basePorts associated with the tenantId.
94 *
95 * @param tenantId the tenant identifier
96 * @return collection of basePorts.
97 */
98 Collection<BasePort> getPorts(TenantId tenantId);
99
100 /**
101 * Returns the collection of the basePorts associated with the deviceId.
102 *
103 * @param deviceId the device identifier
104 * @return collection of basePort.
105 */
106 Collection<BasePort> getPorts(DeviceId deviceId);
107
108 /**
109 * Creates basePorts by basePorts.
110 *
111 * @param basePorts the iterable collection of basePorts
112 * @return true if all given identifiers created successfully.
113 */
114 boolean createPorts(Iterable<BasePort> basePorts);
115
116 /**
117 * Updates basePorts by basePorts.
118 *
119 * @param basePorts the iterable collection of basePorts
120 * @return true if all given identifiers updated successfully.
121 */
122 boolean updatePorts(Iterable<BasePort> basePorts);
123
124 /**
125 * Deletes basePortIds by basePortIds.
126 *
127 * @param basePortIds the iterable collection of basePort identifiers
128 * @return true or false if one with the given identifier to delete is
129 * successfully.
130 */
131 boolean removePorts(Iterable<BasePortId> basePortIds);
132
133 /**
134 * process gluon config for vpn port information.
135 *
136 * @param action can be either update or delete
137 * @param key can contain the id and also target information
138 * @param value content of the vpn port configuration
139 */
140 void processGluonConfig(String action, String key, JsonNode value);
141
142 /**
143 * Adds the specified listener to Vpn Port manager.
144 *
145 * @param listener Vpn Port listener
146 */
147 void addListener(BasePortListener listener);
148
149 /**
150 * Removes the specified listener to Vpn Port manager.
151 *
152 * @param listener Vpn Port listener
153 */
154 void removeListener(BasePortListener listener);
155}