[openstack-dev] Neutron: Need help with tox failure in VPN code

Paul Michali pcm at cisco.com
Tue Mar 4 13:06:42 UTC 2014


Bo,

I did that change, and it passes when I run neutron.tests.unit.services.vpn, but not when I run full tox or neutron.tetss.unit.services.  I still get failures (either error code 10 or test fails with no info).

Irene,

Any thoughts on why the driver is not loading (even with the mod that Bo suggests)?

Nachi,

I just tried run_tests.sh and it fails to run the test (haven't used that in a very long time, so not sure I'm running it correctly). Do I need any special args, when running that? I tried './run_tests.sh -f -V -P' but it ran 0 tests.


All,

The bottom line here is that I can't seem to get the loading of service driver from neutron.conf, irrespective of the blueprint change set. If I use a hard coded driver (as is on master branch and used in the latest patch for 74144), all the tests work. But for this blueprint we need to be able to load the service driver (so that the blueprint driver can be loaded). The issue is unrelated to the blueprint functionality, as shown by the latest patch and by previous versions where I had the full service type framework implementation. It seems like there is some problem with this partial application of STF to load the service driver.

I took the (working) 74144 patch and made the changes below to load the service plugin from neutron.conf, and see tox failures. I've also patched this into the master branch, and I see the same issue!  IOW, there is something wrong with the method I'm using to setup the service driver at least with respect to the current test suite.

diff --git a/neutron/services/vpn/plugin.py b/neutron/services/vpn/plugin.py
index 5d818a3..41cbff0 100644
--- a/neutron/services/vpn/plugin.py
+++ b/neutron/services/vpn/plugin.py
@@ -18,11 +18,9 @@
 #
 # @author: Swaminathan Vasudevan, Hewlett-Packard
 
-# from neutron.db import servicetype_db as st_db
 from neutron.db.vpn import vpn_db
-# from neutron.plugins.common import constants
-# from neutron.services import service_base
-from neutron.services.vpn.service_drivers import ipsec as ipsec_driver
+from neutron.plugins.common import constants
+from neutron.services import service_base
 
 
 class VPNPlugin(vpn_db.VPNPluginDb):
@@ -41,12 +39,10 @@ class VPNDriverPlugin(VPNPlugin, vpn_db.VPNPluginRpcDbMixin):
     #TODO(nati) handle ikepolicy and ipsecpolicy update usecase
     def __init__(self):
         super(VPNDriverPlugin, self).__init__()
-        self.ipsec_driver = ipsec_driver.IPsecVPNDriver(self)
-        # Currently, if the following code is used, there are UT failures
-#         self.service_type_manager = st_db.ServiceTypeManager.get_instance()
-#         drivers, default_provider = service_base.load_drivers(
-#             constants.VPN, self)
-#         self.ipsec_driver = drivers[default_provider]
+        # Dynamically load the current service driver
+        drivers, default_provider = service_base.load_drivers(
+            constants.VPN, self)
+        self.ipsec_driver = drivers[default_provider]
 
     def _get_driver_for_vpnservice(self, vpnservice):
         return self.ipsec_driver
diff --git a/neutron/tests/unit/services/vpn/test_vpnaas_driver_plugin.py b/neutron/tests/unit/services/vpn/test_vpnaas_driver_plugin.py
index 8c25d7e..9531938 100644
--- a/neutron/tests/unit/services/vpn/test_vpnaas_driver_plugin.py
+++ b/neutron/tests/unit/services/vpn/test_vpnaas_driver_plugin.py
@@ -17,6 +17,7 @@
 import contextlib
 
 import mock
+from oslo.config import cfg
 
 from neutron.common import constants
 from neutron import context
@@ -44,6 +45,12 @@ class TestVPNDriverPlugin(test_db_vpnaas.TestVpnaas,
         self.driver = mock.Mock()
         self.driver.service_type = ipsec_driver.IPSEC
         driver_cls.return_value = self.driver
+        vpnaas_provider = (p_constants.VPN +
+                           ':vpnaas:neutron.services.vpn.'
+                           'service_drivers.ipsec.IPsecVPNDriver:default')
+        cfg.CONF.set_override('service_provider',
+                              [vpnaas_provider],
+                              'service_providers')
         super(TestVPNDriverPlugin, self).setUp(
             vpnaas_plugin=VPN_DRIVER_CLASS)


Any advise?


PCM (Paul Michali)

MAIL          pcm at cisco.com
IRC            pcm_  (irc.freenode.net)
TW            @pmichali
GPG key    4525ECC253E31A83
Fingerprint 307A 96BB 1A4C D2C7 931D 8D2D 4525 ECC2 53E3 1A83

On Mar 4, 2014, at 1:31 AM, Bo Lin <linb at vmware.com> wrote:

> I don't know whether i got your point. But try to modify /neutron/tests/unit/services/vpn/test_vpnaas_driver_plugin.py like the following, the error would be fixed:
> --- a/neutron/tests/unit/services/vpn/test_vpnaas_driver_plugin.py
> +++ b/neutron/tests/unit/services/vpn/test_vpnaas_driver_plugin.py
> @@ -17,6 +17,7 @@
> import contextlib
> 
> import mock
> +from oslo.config import cfg
> 
> from neutron.common import constants
> from neutron import context
> @@ -44,6 +45,11 @@ class TestVPNDriverPlugin(test_db_vpnaas.TestVpnaas,
> self.driver = mock.Mock()
> self.driver.service_type = ipsec_driver.IPSEC
> driver_cls.return_value = self.driver
> + vpnaas_provider = (p_constants.VPN +
> + ':vpnaas:neutron.services.vpn.'
> + 'service_drivers.ipsec.IPsecVPNDriver:default' )
> + cfg.CONF.set_override('service_provider',
> + [vpnaas_provider], 'service_providers')
> super(TestVPNDriverPlugin, self).setUp(
> vpnaas_plugin=VPN_DRIVER_CLASS)
> 
> 
> 
> From: "Paul Michali" <pcm at cisco.com>
> To: "OpenStack Development Mailing List (not for usage questions)" <openstack-dev at lists.openstack.org>
> Sent: Tuesday, March 4, 2014 1:28:48 PM
> Subject: [openstack-dev] Neutron: Need help with tox failure in VPN code
> 
> Hi,
> 
> I'm stuck and can use some guidance here…please!
> 
> I have a change set out for review that used the VPN Service Type Framework ( https://review.openstack.org/74144). Everything worked fine, passed Jenkins, etc.
> 
> Found out that the STF won't make it to I-3, so I removed the dependency from my change set and tried to modify the plugin.py file to use some STF logic (like LBaaS uses) to load the desired service driver that is specified as the default. Adjusted the code to no longer use provider info.
> 
> Well, in doing so, tox fails, and unfortunately there little info on the failure. This can be seen by running a subset of the tests, where 2 fail:
> 
> tox -e py27 -v -- neutron.tests.unit.services.vpn
> 
> only the name of a failing test case for one, and a mention of return code 10 on another and no other info on the failure reason. I didn't see this on a full tox run in my repo, but Jenkins failed and Akihiro noticed it too, in running the above subset of the suite (thanks!).
> 
> 
> I've narrow it down a bit, but have no idea why it fails…
> 
> One, it seems to be some interaction between test_vpnaas_driver_plugin.py and the two service driver tests (cisco_ipsec.py and ipsec.py). I can remove either one of the service driver tests cases, and it will still fail with the other one (so even the reference code fails).
> 
> Two, if I change plugin.py to set self.driver to the reference device driver (as is done in the latest patch set) it works fine with all test cases.
> 
> Three, it seems to be a test only issue, because I can run devstack with the login I have in plugin.py, currently commented out in __init__(), and successfully load either the reference or cisco service driver, by changing neutron.conf.
> 
> It seems like I'm doing something wrong in the loading of the service driver, or using this implementation, is somehow interacting with the tests.
> 
> If anyone has ideas on what is wrong, or a better way to load the service driver, please let me know. I was thinking I could read and parse neutron.conf manually and then load the service driver, but there must be a better way!
> 
> Thanks!
> 
> PCM (Paul Michali)
> 
> MAIL          pcm at cisco.com
> IRC            pcm_  (irc.freenode.net)
> TW            @pmichali
> GPG key    4525ECC253E31A83
> Fingerprint 307A 96BB 1A4C D2C7 931D 8D2D 4525 ECC2 53E3 1A83
> 
> 
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> https://urldefense.proofpoint.com/v1/url?u=http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=F5etm0B6kVJ9jleIhCvNyA%3D%3D%0A&m=J3ghWIVLPZdVsutjofb71dKYtoj4XxhrER%2FD8VzKRX0%3D%0A&s=09cf53ed99065938661b61453a717d77ba3b1ec069c48e356b358d472d3b526a
> 
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140304/aa9cc509/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140304/aa9cc509/attachment.pgp>


More information about the OpenStack-dev mailing list