Fix some content of VNFD in UT and FT

Recently tosca-parser has started to validate the required properties
of policies [1]. In current implementation, this caused errors in
testing with VNFD where the policy definition was incorrect.

[1] https://review.opendev.org/c/openstack/tosca-parser/+/763144

This patch fixed the policy type in the VNFD which errored with UT and
FT, so that the VNFD can pass the enhanced policy type validation
processing in tosca-parser.

Closes-Bug: #1909312
Change-Id: I0b655d6ebce7c4dacb9cc9c0526aa702d1ac37db
This commit is contained in:
LiangLu 2021-01-04 14:55:15 +09:00 committed by Ayumu Ueha
parent db2e157934
commit 6e7d28c6ed
8 changed files with 99 additions and 10 deletions

View File

@ -408,6 +408,17 @@ node_types:
entry_schema:
type: tosca.datatypes.nfv.ScaleInfo
tosca.datatypes.nfv.ScaleInfo:
derived_from: tosca.datatypes.Root
description: Indicates for a given scaleAspect the corresponding scaleLevel
properties:
scale_level:
type: integer
description: The scale level for a particular aspect
required: true
constraints:
- greater_or_equal: 0
# capability type definitions
tosca.capabilities.nfv.VirtualLinkable:
derived_from: tosca.capabilities.Node
@ -885,6 +896,15 @@ node_types:
- min_length: 1
targets: [ tosca.nodes.nfv.VnfVirtualLink ]
tosca.datatypes.nfv.VirtualLinkBitrateLevel:
derived_from: tosca.datatypes.Root
description: Describes bitrate requirements applicable to the virtual link instantiated from a particicular VnfVirtualLink
properties:
bitrate_requirements:
type: tosca.datatypes.nfv.LinkBitrateRequirements
description: Virtual link bitrate requirements for an instantiation level or bitrate delta for a scaling step
required: true
# interface type definitions
tosca.interfaces.nfv.Vnflcm:
derived_from: tosca.interfaces.Root

View File

@ -408,6 +408,17 @@ node_types:
entry_schema:
type: tosca.datatypes.nfv.ScaleInfo
tosca.datatypes.nfv.ScaleInfo:
derived_from: tosca.datatypes.Root
description: Indicates for a given scaleAspect the corresponding scaleLevel
properties:
scale_level:
type: integer
description: The scale level for a particular aspect
required: true
constraints:
- greater_or_equal: 0
# capability type definitions
tosca.capabilities.nfv.VirtualLinkable:
derived_from: tosca.capabilities.Node
@ -885,6 +896,15 @@ node_types:
- min_length: 1
targets: [ tosca.nodes.nfv.VnfVirtualLink ]
tosca.datatypes.nfv.VirtualLinkBitrateLevel:
derived_from: tosca.datatypes.Root
description: Describes bitrate requirements applicable to the virtual link instantiated from a particicular VnfVirtualLink
properties:
bitrate_requirements:
type: tosca.datatypes.nfv.LinkBitrateRequirements
description: Virtual link bitrate requirements for an instantiation level or bitrate delta for a scaling step
required: true
# interface type definitions
tosca.interfaces.nfv.Vnflcm:
derived_from: tosca.interfaces.Root

View File

@ -408,6 +408,17 @@ node_types:
entry_schema:
type: tosca.datatypes.nfv.ScaleInfo
tosca.datatypes.nfv.ScaleInfo:
derived_from: tosca.datatypes.Root
description: Indicates for a given scaleAspect the corresponding scaleLevel
properties:
scale_level:
type: integer
description: The scale level for a particular aspect
required: true
constraints:
- greater_or_equal: 0
# capability type definitions
tosca.capabilities.nfv.VirtualLinkable:
derived_from: tosca.capabilities.Node
@ -897,6 +908,15 @@ node_types:
- min_length: 1
targets: [ tosca.nodes.nfv.VnfVirtualLink ]
tosca.datatypes.nfv.VirtualLinkBitrateLevel:
derived_from: tosca.datatypes.Root
description: Describes bitrate requirements applicable to the virtual link instantiated from a particicular VnfVirtualLink
properties:
bitrate_requirements:
type: tosca.datatypes.nfv.LinkBitrateRequirements
description: Virtual link bitrate requirements for an instantiation level or bitrate delta for a scaling step
required: true
# interface type definitions
tosca.interfaces.nfv.Vnflcm:
derived_from: tosca.interfaces.Root

View File

@ -91,3 +91,16 @@ topology_template:
policies:
- instantiation_levels:
type: tosca.policies.nfv.InstantiationLevels
properties:
levels:
instantiation_level_1:
description: Smallest size
scale_info:
worker_instance:
scale_level: 0
instantiation_level_2:
description: Largest size
scale_info:
worker_instance:
scale_level: 2
default_level: instantiation_level_1

View File

@ -88,8 +88,3 @@ topology_template:
l3_protocol_data:
ip_version: ipv4
cidr: 11.11.0.0/24
policies:
- instantiation_levels:
type: tosca.policies.nfv.InstantiationLevels
properties:

View File

@ -408,6 +408,17 @@ node_types:
entry_schema:
type: tosca.datatypes.nfv.ScaleInfo
tosca.datatypes.nfv.ScaleInfo:
derived_from: tosca.datatypes.Root
description: Indicates for a given scaleAspect the corresponding scaleLevel
properties:
scale_level:
type: integer
description: The scale level for a particular aspect
required: true
constraints:
- greater_or_equal: 0
# capability type definitions
tosca.capabilities.nfv.VirtualLinkable:
derived_from: tosca.capabilities.Node
@ -885,6 +896,15 @@ node_types:
- min_length: 1
targets: [ tosca.nodes.nfv.VnfVirtualLink ]
tosca.datatypes.nfv.VirtualLinkBitrateLevel:
derived_from: tosca.datatypes.Root
description: Describes bitrate requirements applicable to the virtual link instantiated from a particicular VnfVirtualLink
properties:
bitrate_requirements:
type: tosca.datatypes.nfv.LinkBitrateRequirements
description: Virtual link bitrate requirements for an instantiation level or bitrate delta for a scaling step
required: true
# interface type definitions
tosca.interfaces.nfv.Vnflcm:
derived_from: tosca.interfaces.Root

View File

@ -116,12 +116,13 @@ class VnfTestCreate(base.BaseTackerTest):
def test_vnf_with_placement_policy_invalid(self):
exc = self.assertRaises(
exceptions.InternalServerError,
exceptions.BadRequest,
self._test_create_delete_vnf,
vnf_name='test_vnf_with_placement_policy_invalid',
vnfd_name='sample-tosca-vnfd-placement-policy-invalid',
vdu_name='invalid-placement-policy-vdu',
placement_policy='invalid')
self.assertIn('["invalid"]', exc.message)
self.assertIn('is not an allowed value ["anti-affinity", "affinity", '
'"soft-anti-affinity", "soft-affinity"]', exc.message)
self.assertIn('"invalid"', exc.message)
self.assertIn('The value "invalid" of property "policy" is '
'not valid. Expected a value from "[affinity, '
'anti-affinity]".', exc.message)

View File

@ -46,7 +46,7 @@ topology_template:
min_instances: 1
max_instances: 3
default_instances: 2
targets: [VDU1]
targets: [ VDU1 ]
- vdu1_cpu_usage_monitoring_policy:
type: tosca.policies.tacker.Alarming