Andreas Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Andreas Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [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.net.behaviour; |
| 17 | |
| 18 | import org.onlab.packet.VlanId; |
| 19 | import org.onosproject.net.DeviceId; |
Andreas Papazois | 1ed54cf | 2016-05-04 16:22:40 +0300 | [diff] [blame] | 20 | import org.onosproject.net.device.DeviceInterfaceDescription; |
Andreas Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [diff] [blame] | 21 | import org.onosproject.net.driver.HandlerBehaviour; |
| 22 | |
Andreas Papazois | 59e19bb | 2016-04-12 13:59:58 +0300 | [diff] [blame] | 23 | import java.util.List; |
| 24 | |
Andreas Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [diff] [blame] | 25 | /** |
| 26 | * Means to configure interfaces on devices. |
| 27 | */ |
| 28 | public interface InterfaceConfig extends HandlerBehaviour { |
| 29 | |
| 30 | /** |
Andreas Papazois | 827d8d0 | 2016-04-15 11:53:16 +0300 | [diff] [blame] | 31 | * Adds an access interface to a VLAN. |
Andreas Papazois | 1ed54cf | 2016-05-04 16:22:40 +0300 | [diff] [blame] | 32 | * |
Andreas Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [diff] [blame] | 33 | * @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 Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 37 | * @deprecated in 1.7.0 Hummingbird release - use of addAccessMode() instead |
Andreas Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [diff] [blame] | 38 | */ |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 39 | @Deprecated |
Sho SHIMIZU | 07e31cf | 2016-08-15 11:46:38 -0700 | [diff] [blame] | 40 | boolean addAccessInterface(DeviceId deviceId, String intf, VlanId vlanId); |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 41 | |
| 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 Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [diff] [blame] | 50 | |
| 51 | /** |
Andreas Papazois | 827d8d0 | 2016-04-15 11:53:16 +0300 | [diff] [blame] | 52 | * Removes an access interface to a VLAN. |
Andreas Papazois | 1ed54cf | 2016-05-04 16:22:40 +0300 | [diff] [blame] | 53 | * |
Andreas Papazois | 92e4a04 | 2016-02-24 15:29:30 +0200 | [diff] [blame] | 54 | * @param deviceId the device ID |
| 55 | * @param intf the name of the interface |
Andreas Papazois | 92e4a04 | 2016-02-24 15:29:30 +0200 | [diff] [blame] | 56 | * @return the result of operation |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 57 | * @deprecated in 1.7.0 Hummingbird release - use of removeAccessMode() instead |
Andreas Papazois | 92e4a04 | 2016-02-24 15:29:30 +0200 | [diff] [blame] | 58 | */ |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 59 | @Deprecated |
Andreas Papazois | 827d8d0 | 2016-04-15 11:53:16 +0300 | [diff] [blame] | 60 | boolean removeAccessInterface(DeviceId deviceId, String intf); |
Andreas Papazois | 92e4a04 | 2016-02-24 15:29:30 +0200 | [diff] [blame] | 61 | |
| 62 | /** |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 63 | * 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 Papazois | 827d8d0 | 2016-04-15 11:53:16 +0300 | [diff] [blame] | 71 | * Adds a trunk interface for VLANs. |
Andreas Papazois | 1ed54cf | 2016-05-04 16:22:40 +0300 | [diff] [blame] | 72 | * |
Andreas Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [diff] [blame] | 73 | * @param deviceId the device ID |
| 74 | * @param intf the name of the interface |
Andreas Papazois | 59e19bb | 2016-04-12 13:59:58 +0300 | [diff] [blame] | 75 | * @param vlanIds the VLAN IDs |
Andreas Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [diff] [blame] | 76 | * @return the result of operation |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 77 | * @deprecated in 1.7.0 Hummingbird release - use of addTrunkMode() instead |
Andreas Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [diff] [blame] | 78 | */ |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 79 | @Deprecated |
Andreas Papazois | 59e19bb | 2016-04-12 13:59:58 +0300 | [diff] [blame] | 80 | boolean addTrunkInterface(DeviceId deviceId, String intf, List<VlanId> vlanIds); |
Andreas Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [diff] [blame] | 81 | |
Andreas Papazois | 92e4a04 | 2016-02-24 15:29:30 +0200 | [diff] [blame] | 82 | /** |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 83 | * 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 Papazois | 1ed54cf | 2016-05-04 16:22:40 +0300 | [diff] [blame] | 93 | * |
Andreas Papazois | 92e4a04 | 2016-02-24 15:29:30 +0200 | [diff] [blame] | 94 | * @param deviceId the device ID |
| 95 | * @param intf the name of the interface |
Andreas Papazois | 92e4a04 | 2016-02-24 15:29:30 +0200 | [diff] [blame] | 96 | * @return the result of operation |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 97 | * @deprecated in 1.7.0 Hummingbird release - use of removeTrunkMode() instead |
Andreas Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [diff] [blame] | 98 | */ |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 99 | @Deprecated |
Andreas Papazois | 827d8d0 | 2016-04-15 11:53:16 +0300 | [diff] [blame] | 100 | boolean removeTrunkInterface(DeviceId deviceId, String intf); |
Andreas Papazois | 92e4a04 | 2016-02-24 15:29:30 +0200 | [diff] [blame] | 101 | |
| 102 | /** |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 103 | * 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 Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 128 | * 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 Moon | 8947866 | 2016-06-09 17:52:34 -0700 | [diff] [blame] | 145 | * 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 Papazois | 1ed54cf | 2016-05-04 16:22:40 +0300 | [diff] [blame] | 162 | * Provides the interfaces configured on a device. |
| 163 | * |
| 164 | * @param deviceId the device ID |
| 165 | * @return the list of the configured interfaces |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 166 | * @deprecated in 1.7.0 Hummingbird release - use of getInterfaces() without |
| 167 | * deviceId as parameter instead |
Andreas Papazois | 1ed54cf | 2016-05-04 16:22:40 +0300 | [diff] [blame] | 168 | */ |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 169 | @Deprecated |
Sho SHIMIZU | 07e31cf | 2016-08-15 11:46:38 -0700 | [diff] [blame] | 170 | List<DeviceInterfaceDescription> getInterfaces(DeviceId deviceId); |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 171 | |
| 172 | /** |
| 173 | * Provides the interfaces configured on a device. |
| 174 | * |
| 175 | * @return the list of the configured interfaces |
| 176 | */ |
| 177 | List<DeviceInterfaceDescription> getInterfaces(); |
Andreas Papazois | 1ed54cf | 2016-05-04 16:22:40 +0300 | [diff] [blame] | 178 | |
| 179 | /** |
Andreas Papazois | 92e4a04 | 2016-02-24 15:29:30 +0200 | [diff] [blame] | 180 | * TODO Addition of more methods to make the behavior symmetrical. |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 181 | * Methods getInterfacesForVlan(VlanId), hasAccessMode(), hasTrunkMode(), |
| 182 | * getTrunkVlans(Interface), getAccessVlan(Interface) should be added to |
| 183 | * complete the behavior. |
Andreas Papazois | 92e4a04 | 2016-02-24 15:29:30 +0200 | [diff] [blame] | 184 | */ |
Andreas Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [diff] [blame] | 185 | } |