// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
//
// 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 load_generator;

import "context.proto";

service LoadGeneratorService {
  rpc Start    (Parameters   ) returns (context.Empty) {}
  rpc GetStatus(context.Empty) returns (Status       ) {}
  rpc Stop     (context.Empty) returns (context.Empty) {}
}

enum RequestTypeEnum {
  REQUESTTYPE_UNDEFINED    = 0;
  REQUESTTYPE_SERVICE_L2NM = 1;
  REQUESTTYPE_SERVICE_L3NM = 2;
  REQUESTTYPE_SERVICE_MW   = 3;
  REQUESTTYPE_SERVICE_TAPI = 4;
  REQUESTTYPE_SLICE_L2NM   = 5;
  REQUESTTYPE_SLICE_L3NM   = 6;
}

message Range {
  float minimum = 1;
  float maximum = 2;
}

message ScalarOrRange {
  oneof value {
    float scalar = 1; // select the scalar value
    Range range = 2;  // select a random uniformly dstributed value between minimum and maximum
  }
}

message Parameters {
  uint64 num_requests = 1;  // if == 0, generate infinite requests
  repeated RequestTypeEnum request_types = 2;
  float offered_load = 3;
  float holding_time = 4;
  float inter_arrival_time = 5;
  repeated ScalarOrRange availability = 6;    // one from the list is selected
  repeated ScalarOrRange capacity_gbps = 7;   // one from the list is selected
  repeated ScalarOrRange e2e_latency_ms = 8;  // one from the list is selected
  uint32 max_workers = 9;
  bool do_teardown = 10;
  bool dry_mode = 11;
  bool record_to_dlt = 12;
  string dlt_domain_id = 13;
}

message Status {
  Parameters parameters = 1;
  uint64 num_generated = 2;
  bool infinite_loop = 3;
  bool running = 4;
}
