Skip to main content

Sardou TOSCA Library

Project description

TOSCA in Swarmchestrate

This repository is home to the Swarmchestrate project documentation.

The full documentation can be seen here and this should be the first stop for anyone looking to deploy applications with Swarmchestrate. There is some usual info for developers below.

Sardou TOSCA Library

This repository also contains the source for the TOSCA Toolkit in Swarmchestrate, named Sardou. Some info for developers is available in this README.

Quickstart

Install Puccini.

wget https://github.com/Swarmchestrate/tosca/releases/download/v0.2.4/go-puccini_0.22.7-SNAPSHOT-3e85b40_linux_amd64.deb
sudo dpkg -i go-puccini_0.22.7-SNAPSHOT-3e85b40_linux_amd64.deb || sudo apt --fix-broken install -y

Install Sardou:

uv add sardou

Run the Sardou CLI to validate an SAT or CDT:

sardou templates/BookInfo.yaml

Setup

System Requirements

  • Python 3.12
  • Minimum GLIBC 2.34 (Ubuntu 22.04 or higher)

Puccini

Puccini provides a TOSCA Parser, which Swarmchestrate uses to validate templates and complete the representation graph. It must be installed before using Sardou.

Prefer the latest (currently unreleased) version. Build from source from Go-Puccini or use the prebuilts attached to this Sardou release.

[!NOTE] Rust Puccini

Puccini is being re-written in Rust. Until its release, we are using the Go version of Puccini, 0.22.x

You can install the recommended Puccini on Linux with:

wget https://github.com/Swarmchestrate/tosca/releases/download/v0.2.4/go-puccini_0.22.7-SNAPSHOT-3e85b40_linux_amd64.deb
sudo dpkg -i go-puccini_0.22.7-SNAPSHOT-3e85b40_linux_amd64.deb || sudo apt --fix-broken install -y

Sardou

You may then install Sardou from PyPi using uv (or pip).

# using uv
uv add Sardou

Command-line Usage

The Sardou CLI currently only performs validation. Run it against any SAT or CDT. If processed succesfully, the template is valid.

sardou templates/BookInfo.yaml

Library Usage

Import the Sardou TOSCA Library

from sardou import Sardou

Validation

To validate a TOSCA template, create a new Sardou object, passing it a file path, or the template content directly as a Python dict. This will validate the template and complete the representation, inheriting from parent types.

# Pass a file path
>>> sat = Sardou("BookInfo.yaml")
Processed successfully: BookInfo.yaml

# Pass content directly as a Python dict
>>> sat = Sardou(content="tosca_definitions_version: tosca_2_0\n...")
Processed successfully

>>> sat
{'path': PosixPath('templates/BookInfo.yaml'), 'description': 'Istio Bookinfo as a Swarmchestrate SAT', 'nodeTemplates': {'details_v1': {'metadata': {}, 'description': '', 'types': {'eu.swarmchestrate:0.1::Kubernetes.APIObject': {'description': ...

The template is not resolved at this point (i.e. statisfied requirements and created relationships) - that functionality is to come. If there are errors or warnings, they will be presented at this time.

Exploring the Template

Get the raw, uncompleted (original YAML) with the raw attribute.

>>> sat.raw
{'tosca_definitions_version': 'tosca_2_0', 'description': 'Istio Bookinfo as a Swarmchestrate SAT', 'metadata': {'name': 'bookinfo', 'author': 'you', ...

You can traverse YAML maps using dot notation if needed (which leads to some unexpected behaviour, so this may not be a long-term feature):

>>> sat.nodeTemplates
{'details_v1': {'metadata': {}, 'description': '', 'types': {'eu.swarmchestrate:0.1::Kubernetes.APIObject': {'description': 'Base type for Kubernetes API objects (persisted resources that can be created/applied on their own, e.g. Service, Deployment, ServiceAccount)...

Going Further

The rest of the developer docs can be found here

Contact

Contact Jay at Westminster for support with TOSCA and/or this repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sardou-0.12.0.tar.gz (895.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sardou-0.12.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file sardou-0.12.0.tar.gz.

File metadata

  • Download URL: sardou-0.12.0.tar.gz
  • Upload date:
  • Size: 895.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sardou-0.12.0.tar.gz
Algorithm Hash digest
SHA256 80242ab6c778a62934b129a01c37a5ff1ffd0c147ccc130d8f4662156479d02c
MD5 211540157b8ab19f498df2dab154bb07
BLAKE2b-256 1ff28a78c246d7fd1b9546e932afc85f4e404731a15caba8e8d826806696ed00

See more details on using hashes here.

Provenance

The following attestation bundles were made for sardou-0.12.0.tar.gz:

Publisher: release.yml on Swarmchestrate/tosca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sardou-0.12.0-py3-none-any.whl.

File metadata

  • Download URL: sardou-0.12.0-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sardou-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d638356ec3ffd47e40bdeca16c5b03916211ec261f29cfaa3a4992c74428dc8a
MD5 709f9ef4174c77804ed5b5c2e4bba55e
BLAKE2b-256 488ca5d9ba1029031c194c1901bf5608bc10ed0c45f928a1f8007c22e627833c

See more details on using hashes here.

Provenance

The following attestation bundles were made for sardou-0.12.0-py3-none-any.whl:

Publisher: release.yml on Swarmchestrate/tosca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page