Hyper Open Edge Cloud

How To Manage Your ORS with Slapos API

Manage Your ORS with Slapos API
  • Last Update:2024-02-20
  • Version:001
  • Language:en

Requirements

This tutorial will show you how to manage your ORS with the slapos API

 

Get Information on your service

First you can list your services:

slapos service list

Then you can get information on a specific service by using its reference:

slapos service info REFERENCE
 

Change your input parameters

To change the input parameters of your instances, you need to use the request command in slapos console.

You can execute scripts in slapos console like this:


slapos console --cfg SLAPOS_CLIENT_CFG script.py

Here is the script you can use:


request(
  software_release = SOFTWARE_RELEASE_URL,
  partition_reference = REFERENCE,
  software_type = SR_TYPE,
  filter_kw = { 'computer_guid': COMP_ID },
  partition_parameter_kw = {'_': JSON_PARAMETERS}
)

Please use the output of the slapos servce info command and your service page on the panel to know which parameters to use for the request command:

  • SOFTWARE_RELEASE_URL: You can get this URL from the "software-url" field
    • Example: https://lab.nexedi.com/nexedi/slapos/raw/1.0.308/software/ors-amarisoft/software-tdd2600.cfg
  • REFERENCE: Reference of your service
    • Example: ors10-nr
  • SR_TYPE: Go to your service on your panel, scroll down to "instances", and click on the instance with the title of your service, then look at "Software Type" field
    • Example: gnb-epc
  • COMP_ID: On the left menu go to the "Servers" tab, find your ORS and look for the reference
    • Example: COMP-1035
  • JSON_PARAMETERS: The parameters of your instances formatted as json. You can copy the JSON in the "instance-parameters" field of slapos service info (copy the json after "_":)
    • Example: {"tx_gain": 50, "rx_gain": 40}

 

Get State and Connection Parameters

To get the connection parameters or state you see on your panel, you can use the request command again:


ret = request(
  software_release = SOFTWARE_RELEASE_URL,
  partition_reference = REFERENCE,
  software_type = SR_TYPE,
  filter_kw = { 'computer_guid': COMP_ID },
  partition_parameter_kw = {'_': JSON_PARAMETERS}
)
print(ret.getState())
print(ret.getConnectionParameterDict())

Every time you call the request command you need to put all the input parameters of your partition in order to not erase them.

 

Start and stop your service

To get the connection parameters or state you see on your panel, you need to again use the request command with the "state" parameter:


request(
  software_release = SOFTWARE_RELEASE_URL,
  partition_reference = REFERENCE,
  software_type = SR_TYPE,
  filter_kw = { 'computer_guid': COMP_ID },
  partition_parameter_kw = {'_': JSON_PARAMETERS},
  state = STATE
)
  • STATE: "started" or "stopped"

 

Get logs from your instance

To get the logs from your instance, you can get the URL of your logs and then use a standard command to download HTML pages.

To get the URL of your logs, checkout the "Monitor your ORS - Access ORS logs" section from this tutorial

Then, once you have accessed the log you can copy the URL which will contain the password needed to access the page.

You can then use wget or curl command for example:

curl https://admin:PASSWORD@SOFTINST_DOMAIN.host.vifib.net/share/private/log/gnb.log -o gnb.log