HIGUCHI Yuta | 4af6b03 | 2015-07-14 13:26:55 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
HIGUCHI Yuta | 4af6b03 | 2015-07-14 13:26:55 -0700 | [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 | |
Andrea Campanella | 241896c | 2017-05-10 13:11:04 -0700 | [diff] [blame] | 18 | import com.google.common.annotations.Beta; |
| 19 | import org.onosproject.net.PortNumber; |
HIGUCHI Yuta | 4af6b03 | 2015-07-14 13:26:55 -0700 | [diff] [blame] | 20 | import org.onosproject.net.driver.HandlerBehaviour; |
| 21 | |
Andrea Campanella | 241896c | 2017-05-10 13:11:04 -0700 | [diff] [blame] | 22 | import java.util.concurrent.CompletableFuture; |
| 23 | |
HIGUCHI Yuta | 4af6b03 | 2015-07-14 13:26:55 -0700 | [diff] [blame] | 24 | /** |
Andrea Campanella | 241896c | 2017-05-10 13:11:04 -0700 | [diff] [blame] | 25 | * Means to administratively enable,disable and query the state |
| 26 | * of a port on a device. |
HIGUCHI Yuta | 4af6b03 | 2015-07-14 13:26:55 -0700 | [diff] [blame] | 27 | */ |
Andrea Campanella | 241896c | 2017-05-10 13:11:04 -0700 | [diff] [blame] | 28 | @Beta |
HIGUCHI Yuta | 4af6b03 | 2015-07-14 13:26:55 -0700 | [diff] [blame] | 29 | public interface PortAdmin extends HandlerBehaviour { |
| 30 | |
| 31 | /** |
Andrea Campanella | 241896c | 2017-05-10 13:11:04 -0700 | [diff] [blame] | 32 | * Enable administratively a port. |
HIGUCHI Yuta | 4af6b03 | 2015-07-14 13:26:55 -0700 | [diff] [blame] | 33 | * |
Andrea Campanella | 241896c | 2017-05-10 13:11:04 -0700 | [diff] [blame] | 34 | * @param number the port to be enabled |
| 35 | * @return CompletableFuture with true if the operation was successful |
HIGUCHI Yuta | 4af6b03 | 2015-07-14 13:26:55 -0700 | [diff] [blame] | 36 | */ |
Andrea Campanella | 241896c | 2017-05-10 13:11:04 -0700 | [diff] [blame] | 37 | CompletableFuture<Boolean> enable(PortNumber number); |
| 38 | |
| 39 | /** |
| 40 | * Disable administratively a port. |
| 41 | * |
| 42 | * @param number the port to be disabled |
| 43 | * @return CompletableFuture with true if the operation was successful |
| 44 | */ |
| 45 | CompletableFuture<Boolean> disable(PortNumber number); |
| 46 | |
| 47 | /** |
| 48 | * Retrieves the information about the administrative state of a port. |
| 49 | * |
| 50 | * @param number identifier of the port to be queried about its state |
| 51 | * @return CompletableFuture containing, when completed, true if the port isEnabled. |
| 52 | */ |
| 53 | CompletableFuture<Boolean> isEnabled(PortNumber number); |
| 54 | |
| 55 | //TODO this behaviour can be augmented or others can be created for |
| 56 | // LED and Speed configuration |
HIGUCHI Yuta | 4af6b03 | 2015-07-14 13:26:55 -0700 | [diff] [blame] | 57 | |
| 58 | } |