
//Copyright (c) 2015-2016 by Cisco Systems, Inc.
//All rights reserved.
//
//Redistribution and use in source and binary forms, with or without 
//modification, are permitted provided that the following conditions 
//are met:
//
//1. Redistributions of source code must retain the above copyright
//   notice, this list of conditions and the following disclaimer.
//
//2. Redistributions in binary form must reproduce the above copyright
//   notice, this list of conditions and the following disclaimer in the
//   documentation and/or other materials provided with the distribution.
//
//3. Neither the name of the copyright holder nor the names of its
//   contributors may be used to endorse or promote products derived from
//   this software without specific prior written permission.
//
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
//COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
//POSSIBILITY OF SUCH DAMAGE.

syntax = "proto3";

package IOSXRExtensibleManagabilityService;

service gRPCConfigOper {
   
    // Configuration related commands

    rpc GetConfig(ConfigGetArgs) returns(stream ConfigGetReply) {};
        
    rpc MergeConfig(ConfigArgs) returns(ConfigReply) {};
    
    rpc DeleteConfig(ConfigArgs) returns(ConfigReply) {};
    
    rpc ReplaceConfig(ConfigArgs) returns(ConfigReply) {};

    rpc CliConfig(CliConfigArgs) returns(CliConfigReply) {};

    rpc CommitReplace(CommitReplaceArgs) returns (CommitReplaceReply) {};

    // Do we need implicit or explicit commit
    //
    rpc CommitConfig(CommitArgs) returns(CommitReply) {};

    rpc ConfigDiscardChanges(DiscardChangesArgs) returns(DiscardChangesReply) {};

   
    // Get only returns oper data
    // 
    rpc GetOper(GetOperArgs) returns(stream GetOperReply) {};
    // Do we need "Get" also to give combined oper and config?
}

//
// Should we seperate Exec from Config/Oper?
//

service gRPCExec {
// Exec commands
    rpc ShowCmdTextOutput(ShowCmdArgs) returns(stream ShowCmdTextReply) {};
    rpc ShowCmdJSONOutput(ShowCmdArgs) returns(stream ShowCmdJSONReply) {};


}

message ConfigGetArgs {
     int64 ReqId = 1;
     string yangpathjson = 2;
}

message ConfigGetReply {
    int64 ResReqId = 1;
    string yangjson = 2;
    string errors = 3;
}

message GetOperArgs {
     int64 ReqId = 1;
     string yangpathjson = 2;
}

message GetOperReply {
    int64 ResReqId = 1;
    string yangjson = 2;
    string errors = 3;
}


message ConfigArgs {
    int64 ReqId = 1;
    string yangjson = 2;
    
}

message ConfigReply {
    int64 ResReqId = 1;
    string errors = 2;
}

message CliConfigArgs {
    int64 ReqId = 1;
    string cli = 2;
}

message CliConfigReply {
    int64 ResReqId = 1;
    string errors = 2;
}


message CommitReplaceArgs {
    int64 ReqId = 1;
    string cli = 2;
    string yangjson = 3;
}

message CommitReplaceReply {
    int64 ResReqId = 1;
    string errors = 2;
}

message CommitMsg {
    string label = 1;
    string comment = 2;
}

enum CommitResult {
    CHANGE = 0;
    NO_CHANGE = 1;
    FAIL = 2;
}

message CommitArgs {
    CommitMsg msg = 1;
    int64 ReqId = 2;
}

message CommitReply {
    CommitResult result = 1;
    int64 ResReqId = 2;
    string errors = 3;
}


message DiscardChangesArgs {
    int64 ReqId = 1;
}

message DiscardChangesReply {
    int64 ResReqId = 1;
    string errors = 2;
}


message ShowCmdArgs {
     int64 ReqId = 1;
     string cli = 2;
}

message ShowCmdTextReply {
    int64 ResReqId =1;
    string output = 2;
    string errors = 3;
}
message ShowCmdJSONReply {
    int64 ResReqId =1;
    string jsonoutput = 2;
    string errors = 3;
}


