def test_openvswitch_bridge_absent_removes_bridge(self): set_module_args(dict(state='absent', bridge='test-br')) commands = ['/usr/bin/ovs-vsctl -t 5 del-br test-br'] self.execute_module( changed=True, commands=commands, test_name='test_openvswitch_bridge_absent_removes_bridge')
def test_openvswitch_bridge_present_idempotent(self): set_module_args( dict(state='present', bridge='test-br', fail_mode='secure', external_ids={'foo': 'bar'})) self.execute_module( test_name='test_openvswitch_bridge_present_idempotent')
def test_openvswitch_db_absent_idempotent(self): set_module_args( dict(state='absent', table='Bridge', record='test-br', col='other_config', key='disable-in-band', value='true')) self.execute_module(test_name='test_openvswitch_db_absent_idempotent')
def test_openvswitch_db_present_stp_enable(self): set_module_args( dict(state='present', table='Bridge', record='test-br', col='stp_enable', value='true')) self.execute_module(changed=True, test_name='test_openvswitch_db_present_stp_enable')
def test_openvswitch_db_present_missing_key_on_map(self): set_module_args( dict(state='present', table='Bridge', record='test-br', col='other_config', value='false')) self.execute_module( failed=True, test_name='test_openvswitch_db_present_missing_key_on_map')
def test_openvswitch_db_present_idempotent_value(self): set_module_args({ "col": "other_config", "key": "pmd-cpu-mask", "record": ".", "table": "open_vswitch", "value": "0xaaa00000000" }) self.execute_module( test_name='test_openvswitch_db_present_idempotent_value')
def test_openvswitch_bridge_present_changes_fail_mode(self): set_module_args( dict(state='present', bridge='test-br', fail_mode='standalone', external_ids={'foo': 'bar'})) commands = ['/usr/bin/ovs-vsctl -t 5 set-fail-mode test-br standalone'] self.execute_module( changed=True, commands=commands, test_name='test_openvswitch_bridge_present_changes_fail_mode')
def test_openvswitch_bridge_present_clears_external_id(self): set_module_args( dict(state='present', bridge='test-br', fail_mode='secure', external_ids={'foo': ''})) commands = ['/usr/bin/ovs-vsctl -t 5 br-set-external-id test-br foo '] self.execute_module( changed=True, commands=commands, test_name='test_openvswitch_bridge_present_clears_external_id')
def test_openvswitch_bridge_updates_vlan(self): set_module_args({ 'state': 'present', 'bridge': 'test-br2', 'parent': 'test-br', 'vlan': 300 }) commands = ['/usr/bin/ovs-vsctl -t 5 set port test-br2 tag=300'] self.execute_module(changed=True, commands=commands, test_name='test_openvswitch_bridge_updates_vlan')
def test_openvswitch_bridge_present_creates_fake_bridge(self): set_module_args( dict(state='present', bridge='test-br2', parent='test-br', vlan=10)) commands = [ '/usr/bin/ovs-vsctl -t 5 add-br test-br2 test-br 10', ] self.execute_module( changed=True, commands=commands, test_name='test_openvswitch_bridge_present_creates_fake_bridge')
def test_openvswitch_db_present_updates_key(self): set_module_args( dict(state='present', table='Bridge', record='test-br', col='other_config', key='disable-in-band', value='false')) self.execute_module( changed=True, commands=[ '/usr/bin/ovs-vsctl -t 5 set Bridge test-br other_config' ':disable-in-band=false' ], test_name='test_openvswitch_db_present_updates_key')
def test_openvswitch_bridge_present_creates_bridge(self): set_module_args( dict(state='present', bridge='test-br', fail_mode='secure', external_ids={'foo': 'bar'})) commands = [ '/usr/bin/ovs-vsctl -t 5 add-br test-br', '/usr/bin/ovs-vsctl -t 5 set-fail-mode test-br secure', '/usr/bin/ovs-vsctl -t 5 br-set-external-id test-br foo bar' ] self.execute_module( changed=True, commands=commands, test_name='test_openvswitch_bridge_present_creates_bridge')
def test_openvswitch_bridge_present_runs_set_mode(self): set_module_args( dict(state='present', bridge='test-br', fail_mode='secure', external_ids={'foo': 'bar'}, set="bridge test-br datapath_type=netdev")) commands = [ '/usr/bin/ovs-vsctl -t 5 add-br test-br -- set bridge test-br' ' datapath_type=netdev', '/usr/bin/ovs-vsctl -t 5 set-fail-mode test-br secure', '/usr/bin/ovs-vsctl -t 5 br-set-external-id test-br foo bar' ] self.execute_module( changed=True, commands=commands, test_name='test_openvswitch_bridge_present_runs_set_mode')
def test_openvswitch_bridge_absent_idempotent(self): set_module_args(dict(state='absent', bridge='test-br')) self.execute_module( test_name='test_openvswitch_bridge_absent_idempotent')