This update is to fix failures in unittests below.
* `custom_def` in Policy class was changed from str to dict in
tosca-parser. This arg isn't interested in the test, so it's replaced
with empty dict.
* Fix unsafe yaml loader with `yamf.safe_load`.
It also removes nouse pip packages which cause failures while
resovlving dependencies, and some tiny refactoring.
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
Change-Id: I8ae60a4ae9f139073f05ec0f99fa82c8bb24ee50
The current heat-translator supports several conversions of
resources defined in ETSI NFV-SOL 001[1].
This patch supports the conversion of new resource types.
Specifically, the following types related to
'PlacementConstraints'.
- tosca.groups.nfv.PlacementGroup
- tosca.policies.nfv.AffinityRule
- tosca.policies.nfv.AntiAffinityRule
[1] https://www.etsi.org/deliver/etsi_gs/NFV-SOL/001_099/001/02.06.01_60/gs_NFV-SOL001v020601p.pdf
Co-Authored-By: Hiroo Kitamura hiroo.kitamura@ntt-at.co.jp
Implements: blueprint support-placement-constraints
Change-Id: Ic22a6183ee0d7c8357063bdafbb1a11c1a6efa3c
In the current UT testcase and yaml, there are several cases where
the required property of policy is insufficient or the definition
part is incorrect.
In addition, there is a bug in the code that has the translation
logic under 'translator/hot/tosca/'.
This patch fixes these translation logic codes, testcase and yaml.
Among the fixed yaml files, the following has a line feed code of CRLF,
so it has been modified to LF.
* translator/tests/data/autoscaling/tosca_cluster_autoscaling.yaml
* translator/tests/data/custom_types/senlin_cluster_policies.yaml
* translator/tests/data/nfv/test_tosca_nfv_autoscaling_with_params.yaml
In addition, NOTE description is added for
'translator/hot/tosca/tosca_policies_monitoring.py',
which is one of the translation logic codes.
Closes-Bug: #1918360
Change-Id: Ib9dec61007db5d354eaca86000ab3bcf6744a838
In python 3, all strings are considered as unicode string.
This patch drops the explicit unicode literal (u'...')
or (u"..") appearances from the unicode strings.
Change-Id: Iaa040f10028935782d8315efc81d344e72b2a152
Hacking 4.0.0 has introduce new optimal assert checks.
Please refer [1] for more details.
Additionally Hacking has enabled some new checks by default,
and the next update to the new release will introduce failures
in heat-translator pep8 jobs.
The main impact is from I122d250cab90964c346e9d53046a97c25054bc00.
This patch adopts new optimal assert check.
[H211]: Change assertTrue(isinstance(A, B)) to
assertIsInstance(A, B).
On bumping up the hacking version, below mention pep8 jobs failed.
This patch address the issues now, when the new hacking release starts
being used it will not cause a disruption.
pep8 run-test: commands[0] | flake8
./translator/tests/test_utils.py:51:13: H211: Use assert{Is,IsNot}instance
self.assertTrue(
[1] https://docs.openstack.org/releasenotes/hacking/unreleased.html#relnotes-4-0-0
Change-Id: Iae79b8c5c6873d6bf5f6ef1b427dc8c60bade03f
This update is to remove six support for dropping python2 from
heat-translator. Only the example of dockerfile is remained in which
it's expected libs are installed under `/usr/local/lib/python2.7`, so
it should also be considered to be updated later.
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
Change-Id: Iafbd1588674c95d6b6ec6b5429f2d34fb23081d0
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.
Change-Id: I7a7b0090139a72a06ec98d22e27e015307c3aec3
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.
Fix problems found.
Remove hacking and friends from lower-constraints, they are not needed
for installation.
Change-Id: I36cc496d9374169b0eafdf8d66747b07f2b2cabb
In ETSI tosca definition, node type “tosca.nodes.nfv.VNF” has
property “vnfm_info” that is defined as of type list.
Definition given in etsi_nfv_sol001_vnfd_types.yaml:
tosca.nodes.nfv.VNF:
properties:
vnfm_info:
type: list
required: true
Example:
tosca.nodes.nfv.VNF:
properties:
vnfm_info: [vnfm1, vnfm2]
Added translation support for list data type.
Change-Id: I02a4ba46da588ef7c1ac36a15d7cd537187e3ecc
When loading tosca clsses, '.', 'p' and 'y' are splited so files
including these charactors in its basename are failed to load. This
patch fixes it by removing only file extension.
Change-Id: I6ad8a32982aec67f8d8aecaafcbaec803d4c7a02
ToscaPlicies.handle_properties overwrites if scheduler_hints exists.
This patch changes it to use 'update' method to add new key and value.
Change-Id: I6062980eaa3c392a48c878518d2d61425eceb86f
Story: #2004963
Task: #29403
If user provides parameter file while creating VNF using scaling
policy, earlier it was failing with error 'The Parameter was not
provided" This patch allows creation of VNF using scaling policy
with parameter file.
APIImpact
Return 200 instead of 400 error when VNF is created using scaling
policy with parameter file
Change-Id: If102519127a3ef63449ab59f849e8cfaaa3ae62b
Closes-Bug: #1799683
If we do not use oslo.log for logging in the openstackclient plugin, all
the errors and messages that are generated by other parts of the client
(cliff, openstackclient) may be lost.
Change-Id: Ie9aec900e477f3f319ee34873018c15e10dafb4a
While translating node_template, heat-translator first checks whether
the policy is derived from the policies 'tosca.policies.Scaling' or
'tosca.policies.Monitoring', If yes, then it adds them into
TOSCA_TO_HOT_TYPE map. In the subsequent code, it again checks for
those policies and if they are not present in TOSCA_TO_HOT_TYPE map
then it raises UnsupportedTypeError exception.
This patch removes this unnecessary redundant code of checking
policies again and ensures that the affected code is getting
covered through test case.
TrivialFix
Change-Id: Ibe435e23e7ac11834e662745d327e6f99280f9f5
Some policies derived from standard policies are translated
by base policy translator. For example, a policy which has
`tosca.policies.tacker.Alarming` type derived from
`tosca.policies.Monitoring` type is translated by a translator to
`tosca.policies.Monitoring` type.
A policy which has a type derived from tosca.policies.Placement
doesn't seems to be translated by a translator to
`tosca.policies.Placement`.
This patch fixes this issue by adding the `tosca.policies.Placement`
specific check while translating nodetemplates.
This policy translation support is required to implement below
tacker blueprint:
https://blueprints.launchpad.net/tacker/+spec/vdu-affinity-policy
Closes-Bug: #1755433
Change-Id: Ib265ac3add18027c91a601140a4f03a661603615
This removes usage of deprecated Ceilometer API
1. Changing trigger type from "OS::Ceilometer::Alarm"
to "OS::Aodh::GnocchiAggregationByResourcesAlarm"
2. Add "resource_type" fixed with value "instance"
3. Change some paramters (meter_name-> metric,
statistic ->aggregation_method, period-> granularity)
4. Change value from "average" to "mean" in method to
compare to the threshold
Change-Id: I66f8e4c76a918494df26b4af277453e24421b917
In Tacker, we now are fixing Tacker scaling to fully leverage heat-translator.
To make a best fit, Tacker need to have nested resources from heat-translator.
Heat-translator already provided this by using translate_to_yaml_dict().
Unfortunately, this method always return to the main heat yaml file not to
nested yaml file.
Change-Id: I7144d9926141dc4fc70f3a3c73c7fd41e2ff288c
Modified default images to use os_type, os_version and os_distro
properties. Added logic to look for distribution/os_distro,
type/os_type and version/os_version image properties when
matching image properties.
Cleaned up minor python warnings in tosca_compute.py
Removed DOS-style newline characters from
tosca_cluster_policies_scaling.py
Change-Id: I72043cf4a4358cfdbc8f98238276d85dc2f5bcc0
Closes-Bug: 1689673
Currently, monitoring policy have not been added to Heat
Translator yet. The current implementation of scaling policy
in Heat Translator showed the couple between scaling and
monitoring policies. But actually monitoring policy shows
that it could have other very good use cases so that it
can stand alone.
This patch will implement monitoring policy in HT.
Implements bp: #monitoring-policy
Change-Id: Ibc412c409846919a8edb581c7cf56e6dcd0cc01f
Depends-On: Idd5268b7ff0a19b57ea927f23c76db24220c462d
With Tacker when more than 1 volume to be created and attached,
but after heat translation, only 1 volume will be attached automatically.
The code change is to allow all volumes to be created and attached as
what specified in TOSCA template.
Change-Id: Iba9e089347d6dfd31e7d7c40b46706b75145c696
Closes-Bug: #1675715
The file content can be copied as is to Dockerfile and use to build a heat
translator docker container.
Change-Id: I32fa7bd9def0842a053c4c61e7f6652db4c16967
Co-Authored-By: Eduardo Patrocinio <epatro@gmail.com>
Avoid dangerous file parsing and object serialization libraries.
yaml.load is the obvious function to use but it is dangerous[1]
Because yaml.load return Python object may be dangerous if you
receive a YAML document from an untrusted source such as the
Internet. The function yaml.safe_load limits this ability to
simple Python objects like integers or lists.
In addition, Bandit flags yaml.load() as security risk so replace
all occurrences with yaml.safe_load(). Thus I replace yaml.load()
with yaml.safe_load()
[1]https://security.openstack.org/guidelines/dg_avoid-dangerous-input-parsing-libraries.html
Change-Id: Ifaecff145e91f72911ae05ea274a4977c56212c7
Closes-Bug: #1634265