Compare commits

...

9 Commits

Author SHA1 Message Date
Armando Migliaccio
c899a2ea3f Convert gate_hook to devstack-tools
Change-Id: I2387bc9778a77b1673751bc4c1ff50f8d4826a5d
Co-Authored-By: Ihar Hrachyshka <ihrachys@redhat.com>
Co-Authored-By: Sean Dague <sean@dague.net>
Original-Commit: Ibd0f67f9131e7f67f3a4a62cb6ad28bf80e11bbf
(cherry picked from commit e516b8230c)
2017-03-06 13:10:56 +00:00
Jenkins
d9e20c9892 Merge "Added --enable-snat option for router-gateway-set" into stable/newton 2016-12-02 03:38:13 +00:00
Armando Migliaccio
c07068a4d3 Disable VPNaaS functional tests in the neutronclient gate
This addresses failures for neutronclient's functional job of
advanced services. VPNaaS is no longer maintained and thus it
makes sense to stop gating against it. Hook and tests are kept
for local development and in case things will resurrect back
to life.

This patch also makes extension functional tests conditional to
the presence of the extension under test.

Closes-bug: #1645819

Conflicts:
        neutronclient/tests/functional/base.py

Change-Id: I17ab8accaa943b9ac04893b5e131be0afe0f5429
(cherry picked from commit a0f15a84d7)
2016-11-29 12:08:56 -08:00
Rodion Tikunov
0113ec4297 Added --enable-snat option for router-gateway-set
If enable_snat_by_default option set to false and disable snat via cli
it becomes unavailable to enable snat again.
This commit allows to enable snat after disabling it.

Change-Id: I01009d5cd5edd5be3eead615c37d6aa2e3224442
Closes-Bug: #1598171
(cherry picked from commit cc1d3fdd35)
2016-11-25 12:14:32 +00:00
Jenkins
4c197f69c9 Merge "Handle keystoneauth exceptions in retry logic" into stable/newton 2016-10-20 21:33:49 +00:00
Monty Taylor
47f6ac356b Handle keystoneauth exceptions in retry logic
The retry_logic in do_request catches neutronclient errors, but if a
SessionClient is being used, nothing throws neutronclient errors -
instead keystoneauth Session throws keystoneauth exceptions.

Add the keystoneauth.exceptions.ConnectionError to the things that
handle the error and retry.

Change-Id: If16e50ee53279652fbdfc2d13d5509f46a54124a
(cherry picked from commit b8a05333dd)
2016-09-27 20:07:18 +00:00
OpenStack Proposal Bot
ef91dbe127 Updated from global requirements
Change-Id: I9d977ba7a92ee3acbb474ee6281dce62656e293b
2016-09-22 21:16:15 +00:00
Ihar Hrachyshka
4072abac8d Use stable/newton for upper-constraints.txt and tox_install.sh
Change-Id: I1534140930771eb9757752c33f4548e486cf1371
2016-09-16 22:41:21 +00:00
Doug Hellmann
aca975c772 Update .gitreview for stable/newton
Change-Id: I7e7135af724c5d20d6c09a61c16620d4b326eb41
2016-09-02 09:43:29 -04:00
11 changed files with 58 additions and 10 deletions

View File

@@ -2,3 +2,4 @@
host=review.openstack.org
port=29418
project=openstack/python-neutronclient.git
defaultbranch=stable/newton

View File

@@ -234,6 +234,9 @@ class SetGatewayRouter(neutronV20.NeutronCommand):
parser.add_argument(
'external_network', metavar='EXTERNAL-NETWORK',
help=_('ID or name of the external network for the gateway.'))
parser.add_argument(
'--enable-snat', action='store_true',
help=_('Enable source NAT on the router gateway.'))
parser.add_argument(
'--disable-snat', action='store_true',
help=_('Disable source NAT on the router gateway.'))
@@ -256,6 +259,8 @@ class SetGatewayRouter(neutronV20.NeutronCommand):
_ext_net_id = neutronV20.find_resourceid_by_name_or_id(
neutron_client, 'network', parsed_args.external_network)
router_dict = {'network_id': _ext_net_id}
if parsed_args.enable_snat:
router_dict['enable_snat'] = True
if parsed_args.disable_snat:
router_dict['enable_snat'] = False
if parsed_args.fixed_ip:

View File

@@ -13,10 +13,15 @@
from neutronclient.tests.functional import base
class SimpleReadOnlyNeutronClientTest(base.ClientTestBase):
class SimpleReadOnlyNeutronFwv1ClientTest(base.ClientTestBase):
"""Tests for FWaaS v1 based client commands that are read only"""
def setUp(self):
super(SimpleReadOnlyNeutronFwv1ClientTest, self).setUp()
if not self.is_extension_enabled('fwaas'):
self.skipTest('FWaaS is not enabled')
def test_neutron_firewall_list(self):
firewall_list = self.parser.listing(self.neutron
('firewall-list'))

View File

@@ -25,6 +25,10 @@ class SimpleReadOnlyNeutronVpnClientTest(base.ClientTestBase):
* with and without optional parameters
* initially just check return codes, and later test command outputs
"""
def setUp(self):
super(SimpleReadOnlyNeutronVpnClientTest, self).setUp()
if not self.is_extension_enabled('vpnaas'):
self.skipTest('VPNaaS is not enabled')
def test_neutron_vpn_ikepolicy_list(self):
ikepolicy = self.parser.listing(self.neutron('vpn-ikepolicy-list'))

View File

@@ -63,3 +63,10 @@ class ClientTestBase(base.ClientTestBase):
def neutron(self, *args, **kwargs):
return self.clients.neutron(*args,
**kwargs)
def is_extension_enabled(self, extension_alias):
extensions = self.parser.listing(self.neutron('ext-list'))
for extension in extensions:
if extension_alias in extension['alias']:
return True
return False

View File

@@ -8,21 +8,34 @@ GATE_DEST=$BASE/new
NEUTRONCLIENT_PATH=$GATE_DEST/python-neutronclient
GATE_HOOKS=$NEUTRONCLIENT_PATH/neutronclient/tests/functional/hooks
DEVSTACK_PATH=$GATE_DEST/devstack
LOCAL_CONF=$DEVSTACK_PATH/late-local.conf
DSCONF=/tmp/devstack-tools/bin/dsconf
# Install devstack-tools used to produce local.conf; we can't rely on
# test-requirements.txt because the gate hook is triggered before neutronclient
# is installed
sudo -H pip install virtualenv
virtualenv /tmp/devstack-tools
/tmp/devstack-tools/bin/pip install -U devstack-tools==0.4.0
# Inject config from hook into localrc
function load_rc_hook {
local hook="$1"
local tmpfile
local config
tmpfile=$(tempfile)
config=$(cat $GATE_HOOKS/$hook)
export DEVSTACK_LOCAL_CONFIG+="
# generated from hook '$hook'
${config}
"
echo "[[local|localrc]]" > $tmpfile
$DSCONF setlc_raw $tmpfile "$config"
$DSCONF merge_lc $LOCAL_CONF $tmpfile
rm -f $tmpfile
}
if [ "$VENV" == "functional-adv-svcs" ]
then
load_rc_hook fwaas
load_rc_hook vpnaas
fi
export DEVSTACK_LOCALCONF=$(cat $LOCAL_CONF)
$BASE/new/devstack-gate/devstack-vm-gate.sh

View File

@@ -356,6 +356,18 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
{"network_id": "externalid"}}
)
def test_set_gateway_enable_snat(self):
# enable external gateway for router: myid externalid.
resource = 'router'
cmd = router.SetGatewayRouter(test_cli20.MyApp(sys.stdout), None)
args = ['myid', 'externalid', '--enable-snat']
self._test_update_resource(resource, cmd, 'myid',
args,
{"external_gateway_info":
{"network_id": "externalid",
"enable_snat": True}}
)
def test_set_gateway_disable_snat(self):
# set external gateway for router: myid externalid.
resource = 'router'

View File

@@ -22,6 +22,7 @@ import re
import time
import debtcollector.renames
from keystoneauth1 import exceptions as ksa_exc
import requests
import six.moves.urllib.parse as urlparse
from six import string_types
@@ -335,7 +336,7 @@ class ClientBase(object):
try:
return self.do_request(method, action, body=body,
headers=headers, params=params)
except exceptions.ConnectionFailed:
except (exceptions.ConnectionFailed, ksa_exc.ConnectionError):
# Exception has already been logged by do_request()
if i < self.retries:
_logger.debug('Retrying connection to Neutron service')

View File

@@ -5,7 +5,7 @@ pbr>=1.6 # Apache-2.0
cliff!=1.16.0,!=1.17.0,>=1.15.0 # Apache-2.0
debtcollector>=1.2.0 # Apache-2.0
iso8601>=0.1.11 # MIT
netaddr!=0.7.16,>=0.7.12 # BSD
netaddr!=0.7.16,>=0.7.13 # BSD
osc-lib>=1.0.2 # Apache-2.0
oslo.i18n>=2.1.0 # Apache-2.0
oslo.serialization>=1.10.0 # Apache-2.0

View File

@@ -5,7 +5,7 @@
# the constraints file before applying it for from-source installation.
ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
BRANCH_NAME=master
BRANCH_NAME=stable/newton
CLIENT_NAME=python-neutronclient
requirements_installed=$(echo "import openstack_requirements" | python 2>/dev/null ; echo $?)

View File

@@ -12,7 +12,7 @@ setenv = VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
usedevelop = True
install_command =
{toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
{toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/newton} {opts} {packages}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
# Delete bytecodes from normal directories before running tests.