blob: eb3c19c259c88580ee4c0292e0aa23b160875428 [file] [log] [blame]
Andrea Campanella241896c2017-05-10 13:11:04 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Andrea Campanella241896c2017-05-10 13:11:04 -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 */
16
17package org.onosproject.net.device;
18
19import com.google.common.annotations.Beta;
20import org.onosproject.net.MastershipRole;
21import org.onosproject.net.driver.DeviceConnect;
22
23import java.util.concurrent.CompletableFuture;
24
25/**
26 * Behavior to test device's reachability and change the mastership role on that
27 * device.
28 */
29@Beta
30public interface DeviceHandshaker extends DeviceConnect {
31
32 /**
33 * Checks the reachability (connectivity) of a device.
34 * Reachability, unlike availability, denotes whether THIS particular node
35 * can send messages and receive replies from the specified device.
36 *
37 * @return CompletableFuture eventually true if reachable, false otherwise
38 */
39 CompletableFuture<Boolean> isReachable();
40
41 /**
42 * Applies on the device a mastership role change as decided by the core.
43 *
44 * @param newRole newly determined mastership role
45 * @return CompletableFuture with the mastership role accepted from the device
46 */
47 CompletableFuture<MastershipRole> roleChanged(MastershipRole newRole);
48
49}