blob: bd222cd11095f63aad33ffa89e9e593a3baaea94 [file] [log] [blame]
Konstantinos Kanonakis0a9031d2016-09-22 11:35:11 -05001/*
2 * Copyright 2016-present Open Networking Laboratory
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 */
16package org.onosproject.net.behaviour;
17
18import com.google.common.annotations.Beta;
19import org.onosproject.net.driver.HandlerBehaviour;
20
21import java.io.IOException;
22import java.util.Collections;
23import java.util.Collection;
24
25/**
26 * Means to configure bandwidth profiles on devices.
27 */
28@Beta
29public interface BandwidthProfileConfigBehaviour extends HandlerBehaviour {
30 /**
31 * Adds a new bandwidth profile on the device.
32 * If a profile with the same name already exists on the device, the profile
33 * is not added.
34 *
35 * @param bwProfile the bandwidth profile to add
36 * @return true, if the profile was added successfully; false otherwise
37 */
38 default boolean addBandwidthProfile(BandwidthProfile bwProfile) {
39 return addBandwidthProfile(Collections.singletonList(bwProfile));
40 }
41
42 /**
43 * Adds new bandwidth profiles on the device.
44 * If profiles with the same names already exist on the device, the
45 * conflicting profiles are not added.
46 *
47 * @param bwProfiles the bandwidth profiles to add
48 * @return true, if any of the profiles were added successfully;
49 * false otherwise
50 */
51 boolean addBandwidthProfile(Collection<BandwidthProfile> bwProfiles);
52
53 /**
54 * Removes an existing bandwidth profile from a device.
55 * Returns false if the profile does not exist on the device.
56 *
57 * @param profileName the name of the profile to remove from the device
58 * @return true, if the profile was removed successfully; false otherwise
59 */
60 default boolean removeBandwidthProfile(String profileName) {
61 return removeBandwidthProfile(Collections.singletonList(profileName));
62 }
63
64 /**
65 * Removes existing bandwidth profiles from a device.
66 * Returns false if none of the profiles exist on the device.
67 *
68 * @param profileNames the names of the profiles to remove from the device
69 * @return true, if any of the profiles were removed successfully;
70 * false otherwise
71 */
72 boolean removeBandwidthProfile(Collection<String> profileNames);
73
74 /**
75 * Removes all existing bandwidth profiles from a device.
76 * Returns true if no profiles exist on the device.
77 *
78 * @return true, if all profiles were removed successfully; false otherwise
79 */
80 boolean removeAllBandwidthProfiles();
81
82 /**
83 * Updates an already configured bandwidth profile on the device.
84 * Returns false if the profile does not exist on the device.
85 *
86 * @param bwProfile the updated bandwidth profile
87 * @return true, if the profile was updated successfully; false otherwise
88 */
89 default boolean updateBandwidthProfile(BandwidthProfile bwProfile) {
90 return updateBandwidthProfile(Collections.singletonList(bwProfile));
91 }
92
93 /**
94 * Updates already configured bandwidth profiles on the device.
95 * Returns false if none of the profiles exist on the device.
96 *
97 * @param bwProfiles the updated bandwidth profile
98 * @return true, if any of the profiles were updated successfully;
99 * false otherwise
100 */
101 boolean updateBandwidthProfile(
102 Collection<BandwidthProfile> bwProfiles);
103
104 /**
105 * Obtains an already configured bandwidth profile from the device.
106 *
107 * @param profileName the name of the profile to obtain from the device
108 * @return the bandwidth profile; null if the profile does not exist
109 * @throws IOException if profile could not be obtained due to
110 * communication issues with the device
111 */
112 BandwidthProfile getBandwidthProfile(String profileName) throws IOException;
113
114 /**
115 * Obtains all already configured bandwidth profiles from the device.
116 *
117 * @return the bandwidth profiles; empty collection if no profiles exist
118 * @throws IOException if profiles could not be obtained due to
119 * communication issues with the device
120 */
121 Collection<BandwidthProfile> getAllBandwidthProfiles() throws IOException;
122}