def test_create_agent_config_map_fails_for_invalid_tunnel_config(self):
     self.addCleanup(cfg.CONF.reset)
     # An ip address is required for tunneling but there is no default
     cfg.CONF.set_override('enable_tunneling', True, group='OVS')
     cfg.CONF.set_override('tunnel_type', 'gre', group='AGENT')
     with testtools.ExpectedException(ValueError):
         ovs_quantum_agent.create_agent_config_map(cfg.CONF)
 def test_create_agent_config_map_enable_tunneling(self):
     self.addCleanup(cfg.CONF.reset)
     # Verify setting only enable_tunneling will default tunnel_type to GRE
     cfg.CONF.set_override('tunnel_type', None, group='AGENT')
     cfg.CONF.set_override('enable_tunneling', True, group='OVS')
     cfg.CONF.set_override('local_ip', '10.10.10.10', group='OVS')
     cfgmap = ovs_quantum_agent.create_agent_config_map(cfg.CONF)
     self.assertEqual(cfgmap['tunnel_type'], constants.TYPE_GRE)
 def setUp(self):
     self.addCleanup(cfg.CONF.reset)
     # Avoid rpc initialization for unit tests
     cfg.CONF.set_override('rpc', False, group='AGENT')
     kwargs = ovs_quantum_agent.create_agent_config_map(cfg.CONF)
     with mock.patch('quantum.plugins.openvswitch.agent.ovs_quantum_agent.'
                     'OVSQuantumAgent.setup_integration_br',
                     return_value=mock.Mock()):
         self.agent = ovs_quantum_agent.OVSQuantumAgent(**kwargs)
     self.agent.plugin_rpc = mock.Mock()
     self.agent.context = mock.Mock()
     self.agent.agent_id = mock.Mock()
Beispiel #4
0
 def setUp(self):
     self.addCleanup(cfg.CONF.reset)
     # Avoid rpc initialization for unit tests
     cfg.CONF.set_override('rpc_backend',
                           'quantum.openstack.common.rpc.impl_fake')
     kwargs = ovs_quantum_agent.create_agent_config_map(cfg.CONF)
     with mock.patch('quantum.plugins.openvswitch.agent.ovs_quantum_agent.'
                     'OVSQuantumAgent.setup_integration_br',
                     return_value=mock.Mock()):
         with mock.patch('quantum.agent.linux.utils.get_interface_mac',
                         return_value='000000000001'):
             self.agent = ovs_quantum_agent.OVSQuantumAgent(**kwargs)
     self.agent.plugin_rpc = mock.Mock()
     self.agent.context = mock.Mock()
     self.agent.agent_id = mock.Mock()
 def setUp(self):
     self.addCleanup(cfg.CONF.reset)
     self.addCleanup(mock.patch.stopall)
     notifier_p = mock.patch(NOTIFIER)
     notifier_cls = notifier_p.start()
     self.notifier = mock.Mock()
     notifier_cls.return_value = self.notifier
     # Avoid rpc initialization for unit tests
     cfg.CONF.set_override("rpc_backend", "quantum.openstack.common.rpc.impl_fake")
     cfg.CONF.set_override("report_interval", 0, "AGENT")
     kwargs = ovs_quantum_agent.create_agent_config_map(cfg.CONF)
     with mock.patch(
         "quantum.plugins.openvswitch.agent.ovs_quantum_agent." "OVSQuantumAgent.setup_integration_br",
         return_value=mock.Mock(),
     ):
         with mock.patch("quantum.agent.linux.utils.get_interface_mac", return_value="000000000001"):
             self.agent = ovs_quantum_agent.OVSQuantumAgent(**kwargs)
     self.agent.sg_agent = mock.Mock()
 def setUp(self):
     super(TestOvsQuantumAgent, self).setUp()
     self.addCleanup(cfg.CONF.reset)
     self.addCleanup(mock.patch.stopall)
     notifier_p = mock.patch(NOTIFIER)
     notifier_cls = notifier_p.start()
     self.notifier = mock.Mock()
     notifier_cls.return_value = self.notifier
     # Avoid rpc initialization for unit tests
     cfg.CONF.set_override('rpc_backend',
                           'quantum.openstack.common.rpc.impl_fake')
     cfg.CONF.set_override('report_interval', 0, 'AGENT')
     kwargs = ovs_quantum_agent.create_agent_config_map(cfg.CONF)
     with mock.patch('quantum.plugins.openvswitch.agent.ovs_quantum_agent.'
                     'OVSQuantumAgent.setup_integration_br',
                     return_value=mock.Mock()):
         with mock.patch('quantum.agent.linux.utils.get_interface_mac',
                         return_value='000000000001'):
             self.agent = ovs_quantum_agent.OVSQuantumAgent(**kwargs)
     self.agent.sg_agent = mock.Mock()
Beispiel #7
0
 def setUp(self):
     super(TestOvsQuantumAgent, self).setUp()
     self.addCleanup(cfg.CONF.reset)
     self.addCleanup(mock.patch.stopall)
     notifier_p = mock.patch(NOTIFIER)
     notifier_cls = notifier_p.start()
     self.notifier = mock.Mock()
     notifier_cls.return_value = self.notifier
     # Avoid rpc initialization for unit tests
     cfg.CONF.set_override('rpc_backend',
                           'quantum.openstack.common.rpc.impl_fake')
     cfg.CONF.set_override('report_interval', 0, 'AGENT')
     kwargs = ovs_quantum_agent.create_agent_config_map(cfg.CONF)
     with mock.patch(
             'quantum.plugins.openvswitch.agent.ovs_quantum_agent.'
             'OVSQuantumAgent.setup_integration_br',
             return_value=mock.Mock()):
         with mock.patch('quantum.agent.linux.utils.get_interface_mac',
                         return_value='000000000001'):
             self.agent = ovs_quantum_agent.OVSQuantumAgent(**kwargs)
     self.agent.sg_agent = mock.Mock()
 def test_create_agent_config_map_fails_for_invalid_tunnel_config(self):
     self.addCleanup(cfg.CONF.reset)
     # An ip address is required for tunneling but there is no default
     cfg.CONF.set_override("enable_tunneling", True, group="OVS")
     with self.assertRaises(ValueError):
         ovs_quantum_agent.create_agent_config_map(cfg.CONF)
 def test_create_agent_config_map_succeeds(self):
     self.assertTrue(ovs_quantum_agent.create_agent_config_map(cfg.CONF))
Beispiel #10
0
 def test_create_agent_config_map_succeeds(self):
     self.assertTrue(ovs_quantum_agent.create_agent_config_map(cfg.CONF))
Beispiel #11
0
 def test_create_agent_config_map_fails_for_invalid_tunnel_config(self):
     self.addCleanup(cfg.CONF.reset)
     # An ip address is required for tunneling but there is no default
     cfg.CONF.set_override('enable_tunneling', True, group='OVS')
     with self.assertRaises(ValueError):
         ovs_quantum_agent.create_agent_config_map(cfg.CONF)