SatNOGS Config utility

SatNOGS Config is a utility for generating the configuration for a Debian-based SatNOGS client system. It is a menu driven configuration tool built on-top of pythondialog. The main purpose of this utility is to create the YAML configuration file for SatNOGS Client Ansible which provisions the system. In addition to that, it interacts with satnogs-setup, which is a wrapper to bootstrap Ansible, upgrades the system packages using APT and probes the hardware to show the user a more limited set of configuration options.

Table of Contents

User guide

Requirements

  • Python 3.4+

  • libapt 1.8+ Python bindings

  • lsb-release 10+

Installation

Debian

To install the required dependencies in Debian run:

$ apt-get install python3-apt lsb-release

SatNOGS Config

To install SatNOGS Config run:

$ pip install satnogs-config

This will install a console script called satnogs-config.

Usage

To execute the script, run it on the command line:

$ satnogs-config

The main menu will be shown

Basic

The Basic sub-menu contains the minimum required configuration options for provisioning the SatNOGS client system.

Advanced

The Advanced sub-menu contains a larger set of configuration options. It is intended for advanced users and contains options categorized by component.

Show

The Show option displays the current configuration file.

Upgrade

The Upgrade option calls APT utilities to upgrade the distribution packages.

Update

The Update option works in conjunction with satnogs-setup to re-bootstrap Ansible and update the configuration tools.

Reset

The Reset option resets the configuration file generated by the utility, effectively removing all the configuration options set by the user.

Apply

The Apply button runs SatNOGS Client Ansible which provisions Debian to become a SatNOGS client system.

Developer guide

Installation

To install the required dependencies in Debian run:

$ apt-get install python3-apt lsb-release

It is recommended to install SatNOGS Config in a virtualenv. The virtualenv needs to have access to system Python bindings. To create the virtualenv, you can use virtualenvwrapper. On the first time, create the virtualenv by running:

$ mkvirtualenv --system-site-packages -a . satnogs-config

To activate the virtualenv after it is created run:

$ workon satnogs-config

To install SatNOGS Config for development run in the project root directory:

$ pip install -e .

Configuration

This project uses python-dotenv. Configuration of satnogsconfig/settings.py can be overridden by setting the respective environment variables or an .env file placed on the project root directory.

Extending

SatNOGS Config functionality can be extended by implementing additional helpers. The helpers are used to enhance menu functionality beyond the core function of generating a YAML file for Ansible.

Modifying the menu

The menu itself is also expressed in YAML format. The menu structure is defined in menu.yml file and shipped along with the package.

Code Quality Assurance

The following code quality assurance tools are used in this project:

  • flake8

  • isort

  • yapf

  • pylint

Automation

tox is used to automate development tasks. To install tox run:

$ pip install tox

To execute the default list of tasks run:

$ tox

Environments

The following tox environments are available:

  • flake8 - Check code for common errors, coding style and complexity

  • isort - Check code for correct imports order

  • isort-apply - Sort imports

  • yapf - Check code for correct formatting

  • yapf-apply - Reformat source code

  • pylint - Execute static code analysis

  • build - Build source and binary distributions

  • upload - Upload source and binary distributions to PyPI

  • docs - Build documentation

To execute a single environment run:

$ tox -e <environment>

Modules reference

satnogsconfig

SatNOGS Config module initialization

satnogsconfig.main()[source]

SatNOGS Setup utility

satnogsconfig.config

Configuration module

class satnogsconfig.config.Config(filename)[source]

Manage configuration file

Parameters

filename (str) – File path of configuration

_load_config()[source]

Load and parse YAML configuration

Returns

Configuration dictionary

Return type

dict or NoneType

clear_config()[source]

Clear configuration file

dump_config(to_file=False)[source]

Dump configuration in YAML format

Parameters

to_file (bool, optional) – Dump to file

Returns

YAML configuration

Return type

str

get_variable(variable)[source]

Get variable value from configuration

Parameters

variable (str) – Variable to get the value

Returns

Value of variable

Return type

str or bool or NoneType

set_variable(variable, value)[source]

Set variable value in configuration

Parameters
  • variable (str) – Variable to set the value

  • value (str or bool or NoneType) – Value of variable

satnogsconfig.helpers

Helpers module

class satnogsconfig.helpers.SatnogsSetup[source]

Interract with satnogs-setup

property gnuradio_version

Get installed gnuradio version

Returns

Version of gr-soapy

Return type

str

property gr_satnogs_version

Get installed gr-satnogs version

Returns

Version of gr-satnogs

Return type

str

property gr_soapy_version

Get installed gr-soapy version

Returns

Version of gr-soapy

Return type

str

property is_applied

Check whether configuration has been applied

Returns

Whether configuration has been applied

Return type

bool

static restart(boot=False)[source]

Restart satnogs-setup script

Parameters

boot (bool, optional) – Whether to bootstrap or not

property satnogs_client_ansible_version

Get installed SatNOGS Client Ansible version

Returns

Version of SatNOGS Client Ansible

Return type

str

property satnogs_client_version

Get installed SatNOGS Client version

Returns

Version of SatNOGS Client

Return type

str

property satnogs_flowgraphs_version

Get installed satnogs-flowgraphs version

Returns

Version of satnogs-flowgraphs

Return type

str

property tags

Get satnogs-setup tags

Returns

Set of tags

Return type

set

upgrade_system()[source]

Upgrade system packages

class satnogsconfig.helpers.GrSatnogs[source]

Get and set gr-satnogs configuration

property gr_satnogs_version

Get gr-satnogs version

probe_soapysdr()[source]

Probe SoapySDR hardware

class satnogsconfig.helpers.Ansible(ansible_dir)[source]

Call Ansible playbooks

pull(playbooks, url, branch=None, tags=None, extra_args=None)[source]

Pull and run Ansible playbook

Parameters
  • playbooks (list) – List of playbooks

  • url (str) – Git URL to pull playbooks

  • branch (str, optional) – Git branch to pull playbooks

  • tags (list, optional) – List of tags

  • extra_args (list, optional) – List of extra arguments to pass to Ansible

Returns

Whether Ansible execution succeeded

Return type

bool

run(playbooks, tags=None, extra_args=None)[source]

Run Ansible playbook

Parameters
  • playbooks (list) – List of playbooks

  • tags (list, optional) – List of tags

  • extra_args (list, optional) – List of extra arguments to pass to Ansible

Returns

Whether Ansible execution succeeded

Return type

bool

class satnogsconfig.helpers.Support(config, satnogs_setup, ansible)[source]

Create support information to be used for reporting bugs

dump(*args, **kwargs)[source]

Dump support information

Returns

JSON dump of support information

Return type

str

property info

Support information

Returns

Support information dictionary

Return type

dict

satnogsconfig.menu

Menu module

class satnogsconfig.menu.Menu(menu, config, backtitle=None)[source]

Show a menu structure based on dialog

Parameters
  • menu (dict) – Menu dictionary

  • config (dict) – Configuration dictionary

  • backtitle (str, optional) – Default dialog backtitle

_apply(menu)[source]

Request setup from configuration management tool

_configbox(menu)[source]

Show scrollbox for viewing configuration

Parameters

menu (dict) – Menu dictionary

_exit(menu)[source]

Exit the utility

Parameters

menu (dict) – Menu dictionary

_get_common_options(menu)[source]

Get dialog common options

Parameters

menu (dict) – Menu dictionary

Returns

Common option dictionary

Return type

dict

_msgbox(menu)[source]

Show msgbox

Parameters

menu (dict) – Menu dictionary

_reboot(menu)[source]

Reboot system

Parameters

menu (dict) – Menu dictionary

_resetyesno(menu)[source]

Reset configuration

Parameters

menu (dict) – Menu dictionary

_submenu(menu)[source]

Show submenu

Parameters

menu (dict) – Menu dictionary

_support(_)[source]

Show support information

_update(_)[source]

Request tool update

_variablebox(menu)[source]

Show inputbox for setting a variable

Parameters

menu (dict) – Menu dictionary

_variableyesno(menu)[source]

Show boolean selection for setting a variable

Parameters

menu (dict) – Menu dictionary

property backtitle

Get default backtitle

Returns

Background title

Return type

str

show()[source]

Show dialog menu structure

satnogsconfig.menu._clear_screen()[source]

Clear screen

satnogsconfig.menu._get_variables(menu, name=None, mandatory=False)[source]

Get all menu variable items

Parameters
  • menu (dict) – Menu dictionary

  • name (str, optional) – Name of menu item

  • mandatory (bool) – Return only mandatory variables

Returns

Menu variables dictionary

Return type

dict

satnogsconfig.menu._load_menu(file)[source]

Load menu structure from YAML file

Parameters

file (file) – Menu file stream

Returns

Menu dictionary

Return type

dict

satnogsconfig.menu._reboot()[source]

Reboot system

Indices and tables