import novaclient.v2.client as novaclient
from glanceclient import client as glanceclient
from keystoneclient.v2_0 import client as keystoneclient
+from neutronclient.v2_0 import client as neutronclient
""" tests configuration """
tests = ['authenticate', 'glance', 'cinder', 'heat', 'keystone',
parser = argparse.ArgumentParser()
parser.add_argument("repo_path", help="Path to the repository")
parser.add_argument("test_name",
- help="Module name to be tested"
+ help="Module name to be tested. "
"Possible values are : "
"[ {d[0]} | {d[1]} | {d[2]} | {d[3]} | {d[4]} | "
- "{d[5]} | {d[6]} | {d[7]}] "
+ "{d[5]} | {d[6]} | {d[7]} | {d[8]} | {d[9]} | "
+ "{d[10]} ] "
"The 'all' value "
- "performs all the possible tests scenarios"
+ "performs all possible test scenarios"
.format(d=tests))
parser.add_argument("-d", "--debug", help="Debug mode", action="store_true")
parser.add_argument("-r", "--report",
help="Create json result file",
action="store_true")
+parser.add_argument("-s", "--smoke",
+ help="Smoke test mode",
+ action="store_true")
args = parser.parse_args()
+client_dict = {}
+
sys.path.append(args.repo_path + "testcases/")
import functest_utils
TEST_DB = functest_yaml.get("results").get("test_db_url")
FLOATING_NETWORK = functest_yaml.get("general"). \
get("openstack").get("neutron_public_net_name")
+FLOATING_SUBNET_CIDR = functest_yaml.get("general"). \
+ get("openstack").get("neutron_public_subnet_cidr")
+PRIVATE_NETWORK = functest_yaml.get("general"). \
+ get("openstack").get("neutron_private_net_name")
GLANCE_IMAGE_NAME = functest_yaml.get("general"). \
get("openstack").get("image_name")
get("openstack").get("image_disk_format")
GLANCE_IMAGE_PATH = functest_yaml.get("general"). \
get("directories").get("dir_functest_data") + "/" + GLANCE_IMAGE_FILENAME
-GLANCE_IMAGE_LOCATION = "http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img"
def push_results_to_db(payload):
def build_task_args(test_file_name):
task_args = {'service_list': [test_file_name]}
- task_args['smoke'] = False
+ task_args['smoke'] = args.smoke
task_args['image_name'] = GLANCE_IMAGE_NAME
task_args['flavor_name'] = FLAVOR_NAME
- task_args['glance_image_location'] = GLANCE_IMAGE_LOCATION
+ task_args['glance_image_location'] = GLANCE_IMAGE_PATH
task_args['floating_network'] = FLOATING_NETWORK
+ task_args['floating_subnet_cidr'] = FLOATING_SUBNET_CIDR
+ task_args['netid'] = functest_utils.get_network_id(client_dict['neutron'],
+ PRIVATE_NETWORK).encode('ascii', 'ignore')
task_args['tmpl_dir'] = TEMPLATE_DIR
task_args['sup_dir'] = SUPPORT_DIR
task_args['users_amount'] = USERS_AMOUNT
creds_nova = functest_utils.get_credentials("nova")
nova_client = novaclient.Client(**creds_nova)
+ creds_neutron = functest_utils.get_credentials("neutron")
+ neutron_client = neutronclient.Client(**creds_neutron)
creds_keystone = functest_utils.get_credentials("keystone")
keystone_client = keystoneclient.Client(**creds_keystone)
glance_endpoint = keystone_client.service_catalog.url_for(service_type='image',
glance_client = glanceclient.Client(1, glance_endpoint,
token=keystone_client.auth_token)
+ client_dict['neutron'] = neutron_client
+
logger.debug("Creating image '%s' from '%s'..." % (GLANCE_IMAGE_NAME, GLANCE_IMAGE_PATH))
image_id = functest_utils.create_glance_image(glance_client,
GLANCE_IMAGE_NAME,GLANCE_IMAGE_PATH)
if args.test_name == "all":
for test_name in tests:
if not (test_name == 'all' or
- test_name == 'heat' or
- test_name == 'smoke' or
test_name == 'vm'):
print(test_name)
run_task(test_name)
security_groups: -1
{%- endmacro %}
-{%- macro unlimited_neutron() %}
-{% if "neutron" in service_list %}
+{%- macro unlimited_neutron(secgroups=false) %}
neutron:
network: -1
port: -1
subnet: -1
-{% endif %}
+ {%- if secgroups %}
+ security_group: -1
+ security_group_rule: -1
+ {%- endif %}
{%- endmacro %}
{%- macro glance_args(location, container="bare", type="qcow2") %}
-
args:
{{ vm_params(image_name,flavor_name,1) }}
+ nics:
+ - net-id: {{ netid }}
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
quotas:
CinderVolumes.create_nested_snapshots_and_attach_volume:
-
args:
- nested_level:
- max: 1
- min: 1
+ nested_level: 1
size:
max: 1
min: 1
servers:
{{ vm_params(image_name,flavor_name,none)|indent(2,true) }}
servers_per_tenant: 1
+ auto_assign_nic: true
+ network: {}
{% endcall %}
runner:
{{ constant_runner(concurrency=2*controllers_amount,times=10*controllers_amount, is_smoke=smoke) }}
max: 5
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
+ quotas:
+ {{ unlimited_volumes() }}
servers:
{{ vm_params(image_name,flavor_name,none)|indent(2,true) }}
servers_per_tenant: 2
+ auto_assign_nic: true
+ network: {}
{% endcall %}
runner:
{{ constant_runner(concurrency=2*controllers_amount,times=10*controllers_amount, is_smoke=smoke) }}
max: 5
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
+ quotas:
+ {{ unlimited_volumes() }}
servers:
{{ vm_params(image_name,flavor_name,none)|indent(2,true) }}
servers_per_tenant: 2
+ auto_assign_nic: true
+ network: {}
{% endcall %}
runner:
{{ constant_runner(concurrency=2*controllers_amount,times=10*controllers_amount, is_smoke=smoke) }}
min: 1
max: 5
context:
- {{ user_context(tenants_amount, users_amount, use_existing_users) }}
+ {% call user_context(tenants_amount, users_amount, use_existing_users) %}
+ quotas:
+ {{ unlimited_volumes() }}
+ {% endcall %}
runner:
{{ constant_runner(concurrency=2*controllers_amount,times=10*controllers_amount, is_smoke=smoke) }}
sla:
args:
detailed: True
context:
- {{ user_context(tenants_amount, users_amount, use_existing_users) }}
+ {% call user_context(tenants_amount, users_amount, use_existing_users) %}
+ quotas:
+ {{ unlimited_volumes() }}
volumes:
size: 1
volumes_per_tenant: 4
+ {% endcall %}
runner:
{{ constant_runner(concurrency=2*controllers_amount,times=10*controllers_amount, is_smoke=smoke) }}
sla:
args:
{{ glance_args(location=glance_image_location) }}
flavor:
- name: "{{flavor_name}}"
+ name: {{ flavor_name }}
number_instances: 2
+ nics:
+ - net-id: {{ netid }}
context:
{{ user_context(tenants_amount, users_amount, use_existing_users) }}
+ quotas:
+ {{ unlimited_nova() }}
runner:
{{ constant_runner(concurrency=2*controllers_amount,times=10*controllers_amount, is_smoke=smoke) }}
sla:
{{ no_failures_sla() }}
+
-
args:
template_path: "{{ tmpl_dir }}/server_with_ports.yaml.template"
+ parameters:
+ public_net: {{ floating_network }}
+ image: {{ image_name }}
+ flavor: {{ flavor_name }}
+ cidr: {{ floating_subnet_cidr }}
context:
{{ user_context(tenants_amount, users_amount, use_existing_users) }}
runner:
-
args:
template_path: "{{ tmpl_dir }}/server_with_volume.yaml.template"
+ parameters:
+ image: {{ image_name }}
+ flavor: {{ flavor_name }}
+ network_id: {{ netid }}
context:
{{ user_context(tenants_amount, users_amount, use_existing_users) }}
runner:
runner:
{{ constant_runner(concurrency=2*controllers_amount,times=10*controllers_amount, is_smoke=smoke) }}
sla:
- {{ no_failures_sla() }}
\ No newline at end of file
+ {{ no_failures_sla() }}
+
KeystoneBasic.create_and_list_tenants:
-
- args:
- name_length: 10
context:
{{ user_context(tenants_amount, users_amount, use_existing_users) }}
runner:
KeystoneBasic.create_update_and_delete_tenant:
-
- args:
- name_length: 10
context:
{{ user_context(tenants_amount, users_amount, use_existing_users) }}
runner:
KeystoneBasic.create_user:
-
- args:
- name_length: 10
runner:
{{ constant_runner(concurrency=2*controllers_amount,times=10*controllers_amount, is_smoke=smoke) }}
sla:
KeystoneBasic.create_tenant:
-
- args:
- name_length: 10
runner:
{{ constant_runner(concurrency=2*controllers_amount,times=10*controllers_amount, is_smoke=smoke) }}
sla:
KeystoneBasic.create_and_list_users:
-
- args:
- name_length: 10
runner:
{{ constant_runner(concurrency=2*controllers_amount,times=10*controllers_amount, is_smoke=smoke) }}
sla:
KeystoneBasic.create_tenant_with_users:
-
args:
- name_length: 10
users_per_tenant: 10
runner:
{{ constant_runner(concurrency=2*controllers_amount,times=10*controllers_amount, is_smoke=smoke) }}
ports_per_network: 1
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
+ network: {}
quotas:
neutron:
network: -1
subnets_per_network: 1
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
+ network: {}
quotas:
neutron:
network: -1
subnets_per_network: 1
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
+ network: {}
quotas:
neutron:
network: -1
ports_per_network: 1
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
+ network: {}
quotas:
neutron:
network: -1
subnets_per_network: 1
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
+ network: {}
quotas:
neutron:
network: -1
subnets_per_network: 1
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
+ network: {}
quotas:
neutron:
network: -1
network_create_args: {}
network_update_args:
admin_state_up: false
- name: "_updated"
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
quotas:
admin_state_up: false
device_id: "dummy_id"
device_owner: "dummy_owner"
- name: "_port_updated"
ports_per_network: 1
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
+ network: {}
quotas:
neutron:
network: -1
router_create_args: {}
router_update_args:
admin_state_up: false
- name: "_router_updated"
subnet_cidr_start: "1.1.0.0/30"
subnet_create_args: {}
subnets_per_network: 1
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
+ network: {}
quotas:
neutron:
network: -1
subnet_create_args: {}
subnet_update_args:
enable_dhcp: false
- name: "_subnet_updated"
subnets_per_network: 1
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
+ network: {}
quotas:
neutron:
network: -1
sla:
{{ no_failures_sla() }}
- Quotas.neutron_update:
- -
- args:
- max_quota: 1024
- context:
- {{ user_context(tenants_amount, users_amount, use_existing_users) }}
- runner:
- {{ constant_runner(concurrency=2*controllers_amount, times=10*controllers_amount, is_smoke=smoke) }}
- sla:
- {{ no_failures_sla() }}
\ No newline at end of file
-
args:
{{ vm_params(image_name, flavor_name) }}
+ server_kwargs:
+ nics:
+ - net-id: {{ netid }}
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
network:
-
rescue_unrescue: 1
{{ vm_params(image_name, flavor_name) }}
+ nics:
+ - net-id: {{ netid }}
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
network:
-
args:
{{ vm_params(image_name, flavor_name) }}
+ nics:
+ - net-id: {{ netid }}
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
network:
args:
detailed: true
{{ vm_params(image_name, flavor_name) }}
+ nics:
+ - net-id: {{ netid }}
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
network:
name: {{ image_name }}
to_image:
name: {{ image_name }}
+ nics:
+ - net-id: {{ netid }}
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
network:
args:
{{ vm_params(image_name, flavor_name) }}
volume_size: 5
+ nics:
+ - net-id: {{ netid }}
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
network:
args:
{{ vm_params(image_name, flavor_name) }}
force_delete: false
+ nics:
+ - net-id: {{ netid }}
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
network:
-
args:
{{ vm_params(image_name, flavor_name) }}
+ nics:
+ - net-id: {{ netid }}
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
network:
{{ vm_params(image_name, flavor_name) }}
security_group_count: 10
rules_per_security_group: 10
+ nics:
+ - net-id: {{ netid }}
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
network:
start_cidr: "100.1.0.0/25"
+ quotas:
+ {{ unlimited_nova() }}
+ {{ unlimited_neutron(secgroups=true) }}
{% endcall %}
runner:
{{ constant_runner(concurrency=2*controllers_amount, times=10*controllers_amount, is_smoke=smoke) }}
- args:
{{ vm_params(image_name, flavor_name) }}
block_migration: false
+ nics:
+ - net-id: {{ netid }}
context:
{{ user_context(tenants_amount, users_amount, use_existing_users) }}
runner:
NovaServers.boot_and_migrate_server:
- args:
{{ vm_params(image_name, flavor_name) }}
+ nics:
+ - net-id: {{ netid }}
context:
{{ user_context(tenants_amount, users_amount, use_existing_users) }}
runner:
args:
{{ vm_params(image_name, flavor_name) }}
volume_size: 10
+ nics:
+ - net-id: {{ netid }}
context:
{{ user_context(tenants_amount, users_amount, use_existing_users) }}
runner:
-
args:
{{ vm_params(image_name, flavor_name) }}
+ nics:
+ - net-id: {{ netid }}
context:
{{ user_context(tenants_amount, users_amount, use_existing_users) }}
runner:
{{ vm_params(image_name, flavor_name) }}
size: 10
block_migration: false
+ boot_server_kwargs:
+ nics:
+ - net-id: {{ netid }}
context:
{{ user_context(tenants_amount, users_amount, use_existing_users) }}
runner:
block_migration: false
volume_size: 10
force_delete: false
+ nics:
+ - net-id: {{ netid }}
context:
{{ user_context(tenants_amount, users_amount, use_existing_users) }}
runner:
security_group_count: 10
rules_per_security_group: 10
context:
- {{ user_context(tenants_amount, users_amount, use_existing_users) }}
+ {% call user_context(tenants_amount, users_amount, use_existing_users) %}
+ quotas:
+ {{ unlimited_neutron(secgroups=true) }}
+ {% endcall %}
runner:
{{ constant_runner(concurrency=2*controllers_amount, times=10*controllers_amount, is_smoke=smoke) }}
sla:
security_group_count: 10
rules_per_security_group: 10
context:
- {{ user_context(tenants_amount, users_amount, use_existing_users) }}
+ {% call user_context(tenants_amount, users_amount, use_existing_users) %}
+ quotas:
+ {{ unlimited_neutron(secgroups=true) }}
+ {% endcall %}
runner:
{{ constant_runner(concurrency=2*controllers_amount, times=10*controllers_amount, is_smoke=smoke) }}
sla:
servers:
{{ vm_params(image_name,flavor_name,none)|indent(2,true) }}
servers_per_tenant: 2
+ auto_assign_nic: true
+ network: {}
{% endcall %}
runner:
{{ constant_runner(concurrency=2*controllers_amount, times=10*controllers_amount, is_smoke=smoke) }}
name: "m1.small"
confirm: true
force_delete: false
+ nics:
+ - net-id: {{ netid }}
context:
{{ user_context(tenants_amount, users_amount, use_existing_users) }}
runner:
{{ vm_params(image_name, flavor_name) }}
floating_network: {{ floating_network }}
force_delete: false
- interpreter: /bin/sh
- script: {{ sup_dir }}/instance_dd_test.sh
- username: admin
+ command:
+ interpreter: /bin/sh
+ script_file: {{ sup_dir }}/instance_dd_test.sh
+ username: cirros
+ nics:
+ - net-id: {{ netid }}
context:
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
network: {}
sla:
{{ no_failures_sla() }}
- VMTasks.boot_runcommand_delete:
-
args:
{{ vm_params(image_name, flavor_name) }}
fixed_network: private
floating_network: {{ floating_network }}
force_delete: false
- interpreter: /bin/sh
- script: {{ sup_dir }}/instance_dd_test.sh
+ command:
+ interpreter: /bin/sh
+ script_file: {{ sup_dir }}/instance_dd_test.sh
use_floatingip: true
- username: admin
+ username: cirros
+ nics:
+ - net-id: {{ netid }}
volume_args:
size: 2
context:
constraints:
- range: { min: 1, max: 1024 }
description: must be between 1 and 1024 Gb.
+ network_id:
+ type: string
resources:
server:
properties:
image: {get_param: image}
flavor: {get_param: flavor}
+ networks:
+ - network: { get_param: network_id }
cinder_volume:
type: OS::Cinder::Volume
properties: