sonata-nfv / tng-sdk-project

The 5GTANGO SDK tool to manage network service projects.
http://www.5gtango.eu
Apache License 2.0
5 stars 4 forks source link

Commands for adding/removing files from a project #8

Closed stefanbschneider closed 6 years ago

stefanbschneider commented 6 years ago

Similar to git, tng-project add <file> should add the specified file to project.yaml, so it's packaged by the packager. Vice versa, tng-project reset/remove removes it from project.yaml, so it is ignored by the packager

mpeuster commented 6 years ago

We might need developers to tell us what file types they add. (we could try to autodetect based on file endings where possible, maybe there are MIME type libraries that help here)

tng-project add -t 'application/octet-stream' folder/folder/myvnf.qcow2
mpeuster commented 6 years ago

This should give a great workflow for developers. I have some further ideas which I write down here, to remember them.

We might want to also support wildcards and stuff:

tng-project add <subfolder>/*

But this is nothing for v0 or even v1 :-)

When we have wildcards, it might also make sense to have a .tngignore file in a project. :-D

stefanbschneider commented 6 years ago

python-magic can detect MIME types without fileendings. But it just returns text/plain for all .yml files as it can't distinguish between VNFDs and NSDs.

I guess, we'll have to build something ourselves here or simply require users to specify what they are adding. Maybe using a few different flags like tng-project add --vnfd sample.yml or --image.

mpeuster commented 6 years ago

Yes that sounds good. I guess we need a combination:

with this three things we should be able to detect most things used in packages. and if they do not work, a manual fallback can be used.

stefanbschneider commented 6 years ago

Extension for later: Optional --tag option that allows to add tags to be used in the NAPD

stefanbschneider commented 6 years ago

Optional --type option to set the MIME type manually. This might be necessary when we can't detect the file type (e.g., of OSM descriptors). In this case we should throw a warning, use a best-effort categorization, and ask the user to provide the type manually.

stefanbschneider commented 6 years ago

We planned to determine the MIME/type of descriptors based on their descriptor_schema, e.g., https://raw.githubusercontent.com/sonata-nfv/tng-schema/master/service-descriptor/nsd-schema.yml.

Should we try to guess the type by slicing this URL (e.g., into nsd-schema)? But this isn't very clean and breaks if we move or rename the schema.

Alternatively, we could add the MIME/type directly in the descriptors such that it can be read directly instead of descriptor_schema.

Also, what about Sonata/Tango yaml files without descriptor_schema? For example, FSMs and SSMs don't even seem to have schemas. And what are "patterns"? Do we need all this in Tango?

stefanbschneider commented 6 years ago
stefanbschneider commented 6 years ago

Closed by PR #12