blob: 1668bcc82739b9a0c5dad3ce209ccb1ba14145e0 [file] [log] [blame]
oleksandr.yashchuk@plvision.eu3dbcaaf2019-03-13 14:44:46 +02001/*
2 * Copyright 2019-present Open Networking Foundation
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
17package org.onosproject.drivers.gnoi;
18
19import org.onosproject.gnoi.api.GnoiClient;
oleksandr.yashchuk@plvision.eu3dbcaaf2019-03-13 14:44:46 +020020import org.onosproject.gnoi.api.GnoiController;
Carmelo Casconec2be50a2019-04-10 00:15:39 -070021import org.onosproject.grpc.utils.AbstractGrpcHandshaker;
oleksandr.yashchuk@plvision.eu3dbcaaf2019-03-13 14:44:46 +020022import org.onosproject.net.MastershipRole;
23import org.onosproject.net.device.DeviceHandshaker;
24
25import java.util.concurrent.CompletableFuture;
26
oleksandr.yashchuk@plvision.eu3dbcaaf2019-03-13 14:44:46 +020027/**
28 * Implementation of DeviceHandshaker for gNOI.
29 */
Carmelo Casconec2be50a2019-04-10 00:15:39 -070030public class GnoiHandshaker
31 extends AbstractGrpcHandshaker<GnoiClient, GnoiController>
32 implements DeviceHandshaker {
oleksandr.yashchuk@plvision.eu3dbcaaf2019-03-13 14:44:46 +020033
Carmelo Casconec2be50a2019-04-10 00:15:39 -070034 public GnoiHandshaker() {
35 super(GnoiController.class);
oleksandr.yashchuk@plvision.eu3dbcaaf2019-03-13 14:44:46 +020036 }
37
38 @Override
39 public boolean isAvailable() {
40 return isReachable();
41 }
42
43 @Override
44 public CompletableFuture<Boolean> probeAvailability() {
45 return probeReachability();
46 }
47
48 @Override
49 public void roleChanged(MastershipRole newRole) {
50 throw new UnsupportedOperationException("Mastership operation not supported");
51 }
52
53 @Override
54 public MastershipRole getRole() {
55 throw new UnsupportedOperationException("Mastership operation not supported");
56 }
oleksandr.yashchuk@plvision.eu3dbcaaf2019-03-13 14:44:46 +020057}