Packages

tnglib.get_packages()

Returns info on all available packages.

Returns:A tuple. [0] is a bool with the result. [1] is a list of dictionaries. Each dictionary contains a package descriptor.
tnglib.remove_all_packages()

Removes all packages from the catalogue.

Returns:A tuple. [0] is a bool with the result. [1] is a list of uuids of packages that were removed.
tnglib.get_package(package_uuid)

Returns info on a specific package.

Parameters:package_uuid – the uuid of the package
Returns:A tuple. [0] is a bool with the result. [1] is a dictionary containing a package descriptor.
tnglib.upload_package(pkg_path, url=False, return_process_uuid=False)

Uploads a package from file.

Parameters:
  • pkg_path – relative path to the package that needs uploading, or url
  • pkg_path – A bool, True if pkg_path is an url
  • return_process_uuid – A bool, if you want the package_process_uuid returned instead of the package_uuid
Returns:

A tuple. [0] is a bool with the result. [1] is a string containing either the uuid of the uploaded package, the process uuid of the package

or an error message.

tnglib.remove_package(package_uuid)

Removes one package from the catalogue.

Parameters:package_uuid – uuid of the package
Returns:A tuple. [0] is a bool with the result. [1] is a string with either the uuid or an error message.
tnglib.map_package_on_service(package_uuid)

Return the uuid of a network service based on a package uuid.

Parameters:package_uuid – the uuid of the package
Returns:A tuple. [0] is a bool with the result. [1] is a string containing a nsd uuid.
tnglib.package_status(pkg_id)

Check the status of the package uploading process. Can be used to obtain the duration of the upload.

Parameters:pkg_id – uuid of the package uploading process
Returns:A tuple. [0] is a bool with the result. [1] is a dictionary containing metadata of the package.