IDBManager#

class stixcore.idb.manager.IDBManager(data_root, force_version=None)[source]#

Bases: object

Manages IDB (definition of TM/TC packet structures) Versions and provides a IDB reader.

Attributes Summary

data_root

Get the data path root directory.

force_version

Get the forced IDB version.

Methods Summary

compile_version(version_label[, force, url])

Download compiles and installs an IDB version of a public available URL.

convert_mib_2_sqlite(*, in_folder, out_file, ...)

Convert a raw IDB version (set of .dat files) into a sqlite DB.

convert_version_label(version_label)

Convert a label or version tuple into a version label.

download_version(version_label[, force, url])

Download and installs an IDB version of a public available URL.

find_version([obt])

Find IDB version operational at a given time.

get_idb([version_label, obt])

Get the IDB for the specified version (or the latest available).

get_versions()

Get all available versions in the root directory.

has_version(version_label)

Test if the IDB version is available.

Attributes Documentation

data_root#

Get the data path root directory.

Returns:

pathlib.Path – path of the root directory

force_version#

Get the forced IDB version.

Returns:

pathlib.Path – path to the IDB directory

Methods Documentation

compile_version(version_label, force=False, url='https://pub099.cs.technik.fhnw.ch/data/idb/')[source]#
Download compiles and installs an IDB version of a public available URL.

Some IDB parameters will be injected to support the raw tw engineering framework.

Parameters:
Returns:

bool – was the download and installation successfully

Raises:

ValueError

static convert_mib_2_sqlite(*, in_folder, out_file, version_label)[source]#

Convert a raw IDB version (set of .dat files) into a sqlite DB.

Parameters:
  • in_folder (Path) – path to the folder with the IDB raw data files

  • out_file (Path) – path and filename of the sqlite DB file to generate

  • version_label (str) – the version label to be included into the DB

static convert_version_label(version_label)[source]#

Convert a label or version tuple into a version label.

Parameters:

version_label (str or (int, int, int)) – a version definition

Returns:

str – a label like ‘1.2.3’

download_version(version_label, force=False, url='https://pub099.cs.technik.fhnw.ch/data/idb/')[source]#

Download and installs an IDB version of a public available URL.

Parameters:
Returns:

bool – was the download and installation successfully

Raises:

ValueError

find_version(obt=None)[source]#

Find IDB version operational at a given time.

Parameters:

obt (datetime, optional) – the time point of the IDB operation, by default None

Returns:

str – a version label

get_idb(version_label='2.26.34', obt=None)[source]#

Get the IDB for the specified version (or the latest available).

Parameters:
  • version_label (str | (int, int, int)) – a version definition (major, minor, patch) or “major.minor.patch” default to ‘2.26.34’

  • obt (datetime, optional) – a date for autodetect the IDB version for operation period

Returns:

IDB – reference to a IDB reader

get_versions()[source]#

Get all available versions in the root directory. Does not check for version conflicts.

Returns:

list – List of available versions e.g. [{'label': '2.26.34', 'path': 'apathv2.26.34', 'version': ['2', '26', '34']}

has_version(version_label)[source]#

Test if the IDB version is available.

Parameters:

version_label (str or (int, int, int)) – a version definition

Returns:

True|False – does the IDB exists and matches the version