CNlucius | a66c397 | 2015-09-06 20:31:29 +0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
CNlucius | a66c397 | 2015-09-06 20:31:29 +0800 | [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 | |
| 18 | import java.util.Collection; |
| 19 | import java.util.List; |
| 20 | import java.util.Set; |
| 21 | |
| 22 | import org.onosproject.net.PortNumber; |
| 23 | import org.onosproject.net.device.PortDescription; |
| 24 | import org.onosproject.net.driver.HandlerBehaviour; |
| 25 | |
| 26 | /** |
| 27 | * Behaviour for handling various drivers for bridge configurations. |
| 28 | */ |
| 29 | public interface BridgeConfig extends HandlerBehaviour { |
| 30 | |
| 31 | /** |
Hyunsun Moon | 1251e19 | 2016-06-07 16:57:05 -0700 | [diff] [blame] | 32 | * 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 | /** |
CNlucius | a66c397 | 2015-09-06 20:31:29 +0800 | [diff] [blame] | 40 | * 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 Moon | 52b9336 | 2016-01-19 11:53:57 -0800 | [diff] [blame] | 54 | * 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 Campanella | 65ece15 | 2016-01-21 13:33:43 -0800 | [diff] [blame] | 62 | * 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 | /** |
HelloONOS | 0854c04 | 2019-02-18 20:09:17 +0900 | [diff] [blame] | 70 | * 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 | /** |
CNlucius | a66c397 | 2015-09-06 20:31:29 +0800 | [diff] [blame] | 82 | * 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 | } |