├── IDL └── ems_grpc.proto ├── LICENSE └── README.md /IDL/ems_grpc.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package IOSXRExtensibleManagabilityService; 4 | 5 | service gRPCConfigOper { 6 | 7 | // Configuration related commands 8 | 9 | rpc GetConfig(ConfigGetArgs) returns(stream ConfigGetReply) {}; 10 | 11 | rpc MergeConfig(ConfigArgs) returns(ConfigReply) {}; 12 | 13 | rpc DeleteConfig(ConfigArgs) returns(ConfigReply) {}; 14 | 15 | rpc ReplaceConfig(ConfigArgs) returns(ConfigReply) {}; 16 | 17 | rpc CliConfig(CliConfigArgs) returns(CliConfigReply) {}; 18 | 19 | rpc CommitReplace(CommitReplaceArgs) returns (CommitReplaceReply) {}; 20 | 21 | // Do we need implicit or explicit commit 22 | // 23 | rpc CommitConfig(CommitArgs) returns(CommitReply) {}; 24 | 25 | rpc ConfigDiscardChanges(DiscardChangesArgs) returns(DiscardChangesReply) {}; 26 | 27 | 28 | // Get only returns oper data 29 | // 30 | rpc GetOper(GetOperArgs) returns(stream GetOperReply) {}; 31 | // Do we need "Get" also to give combined oper and config? 32 | } 33 | 34 | // 35 | // Should we seperate Exec from Config/Oper? 36 | // 37 | 38 | service gRPCExec { 39 | // Exec commands 40 | rpc ShowCmdTextOutput(ShowCmdArgs) returns(stream ShowCmdTextReply) {}; 41 | rpc ShowCmdJSONOutput(ShowCmdArgs) returns(stream ShowCmdJSONReply) {}; 42 | 43 | 44 | } 45 | 46 | message ConfigGetArgs { 47 | int64 ReqId = 1; 48 | string yangpathjson = 2; 49 | } 50 | 51 | message ConfigGetReply { 52 | int64 ResReqId = 1; 53 | string yangjson = 2; 54 | string errors = 3; 55 | } 56 | 57 | message GetOperArgs { 58 | int64 ReqId = 1; 59 | string yangpathjson = 2; 60 | } 61 | 62 | message GetOperReply { 63 | int64 ResReqId = 1; 64 | string yangjson = 2; 65 | string errors = 3; 66 | } 67 | 68 | 69 | message ConfigArgs { 70 | int64 ReqId = 1; 71 | string yangjson = 2; 72 | 73 | } 74 | 75 | message ConfigReply { 76 | int64 ResReqId = 1; 77 | string errors = 2; 78 | } 79 | 80 | message CliConfigArgs { 81 | int64 ReqId = 1; 82 | string cli = 2; 83 | } 84 | 85 | message CliConfigReply { 86 | int64 ResReqId = 1; 87 | string errors = 2; 88 | } 89 | 90 | 91 | message CommitReplaceArgs { 92 | int64 ReqId = 1; 93 | string cli = 2; 94 | string yangjson = 3; 95 | } 96 | 97 | message CommitReplaceReply { 98 | int64 ResReqId = 1; 99 | string errors = 2; 100 | } 101 | 102 | message CommitMsg { 103 | string label = 1; 104 | string comment = 2; 105 | } 106 | 107 | enum CommitResult { 108 | CHANGE = 0; 109 | NO_CHANGE = 1; 110 | FAIL = 2; 111 | } 112 | 113 | message CommitArgs { 114 | CommitMsg msg = 1; 115 | int64 ReqId = 2; 116 | } 117 | 118 | message CommitReply { 119 | CommitResult result = 1; 120 | int64 ResReqId = 2; 121 | string errors = 3; 122 | } 123 | 124 | 125 | message DiscardChangesArgs { 126 | int64 ReqId = 1; 127 | } 128 | 129 | message DiscardChangesReply { 130 | int64 ResReqId = 1; 131 | string errors = 2; 132 | } 133 | 134 | 135 | message ShowCmdArgs { 136 | int64 ReqId = 1; 137 | string cli = 2; 138 | } 139 | 140 | message ShowCmdTextReply { 141 | int64 ResReqId =1; 142 | string output = 2; 143 | string errors = 3; 144 | } 145 | message ShowCmdJSONReply { 146 | int64 ResReqId =1; 147 | string jsonoutput = 2; 148 | string errors = 3; 149 | } 150 | 151 | 152 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2016 cisco Systems Inc. 2 | 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 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Getting Started With gRPC in Cisco IOS XR 2 | ## Cisco IDL 3 | The definition of Cisco IDL can be found at: 4 | ``` 5 | IDL/ems_grpc.proto 6 | ``` 7 | 8 | The following operations act on modeled data and are supported in IOS XR 6.0.0: 9 | * `GetConfig` - Retrieves configuration data. Takes model path in JSON format as input argument. Returns configuration data in JSON format and error string. 10 | * `MergeConfig` - Merges configuration data. Takes modeled data in JSON format as input argument. Returns error string. 11 | * `DeleteConfig` - Deletes configuration data. Takes modeled data in JSON format as input argument. Returns error string. 12 | * `ReplaceConfig` - Replaces configuration data. Takes modeled data in JSON format as input argument. Returns error string. 13 | * `GetOper` - Retrieves operational (state) data. Takes model path in JSON format as input argument. Returns operational (state) data in JSON format and error string. 14 | 15 | The following operations act on CLI data and are supported in IOS XR 6.0.0: 16 | * `CliConfig` - Merges configuration data. Takes CLI configuration as input argument. Returns error string. 17 | * `ShowCmdTextOutput` - Retrieves show-command output. Takes CLI show command as input argument. Returns CLI output and error string. 18 | 19 | ## gRPC Server 20 | The gRPC server on Cisco IOS XR can be configured using its configuration model (Cisco-IOS-XR-man-ems-cfg.yang) or using the command line. The minimum configuration just requires you to enable the gRPC service. By default, the service runs on port 57400 without using TLS. Requests must include user credentials as metadata for AAA authentication whether TLS is enabled or not. The service provides configuration options to specify port (57344-57999), TLS, address family (IPv4/IPv6) and maximum number of concurrent requests (per-user and total). 21 | 22 | ## Basic gRPC Service Configuration Using CLI 23 | ``` 24 | grpc 25 | ! 26 | ``` 27 | 28 | ## Customized gRPC Service Configuration CLI 29 | ``` 30 | grpc 31 | port 57344 32 | tls 33 | ! 34 | max-request-total 32 35 | ! 36 | ``` 37 | 38 | ## Examples 39 | You can find configuration examples in the [getting started guides for OpenConfig](https://github.com/CiscoDevNet/openconfig-getting-started). Examples in JSON and CLI format are relevant for gRPC. 40 | --------------------------------------------------------------------------------