]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Improve unit test coverage for Cisco plugin base code
authorDane LeBlanc <leblancd@cisco.com>
Wed, 27 Nov 2013 22:24:35 +0000 (17:24 -0500)
committerDane LeBlanc <leblancd@cisco.com>
Wed, 27 Nov 2013 22:24:35 +0000 (17:24 -0500)
commit3cb9168822a0805a9b8904ce54577f3e3f05d9eb
tree1f6e4da0c0258859b48edaf9494baaec83077dab
parent15d5f1618c03ed655a441f78e4d903732a95b980
Improve unit test coverage for Cisco plugin base code

Closes-Bug: #1190621

This fix improves test code coverage for the file:
neutron/plugins/cisco/network_plugin.py
from 34% to 98%.

Some of the changes made to realize this code coverage improvements
are the following:
- Core API methods (create_network, update_network, etc.) have been
  removed from the core plugin (network_plugin.py). These methods
  are currently unused. Before this change, we relied on the underlying
  model layer to inform the core plugin whether or not the model layer
  was capable of handling these core API calls itself via a 'MANAGE_STATE'
  attribute. However, there is only one existing model layer
  implementation (i.e. for Nexus plugin; the N1KV plugin does not use
  network_plugin.py), and that model layer supports the core API calls.
  Given that it is unlikely that another model layer for the Cisco Nexus
  plugin will ever be developed (esp. with the availability of the ML2
  plugin), so it makes more sense to delete this untested code.
- Exception raising for non-existent credentials has been removed from
  get_credential_details and rename_credential methods since
  exceptions are already raised for this condition in lower-level
  credential database code.
- The schedule_host, associate_port, and detach_port methods are
  deleted because these essentially do nothing useful (log a debug
  message and then return None), since these methods look for
  the same-named methods in the model layer, but these methods are
  not defined in the model layer.
- The helper functions _invoke_device_plugins and _func_name are
  deleted because they are no longer used.
- In unit test code for the Cisco QoS and credentials database, calls
  are now made indirectly through the core plugin (network_plugin.py)
  extension API methods, as a quick-and-easy way to provide code
  coverage for these core plugin methods.

Change-Id: I0c0d9e2b251a7c0355d83e495912302c5cc4d032
neutron/plugins/cisco/models/virt_phy_sw_v2.py
neutron/plugins/cisco/network_plugin.py
neutron/tests/unit/cisco/test_network_db.py
neutron/tests/unit/cisco/test_network_plugin.py