Change-Id: I17047fa3df555fafcdae566fad50b8c19ddca16f
Issue-ID: VVP-158
Signed-off-by: stark, steven <steven.stark@att.com>
42 files changed:
description: Simple template to deploy a single compute instance
parameters:
description: Simple template to deploy a single compute instance
parameters:
type: string
label: Key Name
description: Name of key-pair to be used for compute instance
type: string
label: Key Name
description: Name of key-pair to be used for compute instance
description: Simple template to deploy a single compute instance
parameters:
description: Simple template to deploy a single compute instance
parameters:
type: string
label: Key Name
description: Name of key-pair to be used for compute instance
type: string
label: Key Name
description: Name of key-pair to be used for compute instance
description: Simple template to deploy a single compute instance
parameters:
description: Simple template to deploy a single compute instance
parameters:
type: string
label: Key Name
description: Name of key-pair to be used for compute instance
type: string
label: Key Name
description: Name of key-pair to be used for compute instance
@validates("R-41492", "R-35735", "R-98748")
@validates("R-41492", "R-35735", "R-98748")
-def test_allowed_address_pairs_include_vm_type_network_role(heat_template):
+def test_allowed_address_pairs_include_vm_type_network_role(yaml_file):
"""
Check that all allowed_address_pairs include the {vm_type} of the
nova server it is associated to and also contains the
{network_role} of the network it is associated with
"""
"""
Check that all allowed_address_pairs include the {vm_type} of the
nova server it is associated to and also contains the
{network_role} of the network it is associated with
"""
- with open(heat_template) as fh:
+ with open(yaml_file) as fh:
yml = yaml.load(fh)
# skip if resources are not defined
yml = yaml.load(fh)
# skip if resources are not defined
-def test_availability_zone_naming(heat_template):
+def test_availability_zone_naming(yaml_file):
"""
Make sure all availability zones are properly formatted
"""
"""
Make sure all availability zones are properly formatted
"""
- with open(heat_template) as fh:
+ with open(yaml_file) as fh:
yml = yaml.load(fh)
# skip if resources are not defined
yml = yaml.load(fh)
# skip if resources are not defined
-def test_availability_zones_start_at_0(heat_template):
- params = Heat(heat_template).parameters
+def test_availability_zones_start_at_0(yaml_file):
+ params = Heat(yaml_file).parameters
invalid_params = check_indices(AZ_PATTERN, params, "Availability Zone Parameters")
assert not invalid_params, ". ".join(invalid_params)
invalid_params = check_indices(AZ_PATTERN, params, "Availability Zone Parameters")
assert not invalid_params, ". ".join(invalid_params)
-def test_cloud_config(heat_template):
+def test_cloud_config(yaml_file):
"""validate resource ids
"""
"""validate resource ids
"""
- h = Heat(filepath=heat_template)
+ h = Heat(filepath=yaml_file)
if not h.resources:
pytest.skip("No resources in this template")
if not h.resources:
pytest.skip("No resources in this template")
-def test_contrail_fqdn(heat_template):
+def test_contrail_fqdn(yaml_file):
"""
When a VNF's Heat Orchestration Template's Contrail resource
has a property that
"""
When a VNF's Heat Orchestration Template's Contrail resource
has a property that
* **MUST** follow the format ``{network-role}_net_fqdn``
* **MUST** be declared as type ``string``
"""
* **MUST** follow the format ``{network-role}_net_fqdn``
* **MUST** be declared as type ``string``
"""
- run_test(heat_template, validate_virtual_network_refs)
+ run_test(yaml_file, validate_virtual_network_refs)
@validates("R-53310", "R-46128")
@validates("R-53310", "R-46128")
-def test_contrail_instance_ip_resource_id_external(heat_template):
+def test_contrail_instance_ip_resource_id_external(yaml_file):
"""
A VNF's Heat Orchestration Template's Resource OS::ContrailV2::InstanceIp
that is configuring an IPv4 Address on a port attached to an external
"""
A VNF's Heat Orchestration Template's Resource OS::ContrailV2::InstanceIp
that is configuring an IPv4 Address on a port attached to an external
regex_names=("ip", "v6_ip"),
network_flavor=ContrailV2InstanceIpProcessor.network_flavor_external,
)
@validates("R-62187", "R-87563")
regex_names=("ip", "v6_ip"),
network_flavor=ContrailV2InstanceIpProcessor.network_flavor_external,
)
@validates("R-62187", "R-87563")
-def test_contrail_instance_ip_resource_id_internal(heat_template):
+def test_contrail_instance_ip_resource_id_internal(yaml_file):
"""
internal
{vm-type}_{vm-type_index}_int_{network-role}_vmi_{vmi_index}
"""
internal
{vm-type}_{vm-type_index}_int_{network-role}_vmi_{vmi_index}
_v6_IP_{index}
"""
run_test(
_v6_IP_{index}
"""
run_test(
regex_names=("int_ip", "int_v6_ip"),
network_flavor=ContrailV2InstanceIpProcessor.network_flavor_internal,
)
@validates("R-20947", "R-88540")
regex_names=("int_ip", "int_v6_ip"),
network_flavor=ContrailV2InstanceIpProcessor.network_flavor_internal,
)
@validates("R-20947", "R-88540")
-def test_contrail_instance_ip_resource_id_subint(heat_template):
+def test_contrail_instance_ip_resource_id_subint(yaml_file):
"""
subint
{vm-type}_{vm-type_index}_subint_{network-role}_vmi_{vmi_index}
"""
subint
{vm-type}_{vm-type_index}_subint_{network-role}_vmi_{vmi_index}
_v6_IP_{index}
"""
run_test(
_v6_IP_{index}
"""
run_test(
regex_names=("subint_ip", "subint_v6_ip"),
network_flavor=ContrailV2InstanceIpProcessor.network_flavor_subint,
)
regex_names=("subint_ip", "subint_v6_ip"),
network_flavor=ContrailV2InstanceIpProcessor.network_flavor_subint,
)
-def test_contrail_irt_route_param_format(heat_template):
+def test_contrail_irt_route_param_format(yaml_file):
"""
If a VNF's Heat Orchestration Template
``OS::ContrailV2::InterfaceRouteTable`` resource
"""
If a VNF's Heat Orchestration Template
``OS::ContrailV2::InterfaceRouteTable`` resource
``interface_route_table_routes_route`` map property parameter name
**MUST** follow the format
"""
``interface_route_table_routes_route`` map property parameter name
**MUST** follow the format
"""
- run_test(heat_template, validate_irt_route_param_format)
+ run_test(yaml_file, validate_irt_route_param_format)
-def test_contrail_irt_route_param_type(heat_template):
+def test_contrail_irt_route_param_type(yaml_file):
"""
* ``{vm-type}_{network-role}_route_prefixes``
**MUST** be defined as type ``json``.
"""
"""
* ``{vm-type}_{network-role}_route_prefixes``
**MUST** be defined as type ``json``.
"""
- run_test(heat_template, validate_irt_route_param_type)
+ run_test(yaml_file, validate_irt_route_param_type)
-def test_contrail_interfaceroutetable_resource_id(heat_template):
+def test_contrail_interfaceroutetable_resource_id(yaml_file):
"""
A VNF's Heat Orchestration Template's Resource
``OS::ContrailV2::InterfaceRouteTable``
"""
A VNF's Heat Orchestration Template's Resource
``OS::ContrailV2::InterfaceRouteTable``
contain the ``{network-role}``.
"""
run_test(
contain the ``{network-role}``.
"""
run_test(
ContrailV2InterfaceRouteTableProcessor,
get_network_roles,
"network_role",
ContrailV2InterfaceRouteTableProcessor,
get_network_roles,
"network_role",
-def test_contrail_networkipam_resource_id(heat_template):
+def test_contrail_networkipam_resource_id(yaml_file):
"""
A VNF's Heat Orchestration Template's Resource
``OS::ContrailV2::NetworkIpam``
"""
A VNF's Heat Orchestration Template's Resource
``OS::ContrailV2::NetworkIpam``
contain the ``{network-role}``.
"""
run_test(
contain the ``{network-role}``.
"""
run_test(
- heat_template, ContrailV2NetworkIpamProcessor, get_network_roles, "network_role"
+ yaml_file, ContrailV2NetworkIpamProcessor, get_network_roles, "network_role"
-def test_contrail_porttuple_resource_id(heat_template):
+def test_contrail_porttuple_resource_id(yaml_file):
"""
A VNF's Heat Orchestration Template's Resource
``OS::ContrailV2::PortTuple``
"""
A VNF's Heat Orchestration Template's Resource
``OS::ContrailV2::PortTuple``
**MUST**
contain the ``{vm-type}``.
"""
**MUST**
contain the ``{vm-type}``.
"""
- run_test(heat_template, ContrailV2PortTupleProcessor, get_vm_types, "vm_type")
+ run_test(yaml_file, ContrailV2PortTupleProcessor, get_vm_types, "vm_type")
-def test_contrail_servicehealthcheck_resource_id(heat_template):
+def test_contrail_servicehealthcheck_resource_id(yaml_file):
"""
A VNF's Heat Orchestration Template's Resource
``OS::ContrailV2::ServiceHealthCheck``
"""
A VNF's Heat Orchestration Template's Resource
``OS::ContrailV2::ServiceHealthCheck``
contain the ``{vm-type}``.
"""
run_test(
contain the ``{vm-type}``.
"""
run_test(
- heat_template, ContrailV2ServiceHealthCheckProcessor, get_vm_types, "vm_type"
+ yaml_file, ContrailV2ServiceHealthCheckProcessor, get_vm_types, "vm_type"
-def test_contrail_servicetemplate_resource_id(heat_template):
+def test_contrail_servicetemplate_resource_id(yaml_file):
"""
A VNF's Heat Orchestration Template's Resource
``OS::ContrailV2::ServiceTemplate``
"""
A VNF's Heat Orchestration Template's Resource
``OS::ContrailV2::ServiceTemplate``
**MUST**
contain the ``{vm-type}``.
"""
**MUST**
contain the ``{vm-type}``.
"""
- run_test(heat_template, ContrailV2ServiceTemplateProcessor, get_vm_types, "vm_type")
+ run_test(yaml_file, ContrailV2ServiceTemplateProcessor, get_vm_types, "vm_type")
-def test_contrail_instance_ip_resource_id_external(heat_template):
+def test_contrail_instance_ip_resource_id_external(yaml_file):
"""
A VNF's Heat Orchestration Template's Resource
OS::ContrailV2::VirtualMachineInterface that is attaching to an
"""
A VNF's Heat Orchestration Template's Resource
OS::ContrailV2::VirtualMachineInterface that is attaching to an
{vm-type}_{vm-type_index}_{network-role}_vmi_{vmi_index}
"""
run_test(
{vm-type}_{vm-type_index}_{network-role}_vmi_{vmi_index}
"""
run_test(
regex_name="vmi_external",
network_flavor=ContrailV2VirtualMachineInterfaceProcessor.network_flavor_external,
)
@validates("R-50468")
regex_name="vmi_external",
network_flavor=ContrailV2VirtualMachineInterfaceProcessor.network_flavor_external,
)
@validates("R-50468")
-def test_contrail_instance_ip_resource_id_internal(heat_template):
+def test_contrail_instance_ip_resource_id_internal(yaml_file):
"""
A VNF's Heat Orchestration Template's Resource
OS::ContrailV2::VirtualMachineInterface that is attaching to an
"""
A VNF's Heat Orchestration Template's Resource
OS::ContrailV2::VirtualMachineInterface that is attaching to an
{vm-type}_{vm-type_index}_int_{network-role}_vmi_{vmi_index}
"""
run_test(
{vm-type}_{vm-type_index}_int_{network-role}_vmi_{vmi_index}
"""
run_test(
regex_name="vmi_internal",
network_flavor=ContrailV2VirtualMachineInterfaceProcessor.network_flavor_internal,
)
@validates("R-54458")
regex_name="vmi_internal",
network_flavor=ContrailV2VirtualMachineInterfaceProcessor.network_flavor_internal,
)
@validates("R-54458")
-def test_contrail_instance_ip_resource_id_subint(heat_template):
+def test_contrail_instance_ip_resource_id_subint(yaml_file):
"""
A VNF's Heat Orchestration Template's Resource
OS::ContrailV2::VirtualMachineInterface that is attaching to an
"""
A VNF's Heat Orchestration Template's Resource
OS::ContrailV2::VirtualMachineInterface that is attaching to an
{vm-type}_{vm-type_index}_subint_{network-role}_vmi_{vmi_index}
"""
run_test(
{vm-type}_{vm-type_index}_subint_{network-role}_vmi_{vmi_index}
"""
run_test(
regex_name="vmi_subint",
network_flavor=ContrailV2VirtualMachineInterfaceProcessor.network_flavor_subint,
)
regex_name="vmi_subint",
network_flavor=ContrailV2VirtualMachineInterfaceProcessor.network_flavor_subint,
)
-def test_neutron_net_resource_id(heat_template):
+def test_neutron_net_resource_id(yaml_file):
"""
A VNF's Heat Orchestration Template's Resource
OS::ContrailV2::VirtualNetwork Resource ID
"""
A VNF's Heat Orchestration Template's Resource
OS::ContrailV2::VirtualNetwork Resource ID
or
2) int_{network-role}_RVN`` where RVN represents Resource Virtual
"""
or
2) int_{network-role}_RVN`` where RVN represents Resource Virtual
"""
- heat = Heat(filepath=heat_template)
+ heat = Heat(filepath=yaml_file)
heat_object_class = ContrailV2VirtualNetworkProcessor
resource_type = heat_object_class.resource_type
resources = heat.get_resource_by_type(resource_type)
heat_object_class = ContrailV2VirtualNetworkProcessor
resource_type = heat_object_class.resource_type
resources = heat.get_resource_by_type(resource_type)
-def test_fixed_ips_include_vm_type_network_role(heat_template):
+def test_fixed_ips_include_vm_type_network_role(yaml_file):
"""
Check that all fixed_ips ip addresses include the {vm_type} of the
nova server it is associated to and also contains the {network_role}
of the network it is associated with
"""
"""
Check that all fixed_ips ip addresses include the {vm_type} of the
nova server it is associated to and also contains the {network_role}
of the network it is associated with
"""
- with open(heat_template) as fh:
+ with open(yaml_file) as fh:
yml = yaml.load(fh)
# skip if resources are not defined
yml = yaml.load(fh)
# skip if resources are not defined
-def test_neutron_floating_ip_resource_type(heat_template):
+def test_neutron_floating_ip_resource_type(yaml_file):
"""
A VNF's Heat Orchestration Template's **MUST NOT**
contain the Resource ``OS::Neutron::FloatingIP``.
"""
"""
A VNF's Heat Orchestration Template's **MUST NOT**
contain the Resource ``OS::Neutron::FloatingIP``.
"""
- run_test(heat_template, "OS::Neutron::FloatingIP")
+ run_test(yaml_file, "OS::Neutron::FloatingIP")
-def test_neutron_floating_ip_association_resource_type(heat_template):
+def test_neutron_floating_ip_association_resource_type(yaml_file):
"""
A VNF's Heat Orchestration Template's **MUST NOT**
contain the Resource ``OS::Neutron::FloatingIPAssociation``.
"""
"""
A VNF's Heat Orchestration Template's **MUST NOT**
contain the Resource ``OS::Neutron::FloatingIPAssociation``.
"""
- run_test(heat_template, "OS::Neutron::FloatingIPAssociation")
+ run_test(yaml_file, "OS::Neutron::FloatingIPAssociation")
-def test_heat_template_structure_contains_resources(heat_template):
+def test_heat_template_structure_contains_resources(yaml_file):
"""
Check that all heat templates have the required sections
"""
required_key_values = ["resources"]
"""
Check that all heat templates have the required sections
"""
required_key_values = ["resources"]
- with open(heat_template) as fh:
+ with open(yaml_file) as fh:
yml = yaml.load(fh)
assert all(
[k in yml for k in required_key_values]
), "{} doesn't contain the {} section, but it is required".format(
yml = yaml.load(fh)
assert all(
[k in yml for k in required_key_values]
), "{} doesn't contain the {} section, but it is required".format(
- heat_template, required_key_values[0]
+ yaml_file, required_key_values[0]
@validates("R-90152")
@pytest.mark.base
@validates("R-90152")
@pytest.mark.base
-def test_06_heat_template_resource_section_has_resources(heat_template):
+def test_06_heat_template_resource_section_has_resources(yaml_file):
- with open(heat_template) as fh:
+ with open(yaml_file) as fh:
yml = yaml.load(fh)
resources = yml.get("resources")
yml = yaml.load(fh)
resources = yml.get("resources")
@validates("R-71577", "R-40971")
@validates("R-71577", "R-40971")
-def test_ips_start_at_0(heat_template):
- params = Heat(heat_template).parameters
+def test_ips_start_at_0(yaml_file):
+ params = Heat(yaml_file).parameters
invalid_params = check_indices(IP_PARAM_PATTERN, params, "IP Parameters")
assert not invalid_params, ". ".join(invalid_params)
invalid_params = check_indices(IP_PARAM_PATTERN, params, "IP Parameters")
assert not invalid_params, ". ".join(invalid_params)
-def test_multipart_mime(heat_template):
+def test_multipart_mime(yaml_file):
"""validate resource ids
"""
"""validate resource ids
"""
- h = Heat(filepath=heat_template)
+ h = Heat(filepath=yaml_file)
if not h.resources:
pytest.skip("No resources in this template")
if not h.resources:
pytest.skip("No resources in this template")
-def test_nested_parameter_args(heat_template):
+def test_nested_parameter_args(yaml_file):
"""
If a VNF’s Heat Orchestration Template resource attribute
property metadata uses a nested get_param, then the "outer"
"""
If a VNF’s Heat Orchestration Template resource attribute
property metadata uses a nested get_param, then the "outer"
vf_module_id:
get_param: [ cdl, { get_param: num }]
"""
vf_module_id:
get_param: [ cdl, { get_param: num }]
"""
- heat = Heat(filepath=heat_template)
+ heat = Heat(filepath=yaml_file)
if not heat.resources:
pytest.skip("No resources found")
has_nested_parameters = False
if not heat.resources:
pytest.skip("No resources found")
has_nested_parameters = False
-def test_nested_template_parameters(heat_template):
+def test_nested_template_parameters(yaml_file):
"""
All parameters defined in a VNFs Nested YAML file
**MUST** be passed in as properties of the resource calling
the nested yaml file.
"""
"""
All parameters defined in a VNFs Nested YAML file
**MUST** be passed in as properties of the resource calling
the nested yaml file.
"""
- dirname, basename = os.path.split(heat_template)
- heat = Heat(filepath=heat_template)
+ dirname, basename = os.path.split(yaml_file)
+ heat = Heat(filepath=yaml_file)
if not heat.resources:
pytest.skip("No resources found")
nested_type = nested_files.get_type_nested_files(heat.yml, dirname)
if not heat.resources:
pytest.skip("No resources found")
nested_type = nested_files.get_type_nested_files(heat.yml, dirname)
@validates("R-62983", "R-86182")
@validates("R-62983", "R-86182")
-def test_network_format(heat_template):
+def test_network_format(yaml_file):
"""
Make sure all network properties use the allowed naming
conventions
"""
"""
Make sure all network properties use the allowed naming
conventions
"""
- with open(heat_template) as fh:
+ with open(yaml_file) as fh:
yml = yaml.load(fh)
# skip if resources are not defined
yml = yaml.load(fh)
# skip if resources are not defined
-def test_network_format_use_get_param_or_get_resource(heat_template):
+def test_network_format_use_get_param_or_get_resource(yaml_file):
"""
Make sure all network properties only use get_param
or get_resource of an internal network
"""
"""
Make sure all network properties only use get_param
or get_resource of an internal network
"""
- with open(heat_template) as fh:
+ with open(yaml_file) as fh:
yml = yaml.load(fh)
# skip if resources are not defined
yml = yaml.load(fh)
# skip if resources are not defined
-def test_neutron_net_resource_id(heat_template):
+def test_neutron_net_resource_id(yaml_file):
"""
A VNF's Heat Orchestration Template's Resource OS::Neutron::Net
Resource ID **MUST** use the naming convention
* int_{network-role}_network
"""
"""
A VNF's Heat Orchestration Template's Resource OS::Neutron::Net
Resource ID **MUST** use the naming convention
* int_{network-role}_network
"""
- heat = Heat(filepath=heat_template)
+ heat = Heat(filepath=yaml_file)
neutron_nets = heat.get_resource_by_type(NeutronNetProcessor.resource_type)
if not neutron_nets:
pytest.skip("No neutron nets found")
neutron_nets = heat.get_resource_by_type(NeutronNetProcessor.resource_type)
if not neutron_nets:
pytest.skip("No neutron nets found")
-def test_neutron_port_external_ipaddress(heat_template):
+def test_neutron_port_external_ipaddress(yaml_file):
"""
If a VNF requires ONAP to assign a Virtual IP (VIP) Address to
ports connected an external network, the port
**MUST NOT** have more than one IPv4 VIP address.
"""
"""
If a VNF requires ONAP to assign a Virtual IP (VIP) Address to
ports connected an external network, the port
**MUST NOT** have more than one IPv4 VIP address.
"""
- run_test(heat_template, validate_external_ipaddress)
+ run_test(yaml_file, validate_external_ipaddress)
-def test_neutron_port_external_ipaddress_v6(heat_template):
+def test_neutron_port_external_ipaddress_v6(yaml_file):
"""
If a VNF requires ONAP to assign a Virtual IP (VIP) Address to
ports connected an external network, the port
**MUST NOT** have more than one IPv6 VIP address.
"""
"""
If a VNF requires ONAP to assign a Virtual IP (VIP) Address to
ports connected an external network, the port
**MUST NOT** have more than one IPv6 VIP address.
"""
- run_test(heat_template, validate_external_ipaddress_v6)
+ run_test(yaml_file, validate_external_ipaddress_v6)
-def test_neutron_port_fixed_ips(heat_template):
+def test_neutron_port_fixed_ips(yaml_file):
"""
The VNF's Heat Orchestration Template's
resource ``OS::Neutron::Port`` property ``fixed_ips``
map property ``subnet``/``subnet_id`` parameter
**MUST** be declared type ``string``.
"""
"""
The VNF's Heat Orchestration Template's
resource ``OS::Neutron::Port`` property ``fixed_ips``
map property ``subnet``/``subnet_id`` parameter
**MUST** be declared type ``string``.
"""
- run_test(heat_template, validate_fixed_ip)
+ run_test(yaml_file, validate_fixed_ip)
@validates("R-62802", "R-15287")
@validates("R-62802", "R-15287")
-def test_neutron_port_external_fixed_ips(heat_template):
+def test_neutron_port_external_fixed_ips(yaml_file):
"""
When the VNF's Heat Orchestration Template's
resource ``OS::Neutron::Port`` is attaching
"""
When the VNF's Heat Orchestration Template's
resource ``OS::Neutron::Port`` is attaching
and the external network IPv6 subnet is to be specified
* ``{network-role}_v6_subnet_id``
"""
and the external network IPv6 subnet is to be specified
* ``{network-role}_v6_subnet_id``
"""
- run_test(heat_template, validate_external_fixed_ip)
+ run_test(yaml_file, validate_external_fixed_ip)
@validates("R-84123", "R-76160")
@validates("R-84123", "R-76160")
-def test_neutron_port_internal_fixed_ips(heat_template):
+def test_neutron_port_internal_fixed_ips(yaml_file):
* ``int_{network-role}_v6_subnet_id``
"""
* ``int_{network-role}_v6_subnet_id``
"""
- run_test(heat_template, validate_internal_fixed_ip)
+ run_test(yaml_file, validate_internal_fixed_ip)
-def test_neutron_port_network_param_is_string(heat_template):
+def test_neutron_port_network_param_is_string(yaml_file):
"""
Make sure all network properties use the allowed naming
conventions
"""
"""
Make sure all network properties use the allowed naming
conventions
"""
- with open(heat_template) as fh:
+ with open(yaml_file) as fh:
yml = yaml.load(fh)
# skip if resources are not defined
yml = yaml.load(fh)
# skip if resources are not defined
-def test_non_server_name(heat_template):
+def test_non_server_name(yaml_file):
"""
If a VNF's Heat Orchestration Template contains the property ``name``
for a non ``OS::Nova::Server`` resource, the intrinsic function
"""
If a VNF's Heat Orchestration Template contains the property ``name``
for a non ``OS::Nova::Server`` resource, the intrinsic function
supplied metadata parameter ``vnf_name`` to generate a unique value.
"""
supplied metadata parameter ``vnf_name`` to generate a unique value.
"""
- h = Heat(filepath=heat_template)
+ h = Heat(filepath=yaml_file)
if not h.resources:
pytest.skip("No resources in this template")
if not h.resources:
pytest.skip("No resources in this template")
-def test_nova_server_name_parameter_starts_at(heat_template):
- params = Heat(heat_template).parameters
+def test_nova_server_name_parameter_starts_at(yaml_file):
+ params = Heat(yaml_file).parameters
invalid_params = check_indices(
SERVER_NAME_PARAM, params, "OS::Nova::Server Name Parameters"
)
invalid_params = check_indices(
SERVER_NAME_PARAM, params, "OS::Nova::Server Name Parameters"
)
-def test_nova_server_resource_id(heat_template):
+def test_nova_server_resource_id(yaml_file):
"""
A VNF's Heat Orchestration Template's Resource
OS::Nova::Server Resource ID
"""
A VNF's Heat Orchestration Template's Resource
OS::Nova::Server Resource ID
* ``{vm-type}_server_{index}``
"""
* ``{vm-type}_server_{index}``
"""
- heat = Heat(filepath=heat_template)
+ heat = Heat(filepath=yaml_file)
resources = heat.nova_server_resources
if not resources:
pytest.skip("No Nova Server resources found")
resources = heat.nova_server_resources
if not resources:
pytest.skip("No Nova Server resources found")
-def test_environment_context(heat_template):
+def test_environment_context(yaml_file):
"""
A VNF's Heat Orchestration Template's OS::Nova::Server Resource
**MUST**
"""
A VNF's Heat Orchestration Template's OS::Nova::Server Resource
**MUST**
metadata map value parameter 'environment_context' **MUST**
be declared as type: 'string'.
"""
metadata map value parameter 'environment_context' **MUST**
be declared as type: 'string'.
"""
- with open(heat_template) as fh:
+ with open(yaml_file) as fh:
yml = yaml.load(fh)
if "parameters" not in yml:
yml = yaml.load(fh)
if "parameters" not in yml:
continue
error = validate_metadata(metadata, yml["parameters"])
if error:
continue
error = validate_metadata(metadata, yml["parameters"])
if error:
- assert False, '%s resource "%s" %s' % (heat_template, resource, error)
+ assert False, '%s resource "%s" %s' % (yaml_file, resource, error)
def validate_metadata(metadata, parameters):
def validate_metadata(metadata, parameters):
-def test_vm_type_consistent_on_nova_servers(heat_template):
+def test_vm_type_consistent_on_nova_servers(yaml_file):
"""
Make sure all nova servers have properly formatted properties
for their name, image and flavor
"""
"""
Make sure all nova servers have properly formatted properties
for their name, image and flavor
"""
- with open(heat_template) as fh:
+ with open(yaml_file) as fh:
yml = yaml.load(fh)
# skip if resources are not defined
yml = yaml.load(fh)
# skip if resources are not defined
@validates("R-901331", "R-481670", "R-663631")
@validates("R-901331", "R-481670", "R-663631")
-def test_vm_type_assignments_on_nova_servers_only_use_get_param(heat_template):
+def test_vm_type_assignments_on_nova_servers_only_use_get_param(yaml_file):
"""
Make sure all nova servers only use get_param for their properties
"""
"""
Make sure all nova servers only use get_param for their properties
"""
- with open(heat_template) as fh:
+ with open(yaml_file) as fh:
yml = yaml.load(fh)
# skip if resources are not defined
yml = yaml.load(fh)
# skip if resources are not defined
-def test_workload_context(heat_template):
+def test_workload_context(yaml_file):
"""
A VNF's Heat Orchestration Template's OS::Nova::Server Resource
**MUST**
"""
A VNF's Heat Orchestration Template's OS::Nova::Server Resource
**MUST**
metadata map value parameter 'workload_context' **MUST**
be declared as type: 'string'.
"""
metadata map value parameter 'workload_context' **MUST**
be declared as type: 'string'.
"""
- with open(heat_template) as fh:
+ with open(yaml_file) as fh:
yml = yaml.load(fh)
if "parameters" not in yml:
yml = yaml.load(fh)
if "parameters" not in yml:
continue
error = validate_metadata(metadata, yml["parameters"])
if error:
continue
error = validate_metadata(metadata, yml["parameters"])
if error:
- assert False, '%s resource "%s" %s' % (heat_template, resource, error)
+ assert False, '%s resource "%s" %s' % (yaml_file, resource, error)
def validate_metadata(metadata, parameters):
def validate_metadata(metadata, parameters):
@validates("R-20453", "R-26351", "R-26506", "R-681859")
@validates("R-20453", "R-26351", "R-26506", "R-681859")
-def test_port_resource_ids(heat_template):
+def test_port_resource_ids(yaml_file):
"""
Check that all resource ids for ports follow the right
naming convention to include the {vm_type} of the
nova server it is associated to and also contains the
{network_role} of the network it is associated with
"""
"""
Check that all resource ids for ports follow the right
naming convention to include the {vm_type} of the
nova server it is associated to and also contains the
{network_role} of the network it is associated with
"""
- with open(heat_template) as fh:
+ with open(yaml_file) as fh:
yml = yaml.load(fh)
# skip if resources are not defined
yml = yaml.load(fh)
# skip if resources are not defined
-def test_availability_zone_parameter_type(heat_template):
- check_parameter_type(heat_template, "availability_zone_", "string")
+def test_availability_zone_parameter_type(yaml_file):
+ check_parameter_type(yaml_file, "availability_zone_", "string")
-def test_vnf_id_parameter_type_and_parameter_name(heat_template):
- check_parameter_type(heat_template, "vnf_id", "string")
- check_server_parameter_name(heat_template, "vnf_id", "vnf_id")
+def test_vnf_id_parameter_type_and_parameter_name(yaml_file):
+ check_parameter_type(yaml_file, "vnf_id", "string")
+ check_server_parameter_name(yaml_file, "vnf_id", "vnf_id")
-def test_vf_module_id_parameter_type_and_parameter_name(heat_template):
- check_parameter_type(heat_template, "vf_module_id", "string")
- check_server_parameter_name(heat_template, "vf_module_id", "vf_module_id")
+def test_vf_module_id_parameter_type_and_parameter_name(yaml_file):
+ check_parameter_type(yaml_file, "vf_module_id", "string")
+ check_server_parameter_name(yaml_file, "vf_module_id", "vf_module_id")
-def test_vnf_name_parameter_type_and_parameter_name(heat_template):
- check_parameter_type(heat_template, "vnf_name", "string")
- check_server_parameter_name(heat_template, "vnf_name", "vnf_name")
+def test_vnf_name_parameter_type_and_parameter_name(yaml_file):
+ check_parameter_type(yaml_file, "vnf_name", "string")
+ check_server_parameter_name(yaml_file, "vnf_name", "vnf_name")
-def test_vf_module_name_parameter_type_and_parameter_name(heat_template):
- check_parameter_type(heat_template, "vf_module_name", "string")
- check_server_parameter_name(heat_template, "vf_module_name", "vf_module_name")
+def test_vf_module_name_parameter_type_and_parameter_name(yaml_file):
+ check_parameter_type(yaml_file, "vf_module_name", "string")
+ check_server_parameter_name(yaml_file, "vf_module_name", "vf_module_name")
-def test_vm_role_parameter_type_and_parameter_name(heat_template):
- check_parameter_type(heat_template, "vm_role", "string")
- check_server_parameter_name(heat_template, "vm_role", "vm_role")
+def test_vm_role_parameter_type_and_parameter_name(yaml_file):
+ check_parameter_type(yaml_file, "vm_role", "string")
+ check_server_parameter_name(yaml_file, "vm_role", "vm_role")
-def test_vf_module_index_parameter_type_and_parameter_name(heat_template):
- check_parameter_type(heat_template, "vf_module_index", "number")
- check_server_parameter_name(heat_template, "vf_module_index", "vf_module_index")
+def test_vf_module_index_parameter_type_and_parameter_name(yaml_file):
+ check_parameter_type(yaml_file, "vf_module_index", "number")
+ check_server_parameter_name(yaml_file, "vf_module_index", "vf_module_index")
-def test_software_config_vm_type(heat_template):
+def test_software_config_vm_type(yaml_file):
"""
A VNF's Heat Orchestration Template's Resource OS::Heat::SoftwareConfig
Resource ID **MUST** contain the {vm-type}.
"""
"""
A VNF's Heat Orchestration Template's Resource OS::Heat::SoftwareConfig
Resource ID **MUST** contain the {vm-type}.
"""
- heat = Heat(filepath=heat_template)
+ heat = Heat(filepath=yaml_file)
software_configs = heat.get_resource_by_type("OS::Heat::SoftwareConfig")
if not software_configs:
pytest.skip("No SoftwareConfig resources found")
software_configs = heat.get_resource_by_type("OS::Heat::SoftwareConfig")
if not software_configs:
pytest.skip("No SoftwareConfig resources found")
-def test_vm_role_from_env_file(heat_template):
+def test_vm_role_from_env_file(yaml_file):
"""
Validate vm_role when using parameters and env file
"""
"""
Validate vm_role when using parameters and env file
"""
- pair = get_environment_pair(heat_template)
+ pair = get_environment_pair(yaml_file)
if not pair:
pytest.skip("Unable to resolve environment pair")
template_params = pair["yyml"].get("parameters") or {}
if not pair:
pytest.skip("Unable to resolve environment pair")
template_params = pair["yyml"].get("parameters") or {}
-def test_vm_type_case(heat_template):
+def test_vm_type_case(yaml_file):
"""
A VNF's Heat Orchestration Template's use of ``{vm-type}`` in all Resource
property parameter names **MUST** be the same case.
"""
"""
A VNF's Heat Orchestration Template's use of ``{vm-type}`` in all Resource
property parameter names **MUST** be the same case.
"""
- heat = Heat(filepath=heat_template)
+ heat = Heat(filepath=yaml_file)
resources = heat.resources
if not resources:
pytest.skip("No resources found")
resources = heat.resources
if not resources:
pytest.skip("No resources found")
-def test_vm_type_resource_id(heat_template):
+def test_vm_type_resource_id(yaml_file):
"""
A VNF's Heat Orchestration Template's use of ``{vm-type}``
in all Resource IDs **MUST** be the same case.
"""
bad = {}
"""
A VNF's Heat Orchestration Template's use of ``{vm-type}``
in all Resource IDs **MUST** be the same case.
"""
bad = {}
- h = Heat(filepath=heat_template)
+ h = Heat(filepath=yaml_file)
if not h.resources:
pytest.skip("No resources specified in the heat template")
vm_types = {
if not h.resources:
pytest.skip("No resources specified in the heat template")
vm_types = {
-def test_vm_type_syntax(heat_template):
+def test_vm_type_syntax(yaml_file):
"""
A VNF's Heat Orchestration Template's ``{vm-type}``
**MUST** contain only
"""
A VNF's Heat Orchestration Template's ``{vm-type}``
**MUST** contain only
contain any of the following strings:
``_int`` or ``int_`` or ``_int_``.
"""
contain any of the following strings:
``_int`` or ``int_`` or ``_int_``.
"""
- v = Heat(filepath=heat_template)
+ v = Heat(filepath=yaml_file)
if not v.resources:
pytest.skip("No resources")
t = set()
if not v.resources:
pytest.skip("No resources")
t = set()
from .utils.vm_types import get_vm_type_for_nova_server
from .utils.vm_types import get_vm_type_for_nova_server
-def test_volume_resource_ids(heat_template):
+def test_volume_resource_ids(yaml_file):
"""
Check that all resource ids for cinder volumes follow the right
naming convention to include the {vm_type} of the
nova server it is associated to
"""
"""
Check that all resource ids for cinder volumes follow the right
naming convention to include the {vm_type} of the
nova server it is associated to
"""
- with open(heat_template) as fh:
+ with open(yaml_file) as fh:
yml = yaml.load(fh)
# skip if resources are not defined
yml = yaml.load(fh)
# skip if resources are not defined