blob: 1cd61a6eddfa2e368bd9755d9f5e1785710bb1f8 [file] [log] [blame]
Andreas Papazois1dff77c2016-02-16 16:27:33 +02001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Andreas Papazois1dff77c2016-02-16 16:27:33 +02003 *
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.net.behaviour;
17
18import org.onlab.packet.VlanId;
19import org.onosproject.net.DeviceId;
Andreas Papazois1ed54cf2016-05-04 16:22:40 +030020import org.onosproject.net.device.DeviceInterfaceDescription;
Andreas Papazois1dff77c2016-02-16 16:27:33 +020021import org.onosproject.net.driver.HandlerBehaviour;
22
Andreas Papazois59e19bb2016-04-12 13:59:58 +030023import java.util.List;
24
Andreas Papazois1dff77c2016-02-16 16:27:33 +020025/**
26 * Means to configure interfaces on devices.
27 */
28public interface InterfaceConfig extends HandlerBehaviour {
29
30 /**
Andreas Papazois827d8d02016-04-15 11:53:16 +030031 * Adds an access interface to a VLAN.
Andreas Papazois1ed54cf2016-05-04 16:22:40 +030032 *
Andreas Papazois1dff77c2016-02-16 16:27:33 +020033 * @param deviceId the device ID
34 * @param intf the name of the interface
35 * @param vlanId the VLAN ID
36 * @return the result of operation
Andreas Papazois34a82cf2016-04-27 09:09:13 +030037 * @deprecated in 1.7.0 Hummingbird release - use of addAccessMode() instead
Andreas Papazois1dff77c2016-02-16 16:27:33 +020038 */
Andreas Papazois34a82cf2016-04-27 09:09:13 +030039 @Deprecated
Sho SHIMIZU07e31cf2016-08-15 11:46:38 -070040 boolean addAccessInterface(DeviceId deviceId, String intf, VlanId vlanId);
Andreas Papazois34a82cf2016-04-27 09:09:13 +030041
42 /**
43 * Adds an access interface to a VLAN.
44 *
45 * @param intf the name of the interface
46 * @param vlanId the VLAN ID
47 * @return the result of operation
48 */
49 boolean addAccessMode(String intf, VlanId vlanId);
Andreas Papazois1dff77c2016-02-16 16:27:33 +020050
51 /**
Andreas Papazois827d8d02016-04-15 11:53:16 +030052 * Removes an access interface to a VLAN.
Andreas Papazois1ed54cf2016-05-04 16:22:40 +030053 *
Andreas Papazois92e4a042016-02-24 15:29:30 +020054 * @param deviceId the device ID
55 * @param intf the name of the interface
Andreas Papazois92e4a042016-02-24 15:29:30 +020056 * @return the result of operation
Andreas Papazois34a82cf2016-04-27 09:09:13 +030057 * @deprecated in 1.7.0 Hummingbird release - use of removeAccessMode() instead
Andreas Papazois92e4a042016-02-24 15:29:30 +020058 */
Andreas Papazois34a82cf2016-04-27 09:09:13 +030059 @Deprecated
Andreas Papazois827d8d02016-04-15 11:53:16 +030060 boolean removeAccessInterface(DeviceId deviceId, String intf);
Andreas Papazois92e4a042016-02-24 15:29:30 +020061
62 /**
Andreas Papazois34a82cf2016-04-27 09:09:13 +030063 * Removes an access interface to a VLAN.
64 *
65 * @param intf the name of the interface
66 * @return the result of operation
67 */
68 boolean removeAccessMode(String intf);
69
70 /**
Andreas Papazois827d8d02016-04-15 11:53:16 +030071 * Adds a trunk interface for VLANs.
Andreas Papazois1ed54cf2016-05-04 16:22:40 +030072 *
Andreas Papazois1dff77c2016-02-16 16:27:33 +020073 * @param deviceId the device ID
74 * @param intf the name of the interface
Andreas Papazois59e19bb2016-04-12 13:59:58 +030075 * @param vlanIds the VLAN IDs
Andreas Papazois1dff77c2016-02-16 16:27:33 +020076 * @return the result of operation
Andreas Papazois34a82cf2016-04-27 09:09:13 +030077 * @deprecated in 1.7.0 Hummingbird release - use of addTrunkMode() instead
Andreas Papazois1dff77c2016-02-16 16:27:33 +020078 */
Andreas Papazois34a82cf2016-04-27 09:09:13 +030079 @Deprecated
Andreas Papazois59e19bb2016-04-12 13:59:58 +030080 boolean addTrunkInterface(DeviceId deviceId, String intf, List<VlanId> vlanIds);
Andreas Papazois1dff77c2016-02-16 16:27:33 +020081
Andreas Papazois92e4a042016-02-24 15:29:30 +020082 /**
Andreas Papazois34a82cf2016-04-27 09:09:13 +030083 * Adds a trunk interface for VLANs.
84 *
85 * @param intf the name of the interface
86 * @param vlanIds the VLAN IDs
87 * @return the result of operation
88 */
89 boolean addTrunkMode(String intf, List<VlanId> vlanIds);
90
91 /**
92 * Removes trunk mode configuration from an interface.
Andreas Papazois1ed54cf2016-05-04 16:22:40 +030093 *
Andreas Papazois92e4a042016-02-24 15:29:30 +020094 * @param deviceId the device ID
95 * @param intf the name of the interface
Andreas Papazois92e4a042016-02-24 15:29:30 +020096 * @return the result of operation
Andreas Papazois34a82cf2016-04-27 09:09:13 +030097 * @deprecated in 1.7.0 Hummingbird release - use of removeTrunkMode() instead
Andreas Papazois1dff77c2016-02-16 16:27:33 +020098 */
Andreas Papazois34a82cf2016-04-27 09:09:13 +030099 @Deprecated
Andreas Papazois827d8d02016-04-15 11:53:16 +0300100 boolean removeTrunkInterface(DeviceId deviceId, String intf);
Andreas Papazois92e4a042016-02-24 15:29:30 +0200101
102 /**
Andreas Papazois34a82cf2016-04-27 09:09:13 +0300103 * Removes trunk mode configuration from an interface.
104 *
105 * @param intf the name of the interface
106 * @return the result of operation
107 */
108 boolean removeTrunkMode(String intf);
109
110 /**
111 * Adds a rate limit on an interface.
112 *
113 * @param intf the name of the interface
114 * @param limit the limit as a percentage
115 * @return the result of operation
116 */
117 boolean addRateLimit(String intf, short limit);
118
119 /**
120 * Removes rate limit from an interface.
121 *
122 * @param intf the name of the interface
123 * @return the result of operation
124 */
125 boolean removeRateLimit(String intf);
126
127 /**
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700128 * Adds a tunnel mode to supplied interface.
129 *
130 * @param intf the name of the interface
131 * @param tunnelDesc tunnel interface description
132 * @return true if the operation succeeds
133 */
134 boolean addTunnelMode(String intf, TunnelDescription tunnelDesc);
135
136 /**
137 * Removes a tunnel interface.
138 *
139 * @param intf tunnel interface name
140 * @return true if the operation succeeds
141 */
142 boolean removeTunnelMode(String intf);
143
144 /**
Hyunsun Moon89478662016-06-09 17:52:34 -0700145 * Adds a patch mode to the supplied interface.
146 *
147 * @param ifaceName interface name to set patch mode
148 * @param patchInterface interface description
149 * @return true if the operation succeeds
150 */
151 boolean addPatchMode(String ifaceName, PatchDescription patchInterface);
152
153 /**
154 * Removes a patch mode from the supplied interface.
155 *
156 * @param ifaceName interface name
157 * @return true if the operation succeeds
158 */
159 boolean removePatchMode(String ifaceName);
160
161 /**
Andreas Papazois1ed54cf2016-05-04 16:22:40 +0300162 * Provides the interfaces configured on a device.
163 *
164 * @param deviceId the device ID
165 * @return the list of the configured interfaces
Andreas Papazois34a82cf2016-04-27 09:09:13 +0300166 * @deprecated in 1.7.0 Hummingbird release - use of getInterfaces() without
167 * deviceId as parameter instead
Andreas Papazois1ed54cf2016-05-04 16:22:40 +0300168 */
Andreas Papazois34a82cf2016-04-27 09:09:13 +0300169 @Deprecated
Sho SHIMIZU07e31cf2016-08-15 11:46:38 -0700170 List<DeviceInterfaceDescription> getInterfaces(DeviceId deviceId);
Andreas Papazois34a82cf2016-04-27 09:09:13 +0300171
172 /**
173 * Provides the interfaces configured on a device.
174 *
175 * @return the list of the configured interfaces
176 */
177 List<DeviceInterfaceDescription> getInterfaces();
Andreas Papazois1ed54cf2016-05-04 16:22:40 +0300178
179 /**
Andreas Papazois92e4a042016-02-24 15:29:30 +0200180 * TODO Addition of more methods to make the behavior symmetrical.
Andreas Papazois34a82cf2016-04-27 09:09:13 +0300181 * Methods getInterfacesForVlan(VlanId), hasAccessMode(), hasTrunkMode(),
182 * getTrunkVlans(Interface), getAccessVlan(Interface) should be added to
183 * complete the behavior.
Andreas Papazois92e4a042016-02-24 15:29:30 +0200184 */
Andreas Papazois1dff77c2016-02-16 16:27:33 +0200185}