Usage - sonata-nfv/tng-sdk-sm GitHub Wiki

The tng-sm CLI tool can be used as follows

usage: tng-sm [-h] [-v] {new,generate,execute} ...

5GTANGO tng-sm tool

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         Verbose output

subcommands:

  {new,generate,execute}
    new                 creating new specific managers
    generate            generate payloads for testing
    execute             execute testing events

Subcommand new

The new subcommand is used to create an empty SSM or FSM, based on a template. The subcommand can be used as

usage: tng-sm new [-h] -t TYPE -n NAME

optional arguments:
  -h, --help            show this help message and exit
  -t TYPE, --type TYPE  Provide the type of specific manager, should be
                        either.'ssm' or 'fsm'.
  -n NAME, --name NAME  provide the name of specific manager

This command will create a new directory with the name <name>-<type>, which contains all files required to build a specific manager and to connect it to the 5GTANGO MANO Framework. The structure of the directory is as follows

<name>-<type>
│   README.md
│   setup.py
│   Dockerfile
└───base
│   │   README.md
│   │   setup.py
│   └───smbase
│       │   smbase.py
│       │   messaging.py
│       │   __init__.py
└───<name>
    │   <name>.py
    │   ssh.py
    │   __init__.py
    │   __main__.py

The base folder contains all abstractions required for the specific manager to connect to the MANO Framework message bus. Typically, the only file that the developer should alter is <name>.py. It already provides a skeleton for the possible interactions (organized as events) between a specific manager and the MANO Framework. The examples folder provides per event an example of what the received input of such an event looks like, and the MANO Framework API documentation should be consulted to ensure that the output of an event is correctly formatted. There is also an example that shows a finished specific manager that sets up an ssh connection with a VNF just after it has started (when the start_event is executed) to perform some configurations in the VNF.

Subcommand generate

The generate subcommand can be used to create (part of) the payloads that will serve as input when testing the various events. For example, when testing the start_event of an FSM, the input requires a VNFD and a VNFR. Since VNFRs are runtime objects, they are typically not readily available. The generate subcommand can be used to generate both VNFRs and NSR as follows

usage: tng-sm generate [-h] -f FILE

optional arguments:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  Provide a file that serves as input for generated
                        files. Should be either a yaml file with a vnfd, or a
                        .tgo package.

If the provided file is a VNFD, the tool will generate a VNFR. If the provided file is a .tgo package, the tool will generate a folder that contains a VNFR for each VNFD, and one NSR. The generated files still need some customisation (e.g. networking details of the VNFs).

subcommand execute

The execute subcommand is used to locally test the different events that your specific manager customizes in the MANO Framework. It can be used as follows

usage: tng-sm execute [-h] -e EVENT -p PAYLOAD -s SPECIFIC MANAGER

optional arguments:
  -h, --help            show this help message and exit
  -e EVENT, --event EVENT
                        The specific manager event that needs testing. One of
                        ['placement', 'configure', 'task', 'state'] for ssms,
                        ['start', 'stop', 'configure', 'state'] for fsms.
  -p PAYLOAD, --payload PAYLOAD
                        The payload that serves as input for the event that
                        needs testing. Should be a yaml file.
  -s SPECIFIC MANAGER, --sm SPECIFIC MANAGER
                        Specific manager subject to the test.

To test one of the events, you need to provide the specific manager, the event name and the payload that serves as input for the event. This payload needs to be a yaml file, and should be formatted in accordance with the MANO Framework API (if not, you are not testing against the correct format). How these payloads should be formatted can be found in the MANO Framework API documentation, and the examples folder contains an example for each of the events. Customize the payloads were needed (e.g. if you want to test a FSM start_event that sets up an ssh connection with a VNF, you need to spin up the VNF and add its networking details to the VNFR that is part of the input payload of the start_event).

Afterwards

Once the code for the specific manager is finished and tested, it should be packaged as a Docker container. This can be done by running

docker build -t <name_of_your_container> -f <name>-<type>/Dockerfile .

To attach a specific manager to a network service or a VNF, it should be added to its descriptor. Please consult the MANO Framework wiki for instructions to do so.

⚠️ **GitHub.com Fallback** ⚠️