blob: e9ee00753e88a026df33af5f198a9218257eb024 [file] [log] [blame]
CNluciusa66c3972015-09-06 20:31:29 +08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
CNluciusa66c3972015-09-06 20:31:29 +08003 *
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 java.util.Collection;
19import java.util.List;
20import java.util.Set;
21
22import org.onosproject.net.PortNumber;
23import org.onosproject.net.device.PortDescription;
24import org.onosproject.net.driver.HandlerBehaviour;
25
26/**
27 * Behaviour for handling various drivers for bridge configurations.
28 */
29public interface BridgeConfig extends HandlerBehaviour {
30
31 /**
Hyunsun Moon1251e192016-06-07 16:57:05 -070032 * Adds a bridge with a given description.
33 *
34 * @param bridgeDescription bridge description
35 * @return true if succeeds, or false
36 */
37 boolean addBridge(BridgeDescription bridgeDescription);
38
39 /**
CNluciusa66c3972015-09-06 20:31:29 +080040 * Remove a bridge.
41 *
42 * @param bridgeName bridge name
43 */
44 void deleteBridge(BridgeName bridgeName);
45
46 /**
47 * Remove a bridge.
48 *
49 * @return bridge collection
50 */
51 Collection<BridgeDescription> getBridges();
52
53 /**
Hyunsun Moon52b93362016-01-19 11:53:57 -080054 * Adds a port to a given bridge.
55 *
56 * @param bridgeName bridge name
57 * @param portName port name
58 */
59 void addPort(BridgeName bridgeName, String portName);
60
61 /**
Andrea Campanella65ece152016-01-21 13:33:43 -080062 * Removes a port from a given bridge.
63 *
64 * @param bridgeName bridge name
65 * @param portName port name
66 */
67 void deletePort(BridgeName bridgeName, String portName);
68
69 /**
HelloONOS0854c042019-02-18 20:09:17 +090070 * Deletes ports to a given bridge.
71 * @param bridgeName bridge name
72 * @param portNames list port names
73 */
74 default void deletePorts(BridgeName bridgeName, List<String> portNames) {
75 for (String portName : portNames) {
76 deletePort(bridgeName, portName);
77 }
78 }
79
80
81 /**
CNluciusa66c3972015-09-06 20:31:29 +080082 * Delete a logical/virtual port.
83 *
84 * @return collection of port
85 */
86 Collection<PortDescription> getPorts();
87
88 /**
89 * Get a collection of port.
90 *
91 * @return portNumbers set of PortNumber
92 */
93 Set<PortNumber> getPortNumbers();
94
95 /**
96 * Get logical/virtual ports by ifaceIds.
97 *
98 * @param ifaceIds the ifaceid that needed
99 * @return list of PortNumber
100 */
101 List<PortNumber> getLocalPorts(Iterable<String> ifaceIds);
102}