Use SlapOS Client And Console

Use SlapOS Client

This document describes how to use the SlapOS client, a utility software to manage SlapOS nodes, instances and the SlapOS Master account on the command line. It is a bare Python console with several global variables defined and initialized so it can interact with a SlapOS Master through the SLAP Library.

To use the SlapOS Client you need a GNU/Linux Server with SlapOS Node installed from packages. It is not necessary to configure this machine as a compute node, the package itself with the respective binaries is all that is required. You will also need a X509 security token from a SlapOS Master (you can use Rapid.Space or create your own SlapOS Master).

Table of Content

  • Prerequisite: SlapOS Client configured
  • Available Commands
  • Instance Allocation via SlapOS Client
 

Prerequisite: SlapOS Client configured

Please follow rapidspace-HowTo.Setup.SlapOS.Client page to get a working SlapOS client.

Available commands

The SlapOS client has a few CLI commands directly available and it also has a "console" mode which is a python console with available commands to talk to the SlapOS master.

The list of commands is:

  • slapos service list
  • slapos service info
  • slapos computer list
  • slapos computer info
  • slapos supply
  • slapos remove
  • slapos request
  • slapos console (the python console)

In order to view the help on a command just add "help" after slapos (e.g. slapos help service info).

Example of service info

$ slapos service info ors48-core-network
/opt/slapos/eggs/urllib3-1.26.12-py3.9.egg/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'api.vifib.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
  warnings.warn(
/opt/slapos/eggs/urllib3-1.26.12-py3.9.egg/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'api.vifib.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
  warnings.warn(
/opt/slapos/eggs/urllib3-1.26.12-py3.9.egg/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'api.vifib.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
  warnings.warn(
/opt/slapos/eggs/slapos.core-1.16.2-py3.9.egg/slapos/util.py:546: UserWarning: No schema defined for software type 'default' of software release https://lab.nexedi.com/nexedi/slapos/-/raw/1.0.399/software/simpleran/software-ors.cfg (KeyError: 'default')
  self._warn("No schema defined", e)
{
  "software-url": "https://lab.nexedi.com/nexedi/slapos/-/raw/1.0.399/software/simpleran/software-ors.cfg",
  "software-type": "core-network",
  "shared": false,
  "requested-state": "start_requested",
  "instance-parameters": {
    "_": {
      "core_network_plmn": "99970",
      "iperf3": 1,
      "local_domain": "ors.rapid.space"
    }
  },
  "connection-parameters": {
    "amarisoft-available-versions": "2024-09-13.1730899377, 2024-06-15.1726499052, 2024-11-21.1734602361, 2024-11-21.1732633257",
    "amarisoft-host-id": "xx-xx-xx-xx-xx-xx-xx-xx",
    "amarisoft-version": "2024-11-21.1734602361",
    "core-network-ipv4": "192.168.99.160",
    "core-network-ipv6": "2a11:9ac1:9::b",
    "core-network-mac": "00:03:1d:15:2e:f8",
    "iperf3-server-0-port": "5001",
    "iperf3-server-ipv4": "172.20.128.1",
    "license-expiration": "2025-06-03",
    "monitor-base-url": "https://softinst271018.host.vifib.net",
    "monitor-gadget-url": "https://softinst271018.host.vifib.net/gadget/software.cfg.html",
    "monitor-setup-url": "https://monitor.app.officejs.com/#page=ojsm_landing&url=https://softinst271018.host.vifib.net/public/feeds&username=admin&password=XXXXXXXXXXXXXX",
    "sim-list": "520030000000485, 001010000000481, 520030000000482, 520030000000483, 520030000000484"
  },
  "status": "green"
}

 

SlapOS console: start the console

slapos console # by default it uses ~/.slapos/slapos-client.cfg but you can launch with "slapos console --cfg XXXXX"

Please note that as regular python, the "slapos console" tool can be run interactively or can execute code from a file.

$ slapos console
2025-03-27 23:04:01 slapos[1357312] INFO IPython not available - using plain Python shell
>>> 

SlapOS console: API

Here is a list of available methods:

  • supply
  • request
  • remove

The following methods are available on a SlapOS Client (full api):

  • supply() is shorthand for slap.registerSupply().supply() and allows to request installation of a software on a node.
  • request() is shorthand for slap.registerOpenOrder().request() and allows to request instances of a software installation on a node.
  • remove() uninstalls a software from a node

Example Usage

# supply software installation on a node
SR-kvm = https://lab.nexedi.com/nexedi/slapos/-/raw/1.0.404/software/kvm/software.cfg
supply(SR-kvm, "mycomputer")

# request instance on arbitrary node
request(SR-kvm, "myuniquekvm")

# request instance on specific node
request(SR-kvm, "myotheruniquekvm", filter_kw = {
  "computer_guid": "COMP-12345"
})

# request instance, specifying parameters
request(SR-kvm, "mythirduniquekvm", partition_parameter_kw = {
  "nbd_ip":"2a01:e35:2e27:460:e2cb:4eff:fed9:48dc", "nbd_port":"1024"
})
# fetch existing instance status
request(SR-kvm, "myuniquekvm").getState()

# fetch instance information from launched instance
request(SR-kvm, "myuniquekvm").getConnectionParameter("url")

Thank You

Image Nexedi Office
  • Nexedi SA
  • 147 Rue du Ballon
  • 59110 La Madeleine
  • France