SBA Gateway Variable Properties

Variable Configuration Properties describes the properties for configuring SBA Gateway variables.

Table 1. Variable Configuration Properties
Property Description
variables.static A list of global static variables. These can be used in NRF registration or heartbeats. Each variable must have a unique name and be able to be referenced in the NRF configuration section.
variables.static.name The name of a global static variable.
variables.static.value The value for the named global static variable.
variables.restApi A list of variables populated by polling a REST API. The REST API is assumed to return a JSON payload.
variables.restApi.enabled When set to true, enables polling of the REST API. The default value is false.
variables.restApi.pollingInterval The polling interval in seconds. The minimum is 1. The default value is 10.
variables.restApi.url The URL to query. For example, the following PromQL query to get the CPU usage as a percentage:
http://localhost:9090/api/v1/query?query=ceil(100 - (avg (irate(node_cpu_seconds_total{job="node",mode="idle"}[5m])) * 100))
variables.restApi.method The HTTP method to use.
variables.restApi.body An optional path to a file containing a body. For example, for POST requests.
variables.restApi.headers Other headers to send in the query. For example, for HTTP BASIC authentication.
variables.restApi.values Values read from the JSON response of a REST API query. Paths to the values are defined using jsonPath syntax.
variables.restApi.values.name The name of the value. For example: nfStatus.
variables.restApi.values.value The default value to use if a value is not present or an error occurs.
variables.restApi.values.jsonPath The path to the value in the JSON response. The default value is $.data.result[0].value[1].
variables.restApi.values.convertToType Specifies a type for converting the received value. Allowed values are STRING, NUMBER, BOOLEAN, DECIMAL.

The following gateway.yaml excerpt shows the common configuration default values (where defaults exist) for these properties:

# Global variables. These can be used in NRF registration/hearbeating.
# Each variable must have a unique name and can be referenced
# in the NRF configuration section.
variables:
  # Define static variables here with a value.
  static:
    - name: example
      value: 1.0
  # Define variables that will be populated by querying a REST API here.
  # The REST API is assumed to return a JSON payload.
  restApi:
    -
      enabled: false
      # Polling interval in seconds (minimum 1)
      pollingInterval: 10
      # URL to query
      # (Example PromQL query to get the CPU usage as a percentage)
      url: http://localhost:9090/api/v1/query?query=ceil(100 - (avg (irate(node_cpu_seconds_total{job="node",mode="idle"}[5m])) * 100))
      # HTTP method to use
      method: GET
      # Optional path to a file containing a body (e.g. for POST requests).
      # body: /opt/mtx/conf/loadQuery.json
      # Optional additional headers to send in the query (e.g. for HTTP BASIC authentication)
      # headers:
      #   Authorization: Basic <credentials>
      # Values are read from the JSON response of a REST API query.
      # Paths to the values are defined using jsonPath syntax.
      values:
        - name: load
          # default value to use if value not present or error occurs
          value: 1
          # Path to the value in the JSON response
          jsonPath: $.data.result[0].value[1]
          # Convert the value received in the JSON to a different data type.
          # Allowed values: STRING, NUMBER, BOOLEAN, DECIMAL
          convertToType: NUMBER