Commit 2f8493ef authored by Muhammad Hamza's avatar Muhammad Hamza
Browse files

Add proto3 descriptor for BWM API

parent 4801e4c1
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
+9 −0
Original line number Diff line number Diff line
.openapi-generator-ignore
README.md
models/bw_info.proto
models/bw_info_deltas.proto
models/bw_info_deltas_session_filter.proto
models/bw_info_session_filter.proto
models/problem_details.proto
models/time_stamp.proto
services/bwm_service.proto
+1 −0
Original line number Diff line number Diff line
5.4.0
 No newline at end of file
+118 −0
Original line number Diff line number Diff line
# gPRC for mec015

The ETSI MEC ISG Bandwidth Management API described using OpenAPI.

## Overview
These files were generated by the [OpenAPI Generator](https://openapi-generator.tech) project.

- API version: 2.2.1
- Package version: 
- Build package: org.openapitools.codegen.languages.ProtobufSchemaCodegen
For more information, please visit [https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api](https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api)

## Usage

Below are some usage examples for Go and Ruby. For other languages, please refer to https://grpc.io/docs/quickstart/.

### Python

1. Install the grpcio-tools package
    ```sh
    $ pip install grpcio-tools
    ```

2. Create a directory for generated Python stubs
    ```sh
    $ mkdir python-stubs 
    ```

3. Run the following commands from the root of the directory containing this README that you are reading.

   - Models:
  
        ```sh
        $ python -m grpc_tools.protoc -I./BwManagementProto3/proto3 --python_out=./python-stubs ./BwManagementProto3/proto3/models/*
        ```
        
        The above command will generate .py files for all the data models in the ./models directory

   - Services:

        ```sh
        $ python -m grpc_tools.protoc -I./BwManagementProto3/proto3 --python_out=./python-stubs --grpc_python_out=./python-stubs ./BwManagementProto3/proto3/services/bwm_service.proto
        ```

        The above command will generate two files for the BWM service:
        - _bwm_service_pb2.py_: containing the python data models used in the BWM service file.
        - _bwm_service_pb2_grpc.py_: containing all the classes and functions needed for the supported HTTP methods in the BWM API.

### Go

1. Install protocol buffer compiler
    ```sh
    $ apt install -y protobuf-compiler
    ```
2. Install Go plugins for `protoc`
    ```sh
    $ go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1
    ```
    ```sh
    $ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2.0
    ```
3. Update `PATH` so `protoc` can find the plugins
    ```sh
    $ export PATH="$PATH:$(go env GOPATH)/bin"
    ```
4. Define a go package by appending `option go_package = "./mec015.services.bwmservice";` in .proto files like this:

    ```Go
    ...

    syntax = "proto3";

    package mec015.services.bwmservice;

    option go_package = "./mec015.services.bwmservice";

    import public "models/<xyz>.proto";

    ...
    ```
5. Generate Go code for models and services
    ```sh 
    $ mkdir go-stubs

    $ protoc --go_out=./go-stubs ./BwManagementProto3/proto3/models/* -I./BwManagementProto3/proto3
    
    $ protoc --go_out=./go-stubs ./BwManagementProto3/proto3/services/* --go-grpc_out=go-stubs -I./BwManagementProto3/proto3

    ```


    > The generated `<data_model>.pb.go` files will contain all the protocol buffer code to populate, serialize, and retrieve request and response message types defined in the `models` folder.

    > The `bwm_service_grpc.pb.go` will contain the stubs for the methods defined in the `bwm_service.proto` file.

### Ruby

1. Install gRPC Ruby Plugin and required tools
   ```sh
   $ gem install grpc
   $ sudo apt install ruby-grpc-tools
   ```

2. Generate code
    ```sh
    $ mkdir ruby-stubs
    ```
    
    Run the following command to create Ruby modules for all the data models defined in the proto files.

    ```sh
    $ grpc_tools_ruby_protoc -I./BwManagementProto3/proto3 --ruby_out=ruby-stubs ./BwManagementProto3/proto3/models/*
    ```
    Run the following command to generate `bwm_service_pb.rb` and `bwm_service_services_pb.rb` files, containing stub and service classes for the endpoints and methods defined in BWM service.

    ```sh
    $ grpc_tools_ruby_protoc -I./BwManagementProto3/proto3 --ruby_out=ruby-stubs --grpc_out=ruby-stubs ./BwManagementProto3/proto3/services/*
    ```
 No newline at end of file
+55 −0
Original line number Diff line number Diff line
/*
  ETSI GS MEC 015 Bandwidth Management API

  The ETSI MEC ISG Bandwidth Management API described using OpenAPI.

  The version of the OpenAPI document: 2.2.1

  Generated by OpenAPI Generator: https://openapi-generator.tech
*/

syntax = "proto3";

package mec015;

import public "models/bw_info_session_filter.proto";
import public "models/time_stamp.proto";

message BwInfo {

  // Bandwidth allocation instance identifier
  string allocationId = 1;

  // Name of the application
  string appName = 2;

  // The direction of the requested BW allocation: 00 = Downlink (towards the UE) 01 = Uplink (towards the application/session) 10 = Symmetrical
  string allocationDirection = 3;

  // Application instance identifier
  string appInsId = 4;

  // Size of requested fixed BW allocation in [bps]
  string fixedAllocation = 5;

  // Indicates the allocation priority when dealing with several applications or sessions in parallel. Values are not defined in the present document
  enum FixedBWPriorityEnum {
    SEE_DESCRIPTION = 0;
  }

  FixedBWPriorityEnum fixedBWPriority = 6;

  // Numeric value (0 - 255) corresponding to specific type of consumer as following: 0 = APPLICATION_SPECIFIC_BW_ALLOCATION 1 = SESSION_SPECIFIC_BW_ALLOCATION
  enum RequestTypeEnum {
    _0 = 0;
    _1 = 1;
  }

  RequestTypeEnum requestType = 7;

  // Session filtering criteria, applicable when requestType is set as SESSION_SPECIFIC_BW_ALLOCATION. Any filtering criteria shall define a single session only. In case multiple sessions match sessionFilter the request shall be rejected
  repeated BwInfoSessionFilter sessionFilter = 8;

  TimeStamp timeStamp = 9;

}
Loading