blob: 579a66d3d4e602d66aedf71bf1beb4ed00e1f7f8 [file] [log] [blame]
Martin Cosyns0efdc872021-09-27 16:24:30 +00001# Copyright 2020-present Open Networking Foundation
2# Original copyright 2020-present ADTRAN, Inc.
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
14from robot.api.deco import keyword
15from grpc_robot.services.service import is_connected
16
17from grpc_robot.services.service import Service
18from voltha_protos import ponsim_pb2_grpc, ponsim_pb2
19
20
21class PonSim(Service):
22
23 prefix = 'pon_sim_'
24
25 def __init__(self, ctx):
26 super().__init__(ctx=ctx, stub=ponsim_pb2_grpc.PonSimStub)
27
28 # rpc SendFrame(PonSimFrame) returns (google.protobuf.Empty) {}
29 @keyword
30 @is_connected
31 def pon_sim_send_frame(self, param_dict, **kwargs):
32 return self._grpc_helper(self.stub.SendFrame, ponsim_pb2.PonSimFrame, param_dict, **kwargs)
33
34 # rpc ReceiveFrames(google.protobuf.Empty) returns (stream PonSimFrame) {}
35 @keyword
36 @is_connected
37 def pon_sim_receive_frames(self, **kwargs):
38 return self._grpc_helper(self.stub.ReceiveFrames, **kwargs)
39
40 # rpc GetDeviceInfo(google.protobuf.Empty) returns(PonSimDeviceInfo) {}
41 @keyword
42 @is_connected
43 def pon_sim_get_device_info(self, **kwargs):
44 return self._grpc_helper(self.stub.GetDeviceInfo, **kwargs)
45
46 # rpc UpdateFlowTable(FlowTable) returns(google.protobuf.Empty) {}
47 @keyword
48 @is_connected
49 def pon_sim_update_flow_table(self, param_dict, **kwargs):
50 return self._grpc_helper(self.stub.UpdateFlowTable, ponsim_pb2.FlowTable, param_dict, **kwargs)
51
52 # rpc GetStats(google.protobuf.Empty) returns(PonSimMetrics) {}
53 @keyword
54 @is_connected
55 def pon_sim_get_stats(self, **kwargs):
56 return self._grpc_helper(self.stub.GetStats, **kwargs)