blob: 42d31db9e158e2894f786cbf6b7f2f163f55fb1c [file] [log] [blame]
Yi Tseng890dc3f2018-11-01 13:23:11 -07001/*
2 * Copyright 2018-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 */
Carmelo Cascone3370c962019-02-07 18:24:19 -080016
17package org.onosproject.gnmi.ctl;
Yi Tseng890dc3f2018-11-01 13:23:11 -070018
19import io.grpc.ManagedChannel;
Yi Tseng890dc3f2018-11-01 13:23:11 -070020import org.onosproject.gnmi.api.GnmiClient;
Yi Tseng890dc3f2018-11-01 13:23:11 -070021import org.onosproject.gnmi.api.GnmiController;
Ray Milkey5739b2c2018-11-06 14:04:51 -080022import org.onosproject.gnmi.api.GnmiEvent;
23import org.onosproject.gnmi.api.GnmiEventListener;
24import org.onosproject.grpc.ctl.AbstractGrpcClientController;
Carmelo Casconec2be50a2019-04-10 00:15:39 -070025import org.onosproject.net.DeviceId;
Ray Milkey5739b2c2018-11-06 14:04:51 -080026import org.osgi.service.component.annotations.Component;
Yi Tseng890dc3f2018-11-01 13:23:11 -070027
28/**
29 * Implementation of gNMI controller.
30 */
Ray Milkey5739b2c2018-11-06 14:04:51 -080031@Component(immediate = true, service = GnmiController.class)
Yi Tseng890dc3f2018-11-01 13:23:11 -070032public class GnmiControllerImpl
Carmelo Cascone3977ea42019-02-28 13:43:42 -080033 extends AbstractGrpcClientController
Carmelo Casconec2be50a2019-04-10 00:15:39 -070034 <GnmiClient, GnmiEvent, GnmiEventListener>
Yi Tseng890dc3f2018-11-01 13:23:11 -070035 implements GnmiController {
Carmelo Casconea46f5542018-12-12 23:41:01 -080036
Carmelo Cascone3977ea42019-02-28 13:43:42 -080037 public GnmiControllerImpl() {
Carmelo Casconec2be50a2019-04-10 00:15:39 -070038 super(GnmiEvent.class, "gNMI");
Yi Tseng890dc3f2018-11-01 13:23:11 -070039 }
40
41 @Override
Carmelo Cascone3977ea42019-02-28 13:43:42 -080042 protected GnmiClient createClientInstance(
Carmelo Casconec2be50a2019-04-10 00:15:39 -070043 DeviceId deviceId, ManagedChannel channel) {
44 return new GnmiClientImpl(deviceId, channel, this);
Yi Tsenge616d752018-11-27 10:53:27 -080045 }
Yi Tseng890dc3f2018-11-01 13:23:11 -070046}