db689f7221
openvswitch_db was not parsing properly some arguments, which caused some commands to be executed when they shouldn't. This commit fixesit and adds unit testing for the usecase. Closes-Bug: #55432 Closes-bug: #43858
183 lines
3.1 KiB
YAML
183 lines
3.1 KiB
YAML
---
|
|
|
|
- name: Make sure test bridge does not exist before tests
|
|
command: ovs-vsctl del-br br-test
|
|
become: yes
|
|
ignore_errors: yes
|
|
|
|
- name: Create test bridge
|
|
command: ovs-vsctl add-br br-test
|
|
become: yes
|
|
|
|
- name: Create bridge
|
|
openvswitch_db:
|
|
table: Bridge
|
|
record: br-test
|
|
col: other_config
|
|
key: disable-in-band
|
|
value: true
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is changed
|
|
|
|
- name: Create bridge again (idempotent)
|
|
openvswitch_db:
|
|
table: Bridge
|
|
record: br-test
|
|
col: other_config
|
|
key: disable-in-band
|
|
value: true
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is not changed
|
|
|
|
- name: Change key value with quotes
|
|
openvswitch_db:
|
|
table: open_vswitch
|
|
record: .
|
|
col: other_config
|
|
key: pmd-cpu-mask
|
|
value: "0xaaa00000000"
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is changed
|
|
|
|
- name: Change keyvalue with quotes(idempotent)
|
|
openvswitch_db:
|
|
table: open_vswitch
|
|
record: .
|
|
col: other_config
|
|
key: pmd-cpu-mask
|
|
value: "0xaaa00000000"
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is not changed
|
|
|
|
- name: Remove key value with quotes
|
|
openvswitch_db:
|
|
table: open_vswitch
|
|
record: .
|
|
col: other_config
|
|
key: pmd-cpu-mask
|
|
value: "0xaaa00000000"
|
|
state: absent
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is changed
|
|
|
|
- name: Change column value in a map
|
|
openvswitch_db:
|
|
table: Bridge
|
|
record: br-test
|
|
col: other_config
|
|
key: disable-in-band
|
|
value: false
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is changed
|
|
|
|
- name: Change column value in a map again (idempotent)
|
|
openvswitch_db:
|
|
table: Bridge
|
|
record: br-test
|
|
col: other_config
|
|
key: disable-in-band
|
|
value: false
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is not changed
|
|
|
|
- name: Change column value
|
|
openvswitch_db:
|
|
table: Bridge
|
|
record: br-test
|
|
col: stp_enable
|
|
value: true
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is changed
|
|
|
|
- name: Change column value again (idempotent)
|
|
openvswitch_db:
|
|
table: Bridge
|
|
record: br-test
|
|
col: stp_enable
|
|
value: true
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is not changed
|
|
|
|
- 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
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is failed
|
|
|
|
- name: Remove bridge
|
|
openvswitch_db:
|
|
table: Bridge
|
|
record: br-test
|
|
col: other_config
|
|
key: disable-in-band
|
|
value: false
|
|
state: absent
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is changed
|
|
|
|
- name: Remove bridge again (idempotent)
|
|
openvswitch_db:
|
|
table: Bridge
|
|
record: br-test
|
|
col: other_config
|
|
key: disable-in-band
|
|
value: false
|
|
state: absent
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result is not changed
|
|
|
|
- name: Tear down test bridge
|
|
command: ovs-vsctl del-br br-test
|
|
become: yes
|