Upload VNF Package from uri REST API accepts userName and password
parameter but internally these parameters are not used while getting
the csar zip file from the URI as specified in the addressInformation.
If the server serving the CSAR zip requires authentication, it would
return 401 error and the uploading vnf package will fail to set the VNF
package to onboarded status.
This patch uses userName and password parameters to set "Authorization"
header as shown below if these parameters are passed in the request body.
* The userName and password are combined with a single colon (:).
This means that the username itself cannot contain a colon.
* The resulting string is encoded using a variant of Base64.
* The authorization method (Basic and a space (e.g. "Basic ") is then
prepended to the encoded string.
For example, if userName and password is "xyz" and "xyzpassword", then
the field's value is the base64-encoding of xyz:xyzpassword, or
eHl6Onh5enBhc3N3b3Jk. Then the Authorization header will appear as:
Authorization: Basic eHl6Onh5enBhc3N3b3Jk
Change-Id: Ie79d5e4659951f41db4a1003950c649acab8b439
The GET method fetches the content of a VNF package identified by
the VNF package identifier allocated by the NFVO.
The 'HTTP_RANGE' header is inspected for a valid value.
If it is present and valid, then the package content within
the range is fetched.If not present the entire content is
fetched
A 'size' column has been added to vnf_packages db table.
When the VNF package content is uploaded, the size of the
csar zip is persisted in this newly added 'size' column of
vnf_packages db table.
When VNF_Package content is fetched for the first time, its size is
retrieved from glance store and the size column in vnf packages table
is populated with this value. For subsequent fetch calls the size of
csar file content is retrieved from 'size' column in vnf_packages
table.
A lot of the content fetching code has been reused from
glance/api/v2/image_data.py ResponseSerializer class
download function
Blueprint: bp/enhance-vnf-package-support-part1
Change-Id: Ib49ef8b1e81ca4a4b7e3ac4a0836c111ce7da4a3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.
Fix problems found by updated hacking version.
Update local hacking checks for new flake8.
Remove hacking and friends from lower-constraints, they are not
needed in installations.
Change-Id: If787d610315be6c973b4335e047242c3aa3caf2a
As per ETSI GS NFV-SOL 005 V2.4.1 (2018-02) table 9.4.2.3.2-2, GET Vnf
Packages should return list of all Vnf packages, but as per current
implemention this api is returning dictionory with resource name as key
i.e {'vnf_packages': [{vnf_package1}, {vnf_package2},...]}. Hence
removing the resource key and returning api response as a list.
As per process to fix this issue we need to provide micro version
support in tacker as well as in python-tackerclient for command.
The list api was part of VNF package api which released in train cycle.
But we can not instantiate, terminate and Heal VNF as these feature is
not released yet and about to release in U cycle. The changes we have
proposed will be useful after U release and that is why we think we
should do these change without micro version support.
Closes-bug: #1871054
Change-Id: I7f5105fc7a49f9d31fb32119c725dae0421cfde7
Implement new method of VNF lifecycle management using LCM operation
user data.
Change-Id: Ib2fbe341b5d26758f0b48dc19e3e05810c2c830f
Blueprint: support-etsi-nfv-specs
Certain resource representations can become quite big, in particular
``GET /vnfpackages`` API which is a container for multiple sub-resources.
In these cases, it can be desired to reduce the amount of data exchanged
over the interface and processed by the API consumer application.
An attribute selector i.e filter, allows the API consumer to choose
which attributes it wants to be contained in the response. Only
attributes that are not required to be present, i.e. those with
a lower bound of zero on their cardinality (e.g. 0..1, 0..N)
and that are not conditionally mandatory, are allowed to be omitted
as part of the selection process.
This patch implements attribute filtering for ``GET /vnfpackages`` API.
It will support following query parameters:-
* filter: Filter criterion built with attributes of VNF Package and
REST operators.
* all_fields: Return all fields
* fields=<list> : Return fields specified in the <list>
* exclude_fields=<list>: Return fields not specified in the <list>
* exclude_default parameters: Return all fields except default fields
* exclude_default and fields=<list>: Return all fields except default
fields and fields in the <list>
* When no parameter is specified it is treated as exclude_default.
You can find more details about supported query parameters in document:
ETSI GS NFV-SOL 013 V2.6.1 (2019-03 in section 5.2 and 5.3
Co-Authored-By: Prashant Bhole <prashant.bhole@nttdata.com>
Change-Id: I1513d7d87967de5248787cd298c3bec65c2dde9d
Implements: bp/enhance-vnf-package-support-part1
Added db support to filter out the vnf packages as per the
filter rule specified in the `filter` query parameter.
Made use of ready-made 'sqlalchemy-filters' library which
can apply filters to the query object dynamically.
You can find few examples on home page of sqlalchemy-filters
github repository:
https://github.com/juliotrigo/sqlalchemy-filters
Change-Id: Iddf0ba7445fa7739440d333d914e675bd0782040
Implements: bp/enhance-vnf-package-support-part1
Used tooz distribued lock mechanism for synchronizing various
vnf instance tasks like instantiate, terminate and heal. It
supports various backends, such as etcd, mysql, file locks, redis,
zookeeper, etc.
This change imports the "coordination" module, which is shared by
Cinder, Manila and a few other projects.
The lock backend can be selected using the CONF.coordination.backend_url
config option.
Change-Id: Ia4979571e788ecc4874ae0b62533fbc5277253a8
Blueprint: support-etsi-nfv-specs
Implemented instantiate vnf instance API.
* GET /vnflcm/v1/vnf_instances/{vnf_instance_id}/instantiate
Co-authored-By: Nitin Uikey <nitin.uikey@nttdata.com>
Co-authored-By: tpatil <tushar.vitthal.patil@gmail.com>
Co-authored-By: Ajay Parja <ajay.parja@nttdata.com>
Co-authored-By: Shubham Potale <shubham.potale@nttdata.com>
Co-authored-By: Sameer Thakur <sameer.thakur@nttdata.com>
Updated lower-constraints openstacksdk version to 0.44.0 as it
includes fix[1] which is required to create images from filename
which further requires to upgrade os-service-types, keystoneauth1
and decorato to higher versions.
[1] : https://review.opendev.org/#/c/710368
Change-Id: Ic30f8d730d54e3af1345816ffa1bfb702cd00694
Blueprint: support-etsi-nfv-specs
The VNFD can be implemented as a single file or as a collection of
multiple files. If the VNFD is implemented in the form of multiple
files, a ZIP file embedding these files shall be returned. If the VNFD
is implemented as a single file, either that file or a ZIP file
embedding that file shall be returned.
Implemented below API:-
* GET /vnf_packages/{vnfPkgId}/vnfd
Change-Id: I4af9c8126fb7478da294bc99a176eabba3944564
Implements: bp enhance-vnf-package-support-part1
This patch fixes the issue for uploading single yaml casr.
It was reading the flavour details from the nested template
only in the earlier code.
Change-Id: Ibf86ed06e940a0b9aaaa8eaf63f3249be1462e36
Closes-Bug: #1861754
Added API to update information of VNF package.
Implemented below API:-
* PATCH /vnf_packages/{vnfPkgId}
Co-authored-by: Shubham Potale <shubham.potale@nttdata.com>
Change-Id: I6d60e87b48a6703362dcd30975f300f524f8ca7a
Implements: bp enhance-vnf-package-support-part1
The existing two unit tests are failing due to the changes
merged [1] in heat-translator 2.0.0 version.
Failing two unit tests:-
tacker.tests.unit.vnfm.infra_drivers.openstack.test_openstack.TestOpenStack
1) test_create_tosca_alarm_scale
2) test_create_tosca_scale
[1]: https://review.opendev.org/#/c/696446/9/translator/hot/syntax/hot_resource.py
Change-Id: Ib6457fd4c407413bea4d7d1986c54037f46fec0d
Closes-Bug: #1870469
Presently, vnf package can be deleted when it's operationalState is
'ENABLED'.
As per pre-condition rule, vnf package can be deleted only when
it's operationalState is 'DISABLED' and it's usageState is 'NOT_IN_USE.
This patch fixes this issue and now vnf package will be deleted only
when it's operationalState is 'DISABLED' and it's usageState is 'NOT_IN_USE.
Note: I have fixed windows style line ending issue in vnf_packages.inc.
Also, updated 'Delete VNF Package' API doc to include 409 error.
Change-Id: Id4d50264d1052a09e6ce527b6aab1bb941fdc6af
Closes-Bug: #1862864
If user deletes VNF in "PENDING_CREATE" status, VNF is deleted from
tacker but the resources created by VIM driver are not cleaned up
properly. This patch doesn't allow VNF to be deleted if the status is
in "PENDING_CREATE" status. It will raise 409 error.
APIImpact
Return 409 error instead of 200 when VNF is deleted in
"PENDING_CREATE" status.
Change-Id: I2de9c3dce5a4b3795119e2550aa8acea68940c45
Closes-Bug: #1798726
Pep8 didn't recognised this error because it was running
on python2. Now tacker is going to support python3 so this
window style line ending should be fixed.
This patch removed window style line endings.
Change-Id: I2dfee4967545aba5ea54561dc4910df02b0a9c98
In test_vnf_package.py, self.assertTrue(result.objects, list) is
used to verify whether result.objects is of type list, and
self.assertTrue(isinstance(result.objects, list)) should be used
instead.
Change-Id: I1705e36ec35f6c0f01ed16b5eb79dae7608d96a1
This patch fix bugs regarding bytestring "mgmt_ip_address" and
assertion test for bytestring "req.body".
Change-Id: I76424f64b2e436da05f9871adfa11b8bef9a3939
If you upload a vnf package without policies, currently
it fails with an error message:
"InvalidCSAR: 'NoneType' object is not iterable".
This patch fixes this issue.
Closes-Bug: #1847745
Change-Id: I4d6907b4da639e62294f07cbc767a176af04337c
In Python3 test, the test "test_create_vnffg_pre()" affects
other tests regarding mocked "__new__" part.
Because most part of this test are covered in
test_create_vnffg_abstract_types(), this test should be deleted.
Change-Id: Icf118cbb3e9dda745248cedbe16a6d4a0be1569f
Below deprecation warning message is emitted continuously during each
API call due to the introduction of glance_store library in patch [1].
DeprecationWarning: Property 'user' has moved to 'user_id' in version
'2.6' and will be removed in version '3.0'"
DeprecationWarning: Property 'tenant' has moved to 'project_id' in
version '2.6' and will be removed in version '3.0'"
There is an issue in glance_store library which is reported in
LP bug [2] and it will be fixed by patch [3].
But we are not sure whether this issue will be fixed in Train
cycle Moreover, in future we will need to deal and remove
`tenant` and `user` attributes from context as these attributes
are deprecated from oslo.context in version 2.6 and it's planned
to be removed in 3.0. so this patch removes these 'tenant' and
'user' attributes from context. Also, added warnings fixture in
the unit test to ensure these attributes are not used anywhere
in the code. If used, it will result in test failure.
[1] : https://review.opendev.org/#/c/675600
[2] : https://bugs.launchpad.net/glance-store/+bug/1844462
[3] : https://review.opendev.org/#/c/683034
Implements: blueprint tosca-csar-mgmt-driver
Change-Id: I0cb320bbf237ebfac72b8e65128901c70cdd6780
vnf-update don't change heat stack's state.
But update_wait function currently check stack's state.
Therefore update_wait always raise exception,when tacker
execute update. The reason that this function execute
check process is because vdu_autoheal action shares
update_wait with update action.
this commit splits update_wait into heal_wait and update_wait.
Closes-Bug:#1837205
Change-Id: I7ab059bb30b5de38943555883a92d77a64a56d34
In python3.0 the cmp parameter was removed from sorted function.
Using functools.cmp_to_key() instead.
Change-Id: I8cd7856a625107602df1f584b22806a8534a3142