ETSI-NFV SOL 001 translation: AffinityRule

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
This commit is contained in:
Nobuhiro Uematsu 2021-03-04 12:15:46 +09:00 committed by Hiroo Kitamura
parent 2c94431c0d
commit c6e04928fb
12 changed files with 857 additions and 0 deletions

View File

@ -0,0 +1,72 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from translator.hot.syntax.hot_resource import HotResource
# Name used to dynamically load appropriate map class.
TARGET_CLASS_NAME = 'ToscaNfvCommonAffinityRule'
class ToscaNfvCommonAffinityRule(HotResource):
"""Translate common TOSCA policy type tosca.policies.nfv.AffinityRule."""
GROUP_SUFFIX = '_group'
def __init__(self, policy, csar_dir=None, hot_template_parameters=None):
self.own_resource_name = policy.name + self.GROUP_SUFFIX
super(ToscaNfvCommonAffinityRule, self).__init__(
policy,
name=self.own_resource_name,
type='OS::Nova::ServerGroup',
csar_dir=csar_dir)
self.policy = policy
self.hot_template_parameters = hot_template_parameters
def handle_properties(self, resources):
policy_props = self.policy.properties
rule = 'anti-affinity' if self.is_anti else 'affinity'
# NOTE: In ETSI-NFV SOL001, nfvi_node/zone/zone_group/nfvi_pop
# is specified as 'scope'.
# This code only supports nfvi_node as 'scope'and no conversion
# for other'scope'.
scope = policy_props.get('scope', None)
if scope != 'nfvi_node':
self.name = None
self.type = None
return
# NOTE: In ETSI-NFV SOL001,
# - tosca.nodes.nfv.Vdu.Compute
# - tosca.nodes.nfv.VnfVirtualLink
# - tosca.groups.nfv.PlacementGroup
# is specified as'targets'.
# This code only supports tosca.nodes.nfv.Vdu.Compute as 'targets'
# and no conversion for other 'targets'.
is_exists_server = False
for resource in resources:
if self.policy.type in self.toscatype and \
resource.name in self.policy.targets and \
resource.type == 'OS::Nova::Server':
self.properties['name'] = self.name
self.properties['policies'] = [rule]
if not resource.properties.get('scheduler_hints'):
resource.properties['scheduler_hints'] = {}
resource.properties['scheduler_hints'].update(
{'group': '{ get_resource: %s }' % (self.name)}
)
is_exists_server = True
if is_exists_server is False:
self.name = None
self.type = None

View File

@ -0,0 +1,32 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from translator.hot.syntax.hot_resource import HotResource
# Name used to dynamically load appropriate map class.
TARGET_CLASS_NAME = 'ToscaNfvPlacementGroup'
class ToscaNfvPlacementGroup(HotResource):
"""Translate TOSCA group type tosca.groups.nfv.PlacementGroup."""
toscatype = 'tosca.groups.nfv.PlacementGroup'
def __init__(self, nodetemplate, csar_dir=None):
super(ToscaNfvPlacementGroup, self).__init__(
nodetemplate,
type=None,
csar_dir=csar_dir)
def handle_properties(self):
pass

View File

@ -0,0 +1,33 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from translator.hot.tosca.etsi_nfv.common_affinityrule.\
tosca_policies_nfv_common_affinityrule import ToscaNfvCommonAffinityRule
# Name used to dynamically load appropriate map class.
TARGET_CLASS_NAME = 'ToscaNfvAffinityRule'
class ToscaNfvAffinityRule(ToscaNfvCommonAffinityRule):
"""Translate TOSCA policy type tosca.policies.nfv.AffinityRule."""
toscatype = 'tosca.policies.nfv.AffinityRule'
def __init__(self, policy, csar_dir=None):
super(ToscaNfvAffinityRule, self).__init__(
policy,
csar_dir=csar_dir)
self.is_anti = False
def handle_properties(self, resources):
super().handle_properties(resources)

View File

@ -0,0 +1,33 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from translator.hot.tosca.etsi_nfv.common_affinityrule.\
tosca_policies_nfv_common_affinityrule import ToscaNfvCommonAffinityRule
# Name used to dynamically load appropriate map class.
TARGET_CLASS_NAME = 'ToscaNfvAntiAffinityRule'
class ToscaNfvAntiAffinityRule(ToscaNfvCommonAffinityRule):
"""Translate TOSCA policy type tosca.policies.nfv.AntiAffinityRule."""
toscatype = 'tosca.policies.nfv.AntiAffinityRule'
def __init__(self, policy, csar_dir=None):
super(ToscaNfvAntiAffinityRule, self).__init__(
policy,
csar_dir=csar_dir)
self.is_anti = True
def handle_properties(self, resources):
super().handle_properties(resources)

View File

@ -0,0 +1,85 @@
tosca_definitions_version: tosca_simple_yaml_1_2
description: >
Template for deploying two VDUs with scope nfvi_node.
imports:
- etsi_nfv_sol001_common_types.yaml
- etsi_nfv_sol001_vnfd_types.yaml
topology_template:
node_templates:
VDU1:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: VDU1
description: VDU1 compute node
vdu_profile:
min_number_of_instances: 1
max_number_of_instances: 1
sw_image_data:
name: Software of VDU1
version: '0.4.0'
checksum:
algorithm: sha-512
hash: 6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e58b64dd39390617cd5a350f78
container_format: bare
disk_format: qcow2
min_disk: 1 GiB
size: 1 GiB
artifacts:
sw_image:
type: tosca.artifacts.nfv.SwImage
file: Files/images/cirros-0.4.0-x86_64-disk.img
capabilities:
virtual_compute:
properties:
virtual_memory:
virtual_mem_size: 512 MiB
virtual_cpu:
num_virtual_cpu: 1
virtual_local_storage:
- size_of_storage: 1 GiB
VDU2:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: VDU2
description: VDU2 compute node
vdu_profile:
min_number_of_instances: 1
max_number_of_instances: 1
sw_image_data:
name: Software of VDU2
version: '0.4.0'
checksum:
algorithm: sha-512
hash: 6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e58b64dd39390617cd5a350f78
container_format: bare
disk_format: qcow2
min_disk: 1 GiB
size: 1 GiB
artifacts:
sw_image:
type: tosca.artifacts.nfv.SwImage
file: Files/images/cirros-0.4.0-x86_64-disk.img
capabilities:
virtual_compute:
properties:
virtual_memory:
virtual_mem_size: 512 MiB
virtual_cpu:
num_virtual_cpu: 1
virtual_local_storage:
- size_of_storage: 1 GiB
policies:
- Affinity:
type: tosca.policies.nfv.AffinityRule
targets: [ VDU1 ]
properties:
scope: nfvi_node
- AntiAffinity:
type: tosca.policies.nfv.AntiAffinityRule
targets: [ VDU2 ]
properties:
scope: nfvi_node

View File

@ -0,0 +1,233 @@
tosca_definitions_version: tosca_simple_yaml_1_2
description: >
Template for deploying six VDUs with unsupported scope type.
imports:
- etsi_nfv_sol001_common_types.yaml
- etsi_nfv_sol001_vnfd_types.yaml
topology_template:
node_templates:
VDU1:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: VDU1
description: VDU1 compute node
vdu_profile:
min_number_of_instances: 1
max_number_of_instances: 1
sw_image_data:
name: Software of VDU1
version: '0.4.0'
checksum:
algorithm: sha-512
hash: 6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e58b64dd39390617cd5a350f78
container_format: bare
disk_format: qcow2
min_disk: 1 GiB
size: 1 GiB
artifacts:
sw_image:
type: tosca.artifacts.nfv.SwImage
file: Files/images/cirros-0.4.0-x86_64-disk.img
capabilities:
virtual_compute:
properties:
virtual_memory:
virtual_mem_size: 512 MiB
virtual_cpu:
num_virtual_cpu: 1
virtual_local_storage:
- size_of_storage: 1 GiB
VDU2:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: VDU2
description: VDU2 compute node
vdu_profile:
min_number_of_instances: 1
max_number_of_instances: 1
sw_image_data:
name: Software of VDU2
version: '0.4.0'
checksum:
algorithm: sha-512
hash: 6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e58b64dd39390617cd5a350f78
container_format: bare
disk_format: qcow2
min_disk: 1 GiB
size: 1 GiB
artifacts:
sw_image:
type: tosca.artifacts.nfv.SwImage
file: Files/images/cirros-0.4.0-x86_64-disk.img
capabilities:
virtual_compute:
properties:
virtual_memory:
virtual_mem_size: 512 MiB
virtual_cpu:
num_virtual_cpu: 1
virtual_local_storage:
- size_of_storage: 1 GiB
VDU3:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: VDU3
description: VDU3 compute node
vdu_profile:
min_number_of_instances: 1
max_number_of_instances: 1
sw_image_data:
name: Software of VDU3
version: '0.4.0'
checksum:
algorithm: sha-512
hash: 6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e58b64dd39390617cd5a350f78
container_format: bare
disk_format: qcow2
min_disk: 1 GiB
size: 1 GiB
artifacts:
sw_image:
type: tosca.artifacts.nfv.SwImage
file: Files/images/cirros-0.4.0-x86_64-disk.img
capabilities:
virtual_compute:
properties:
properties:
virtual_memory:
virtual_mem_size: 512 MiB
virtual_cpu:
num_virtual_cpu: 1
virtual_local_storage:
- size_of_storage: 1 GiB
VDU4:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: VDU4
description: VDU4 compute node
vdu_profile:
min_number_of_instances: 1
max_number_of_instances: 1
sw_image_data:
name: Software of VDU4
version: '0.4.0'
checksum:
algorithm: sha-512
hash: 6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e58b64dd39390617cd5a350f78
container_format: bare
disk_format: qcow2
min_disk: 1 GiB
size: 1 GiB
artifacts:
sw_image:
type: tosca.artifacts.nfv.SwImage
file: Files/images/cirros-0.4.0-x86_64-disk.img
capabilities:
virtual_compute:
properties:
properties:
virtual_memory:
virtual_mem_size: 512 MiB
virtual_cpu:
num_virtual_cpu: 1
virtual_local_storage:
- size_of_storage: 1 GiB
VDU5:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: VDU5
description: VDU5 compute node
vdu_profile:
min_number_of_instances: 1
max_number_of_instances: 1
sw_image_data:
name: Software of VDU5
version: '0.4.0'
checksum:
algorithm: sha-512
hash: 6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e58b64dd39390617cd5a350f78
container_format: bare
disk_format: qcow2
min_disk: 1 GiB
size: 1 GiB
artifacts:
sw_image:
type: tosca.artifacts.nfv.SwImage
file: Files/images/cirros-0.4.0-x86_64-disk.img
capabilities:
virtual_compute:
properties:
properties:
virtual_memory:
virtual_mem_size: 512 MiB
virtual_cpu:
num_virtual_cpu: 1
virtual_local_storage:
- size_of_storage: 1 GiB
VDU6:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: VDU6
description: VDU6 compute node
vdu_profile:
min_number_of_instances: 1
max_number_of_instances: 1
sw_image_data:
name: Software of VDU6
version: '0.4.0'
checksum:
algorithm: sha-512
hash: 6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e58b64dd39390617cd5a350f78
container_format: bare
disk_format: qcow2
min_disk: 1 GiB
size: 1 GiB
artifacts:
sw_image:
type: tosca.artifacts.nfv.SwImage
file: Files/images/cirros-0.4.0-x86_64-disk.img
capabilities:
virtual_compute:
properties:
properties:
virtual_memory:
virtual_mem_size: 512 MiB
virtual_cpu:
num_virtual_cpu: 1
virtual_local_storage:
- size_of_storage: 1 GiB
policies:
- Affinity:
type: tosca.policies.nfv.AffinityRule
targets: [ VDU1 ]
properties:
scope: nfvi_pop
- AntiAffinity:
type: tosca.policies.nfv.AffinityRule
targets: [ VDU2 ]
properties:
scope: zone
- Affinity:
type: tosca.policies.nfv.AffinityRule
targets: [ VDU3 ]
properties:
scope: zone_group
- Affinity:
type: tosca.policies.nfv.AntiAffinityRule
targets: [ VDU4 ]
properties:
scope: nfvi_pop
- AntiAffinity:
type: tosca.policies.nfv.AntiAffinityRule
targets: [ VDU5 ]
properties:
scope: zone
- Affinity:
type: tosca.policies.nfv.AntiAffinityRule
targets: [ VDU6 ]
properties:
scope: zone_group

View File

@ -0,0 +1,155 @@
tosca_definitions_version: tosca_simple_yaml_1_2
description: >
Template for deploying four VDUs with unsupported targets.
imports:
- etsi_nfv_sol001_common_types.yaml
- etsi_nfv_sol001_vnfd_types.yaml
topology_template:
node_templates:
VDU1:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: VDU1
description: VDU1 compute node
vdu_profile:
min_number_of_instances: 1
max_number_of_instances: 1
sw_image_data:
name: Software of VDU1
version: '0.4.0'
checksum:
algorithm: sha-512
hash: 6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e58b64dd39390617cd5a350f78
container_format: bare
disk_format: qcow2
min_disk: 1 GiB
size: 1 GiB
artifacts:
sw_image:
type: tosca.artifacts.nfv.SwImage
file: Files/images/cirros-0.4.0-x86_64-disk.img
capabilities:
virtual_compute:
properties:
virtual_memory:
virtual_mem_size: 512 MiB
virtual_cpu:
num_virtual_cpu: 1
virtual_local_storage:
- size_of_storage: 1 GiB
VDU2:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: VDU2
description: VDU2 compute node
vdu_profile:
min_number_of_instances: 1
max_number_of_instances: 1
sw_image_data:
name: Software of VDU2
version: '0.4.0'
checksum:
algorithm: sha-512
hash: 6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e58b64dd39390617cd5a350f78
container_format: bare
disk_format: qcow2
min_disk: 1 GiB
size: 1 GiB
artifacts:
sw_image:
type: tosca.artifacts.nfv.SwImage
file: Files/images/cirros-0.4.0-x86_64-disk.img
capabilities:
virtual_compute:
properties:
virtual_memory:
virtual_mem_size: 512 MiB
virtual_cpu:
num_virtual_cpu: 1
virtual_local_storage:
- size_of_storage: 1 GiB
VDU3:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: VDU3
description: VDU3 compute node
vdu_profile:
min_number_of_instances: 1
max_number_of_instances: 1
sw_image_data:
name: Software of VDU3
version: '0.4.0'
checksum:
algorithm: sha-512
hash: 6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e58b64dd39390617cd5a350f78
container_format: bare
disk_format: qcow2
min_disk: 1 GiB
size: 1 GiB
artifacts:
sw_image:
type: tosca.artifacts.nfv.SwImage
file: Files/images/cirros-0.4.0-x86_64-disk.img
capabilities:
virtual_compute:
properties:
virtual_memory:
virtual_mem_size: 512 MiB
virtual_cpu:
num_virtual_cpu: 1
virtual_local_storage:
- size_of_storage: 1 GiB
VDU4:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: VDU4
description: VDU4 compute node
vdu_profile:
min_number_of_instances: 1
max_number_of_instances: 1
sw_image_data:
name: Software of VDU4
version: '0.4.0'
checksum:
algorithm: sha-512
hash: 6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e2161b5b5186106570c17a9e58b64dd39390617cd5a350f78
container_format: bare
disk_format: qcow2
min_disk: 1 GiB
size: 1 GiB
artifacts:
sw_image:
type: tosca.artifacts.nfv.SwImage
file: Files/images/cirros-0.4.0-x86_64-disk.img
capabilities:
virtual_compute:
properties:
virtual_memory:
virtual_mem_size: 512 MiB
virtual_cpu:
num_virtual_cpu: 1
virtual_local_storage:
- size_of_storage: 1 GiB
groups:
AffinityGroup:
type: tosca.groups.nfv.PlacementGroup
members: [ VDU1, VDU2 ]
AntiAffinityGroup:
type: tosca.groups.nfv.PlacementGroup
members: [ VDU3, VDU4 ]
policies:
- Affinity:
type: tosca.policies.nfv.AffinityRule
targets: [ AffinityGroup ]
properties:
scope: nfvi_node
- AntiAffinity:
type: tosca.policies.nfv.AntiAffinityRule
targets: [ AntiAffinityGroup ]
properties:
scope: nfvi_node

View File

@ -0,0 +1,48 @@
heat_template_version: 2013-05-23
description: >
Template for deploying two VDUs with scope nfvi_node.
parameters: {}
resources:
VDU1:
type: OS::Nova::Server
properties:
flavor: { get_resource: VDU1_flavor }
name: VDU1
image: #ADD_YOUR_IMAGE_HERE
scheduler_hints:
group: { get_resource: Affinity_group }
VDU2:
type: OS::Nova::Server
properties:
flavor: { get_resource: VDU2_flavor }
name: VDU2
image: #ADD_YOUR_IMAGE_HERE
scheduler_hints:
group: { get_resource: AntiAffinity_group }
Affinity_group:
type: OS::Nova::ServerGroup
properties:
name: Affinity_group
policies:
- affinity
AntiAffinity_group:
type: OS::Nova::ServerGroup
properties:
name: AntiAffinity_group
policies:
- anti-affinity
VDU1_flavor:
type: OS::Nova::Flavor
properties:
ram: 512
vcpus: 1
disk: 1
VDU2_flavor:
type: OS::Nova::Flavor
properties:
ram: 512
vcpus: 1
disk: 1
outputs: {}

View File

@ -0,0 +1,80 @@
heat_template_version: 2013-05-23
description: >
Template for deploying six VDUs with unsupported scope type.
parameters: {}
resources:
VDU1:
type: OS::Nova::Server
properties:
flavor: { get_resource: VDU1_flavor }
name: VDU1
image: #ADD_YOUR_IMAGE_HERE
VDU2:
type: OS::Nova::Server
properties:
flavor: { get_resource: VDU2_flavor }
name: VDU2
image: #ADD_YOUR_IMAGE_HERE
VDU3:
type: OS::Nova::Server
properties:
flavor: { get_resource: VDU3_flavor }
name: VDU3
image: #ADD_YOUR_IMAGE_HERE
VDU4:
type: OS::Nova::Server
properties:
flavor: { get_resource: VDU4_flavor }
name: VDU4
image: #ADD_YOUR_IMAGE_HERE
VDU5:
type: OS::Nova::Server
properties:
flavor: { get_resource: VDU5_flavor }
name: VDU5
image: #ADD_YOUR_IMAGE_HERE
VDU6:
type: OS::Nova::Server
properties:
flavor: { get_resource: VDU6_flavor }
name: VDU6
image: #ADD_YOUR_IMAGE_HERE
VDU1_flavor:
type: OS::Nova::Flavor
properties:
ram: 512
vcpus: 1
disk: 1
VDU2_flavor:
type: OS::Nova::Flavor
properties:
ram: 512
vcpus: 1
disk: 1
VDU3_flavor:
type: OS::Nova::Flavor
properties:
ram: 512
vcpus: 1
disk: 1
VDU4_flavor:
type: OS::Nova::Flavor
properties:
ram: 512
vcpus: 1
disk: 1
VDU5_flavor:
type: OS::Nova::Flavor
properties:
ram: 512
vcpus: 1
disk: 1
VDU6_flavor:
type: OS::Nova::Flavor
properties:
ram: 512
vcpus: 1
disk: 1
outputs: {}

View File

@ -0,0 +1,56 @@
heat_template_version: 2013-05-23
description: >
Template for deploying four VDUs with unsupported targets.
parameters: {}
resources:
VDU1:
type: OS::Nova::Server
properties:
flavor: { get_resource: VDU1_flavor }
name: VDU1
image: #ADD_YOUR_IMAGE_HERE
VDU2:
type: OS::Nova::Server
properties:
flavor: { get_resource: VDU2_flavor }
name: VDU2
image: #ADD_YOUR_IMAGE_HERE
VDU3:
type: OS::Nova::Server
properties:
flavor: { get_resource: VDU3_flavor }
name: VDU3
image: #ADD_YOUR_IMAGE_HERE
VDU4:
type: OS::Nova::Server
properties:
flavor: { get_resource: VDU4_flavor }
name: VDU4
image: #ADD_YOUR_IMAGE_HERE
VDU1_flavor:
type: OS::Nova::Flavor
properties:
ram: 512
vcpus: 1
disk: 1
VDU2_flavor:
type: OS::Nova::Flavor
properties:
ram: 512
vcpus: 1
disk: 1
VDU3_flavor:
type: OS::Nova::Flavor
properties:
ram: 512
vcpus: 1
disk: 1
VDU4_flavor:
type: OS::Nova::Flavor
properties:
ram: 512
vcpus: 1
disk: 1
outputs: {}

View File

@ -331,3 +331,30 @@ class EtsiToscaHotTranslationTest(TestCase):
expected_msg,
self.log_fixture.output
)
def test_hot_translate_etsi_nfv_vdu_with_scope_nfvi(self):
tosca_file = '../tests/data/etsi_nfv/' \
'tosca_nfv_vdu_affinity_with_scope_nfvi.yaml'
hot_files = [
'../tests/data/hot_output/etsi_nfv/'
'hot_nfv_vdu_affinity_with_scope_nfvi.yaml',
]
self._test_successful_translation(tosca_file, hot_files, params={})
def test_hot_translate_etsi_nfv_vdu_with_unsupported_scope(self):
tosca_file = '../tests/data/etsi_nfv/' \
'tosca_nfv_vdu_affinity_with_unsupported_scope.yaml'
hot_files = [
'../tests/data/hot_output/etsi_nfv/'
'hot_nfv_vdu_affinity_with_unsupported_scope.yaml',
]
self._test_successful_translation(tosca_file, hot_files, params={})
def test_hot_translate_etsi_nfv_vdu_with_unsupported_targets(self):
tosca_file = '../tests/data/etsi_nfv/' \
'tosca_nfv_vdu_affinity_with_unsupported_targets.yaml'
hot_files = [
'../tests/data/hot_output/etsi_nfv/'
'hot_nfv_vdu_affinity_with_unsupported_targets.yaml',
]
self._test_successful_translation(tosca_file, hot_files, params={})

View File

@ -39,6 +39,9 @@ class TranslateNodeTemplatesTest(TestCase):
'tosca.nodes.nfv.Vdu.VirtualBlockStorage',
'tosca.nodes.nfv.VduCp',
'tosca.nodes.nfv.VnfVirtualLink',
'tosca.groups.nfv.PlacementGroup',
'tosca.policies.nfv.AffinityRule',
'tosca.policies.nfv.AntiAffinityRule',
'tosca.policies.nfv.InstantiationLevels',
'tosca.policies.nfv.ScalingAspects',
'tosca.policies.nfv.VduInitialDelta',