Пример #1
0
 def _get_vif_driver(self, vif_type):
     vif_driver = self._vif_driver_cache.get(vif_type)
     if vif_driver:
         return vif_driver
     vif_driver = vif_utils.get_vif_driver(vif_type)
     self._vif_driver_cache[vif_type] = vif_driver
     return vif_driver
Пример #2
0
 def _test_get_vif_driver(self, expected_driver, vif_type,
                          network_class='nova.network.api.API',
                          expected_exception=None):
     self.flags(network_api_class=network_class)
     if expected_exception:
         self.assertRaises(expected_exception,
                           vif.get_vif_driver,
                           vif_type)
     else:
         actual_class = type(vif.get_vif_driver(vif_type))
         self.assertEqual(expected_driver, actual_class)