Handles all the tox errors in networking-brocade

Change-Id: Iac5d74e2164c8c725cb4a6bfc39e87bbc2d207ae
Closes-Bug: #1563040
changes/88/299188/3
bharathkumarelec 7 years ago
parent 3a4c8810c1
commit f540fe1def
  1. 1
      networking_brocade/test_discover/test_discover.py
  2. 6
      networking_brocade/vyatta/tests/test_vrouter_driver.py
  3. 13
      networking_brocade/vyatta/tests/test_vrouter_neutron_plugin.py
  4. 2
      networking_brocade/vyatta/vrouter/driver.py
  5. 10
      networking_brocade/vyatta/vrouter/neutron_plugin.py
  6. 2
      tox.ini

@ -31,6 +31,7 @@ def load_tests(loader, tests, pattern):
# './networking_brocade/vdx/tests/unit/ml2/drivers/brocade',
MLX_TEST_BASE_PATH + '/unit/ml2/drivers/brocade',
MLX_TEST_BASE_PATH + '/unit/services/l3_router/brocade',
'./networking_brocade/vyatta/tests'
}
for test_dir in test_dirs:
if not pattern:

@ -19,13 +19,13 @@ import urllib
from neutron import context
from neutron.db import models_v2
from neutron.openstack.common import uuidutils
from neutron.tests import base as n_base
from networking_brocade.vyatta.common import utils as vyatta_utils
from networking_brocade.vyatta.vrouter import client as vyatta_client
from networking_brocade.vyatta.vrouter import driver as vrouter_driver
from oslo_utils import uuidutils
_uuid = uuidutils.generate_uuid
@ -49,7 +49,7 @@ class TestVRouterDriver(n_base.BaseTestCase):
# '_management_network').return_value = _uuid()
self._nova_client = mock_patch(
'novaclient.v1_1.client.Client').return_value
'novaclient.v2.client.Client').return_value
self._server = self._create_server()
self._nova_client.servers.create.return_value = self._server
@ -204,7 +204,7 @@ class TestVRouterDriverApi(n_base.BaseTestCase):
super(TestVRouterDriverApi, self).setUp()
self._nova_client = mock_patch(
'novaclient.v1_1.client.Client').return_value
'novaclient.v2.client.Client').return_value
# self._mock_object(vrouter_driver.VyattaVRouterDriver,
# '_management_network')

@ -22,7 +22,6 @@ from neutron.db import external_net_db
from neutron.db import models_v2
from neutron.db import securitygroups_rpc_base as sg_db_rpc
from neutron.extensions import l3
from neutron.openstack.common import uuidutils
from neutron.tests.unit.db import test_db_base_plugin_v2 as test_db_plugin
from neutron.tests.unit.extensions import test_l3 as test_l3_plugin
from neutron.tests.unit import testlib_api
@ -31,6 +30,8 @@ from neutron.tests.unit import testlib_api
from networking_brocade.vyatta.common import utils as vyatta_utils
from networking_brocade.vyatta.vrouter import neutron_plugin as vrouter_plugin
from oslo_utils import uuidutils
_uuid = uuidutils.generate_uuid
@ -44,6 +45,9 @@ class VRouterTestPlugin(vrouter_plugin.VyattaVRouterMixin,
external_net_db.External_net_db_mixin,
sg_db_rpc.SecurityGroupServerRpcMixin):
def __init__(self):
self.set_ipam_backend()
def delete_port(self, context, port_id, l3_port_check=False):
super(VRouterTestPlugin, self).delete_port(context, port_id)
@ -66,6 +70,7 @@ class TestVyattaVRouterPlugin(testlib_api.SqlTestCase):
self.context = context.get_admin_context()
self.plugin = VRouterTestPlugin()
self.plugin.driver = self.driver
session = self.context.session
with session.begin(subtransactions=True):
@ -90,8 +95,7 @@ class TestVyattaVRouterPlugin(testlib_api.SqlTestCase):
network = models_v2.Network(tenant_id='fake-tenant-id',
name='test-network-{0}'.format(n),
status='ACTIVE',
admin_state_up=True,
shared=is_shared)
admin_state_up=True)
session.add(network)
session.flush()
if is_external:
@ -109,8 +113,7 @@ class TestVyattaVRouterPlugin(testlib_api.SqlTestCase):
ip_version=4,
cidr='{0}.0/24'.format(cidr_prefix),
gateway_ip='{0}.1'.format(cidr_prefix),
enable_dhcp=True,
shared=False)
enable_dhcp=True)
session.add(subnet)
session.flush()
ippool = models_v2.IPAllocationPool(

@ -25,7 +25,7 @@ from neutron.common import log
from neutron.db import models_v2
from neutron.i18n import _LE, _LI
from novaclient import exceptions as nova_exc
from novaclient.v1_1 import client as novaclient
from novaclient.v2 import client as novaclient
from networking_brocade.vyatta.common import config
from networking_brocade.vyatta.common import exceptions as v_exc

@ -137,8 +137,14 @@ class VyattaVRouterMixin(common_db_mixin.CommonDbMixin,
context.session.delete(router_db)
if gw_info != attributes.ATTR_NOT_SPECIFIED:
self._update_router_gw_info(context, router_db['id'], gw_info)
router_dict[l3.EXTERNAL_GW_INFO] = gw_info
try:
self._update_router_gw_info(context, router_db['id'], gw_info)
router_dict[l3.EXTERNAL_GW_INFO] = gw_info
except q_exc.NeutronException:
self.delete_router(context, router_id)
with excutils.save_and_reraise_exception():
with context.session.begin(subtransactions=True):
context.session.delete(router_db)
return self._make_router_dict(router_db)

@ -8,7 +8,7 @@ usedevelop = True
install_command = pip install -U {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
deps = -egit+https://git.openstack.org/openstack/neutron#egg=neutron
deps = -egit+https://git.openstack.org/openstack/neutron@stable/liberty#egg=neutron
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
whitelist_externals = sh

Loading…
Cancel
Save