blob: 4895b9b14587541fb930532b5d6d8a56f6de4e6f [file] [log] [blame]
HIGUCHI Yuta4af6b032015-07-14 13:26:55 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
HIGUCHI Yuta4af6b032015-07-14 13:26:55 -07003 *
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
Andrea Campanella241896c2017-05-10 13:11:04 -070018import com.google.common.annotations.Beta;
19import org.onosproject.net.PortNumber;
HIGUCHI Yuta4af6b032015-07-14 13:26:55 -070020import org.onosproject.net.driver.HandlerBehaviour;
21
Andrea Campanella241896c2017-05-10 13:11:04 -070022import java.util.concurrent.CompletableFuture;
23
HIGUCHI Yuta4af6b032015-07-14 13:26:55 -070024/**
Andrea Campanella241896c2017-05-10 13:11:04 -070025 * Means to administratively enable,disable and query the state
26 * of a port on a device.
HIGUCHI Yuta4af6b032015-07-14 13:26:55 -070027 */
Andrea Campanella241896c2017-05-10 13:11:04 -070028@Beta
HIGUCHI Yuta4af6b032015-07-14 13:26:55 -070029public interface PortAdmin extends HandlerBehaviour {
30
31 /**
Andrea Campanella241896c2017-05-10 13:11:04 -070032 * Enable administratively a port.
HIGUCHI Yuta4af6b032015-07-14 13:26:55 -070033 *
Andrea Campanella241896c2017-05-10 13:11:04 -070034 * @param number the port to be enabled
35 * @return CompletableFuture with true if the operation was successful
HIGUCHI Yuta4af6b032015-07-14 13:26:55 -070036 */
Andrea Campanella241896c2017-05-10 13:11:04 -070037 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 Yuta4af6b032015-07-14 13:26:55 -070057
58}