Andreas Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
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 | |
Ray Milkey | e3e21ae | 2017-08-22 10:39:36 -0700 | [diff] [blame] | 18 | import java.util.List; |
| 19 | |
Andreas Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [diff] [blame] | 20 | import org.onlab.packet.VlanId; |
Andreas Papazois | 1ed54cf | 2016-05-04 16:22:40 +0300 | [diff] [blame] | 21 | import org.onosproject.net.device.DeviceInterfaceDescription; |
Andreas Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [diff] [blame] | 22 | import org.onosproject.net.driver.HandlerBehaviour; |
| 23 | |
| 24 | /** |
| 25 | * Means to configure interfaces on devices. |
| 26 | */ |
| 27 | public interface InterfaceConfig extends HandlerBehaviour { |
| 28 | |
| 29 | /** |
Andreas Papazois | 827d8d0 | 2016-04-15 11:53:16 +0300 | [diff] [blame] | 30 | * Adds an access interface to a VLAN. |
Andreas Papazois | 1ed54cf | 2016-05-04 16:22:40 +0300 | [diff] [blame] | 31 | * |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 32 | * @param intf the name of the interface |
| 33 | * @param vlanId the VLAN ID |
| 34 | * @return the result of operation |
| 35 | */ |
| 36 | boolean addAccessMode(String intf, VlanId vlanId); |
Andreas Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [diff] [blame] | 37 | |
| 38 | /** |
Andreas Papazois | 827d8d0 | 2016-04-15 11:53:16 +0300 | [diff] [blame] | 39 | * Removes an access interface to a VLAN. |
Andreas Papazois | 1ed54cf | 2016-05-04 16:22:40 +0300 | [diff] [blame] | 40 | * |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 41 | * @param intf the name of the interface |
| 42 | * @return the result of operation |
| 43 | */ |
| 44 | boolean removeAccessMode(String intf); |
| 45 | |
| 46 | /** |
Andreas Papazois | 827d8d0 | 2016-04-15 11:53:16 +0300 | [diff] [blame] | 47 | * Adds a trunk interface for VLANs. |
Andreas Papazois | 1ed54cf | 2016-05-04 16:22:40 +0300 | [diff] [blame] | 48 | * |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 49 | * @param intf the name of the interface |
| 50 | * @param vlanIds the VLAN IDs |
| 51 | * @return the result of operation |
| 52 | */ |
| 53 | boolean addTrunkMode(String intf, List<VlanId> vlanIds); |
| 54 | |
| 55 | /** |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 56 | * Removes trunk mode configuration from an interface. |
| 57 | * |
| 58 | * @param intf the name of the interface |
| 59 | * @return the result of operation |
| 60 | */ |
| 61 | boolean removeTrunkMode(String intf); |
| 62 | |
| 63 | /** |
| 64 | * Adds a rate limit on an interface. |
| 65 | * |
| 66 | * @param intf the name of the interface |
| 67 | * @param limit the limit as a percentage |
| 68 | * @return the result of operation |
| 69 | */ |
| 70 | boolean addRateLimit(String intf, short limit); |
| 71 | |
| 72 | /** |
| 73 | * Removes rate limit from an interface. |
| 74 | * |
| 75 | * @param intf the name of the interface |
| 76 | * @return the result of operation |
| 77 | */ |
| 78 | boolean removeRateLimit(String intf); |
| 79 | |
| 80 | /** |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 81 | * Adds a tunnel mode to supplied interface. |
| 82 | * |
| 83 | * @param intf the name of the interface |
| 84 | * @param tunnelDesc tunnel interface description |
| 85 | * @return true if the operation succeeds |
| 86 | */ |
| 87 | boolean addTunnelMode(String intf, TunnelDescription tunnelDesc); |
| 88 | |
| 89 | /** |
| 90 | * Removes a tunnel interface. |
| 91 | * |
| 92 | * @param intf tunnel interface name |
| 93 | * @return true if the operation succeeds |
| 94 | */ |
| 95 | boolean removeTunnelMode(String intf); |
| 96 | |
| 97 | /** |
Hyunsun Moon | 8947866 | 2016-06-09 17:52:34 -0700 | [diff] [blame] | 98 | * Adds a patch mode to the supplied interface. |
| 99 | * |
| 100 | * @param ifaceName interface name to set patch mode |
| 101 | * @param patchInterface interface description |
| 102 | * @return true if the operation succeeds |
| 103 | */ |
| 104 | boolean addPatchMode(String ifaceName, PatchDescription patchInterface); |
| 105 | |
| 106 | /** |
| 107 | * Removes a patch mode from the supplied interface. |
| 108 | * |
| 109 | * @param ifaceName interface name |
| 110 | * @return true if the operation succeeds |
| 111 | */ |
| 112 | boolean removePatchMode(String ifaceName); |
| 113 | |
| 114 | /** |
Andreas Papazois | 1ed54cf | 2016-05-04 16:22:40 +0300 | [diff] [blame] | 115 | * Provides the interfaces configured on a device. |
| 116 | * |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 117 | * @return the list of the configured interfaces |
| 118 | */ |
| 119 | List<DeviceInterfaceDescription> getInterfaces(); |
Andreas Papazois | 1ed54cf | 2016-05-04 16:22:40 +0300 | [diff] [blame] | 120 | |
| 121 | /** |
Andreas Papazois | 92e4a04 | 2016-02-24 15:29:30 +0200 | [diff] [blame] | 122 | * TODO Addition of more methods to make the behavior symmetrical. |
Andreas Papazois | 34a82cf | 2016-04-27 09:09:13 +0300 | [diff] [blame] | 123 | * Methods getInterfacesForVlan(VlanId), hasAccessMode(), hasTrunkMode(), |
| 124 | * getTrunkVlans(Interface), getAccessVlan(Interface) should be added to |
| 125 | * complete the behavior. |
Andreas Papazois | 92e4a04 | 2016-02-24 15:29:30 +0200 | [diff] [blame] | 126 | */ |
Andreas Papazois | 1dff77c | 2016-02-16 16:27:33 +0200 | [diff] [blame] | 127 | } |