aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ansible/roles/convert_openrc/tasks/main.yml2
-rw-r--r--ansible/roles/infra_check_requirements/tasks/main.yml16
-rw-r--r--ansible/roles/infra_create_network/tasks/create_xml.yml (renamed from ansible/roles/infra_create_network/tasks/create_xml.yaml)20
-rw-r--r--ansible/roles/infra_create_network/tasks/main.yml2
-rw-r--r--ansible/roles/infra_create_vms/tasks/configure_vm.yml4
-rw-r--r--ansible/roles/infra_create_vms/tasks/create_interfaces.yml10
-rw-r--r--ansible/roles/infra_create_vms/tasks/main.yml8
-rw-r--r--etc/infra/infra_deploy.yaml.sample6
-rwxr-xr-xtests/ci/prepare_env.sh4
-rw-r--r--yardstick/benchmark/core/task.py2
-rw-r--r--yardstick/network_services/vnf_generic/vnf/sample_vnf.py6
11 files changed, 70 insertions, 10 deletions
diff --git a/ansible/roles/convert_openrc/tasks/main.yml b/ansible/roles/convert_openrc/tasks/main.yml
index be621f0af..00aa13615 100644
--- a/ansible/roles/convert_openrc/tasks/main.yml
+++ b/ansible/roles/convert_openrc/tasks/main.yml
@@ -18,7 +18,7 @@
- debug: var=openrc
- set_fact:
- yardstick_url_ip: "{{ openrc.OS_AUTH_URL|urlsplit|attr('hostname') }}"
+ yardstick_url_ip: "{{ openrc.OS_AUTH_URL|urlsplit('hostname') }}"
- debug: var=yardstick_url_ip
diff --git a/ansible/roles/infra_check_requirements/tasks/main.yml b/ansible/roles/infra_check_requirements/tasks/main.yml
index 8d05bbdb7..a11bc56a1 100644
--- a/ansible/roles/infra_check_requirements/tasks/main.yml
+++ b/ansible/roles/infra_check_requirements/tasks/main.yml
@@ -34,6 +34,22 @@
msg: "Failed, not enough CPU, required: {{ vcpu_t }}, available {{ ansible_processor_vcpus }}"
when: ansible_processor_vcpus < vcpu_t|int
+- name: Define default network counter
+ set_fact:
+ num_default_network_detected: 0
+
+- name: Increment counter for every default network detected
+ set_fact:
+ num_default_network_detected: "{{ num_default_network_detected|int + 1 }}"
+ when:
+ - item.default_gateway is defined
+ - item.default_gateway == True
+ with_items: "{{infra_deploy_vars.networks}}"
+
+- name: Fail if more than 1 or 0 default networks
+ fail:
+ msg: "Failed, there must be 1 default network: {{ num_default_network_detected }} detected"
+ when: num_default_network_detected|int != 1
- name: Fail if not enough Disk space
set_fact:
diff --git a/ansible/roles/infra_create_network/tasks/create_xml.yaml b/ansible/roles/infra_create_network/tasks/create_xml.yml
index a01c7974a..1632e591c 100644
--- a/ansible/roles/infra_create_network/tasks/create_xml.yaml
+++ b/ansible/roles/infra_create_network/tasks/create_xml.yml
@@ -40,10 +40,30 @@
xpath: /network
add_children:
- name: "{{ item.name }}"
+ - forward:
+ mode: nat
- bridge
- ip
pretty_print: yes
+- name: Add new children nodes to "forward" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /network/forward
+ add_children:
+ - nat
+ pretty_print: yes
+
+- name: Add new children nodes to "nat" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /network/forward/nat
+ add_children:
+ - port:
+ start: "1024"
+ end: "65535"
+ pretty_print: yes
+
- name: Add "name" attribute to "bridge" node
xml:
path: "{{ xml_file }}"
diff --git a/ansible/roles/infra_create_network/tasks/main.yml b/ansible/roles/infra_create_network/tasks/main.yml
index eba4a3a49..025a775a1 100644
--- a/ansible/roles/infra_create_network/tasks/main.yml
+++ b/ansible/roles/infra_create_network/tasks/main.yml
@@ -18,5 +18,5 @@
name: infra_deploy_vars
- name: Create XML file
- include_tasks: create_xml.yaml
+ include_tasks: create_xml.yml
with_items: "{{ infra_deploy_vars.networks }}"
diff --git a/ansible/roles/infra_create_vms/tasks/configure_vm.yml b/ansible/roles/infra_create_vms/tasks/configure_vm.yml
index 5685e634f..7419fd565 100644
--- a/ansible/roles/infra_create_vms/tasks/configure_vm.yml
+++ b/ansible/roles/infra_create_vms/tasks/configure_vm.yml
@@ -305,7 +305,7 @@
- name: Populate network-config and add interface to xml file
include_tasks: create_interfaces.yml
- extra_vars: "{{ network_config, xml_file , slot_address, mac_address_counter }}"
+ extra_vars: "{{ network_config xml_file slot_address mac_address_counter }}"
loop_control:
loop_var: interface_item
with_items: "{{ node_item.interfaces }}"
@@ -326,7 +326,7 @@
shell: >
qemu-img convert -O qcow2 {{ node_item.image }} {{ image_dir+node_item.hostname+'.qcow2' }}
-- name: Copy and convert the ubuntu image
+- name: Resize image
shell: >
qemu-img resize {{ image_dir+node_item.hostname+'.qcow2' }} {{ node_item.disk }}M
diff --git a/ansible/roles/infra_create_vms/tasks/create_interfaces.yml b/ansible/roles/infra_create_vms/tasks/create_interfaces.yml
index 124421b56..34bfd1b71 100644
--- a/ansible/roles/infra_create_vms/tasks/create_interfaces.yml
+++ b/ansible/roles/infra_create_vms/tasks/create_interfaces.yml
@@ -24,6 +24,16 @@
addresses:
- {{ interface_item.ip }}/{{ interface_item.netmask }}
+- name: Add default gateway
+ blockinfile:
+ path: "{{ network_config }}"
+ insertafter: "{{ interface_item.ip }}"
+ marker: "MARKER"
+ block: |2
+ gateway4: {{ default_bridge.host_ip }}
+ when:
+ - default_bridge is defined
+ - default_bridge.name == interface_item.network
- name: Remove the marker introduced in network-data
lineinfile:
diff --git a/ansible/roles/infra_create_vms/tasks/main.yml b/ansible/roles/infra_create_vms/tasks/main.yml
index 62a023e7e..4d47f44ff 100644
--- a/ansible/roles/infra_create_vms/tasks/main.yml
+++ b/ansible/roles/infra_create_vms/tasks/main.yml
@@ -20,9 +20,15 @@
- set_fact:
mac_address_counter: 0
+- set_fact:
+ default_bridge: "{{ item }}"
+ when:
+ - item.default_gateway is defined
+ - item.default_gateway == True
+ with_items: "{{ infra_deploy_vars.networks }}"
+
- name: Create XML file
include_tasks: configure_vm.yml
- extra_vars: "{{ mac_address_counter }}"
loop_control:
loop_var: node_item
with_items: "{{ infra_deploy_vars.nodes }}"
diff --git a/etc/infra/infra_deploy.yaml.sample b/etc/infra/infra_deploy.yaml.sample
index bf07a01bc..8ed793622 100644
--- a/etc/infra/infra_deploy.yaml.sample
+++ b/etc/infra/infra_deploy.yaml.sample
@@ -31,5 +31,11 @@ nodes:
networks:
- name: management
+ default_gateway: True
host_ip: 192.168.1.1
netmask: 255.255.255.0
+
+ - name: traffic
+ default_gateway: False # This parameter is not mandatory, default value: False
+ host_ip: 192.20.1.1
+ netmask: 255.255.255.0
diff --git a/tests/ci/prepare_env.sh b/tests/ci/prepare_env.sh
index 886e50e21..a097cec69 100755
--- a/tests/ci/prepare_env.sh
+++ b/tests/ci/prepare_env.sh
@@ -74,8 +74,8 @@ if [ "$INSTALLER_TYPE" == "fuel" ]; then
ssh -l ubuntu "${INSTALLER_IP}" -i ${SSH_KEY} ${ssh_options} \
"sudo salt -C 'ctl* or cmp*' grains.get fqdn_ip4 --out yaml">node_info
- controller_ips=($(awk '/ctl/{getline; print $2} < node_info'))
- compute_ips=($(awk '/cmp/{getline; print $2} < node_info'))
+ controller_ips=($(awk '/ctl/{getline; print $2}' < node_info))
+ compute_ips=($(awk '/cmp/{getline; print $2}' < node_info))
if [[ ${controller_ips[0]} ]]; then
sed -i "s|ip1|${controller_ips[0]}|" "${pod_yaml}"
diff --git a/yardstick/benchmark/core/task.py b/yardstick/benchmark/core/task.py
index 7f6309a7e..e7acde696 100644
--- a/yardstick/benchmark/core/task.py
+++ b/yardstick/benchmark/core/task.py
@@ -149,7 +149,7 @@ class Task(object): # pragma: no cover
total_end_time - total_start_time)
LOG.info('To generate report, execute command "yardstick report '
- 'generate %(task_id)s <yaml_name>s"', self.task_id)
+ 'generate %s <YAML_NAME>"', self.task_id)
LOG.info("Task ALL DONE, exiting")
return result
diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
index f16b4142d..ad78774f0 100644
--- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
+++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
@@ -609,8 +609,10 @@ class ScenarioHelper(object):
@property
def timeout(self):
- return self.options.get('timeout', DEFAULT_VNF_TIMEOUT)
-
+ test_duration = self.scenario_cfg.get('runner', {}).get('duration',
+ self.options.get('timeout', DEFAULT_VNF_TIMEOUT))
+ test_timeout = self.options.get('timeout', DEFAULT_VNF_TIMEOUT)
+ return test_duration if test_duration > test_timeout else test_timeout
class SampleVNF(GenericVNF):
""" Class providing file-like API for generic VNF implementation """