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 sw_management_service_pb2_grpc, sw_management_service_pb2, hw_pb2 |
| 19 | |
| 20 | |
| 21 | class NativeSoftwareManagementService(Service): |
| 22 | |
| 23 | prefix = 'sw_management_service_' |
| 24 | |
| 25 | def __init__(self, ctx): |
| 26 | super().__init__(ctx=ctx, stub=sw_management_service_pb2_grpc.NativeSoftwareManagementServiceStub) |
| 27 | |
| 28 | @keyword |
| 29 | @is_connected |
| 30 | def sw_management_service_get_software_version(self, param_dict, **kwargs): |
| 31 | return self._grpc_helper(self.stub.GetSoftwareVersion, hw_pb2.HardwareID, param_dict, **kwargs) |
| 32 | |
| 33 | @keyword |
| 34 | @is_connected |
| 35 | def sw_management_service_download_image(self, param_dict, **kwargs): |
| 36 | return self._grpc_helper(self.stub.DownloadImage, sw_management_service_pb2.DownloadImageRequest, param_dict, **kwargs) |
| 37 | |
| 38 | @keyword |
| 39 | @is_connected |
| 40 | def sw_management_service_activate_image(self, param_dict, **kwargs): |
| 41 | return self._grpc_helper(self.stub.ActivateImage, hw_pb2.HardwareID, param_dict, **kwargs) |
| 42 | |
| 43 | @keyword |
| 44 | @is_connected |
| 45 | def sw_management_service_revert_to_standby_image(self, param_dict, **kwargs): |
| 46 | return self._grpc_helper(self.stub.RevertToStandbyImage, hw_pb2.HardwareID, param_dict, **kwargs) |