コード例 #1
0
 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')
コード例 #2
0
 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')
コード例 #3
0
 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')
コード例 #4
0
 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')
コード例 #5
0
 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')
コード例 #6
0
 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')
コード例 #7
0
 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')
コード例 #8
0
 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')
コード例 #9
0
 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')
コード例 #10
0
 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')
コード例 #11
0
 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')
コード例 #12
0
 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')
コード例 #13
0
 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')
コード例 #14
0
 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')