コード例 #1
0
 def setUp(self):
     self.useFixture(base.OpenDaylightFeaturesFixture())
     self.useFixture(base.OpenDaylightJournalThreadFixture())
     self.useFixture(base.OpenDaylightPseudoAgentPrePopulateFixture())
     super(OpenDaylightMechanismDriverTestCase, self).setUp()
     self.mech = mech_driver_v2.OpenDaylightMechanismDriver()
     self.mech.initialize()
コード例 #2
0
ファイル: base_v2.py プロジェクト: sorrison/networking-odl
 def setUp(self):
     self.mock_sendjson = mock.patch.object(client.OpenDaylightRestClient,
                                            'sendjson').start()
     super(OpenDaylightTestCase, self).setUp()
     self.port_create_status = 'DOWN'
     self.mech = mech_driver_v2.OpenDaylightMechanismDriver()
     self.mock_sendjson.side_effect = self.check_sendjson
コード例 #3
0
    def test_bind_port_from_mech_driver_v2_with_vhostuser(self):
        given_client = self.mock_client('vhostuser_topology.json')
        self.mock_get_addresses_by_name(['127.0.0.1', '192.168.66.1'])
        given_network_topology = network_topology.NetworkTopologyManager(
            vif_details={'some': 'detail'},
            client=given_client)
        self.patch(
            network_topology, 'NetworkTopologyManager',
            return_value=given_network_topology)

        given_driver = mech_driver_v2.OpenDaylightMechanismDriver()
        given_driver._network_topology = given_network_topology
        given_port_context = self.given_port_context()

        given_driver.initialize()
        # when port is bound
        given_driver.bind_port(given_port_context)

        expected_vif_details = {
            'vhostuser_socket': '/var/run/openvswitch/vhuCURRENT_CON',
            'vhostuser_ovs_plug': True,
            'some': 'detail',
            'vhostuser_mode': 'client'}

        # then context binding is setup with returned vif_type and valid
        # segment api ID
        given_port_context.set_binding.assert_called_once_with(
            self.valid_segment[api.ID],
            portbindings.VIF_TYPE_VHOST_USER,
            expected_vif_details, status=n_constants.PORT_STATUS_ACTIVE)
コード例 #4
0
 def setUp(self):
     super(OpenDaylightMechanismDriverTestCase, self).setUp()
     self.db_session = neutron_db_api.get_session()
     self.mech = mech_driver_v2.OpenDaylightMechanismDriver()
     mock.patch.object(journal.OpendaylightJournalThread,
                       'start_odl_sync_thread').start()
     self.mech.initialize()
     self.thread = journal.OpendaylightJournalThread()
     self.addCleanup(self._db_cleanup)
コード例 #5
0
    def test_thread_call(self):
        """Verify that the sync thread method is called."""

        with mock.patch.object(journal.OpenDaylightJournalThread,
                               'start') as mock_sync_thread:
            self.mech = mech_driver_v2.OpenDaylightMechanismDriver()
            self.mech.initialize()

            # Create any object that would spin up the sync thread via the
            # decorator call_thread_on_end() used by all the event handlers.
            self._call_operation_object(odl_const.ODL_CREATE,
                                        odl_const.ODL_NETWORK)

            # Verify that the thread call was made.
            mock_sync_thread.assert_called()
コード例 #6
0
    def test_bind_port_from_mech_driver_v2_with_ovs(self):
        given_client = self.mock_client('ovs_topology.json')
        self.mock_get_addresses_by_name(['127.0.0.1', '10.237.214.247'])
        given_network_topology = network_topology.NetworkTopologyManager(
            vif_details={'some': 'detail'}, client=given_client)

        given_driver = mech_driver_v2.OpenDaylightMechanismDriver()
        given_driver._network_topology = given_network_topology
        given_port_context = self.given_port_context()

        # when port is bound
        given_driver.bind_port(given_port_context)

        # then context binding is setup with returned vif_type and valid
        # segment api ID
        given_port_context.set_binding.assert_called_once_with(
            self.valid_segment[driver_api.ID],
            portbindings.VIF_TYPE_OVS, {'some': 'detail'},
            status=n_constants.PORT_STATUS_ACTIVE)
コード例 #7
0
 def setUp(self):
     config.cfg.CONF.set_override("core_plugin",
                                  'neutron.plugins.ml2.plugin.Ml2Plugin')
     core_plugin = config.cfg.CONF.core_plugin
     super(OpenDaylightL3TestCase, self).setUp(plugin=core_plugin)
     config.cfg.CONF.set_override('mechanism_drivers',
                                  ['logger', 'opendaylight'], 'ml2')
     config.cfg.CONF.set_override('url', 'http://127.0.0.1:9999', 'ml2_odl')
     config.cfg.CONF.set_override('username', 'someuser', 'ml2_odl')
     config.cfg.CONF.set_override('password', 'somepass', 'ml2_odl')
     mock.patch.object(journal.OpendaylightJournalThread,
                       'start_odl_sync_thread').start()
     self.db_session = neutron_db_api.get_session()
     self.mech = mech_driver_v2.OpenDaylightMechanismDriver()
     self.plugin = manager.NeutronManager.get_plugin()
     self.plugin._network_is_external = mock.Mock(return_value=True)
     self.driver = l3_odl_v2.OpenDaylightL3RouterPlugin()
     self.thread = journal.OpendaylightJournalThread()
     self.driver.get_floatingip = mock.Mock(
         return_value={
             'router_id': ROUTER_ID,
             'floating_network_id': NETWORK_ID
         })
     self.addCleanup(self._db_cleanup)
コード例 #8
0
 def setUp(self):
     super(OpenDaylightMechanismDriverTestCase, self).setUp()
     self.db_session = neutron_db_api.get_session()
     self.mech = mech_driver_v2.OpenDaylightMechanismDriver()
     self.mech.initialize()
     self.thread = journal.OpendaylightJournalThread()
コード例 #9
0
 def setUp(self):
     super(OpenDaylightMechanismDriverTestCase, self).setUp()
     self.useFixture(odl_base.OpenDaylightFeaturesFixture())
     self.db_session = neutron_db_api.get_writer_session()
     self.mech = mech_driver_v2.OpenDaylightMechanismDriver()
     self.mech.initialize()
コード例 #10
0
 def test_dhcp_driver_not_loaded_without_flag(self):
     mech = mech_driver_v2.OpenDaylightMechanismDriver()
     mech.initialize()
     args = [mech, 'dhcp_driver']
     self.assertRaises(AttributeError, getattr, *args)
コード例 #11
0
 def setUp(self):
     super(OdlDhcpDriverTestCase, self).setUp()
     self.cfg.config(enable_dhcp_service=True, group='ml2_odl')
     self.mech = mech_driver_v2.OpenDaylightMechanismDriver()
     self.mech.initialize()