Compare commits
9 Commits
wallaby-em
...
newton-eol
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c899a2ea3f | ||
|
|
d9e20c9892 | ||
|
|
c07068a4d3 | ||
|
|
0113ec4297 | ||
|
|
4c197f69c9 | ||
|
|
47f6ac356b | ||
|
|
ef91dbe127 | ||
|
|
4072abac8d | ||
|
|
aca975c772 |
@@ -2,3 +2,4 @@
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=openstack/python-neutronclient.git
|
||||
defaultbranch=stable/newton
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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'))
|
||||
|
||||
@@ -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'))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 $?)
|
||||
|
||||
|
||||
2
tox.ini
2
tox.ini
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user