blob: bfb63a06712d6446b6d717a748702913c64ba894 [file] [log] [blame]
Jian Li4f368e82018-07-02 14:22:22 +09001/*
2 * Copyright 2018-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 */
16package org.onosproject.openstackvtap.api;
17
Jimo Jung14e87bf2018-09-03 16:28:13 +090018import org.onlab.packet.IpAddress;
Jian Li38e4d942018-07-03 22:19:16 +090019import org.onosproject.event.ListenerService;
20import org.onosproject.net.DeviceId;
21
22import java.util.Set;
23
Jian Li4f368e82018-07-02 14:22:22 +090024/**
Jimo Jung14e87bf2018-09-03 16:28:13 +090025 * Service for interacting with the inventory of openstack vtap.
Jian Li4f368e82018-07-02 14:22:22 +090026 */
Jian Li38e4d942018-07-03 22:19:16 +090027public interface OpenstackVtapService
28 extends ListenerService<OpenstackVtapEvent, OpenstackVtapListener> {
Jian Li4f368e82018-07-02 14:22:22 +090029
30 /**
Jimo Jung14e87bf2018-09-03 16:28:13 +090031 * Creates a new openstack vtap network based on the specified description.
Jian Li38e4d942018-07-03 22:19:16 +090032 *
Jimo Jung14e87bf2018-09-03 16:28:13 +090033 * @param mode mode of vtap network
34 * @param networkId network id of the vtap tunneling network
35 * @param serverIp server IP address used for tunneling
36 * @return created openstack vtap network object or null if error occurred
37 */
38 OpenstackVtapNetwork createVtapNetwork(OpenstackVtapNetwork.Mode mode, Integer networkId, IpAddress serverIp);
39
40 /**
41 * Updates the openstack vtap network based on the specified description.
42 *
43 * @param description description of vtap network
44 * @return updated openstack vtap network object or null if error occurred
45 */
46 OpenstackVtapNetwork updateVtapNetwork(OpenstackVtapNetwork description);
47
48 /**
49 * Removes the specified openstack vtap network.
50 *
51 * @return removed openstack vtap network object or null if error occurred
52 */
53 OpenstackVtapNetwork removeVtapNetwork();
54
55 /**
56 * Returns the openstack vtap network.
57 *
58 * @return openstack vtap network or null if not exists
59 */
60 OpenstackVtapNetwork getVtapNetwork();
61
62 /**
63 * Returns a set of devices which are associated with the openstack vtap network.
64 *
65 * @return set of devices
66 */
67 Set<DeviceId> getVtapNetworkDevices();
68
69 /**
70 * Creates a new openstack vtap based on the specified type and criterion.
71 *
72 * @param type type of vtap (all,rx,tx)
73 * @param vtapCriterion criterion of vtap
74 * @return created openstack vtap object or null if error occurred
75 */
76 OpenstackVtap createVtap(OpenstackVtap.Type type, OpenstackVtapCriterion vtapCriterion);
77
78 /**
79 * Updates the openstack vtap with specified description.
80 *
81 * @param description description of vtap
82 * @return updated openstack vtap object or null if error occurred
83 */
84 OpenstackVtap updateVtap(OpenstackVtap description);
85
86 /**
87 * Removes the specified openstack vtap with given vtap identifier.
88 *
89 * @param vtapId vtap identifier
90 * @return removed openstack vtap object or null if error occurred
91 */
92 OpenstackVtap removeVtap(OpenstackVtapId vtapId);
93
94 /**
95 * Returns the number of openstack vtaps for the given type.
96 *
97 * @param type type of vtap (any,rx,tx,all)
98 * @return number of openstack vtaps
Jian Li4f368e82018-07-02 14:22:22 +090099 */
Jian Li38e4d942018-07-03 22:19:16 +0900100 int getVtapCount(OpenstackVtap.Type type);
101
102 /**
Jimo Jung14e87bf2018-09-03 16:28:13 +0900103 * Returns a set of openstack vtaps for the given type.
Jian Li38e4d942018-07-03 22:19:16 +0900104 *
Jimo Jung14e87bf2018-09-03 16:28:13 +0900105 * @param type type of vtap (any,rx,tx,all)
106 * @return set of openstack vtaps
Jian Li38e4d942018-07-03 22:19:16 +0900107 */
108 Set<OpenstackVtap> getVtaps(OpenstackVtap.Type type);
109
110 /**
Jimo Jung14e87bf2018-09-03 16:28:13 +0900111 * Returns the openstack vtap with the specified identifier.
Jian Li38e4d942018-07-03 22:19:16 +0900112 *
Jimo Jung14e87bf2018-09-03 16:28:13 +0900113 * @param vtapId vtap identifier
114 * @return openstack vtap or null if one with the given identifier is not known
Jian Li38e4d942018-07-03 22:19:16 +0900115 */
Jimo Jung14e87bf2018-09-03 16:28:13 +0900116 OpenstackVtap getVtap(OpenstackVtapId vtapId);
Jian Li38e4d942018-07-03 22:19:16 +0900117
118 /**
Jimo Jung14e87bf2018-09-03 16:28:13 +0900119 * Returns a set of openstack vtaps which are associated with the given device.
Jian Li38e4d942018-07-03 22:19:16 +0900120 *
Jimo Jung14e87bf2018-09-03 16:28:13 +0900121 * @param deviceId device identifier
122 * @return set of openstack vtaps
Jian Li38e4d942018-07-03 22:19:16 +0900123 */
Jimo Jung14e87bf2018-09-03 16:28:13 +0900124 Set<OpenstackVtap> getVtapsByDeviceId(DeviceId deviceId);
Jian Li4f368e82018-07-02 14:22:22 +0900125}