blob: 983748faf50da744fff300b8d74773204ab52d93 [file] [log] [blame]
Konstantinos Kanonakisc4a9e872016-09-22 14:26:25 -05001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Konstantinos Kanonakisc4a9e872016-09-22 14:26:25 -05003 *
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 com.google.common.annotations.Beta;
19import org.onlab.packet.VlanId;
20import org.onosproject.net.driver.HandlerBehaviour;
21
22import java.util.Arrays;
23import java.util.Collection;
24
25/**
26 * Means to configure VLANs on legacy L2 switch devices.
27 */
28@Beta
29public interface L2SwitchVlanConfigBehaviour extends HandlerBehaviour {
30 /**
31 * Provides the VLANs configured on a device.
32 *
33 * @return the configured VLANs on the device
34 */
35 Collection<VlanId> getVlans();
36
37 /**
38 * Adds a VLAN on a device.
39 * Default enabled/disabled status of VLAN after depends on device.
40 *
41 * @param vlanId the VLAN to add
42 * @return true, if the VLAN was added successfully; false otherwise
43 */
44 default boolean addVlan(VlanId vlanId) {
45 return addVlan(Arrays.asList(vlanId));
46 }
47
48 /**
49 * Adds VLANs on a device.
50 * Default enabled/disabled status of VLAN after depends on device.
51 *
52 * @param vlanIds the VLANs to add
53 * @return true, if the VLANs were added successfully; false otherwise
54 */
55 boolean addVlan(Collection<VlanId> vlanIds);
56
57 /**
58 * Removes a VLAN from a device.
59 *
60 * @param vlanId the VLAN to remove
61 * @return true, if the VLAN was removed successfully; false otherwise
62 */
63 default boolean removeVlan(VlanId vlanId) {
64 return removeVlan(Arrays.asList(vlanId));
65 }
66
67 /**
68 * Removes VLANs from a device.
69 *
70 * @param vlanIds the VLANs to remove
71 * @return true, if the VLANs were removed successfully; false otherwise
72 */
73 boolean removeVlan(Collection<VlanId> vlanIds);
74
75 /**
76 * Obtains the status of a VLAN on a device.
77 *
78 * @param vlanId the VLAN to check
79 * @return true, if the VLAN is configured and enabled; false otherwise
80 */
81 boolean isEnabled(VlanId vlanId);
82
83 /**
84 * Enables a VLAN on a device.
85 *
86 * @param vlanId the VLAN to enable
87 * @return true, if the VLAN was enabled successfully; false otherwise
88 */
89 default boolean enableVlan(VlanId vlanId) {
90 return enableVlan(Arrays.asList(vlanId));
91 }
92
93 /**
94 * Enables VLANs on a device.
95 *
96 * @param vlanIds the VLANs to enable
97 * @return true, if the VLANs were enabled successfully; false otherwise
98 */
99 boolean enableVlan(Collection<VlanId> vlanIds);
100
101 /**
102 * Disables a VLAN on a device.
103 *
104 * @param vlanId the VLAN to disable
105 * @return true, if the VLAN was disabled successfully; false otherwise
106 */
107 default boolean disableVlan(VlanId vlanId) {
108 return disableVlan(Arrays.asList(vlanId));
109 }
110
111 /**
112 * Disables VLANs on a device.
113 *
114 * @param vlanIds VLANs to disable
115 * @return true, if the VLANs were disabled successfully; false otherwise
116 */
117 boolean disableVlan(Collection<VlanId> vlanIds);
118}