//Copyright 2017 the original author or authors.
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at

//       http://www.apache.org/licenses/LICENSE-2.0

//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.

syntax = "proto3";
package api;
import "google/api/annotations.proto";

message EchoMessage{
   string Ping =1;
}
message EchoReplyMessage{
   string Pong =1;
}

message AddChassisMessage{
   string CLLI =1;
   string XOSIP =2;
   int32 XOSPort=3;
   string XOSUser=4;
   string XOSPassword=5;
   int32 Rack=6;
   int32 Shelf=7;
}
message AddChassisReturn{
   string DeviceID = 1;
}
message ChangeXOSUserPasswordMessage{
   string CLLI =1;
   string XOSUser=2;
   string XOSPassword=3;
}
message ChangeXOSUserPasswordReturn{
   bool Success=1;
}

message AddOLTChassisMessage{
   string CLLI=1;
   string SlotIP=2;
   fixed32 SlotPort=3;
   string Hostname=4;
   fixed32 NumPorts = 5;
   bool Activate = 6;
   enum OltDriver {
      openoltDriver= 0;
      asfvolt16Driver=1;
      adtranDriver=2;
      tibitsDriver=3;
   }
   OltDriver Driver=7;
   enum OltType{
      edgecore=0;
      adtran=1;
      tibit=2;
   }
   OltType Type=8;

}
message AddOLTChassisReturn {
   string DeviceID =1;
   string ChassisDeviceID =2;
}

message AddOntMessage{
   string CLLI=1;
   int32 SlotNumber=2;
   int32 PortNumber=3;
   int32 OntNumber=4;
   string SerialNumber=5;
}
message AddOntFullMessage{
   string CLLI=1;
   int32 SlotNumber=2;
   int32 PortNumber=3;
   int32 OntNumber=4;
   string SerialNumber=5;
   uint32 STag=7;
   uint32 CTag=8;
   string NasPortID=9;
   string CircuitID=10;
}
message AddOntReturn{
   bool Success=1;
}

message DeleteOntMessage{
   string CLLI=1;
   int32 SlotNumber=2;
   int32 PortNumber=3;
   int32 OntNumber=4;
   string SerialNumber=5;
}
message DeleteOntReturn{
   bool Success=1;
}
message ReflowMessage{

}
message ReflowReturn{
    bool Success=1;
}
message OutputMessage{
   string Something=1;
}
message OutputReturn{
   bool Success=1;
}
service AbstractOLT{
   rpc Echo(EchoMessage) returns (EchoReplyMessage){
      option(google.api.http)={
        post:"/v1/Echo"
	body:"*"
      };
   }
   rpc CreateChassis(AddChassisMessage) returns (AddChassisReturn) {
      option(google.api.http) = {
         post: "/v1/CreateAbstractChassis"
	 body:"*"
      };
   }
   rpc ChangeXOSUserPassword(ChangeXOSUserPasswordMessage) returns(ChangeXOSUserPasswordReturn){
      option(google.api.http)={
        post:"/v1/ChangeXOSUserPassword"
	body:"*"
      };
   }
   rpc CreateOLTChassis(AddOLTChassisMessage) returns (AddOLTChassisReturn) {
      option(google.api.http) = {
         post: "/v1/CreateOLTChassis"
	 body:"*"
      };
   }
   rpc ProvisionOnt(AddOntMessage) returns (AddOntReturn) {
      option(google.api.http) = {
         post:"/v1/ProvsionOnt"
	 body:"*"
      };
   }
   rpc ProvisionOntFull(AddOntFullMessage) returns (AddOntReturn) {
      option(google.api.http) = {
         post:"/v1/ProvsionOtFull"
	 body:"*"
      };
   }
   rpc DeleteOnt(DeleteOntMessage) returns (DeleteOntReturn){
      option(google.api.http)={
        post:"/v1/DeleteOnt"
	body:"*"
      };
   }
   rpc Reflow(ReflowMessage)returns (ReflowReturn){
       option(google.api.http)={
           post:"/v1/Reflow"
           body:"*"

       };
   }
   rpc Output(OutputMessage)returns(OutputReturn){
      option(google.api.http)={
        post:"/v1/Output"
	    body:"*"
      };
   }
}

