-
Notifications
You must be signed in to change notification settings - Fork 4
Example: Creating and managing a project
Stefan Schneider edited this page Jul 5, 2018
·
1 revision
This example illustrates how to create a new project, add and remove files, and check its status. Before starting, make sure the tool is installed correctly. After cloning the repository, install with setuptools (Python 3.5+):
$ python setup.py install
Creating a new project called example-project
.
$ tng-project -p example-project
2018-07-05 09:57:38 nb-stschn tngsdk.project.project[16844] INFO Creating project at example-project
2018-07-05 09:57:38 nb-stschn tngsdk.project.project[16844] INFO Added example-project\sources\vnfd\vnfd-sample.yml to project.yml
2018-07-05 09:57:38 nb-stschn tngsdk.project.project[16844] INFO Added example-project\sources\nsd\nsd-sample.yml to project.yml
Checking the status of the newly created project. This shows basic information about the project and provides an overview of the included files - so far one 5GTANGO NSD and one VNFD.
$ tng-project -p example-project --status
2018-07-05 09:58:51 nb-stschn tngsdk.project.project[13912] INFO Loading Project configuration 'example-project\project.yml'
Project: 5gtango-project-sample
Vendor: eu.5gtango
Version: 0.1
Some description about this sample
+------------------------------+------------+
| MIME type | Quantity |
+==============================+============+
| application/vnd.5gtango.vnfd | 1 |
+------------------------------+------------+
| application/vnd.5gtango.nsd | 1 |
+------------------------------+------------+
Let's test adding and removing files by creating a sample test.txt
and then adding it to the project. Afterwards, we can remove the file again. In between, we check the project status to verify that it works as expected.
# create a sample file
$ echo "test text" > example-project/test.txt
# add it to the project
$ tng-project -p example-project --add example-project/test.txt
2018-07-05 10:01:59 nb-stschn tngsdk.project.project[8368] INFO Loading Project configuration 'example-project\project.yml'
2018-07-05 10:01:59 nb-stschn tngsdk.project.project[8368] INFO Added example-project/test.txt to project.yml
# check the project status (now includes the test.txt shown as plain text file)
$ tng-project -p example-project --status
2018-07-05 10:02:30 nb-stschn tngsdk.project.project[7760] INFO Loading Project configuration 'example-project\project.yml'
Project: 5gtango-project-sample
Vendor: eu.5gtango
Version: 0.1
Some description about this sample
+------------------------------+------------+
| MIME type | Quantity |
+==============================+============+
| application/vnd.5gtango.vnfd | 1 |
+------------------------------+------------+
| application/vnd.5gtango.nsd | 1 |
+------------------------------+------------+
| text/plain | 1 |
+------------------------------+------------+
# remove the test file again
$ tng-project -p example-project --remove example-project/test.txt
2018-07-05 10:03:03 nb-stschn tngsdk.project.project[16148] INFO Loading Project configuration 'example-project\project.yml'
2018-07-05 10:03:03 nb-stschn tngsdk.project.project[16148] INFO Removed example-project/test.txt from project.yml
# check the status again (test.txt was removed)
$ tng-project -p example-project --status
2018-07-05 10:03:27 nb-stschn tngsdk.project.project[11132] INFO Loading Project configuration 'example-project\project.yml'
Project: 5gtango-project-sample
Vendor: eu.5gtango
Version: 0.1
Some description about this sample
+------------------------------+------------+
| MIME type | Quantity |
+==============================+============+
| application/vnd.5gtango.vnfd | 1 |
+------------------------------+------------+
| application/vnd.5gtango.nsd | 1 |
+------------------------------+------------+