Beerappa S M | 7af96e5 | 2021-04-20 18:57:54 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2021-present Open Networking Foundation |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at |
| 6 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | * Unless required by applicable law or agreed to in writing, software |
| 8 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | * See the License for the specific language governing permissions and |
| 11 | * limitations under the License. |
| 12 | */ |
| 13 | |
| 14 | #ifndef DMI_SW_MGMT_H_ |
| 15 | #define DMI_SW_MGMT_H_ |
| 16 | |
| 17 | #include "sw_management_service.grpc.pb.h" |
| 18 | #include "sw_management_service.pb.h" |
| 19 | #include "dmi_common.h" |
| 20 | |
| 21 | using grpc::ServerWriter; |
| 22 | |
| 23 | grpc::Status GetSoftwareVersion_(const dmi::HardwareID* request, |
| 24 | dmi::GetSoftwareVersionInformationResponse* response); |
| 25 | |
| 26 | class SWMgmtService final : public dmi::NativeSoftwareManagementService::Service |
| 27 | { |
| 28 | public: |
| 29 | static SWMgmtService& getSWInstance() |
| 30 | { |
| 31 | static SWMgmtService swinstance; |
| 32 | return swinstance; |
| 33 | } |
| 34 | |
| 35 | grpc::Status GetSoftwareVersion( |
| 36 | ServerContext* context, |
| 37 | const dmi::HardwareID* request, |
| 38 | dmi::GetSoftwareVersionInformationResponse* response ) |
| 39 | { |
| 40 | return GetSoftwareVersion_(request, response); |
| 41 | } |
| 42 | |
| 43 | grpc::Status DownloadImage( |
| 44 | ServerContext* context, |
| 45 | const dmi::DownloadImageRequest* request, |
| 46 | ServerWriter<dmi::ImageStatus>* writer ) |
| 47 | { |
| 48 | //TODO write an internal API to handle the request |
| 49 | return Status(grpc::StatusCode::UNIMPLEMENTED, "RPC not implemented"); |
| 50 | } |
| 51 | |
| 52 | grpc::Status ActivateImage( |
| 53 | ServerContext* context, |
| 54 | const dmi::HardwareID* request, |
| 55 | ServerWriter<dmi::ImageStatus>* writer ) |
| 56 | { |
| 57 | //TODO write an internal API to handle the request |
| 58 | return Status(grpc::StatusCode::UNIMPLEMENTED, "RPC not implemented"); |
| 59 | } |
| 60 | |
| 61 | grpc::Status RevertToStandbyImage( |
| 62 | ServerContext* context, |
| 63 | const dmi::HardwareID* request, |
| 64 | ServerWriter<dmi::ImageStatus>* writer ) |
| 65 | { |
| 66 | //TODO write an internal API to handle the request |
| 67 | return Status(grpc::StatusCode::UNIMPLEMENTED, "RPC not implemented"); |
| 68 | } |
| 69 | |
| 70 | grpc::Status UpdateStartupConfiguration( |
| 71 | ServerContext* context, |
| 72 | const dmi::ConfigRequest* request, |
| 73 | ServerWriter<dmi::ConfigResponse>* writer ) |
| 74 | { |
| 75 | //TODO write an internal API to handle the request |
| 76 | return Status(grpc::StatusCode::UNIMPLEMENTED, "RPC not implemented"); |
| 77 | } |
| 78 | |
| 79 | grpc::Status GetStartupConfigurationInfo( |
| 80 | ServerContext* context, |
| 81 | const dmi::StartupConfigInfoRequest* request, |
| 82 | dmi::StartupConfigInfoResponse* response ) |
| 83 | { |
| 84 | //TODO write an internal API to handle the request |
| 85 | return Status(grpc::StatusCode::UNIMPLEMENTED, "RPC not implemented"); |
| 86 | } |
| 87 | private: |
| 88 | SWMgmtService() |
| 89 | { |
| 90 | } |
| 91 | |
| 92 | ~SWMgmtService() |
| 93 | { |
| 94 | } |
| 95 | }; |
| 96 | #endif |