2017-06-12 13:13:41 +02:00
|
|
|
---
|
|
|
|
|
2017-11-21 13:34:27 +01:00
|
|
|
- name: Make sure test bridge does not exist before tests
|
|
|
|
command: ovs-vsctl del-br br-test
|
2018-07-10 15:55:09 +02:00
|
|
|
become: yes
|
2017-11-21 13:34:27 +01:00
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: Create test bridge
|
|
|
|
command: ovs-vsctl add-br br-test
|
2018-07-10 15:55:09 +02:00
|
|
|
become: yes
|
2017-06-12 13:13:41 +02:00
|
|
|
|
2017-06-12 17:41:10 +02:00
|
|
|
- name: Create bridge
|
|
|
|
openvswitch_db:
|
2017-06-12 13:13:41 +02:00
|
|
|
table: Bridge
|
|
|
|
record: br-test
|
|
|
|
col: other_config
|
|
|
|
key: disable-in-band
|
|
|
|
value: true
|
2018-07-10 15:55:09 +02:00
|
|
|
become: yes
|
2017-06-12 17:48:59 +02:00
|
|
|
register: result
|
2017-06-12 13:13:41 +02:00
|
|
|
|
2017-06-12 17:41:10 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: Create bridge again (idempotent)
|
|
|
|
openvswitch_db:
|
|
|
|
table: Bridge
|
|
|
|
record: br-test
|
|
|
|
col: other_config
|
|
|
|
key: disable-in-band
|
|
|
|
value: true
|
2018-07-10 15:55:09 +02:00
|
|
|
become: yes
|
2017-06-12 17:48:59 +02:00
|
|
|
register: result
|
2017-06-12 17:41:10 +02:00
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
2018-07-09 15:42:41 +02:00
|
|
|
- name: Change column value in a map
|
2017-06-12 17:41:10 +02:00
|
|
|
openvswitch_db:
|
2017-06-12 13:13:41 +02:00
|
|
|
table: Bridge
|
|
|
|
record: br-test
|
|
|
|
col: other_config
|
|
|
|
key: disable-in-band
|
|
|
|
value: false
|
2018-07-10 15:55:09 +02:00
|
|
|
become: yes
|
2017-06-12 17:48:59 +02:00
|
|
|
register: result
|
2017-06-12 13:13:41 +02:00
|
|
|
|
2017-06-12 17:41:10 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
2018-07-09 15:42:41 +02:00
|
|
|
- name: Change column value in a map again (idempotent)
|
2017-06-12 17:41:10 +02:00
|
|
|
openvswitch_db:
|
|
|
|
table: Bridge
|
|
|
|
record: br-test
|
|
|
|
col: other_config
|
|
|
|
key: disable-in-band
|
|
|
|
value: false
|
2018-07-10 15:55:09 +02:00
|
|
|
become: yes
|
2017-06-12 17:48:59 +02:00
|
|
|
register: result
|
2017-06-12 17:41:10 +02:00
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
2018-07-09 15:42:41 +02:00
|
|
|
- name: Change column value
|
|
|
|
openvswitch_db:
|
|
|
|
table: Bridge
|
|
|
|
record: br-test
|
|
|
|
col: stp_enable
|
2018-08-10 07:01:03 +02:00
|
|
|
value: 'true'
|
|
|
|
become: yes
|
2018-07-09 15:42:41 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: Change column value again (idempotent)
|
|
|
|
openvswitch_db:
|
|
|
|
table: Bridge
|
|
|
|
record: br-test
|
|
|
|
col: stp_enable
|
2018-08-10 07:01:03 +02:00
|
|
|
value: 'true'
|
|
|
|
become: yes
|
2018-07-09 15:42:41 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Try to set value on a map type without a key (negative)
|
|
|
|
ignore_errors: true
|
|
|
|
openvswitch_db:
|
|
|
|
table: Bridge
|
|
|
|
record: br-test
|
|
|
|
col: other_config
|
|
|
|
value: true
|
2018-08-10 07:01:03 +02:00
|
|
|
become: yes
|
2018-07-09 15:42:41 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == true"
|
|
|
|
|
2017-06-12 17:41:10 +02:00
|
|
|
- name: Remove bridge
|
|
|
|
openvswitch_db:
|
|
|
|
table: Bridge
|
|
|
|
record: br-test
|
|
|
|
col: other_config
|
|
|
|
key: disable-in-band
|
|
|
|
value: false
|
|
|
|
state: absent
|
2018-07-10 15:55:09 +02:00
|
|
|
become: yes
|
2017-06-12 17:48:59 +02:00
|
|
|
register: result
|
2017-06-12 17:41:10 +02:00
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: Remove bridge again (idempotent)
|
|
|
|
openvswitch_db:
|
2017-06-12 13:13:41 +02:00
|
|
|
table: Bridge
|
|
|
|
record: br-test
|
|
|
|
col: other_config
|
|
|
|
key: disable-in-band
|
|
|
|
value: false
|
|
|
|
state: absent
|
2018-07-10 15:55:09 +02:00
|
|
|
become: yes
|
2017-06-12 17:48:59 +02:00
|
|
|
register: result
|
2017-06-12 17:41:10 +02:00
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
2017-11-21 13:34:27 +01:00
|
|
|
|
|
|
|
- name: Tear down test bridge
|
|
|
|
command: ovs-vsctl del-br br-test
|
2018-07-10 15:55:09 +02:00
|
|
|
become: yes
|