Martin Cosyns | 0efdc87 | 2021-09-27 16:24:30 +0000 | [diff] [blame^] | 1 | # 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 |
| 14 | from robot.api.deco import keyword |
| 15 | from grpc_robot.services.service import is_connected |
| 16 | |
| 17 | from grpc_robot.services.service import Service |
| 18 | from dmi import hw_metrics_mgmt_service_pb2_grpc, hw_metrics_mgmt_service_pb2, hw_pb2 |
| 19 | |
| 20 | |
| 21 | class NativeMetricsManagementService(Service): |
| 22 | |
| 23 | prefix = 'hw_metrics_mgmt_service_' |
| 24 | |
| 25 | def __init__(self, ctx): |
| 26 | super().__init__(ctx=ctx, stub=hw_metrics_mgmt_service_pb2_grpc.NativeMetricsManagementServiceStub) |
| 27 | |
| 28 | # rpc ListMetrics(HardwareID) returns(ListMetricsResponse); |
| 29 | @keyword |
| 30 | @is_connected |
| 31 | def hw_metrics_mgmt_service_list_metrics(self, param_dict, **kwargs): |
| 32 | return self._grpc_helper(self.stub.ListMetrics, hw_pb2.HardwareID, param_dict, **kwargs) |
| 33 | |
| 34 | # rpc UpdateMetricsConfiguration(MetricsConfigurationRequest) returns(MetricsConfigurationResponse); |
| 35 | @keyword |
| 36 | @is_connected |
| 37 | def hw_metrics_mgmt_service_update_metrics_configuration(self, param_dict, **kwargs): |
| 38 | return self._grpc_helper(self.stub.UpdateMetricsConfiguration, hw_metrics_mgmt_service_pb2.MetricsConfigurationRequest, param_dict, **kwargs) |
| 39 | |
| 40 | # rpc GetMetric(GetMetricRequest) returns(GetMetricResponse); |
| 41 | @keyword |
| 42 | @is_connected |
| 43 | def hw_metrics_mgmt_service_get_metric(self, param_dict, **kwargs): |
| 44 | return self._grpc_helper(self.stub.GetMetric, hw_metrics_mgmt_service_pb2.GetMetricRequest, param_dict, **kwargs) |