Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 58 additions & 43 deletions roles/telemetry_autoscaling/tasks/test_autoscaling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,55 +83,70 @@
ansible.builtin.debug:
var: result

- name: |
TEST Verify cpu high alarm has been triggered
ansible.builtin.shell: |
# source ~/overcloudrc;
{{ openstack_cmd }} alarm list -c state -c name -f value| \
grep -i "cpu_alarm_high" | \
grep -i "{{ stack_name }}" | \
awk '{print $2}'
retries: 100
delay: 5
register: result
until: result.stdout == "alarm"

- name: |
TEST Verify orchestration scaled up instances
ansible.builtin.shell: |
# source ~/overcloudrc;
{{ openstack_cmd }} server list --long | grep -i metering.server_group
retries: 100
delay: 5
register: instance_count2
until: instance_count2.stdout_lines | length == 3
- name: TEST Scaling Up instance
block:
- name: |
TEST Verify cpu high alarm has been triggered
ansible.builtin.shell: |
# source ~/overcloudrc;
{{ openstack_cmd }} alarm list -c state -c name -f value| \
grep -i "cpu_alarm_high" | \
grep -i "{{ stack_name }}" | \
awk '{print $2}'
retries: 100
delay: 5
register: result
until: result.stdout == "alarm"

- name: |
TEST Verify orchestration scaled up instances
ansible.builtin.shell: |
# source ~/overcloudrc;
{{ openstack_cmd }} server list --long | grep -i metering.server_group
retries: 100
delay: 5
register: instance_count2
until: instance_count2.stdout_lines | length == 3

- name: Ensure Scaling Up instance result is set
ansible.builtin.set_fact:
scaling_up_success: "{{ instance_count2.stdout_lines | length == 3 }}"

- name: Debug scaling_up_success
ansible.builtin.debug:
var: scaling_up_success


- name: Stop the busy process
ansible.builtin.shell: |
sshpass -p gocubsgo ssh cirros@{{ item | trim }} "sudo killall yes"
register: kill_busy_process
with_items: "{{ vnf_instance_ip.stdout_lines }}"

- name: |
TEST Verify cpu low alarm has been triggered
ansible.builtin.shell: |
# source ~/overcloudrc;
{{ openstack_cmd }} alarm list -c state -c name -f value| \
grep -i "cpu_alarm_low" | \
grep -i "{{ stack_name }}" | \
awk '{print $2}'
retries: 160
delay: 5
register: result
until: result.stdout == "alarm"
- name: TEST Scaling down instance
when: scaling_up_success | bool
block:
- name: |
TEST Verify cpu low alarm has been triggered
ansible.builtin.shell: |
# source ~/overcloudrc;
{{ openstack_cmd }} alarm list -c state -c name -f value| \
grep -i "cpu_alarm_low" | \
grep -i "{{ stack_name }}" | \
awk '{print $2}'
retries: 160
delay: 5
register: result
until: result.stdout == "alarm"

- name: |
TEST Verify Orchestration scaled down instances
ansible.builtin.shell: |
# source ~/overcloudrc;
export STACK_ID=$({{ openstack_cmd }} stack show {{ stack_name }} -c id -f value)
{{ openstack_cmd }} server list --long|grep -i metering.server_group=\'$STACK_ID\'
retries: 100
delay: 5
register: instance_count3
until: instance_count3.stdout_lines | length == 1
- name: |
TEST Verify Orchestration scaled down instances
ansible.builtin.shell: |
# source ~/overcloudrc;
export STACK_ID=$({{ openstack_cmd }} stack show {{ stack_name }} -c id -f value)
{{ openstack_cmd }} server list --long|grep -i metering.server_group=\'$STACK_ID\'
retries: 100
delay: 5
register: instance_count3
until: instance_count3.stdout_lines | length == 1