Wei-Yu Chen | ad55cb8 | 2022-02-15 20:07:01 +0800 | [diff] [blame^] | 1 | // SPDX-FileCopyrightText: 2020 The Magma Authors. |
| 2 | // SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org> |
| 3 | // |
| 4 | // SPDX-License-Identifier: BSD-3-Clause |
| 5 | |
| 6 | syntax = "proto3"; |
| 7 | |
| 8 | import "orc8r/protos/common.proto"; |
| 9 | import "orc8r/protos/mconfig.proto"; |
| 10 | import "google/protobuf/struct.proto"; |
| 11 | |
| 12 | package magma.orc8r; |
| 13 | option go_package = "magma/orc8r/lib/go/protos"; |
| 14 | |
| 15 | |
| 16 | message PingParams { |
| 17 | string host_or_ip = 1; |
| 18 | int32 num_packets = 2; |
| 19 | } |
| 20 | |
| 21 | message TracerouteParams { |
| 22 | string host_or_ip = 1; |
| 23 | int32 max_hops = 2; |
| 24 | int32 bytes_per_packet = 3; |
| 25 | } |
| 26 | |
| 27 | message NetworkTestRequest { |
| 28 | repeated PingParams pings = 1; |
| 29 | repeated TracerouteParams traceroutes = 2; |
| 30 | } |
| 31 | |
| 32 | message PingResult { |
| 33 | string host_or_ip = 1; |
| 34 | int32 num_packets = 2; |
| 35 | string error = 3; |
| 36 | int32 packets_transmitted = 4; |
| 37 | int32 packets_received = 5; |
| 38 | float avg_response_ms = 6; |
| 39 | } |
| 40 | |
| 41 | message TracerouteProbe { |
| 42 | string hostname = 1; |
| 43 | string ip = 2; |
| 44 | float rtt_ms = 3; |
| 45 | } |
| 46 | |
| 47 | message TracerouteHop { |
| 48 | int32 idx = 1; |
| 49 | repeated TracerouteProbe probes = 2; |
| 50 | } |
| 51 | |
| 52 | message TracerouteResult { |
| 53 | string error = 1; |
| 54 | string host_or_ip = 2; |
| 55 | repeated TracerouteHop hops = 3; |
| 56 | } |
| 57 | |
| 58 | message NetworkTestResponse { |
| 59 | repeated PingResult pings = 1; |
| 60 | repeated TracerouteResult traceroutes = 2; |
| 61 | } |
| 62 | |
| 63 | message GetGatewayIdResponse { |
| 64 | string gateway_id = 1; |
| 65 | } |
| 66 | |
| 67 | message RestartServicesRequest { |
| 68 | repeated string services = 1; |
| 69 | } |
| 70 | |
| 71 | message GenericCommandParams { |
| 72 | string command = 1; |
| 73 | google.protobuf.Struct params = 2; |
| 74 | } |
| 75 | |
| 76 | message GenericCommandResponse { |
| 77 | google.protobuf.Struct response = 1; |
| 78 | } |
| 79 | |
| 80 | message TailLogsRequest { |
| 81 | string service = 1; |
| 82 | } |
| 83 | |
| 84 | message LogLine { |
| 85 | string line = 1; |
| 86 | } |
| 87 | |
| 88 | message CheckStatelessResponse{ |
| 89 | enum AGWMode { |
| 90 | INVALID = 0; |
| 91 | STATELESS = 1; |
| 92 | STATEFUL = 2; |
| 93 | CORRUPT = 3; |
| 94 | } |
| 95 | AGWMode agw_mode = 1; |
| 96 | } |
| 97 | |
| 98 | message ConfigureStatelessRequest { |
| 99 | enum Cmd { |
| 100 | CHECK = 0; |
| 101 | DISABLE = 1; |
| 102 | ENABLE = 2; |
| 103 | } |
| 104 | Cmd config_cmd = 1; |
| 105 | } |
| 106 | |
| 107 | // -------------------------------------------------------------------------- |
| 108 | // Magmad service definition. |
| 109 | // -------------------------------------------------------------------------- |
| 110 | service Magmad { |
| 111 | |
| 112 | // Starts all magma services |
| 113 | rpc StartServices (Void) returns (Void) {} |
| 114 | |
| 115 | // Stops all magma services |
| 116 | rpc StopServices (Void) returns (Void) {} |
| 117 | |
| 118 | // Reboot the gateway device |
| 119 | rpc Reboot (Void) returns (Void) {} |
| 120 | |
| 121 | // Restart specified magma services |
| 122 | rpc RestartServices (RestartServicesRequest) returns (Void) {} |
| 123 | |
| 124 | // Updates AG configs and restarts affected AG services |
| 125 | rpc SetConfigs (GatewayConfigs) returns (Void) {} |
| 126 | |
| 127 | // Get current AG configs |
| 128 | rpc GetConfigs (Void) returns (GatewayConfigs) {} |
| 129 | |
| 130 | // Execute some network commands to check gateway network health |
| 131 | rpc RunNetworkTests (NetworkTestRequest) returns (NetworkTestResponse) {} |
| 132 | |
| 133 | // Get gateway hardware ID |
| 134 | rpc GetGatewayId (Void) returns (GetGatewayIdResponse) {} |
| 135 | |
| 136 | // Execute generic command |
| 137 | rpc GenericCommand (GenericCommandParams) returns (GenericCommandResponse) {} |
| 138 | |
| 139 | // Get stream of logs |
| 140 | rpc TailLogs (TailLogsRequest) returns (stream LogLine) {} |
| 141 | |
| 142 | // CheckStateless returns whether AGW is stateless or stateful |
| 143 | rpc CheckStateless (Void) returns (CheckStatelessResponse) {} |
| 144 | |
| 145 | // ConfigureStateless configures the stateless mode of AGW |
| 146 | rpc ConfigureStateless (ConfigureStatelessRequest) returns (Void) {} |
| 147 | } |