blob: 9345b78f455a17d796767e8b12391b5311bde47d [file] [log] [blame]
Andreas Papazois1dff77c2016-02-16 16:27:33 +02001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
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
Ray Milkeye3e21ae2017-08-22 10:39:36 -070018import java.util.List;
19
Andreas Papazois1dff77c2016-02-16 16:27:33 +020020import org.onlab.packet.VlanId;
Andreas Papazois1ed54cf2016-05-04 16:22:40 +030021import org.onosproject.net.device.DeviceInterfaceDescription;
Andreas Papazois1dff77c2016-02-16 16:27:33 +020022import org.onosproject.net.driver.HandlerBehaviour;
23
24/**
25 * Means to configure interfaces on devices.
26 */
27public interface InterfaceConfig extends HandlerBehaviour {
28
29 /**
Andreas Papazois827d8d02016-04-15 11:53:16 +030030 * Adds an access interface to a VLAN.
Andreas Papazois1ed54cf2016-05-04 16:22:40 +030031 *
Andreas Papazois34a82cf2016-04-27 09:09:13 +030032 * @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 Papazois1dff77c2016-02-16 16:27:33 +020037
38 /**
Andreas Papazois827d8d02016-04-15 11:53:16 +030039 * Removes an access interface to a VLAN.
Andreas Papazois1ed54cf2016-05-04 16:22:40 +030040 *
Andreas Papazois34a82cf2016-04-27 09:09:13 +030041 * @param intf the name of the interface
42 * @return the result of operation
43 */
44 boolean removeAccessMode(String intf);
45
46 /**
Andreas Papazois827d8d02016-04-15 11:53:16 +030047 * Adds a trunk interface for VLANs.
Andreas Papazois1ed54cf2016-05-04 16:22:40 +030048 *
Andreas Papazois34a82cf2016-04-27 09:09:13 +030049 * @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 Papazois34a82cf2016-04-27 09:09:13 +030056 * 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 Moondd14e8e2016-06-09 16:17:32 -070081 * 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 Moon89478662016-06-09 17:52:34 -070098 * 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 Papazois1ed54cf2016-05-04 16:22:40 +0300115 * Provides the interfaces configured on a device.
116 *
Andreas Papazois34a82cf2016-04-27 09:09:13 +0300117 * @return the list of the configured interfaces
118 */
119 List<DeviceInterfaceDescription> getInterfaces();
Andreas Papazois1ed54cf2016-05-04 16:22:40 +0300120
121 /**
Andreas Papazois92e4a042016-02-24 15:29:30 +0200122 * TODO Addition of more methods to make the behavior symmetrical.
Andreas Papazois34a82cf2016-04-27 09:09:13 +0300123 * Methods getInterfacesForVlan(VlanId), hasAccessMode(), hasTrunkMode(),
124 * getTrunkVlans(Interface), getAccessVlan(Interface) should be added to
125 * complete the behavior.
Andreas Papazois92e4a042016-02-24 15:29:30 +0200126 */
Andreas Papazois1dff77c2016-02-16 16:27:33 +0200127}