Browse Source

update hacking and bandit

This patch updates hacking and bandit versions to match what neutron
and others are doing. It also fixes and ignores some pep8 errors
that crop up due to the version bump.

Change-Id: I99fa046475847400f8b0174c700d1b586766caa5
changes/62/662262/3
Boden R 2 years ago
committed by Kobi Samoray
parent
commit
e220ca0203
  1. 4
      doc/requirements.txt
  2. 7
      lower-constraints.txt
  3. 2
      requirements.txt
  4. 7
      test-requirements.txt
  5. 2
      tox.ini
  6. 3
      vmware_nsx_tempest_plugin/lib/appliance_manager.py
  7. 1
      vmware_nsx_tempest_plugin/lib/traffic_manager.py
  8. 2
      vmware_nsx_tempest_plugin/plugin.py
  9. 4
      vmware_nsx_tempest_plugin/services/nsxv_client.py
  10. 3
      vmware_nsx_tempest_plugin/services/openstack_network_clients.py
  11. 4
      vmware_nsx_tempest_plugin/tests/api/test_provider_networks.py
  12. 3
      vmware_nsx_tempest_plugin/tests/api/test_qos.py
  13. 8
      vmware_nsx_tempest_plugin/tests/dvs/api/base_dvs.py
  14. 4
      vmware_nsx_tempest_plugin/tests/dvs/scenario/test_network_basic_ops.py
  15. 20
      vmware_nsx_tempest_plugin/tests/nsxv/scenario/network_addon_methods.py
  16. 2
      vmware_nsx_tempest_plugin/tests/nsxv/scenario/test_admin_policy_basic_ops.py
  17. 18
      vmware_nsx_tempest_plugin/tests/nsxv/scenario/test_dhcp_121.py
  18. 4
      vmware_nsx_tempest_plugin/tests/nsxv/scenario/test_multiple_transport_zones_basic_ops.py
  19. 4
      vmware_nsx_tempest_plugin/tests/nsxv3/api/test_ipv6_nsx_mac_learning.py
  20. 24
      vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_allowed_address_pair.py
  21. 4
      vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_ipv6_provider_networks.py
  22. 4
      vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_multi_hv_network_ops.py
  23. 24
      vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_provider_security_group.py
  24. 4
      vmware_nsx_tempest_plugin/tests/scenario/manager.py
  25. 13
      vmware_nsx_tempest_plugin/tests/scenario/test_designate.py
  26. 3
      vmware_nsx_tempest_plugin/tests/scenario/test_new_case_coverage.py
  27. 4
      vmware_nsx_tempest_plugin/tests/scenario/test_provider_networks.py
  28. 17
      vmware_nsx_tempest_plugin/tests/scenario/test_qos.py
  29. 2
      vmware_nsx_tempest_plugin/tests/uni-scale/test_dhcp_uni_dimensionalscale.py

4
doc/requirements.txt

@ -1,4 +1,4 @@
sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD
sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD
sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD
openstackdocstheme>=1.18.1 # Apache-2.0
reno>=2.5.0 # Apache-2.0
mock>=2.0.0 # BSD

7
lower-constraints.txt

@ -1,14 +1,15 @@
coverage==4.0
hacking==0.12.0
hacking>=1.1.0 # Apache-2.0
flake8-import-order==0.12
mock==2.0.0
neutron-lib==1.25.0
neutron-lib==1.26.0
openstackdocstheme==1.18.1
os-testr==1.0.0
oslotest==3.2.0
pbr==4.0.0
pylint==1.7.1
python-subunit==1.0.0
reno==2.5.0
Sphinx==1.6.5
stestr==2.0.0
tempest==17.1.0
testtools==2.2.0

2
requirements.txt

@ -3,4 +3,4 @@
# process, which may cause wedges in the gate later.
pbr>=4.0.0 # Apache-2.0
neutron-lib>=1.25.0 # Apache-2.0
neutron-lib>=1.26.0 # Apache-2.0

7
test-requirements.txt

@ -2,10 +2,12 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking<0.13,>=0.12.0 # Apache-2.0
hacking>=1.1.0 # Apache-2.0
bandit>=1.1.0 # Apache-2.0
bandit!=1.6.0,>=1.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
flake8-import-order==0.12 # LGPLv3
mock>=2.0.0 # BSD
python-subunit>=1.0.0 # Apache-2.0/BSD
oslotest>=3.2.0 # Apache-2.0
testtools>=2.2.0 # MIT
@ -13,4 +15,5 @@ testtools>=2.2.0 # MIT
reno>=2.5.0 # Apache-2.0
tempest>=17.1.0 # Apache-2.0
os-testr>=1.0.0 # Apache-2.0
pylint==1.7.6 # GPLv2
stestr>=2.0.0 # Apache-2.0

2
tox.ini

@ -82,7 +82,7 @@ commands = oslo_debug_helper {posargs}
# E123, E125 skipped as they are invalid PEP-8.
show-source = True
ignore = E125,E126,E128,E129,E265,H305,H307,H404,H405,H904,N530,N531
ignore = E125,E126,E128,E129,E265,H305,H307,H404,H405,H904,N530,N531,W504
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,.ropeproject
import-order-style = pep8

3
vmware_nsx_tempest_plugin/lib/appliance_manager.py

@ -12,12 +12,13 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import collections
import re
import netaddr
from oslo_log import log as logging
from oslo_utils import netutils
import re
from tempest import config
from tempest.lib.common.utils import data_utils

1
vmware_nsx_tempest_plugin/lib/traffic_manager.py

@ -18,6 +18,7 @@ import shlex
import subprocess
import tempfile
import time
import urllib3
from oslo_log import log as logging

2
vmware_nsx_tempest_plugin/plugin.py

@ -36,7 +36,7 @@ _opts = [
class VmwareNsxTempestPlugin(plugins.TempestPlugin):
"""Our addon configuration is defined at vmware_nsx_tempest_plugin/config.py
"""Our addon config is defined at vmware_nsx_tempest_plugin/config.py
1. register_opts() to register group/opts to Tempest
2. get_opt_lists() to pass config to Tempest

4
vmware_nsx_tempest_plugin/services/nsxv_client.py

@ -312,8 +312,8 @@ class VSMClient(object):
edges = self.get_all_edges()
edge_list = []
for e in edges:
if (not e['edgeStatus'] == 'GREY'
and not e['state'] == 'undeployed'):
if (not e['edgeStatus'] == 'GREY' and
not e['state'] == 'undeployed'):
p = re.compile(r'dhcp*')
if (p.match(e['name'])):
if version is not None and \

3
vmware_nsx_tempest_plugin/services/openstack_network_clients.py

@ -14,9 +14,10 @@
# under the License.
import json
import six
import time
import six
from oslo_log import log
from tempest import config
from tempest.lib.common import rest_client

4
vmware_nsx_tempest_plugin/tests/api/test_provider_networks.py

@ -57,8 +57,8 @@ class ProviderNetworks(feature_manager.FeatureManager):
vlan_flag = 0
vxlan_flag = 0
for tz in out:
if "transport_type" in tz.keys() and (vlan_flag == 0
or vxlan_flag == 0):
if "transport_type" in tz.keys() and \
(vlan_flag == 0 or vxlan_flag == 0):
if vxlan_flag == 0 and tz['transport_type'] == "OVERLAY":
cls.overlay_id = tz['id']
vxlan_flag = 1

3
vmware_nsx_tempest_plugin/tests/api/test_qos.py

@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
import time
import testtools
from tempest.api.network import base
from tempest import config
from tempest.lib.common.utils import data_utils

8
vmware_nsx_tempest_plugin/tests/dvs/api/base_dvs.py

@ -39,8 +39,8 @@ class BaseDvsAdminNetworkTest(base.BaseAdminNetworkTest):
@classmethod
def create_network(cls, **kwargs):
"""Wrapper utility that returns a test admin provider network."""
network_name = (kwargs.get('net_name')
or data_utils.rand_name('test-adm-net-'))
network_name = (kwargs.get('net_name') or
data_utils.rand_name('test-adm-net-'))
net_type = kwargs.get('net_type', "flat")
if tempest.test.is_extension_enabled('provider', 'network'):
body = {'name': network_name}
@ -59,8 +59,8 @@ class BaseDvsAdminNetworkTest(base.BaseAdminNetworkTest):
"""Wrapper utility that returns a test subnet."""
# The cidr and mask_bits depend on the ip version.
if cls._ip_version == 4:
cidr = netaddr.IPNetwork(CONF.network.project_network_cidr
or "192.168.101.0/24")
cidr = netaddr.IPNetwork(CONF.network.project_network_cidr or
"192.168.101.0/24")
mask_bits = CONF.network.project_network_mask_bits or 24
elif cls._ip_version == 6:
cidr = netaddr.IPNetwork(CONF.network.project_network_v6_cidr)

4
vmware_nsx_tempest_plugin/tests/dvs/scenario/test_network_basic_ops.py

@ -69,8 +69,8 @@ class TestDvsNetworkBasicOps(manager.NetworkScenarioTest):
def _create_subnet(self, network):
# The cidr and mask_bits depend on the ip version.
if self._ip_version == 4:
cidr = netaddr.IPNetwork(CONF.network.project_network_cidr
or "192.168.101.0/24")
cidr = netaddr.IPNetwork(CONF.network.project_network_cidr or
"192.168.101.0/24")
mask_bits = CONF.network.project_network_mask_bits or 24
elif self._ip_version == 6:
cidr = netaddr.IPNetwork(CONF.network.project_network_v6_cidr)

20
vmware_nsx_tempest_plugin/tests/nsxv/scenario/network_addon_methods.py

@ -194,16 +194,16 @@ def create_network(SELF, client=None, tenant_id=None, name=None, **kwargs):
def create_port(SELF, client=None, **kwargs):
if not client:
client = SELF.port_client
result = client.create_port(**kwargs)
net_port = result['port']
SELF.assertIsNotNone(result, 'Unable to allocate port')
SELF.addCleanup(test_utils.call_and_ignore_notfound_exc,
client.delete_port,
net_port['id'])
return net_port
if not client:
client = SELF.port_client
result = client.create_port(**kwargs)
net_port = result['port']
SELF.assertIsNotNone(result, 'Unable to allocate port')
SELF.addCleanup(test_utils.call_and_ignore_notfound_exc,
client.delete_port,
net_port['id'])
return net_port
# gateway=None means don't set gateway_ip in subnet

2
vmware_nsx_tempest_plugin/tests/nsxv/scenario/test_admin_policy_basic_ops.py

@ -530,7 +530,7 @@ class TestAdminPolicyBasicOps(dmgr.TopoDeployScenarioManager):
[self.fip_nasa_ames_1['floating_ip_address']])
def run_policy_BB_on_ames_BB_on_jpl(self):
### tenant jpl:policy_BB_GP, tenant ames:policy_BB_GP
# tenant jpl:policy_BB_GP, tenant ames:policy_BB_GP
self.log_exc_msg(
("Update tenant:ames to use policy_BB[%s] with group-ping"
% self.policy_BB))

18
vmware_nsx_tempest_plugin/tests/nsxv/scenario/test_dhcp_121.py

@ -62,8 +62,8 @@ class TestDHCP121BasicOps(dmgr.TopoDeployScenarioManager):
@classmethod
def skip_checks(cls):
super(TestDHCP121BasicOps, cls).skip_checks()
if not ((CONF.network.project_networks_reachable
or CONF.network.public_network_id) and
if not ((CONF.network.project_networks_reachable or
CONF.network.public_network_id) and
CONF.network.public_network_cidr):
msg = ('Either project_networks_reachable must be "true", or '
'public_network_id must be defined.')
@ -458,10 +458,16 @@ class TestDhcpHostRoutesBetweenVms(TestDHCP121BasicOps):
client_mgr = self.manager
next_hop = CONF.network.project_network_cidr
ip = next_hop.rsplit('/', 1)[0]
ip2int = lambda ipstr: struct.unpack('!I', socket.inet_aton(ipstr))[0]
ss = (ip2int(ip))
int2ip = lambda n: socket.inet_ntoa(struct.pack('!I', n))
new_network_cidr = (int2ip(ss + 256))
def ip2int(ipstr):
return struct.unpack('!I', socket.inet_aton(ipstr))[0]
ss = ip2int(ip)
def int2ip(n):
return socket.inet_ntoa(struct.pack('!I', n))
new_network_cidr = int2ip(ss + 256)
net_mask = str(CONF.network.project_network_mask_bits)
new_network_cidr = new_network_cidr + '/' + net_mask
cidr = netaddr.IPNetwork(new_network_cidr)

4
vmware_nsx_tempest_plugin/tests/nsxv/scenario/test_multiple_transport_zones_basic_ops.py

@ -47,8 +47,8 @@ class TestMultipleTransportZonesBasicOps(dmgr.TopoDeployScenarioManager):
@classmethod
def skip_checks(cls):
super(TestMultipleTransportZonesBasicOps, cls).skip_checks()
if not (CONF.network.project_networks_reachable
or CONF.network.public_network_id):
if not (CONF.network.project_networks_reachable or
CONF.network.public_network_id):
msg = ('Either project_networks_reachable must be "true", or '
'public_network_id must be defined.')
raise cls.skipException(msg)

4
vmware_nsx_tempest_plugin/tests/nsxv3/api/test_ipv6_nsx_mac_learning.py

@ -12,6 +12,8 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import time
from oslo_log import log as logging
from tempest import config
@ -23,8 +25,6 @@ from vmware_nsx_tempest_plugin.common import constants
from vmware_nsx_tempest_plugin.lib import feature_manager
from vmware_nsx_tempest_plugin.services import nsxv3_client
import time
CONF = config.CONF
CONF.validation.auth_method = 'None'

24
vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_allowed_address_pair.py

@ -237,18 +237,18 @@ class TestAllowedAddressPair(manager.NetworkScenarioTest):
def _check_server_connectivity(self, floating_ip,
remote_ip, private_key,
should_connect=True):
ssh_source = self.get_remote_client(floating_ip,
private_key=private_key)
msg = "ip address %s is reachable" % remote_ip
try:
self.assertTrue(self._check_remote_connectivity
(ssh_source, remote_ip, should_connect),
msg)
except Exception:
LOG.exception("Unable to access {dest} via ssh to "
"floating-ip {src}".format(dest=remote_ip,
src=floating_ip))
raise
ssh_source = self.get_remote_client(floating_ip,
private_key=private_key)
msg = "ip address %s is reachable" % remote_ip
try:
self.assertTrue(self._check_remote_connectivity
(ssh_source, remote_ip, should_connect),
msg)
except Exception:
LOG.exception("Unable to access {dest} via ssh to "
"floating-ip {src}".format(dest=remote_ip,
src=floating_ip))
raise
def _assign_ip_address(self, ssh_source, interface_name, ip_address):
ssh_source.exec_command("sudo ifconfig %s %s netmask 255.255.255.0 \

4
vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_ipv6_provider_networks.py

@ -63,8 +63,8 @@ class ProviderNetworks(feature_manager.FeatureManager):
vlan_flag = 0
vxlan_flag = 0
for tz in out:
if "transport_type" in tz.keys() and (vlan_flag == 0
or vxlan_flag == 0):
if "transport_type" in tz.keys() and (vlan_flag == 0 or
vxlan_flag == 0):
if vxlan_flag == 0 and tz['transport_type'] == "OVERLAY":
cls.overlay_id = tz['id']
vxlan_flag = 1

4
vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_multi_hv_network_ops.py

@ -53,8 +53,8 @@ class TestMultiHVNetworkOps(manager.NetworkScenarioTest):
@classmethod
def skip_checks(cls):
super(TestMultiHVNetworkOps, cls).skip_checks()
if not (CONF.network.project_networks_reachable
or CONF.network.public_network_id):
if not (CONF.network.project_networks_reachable or
CONF.network.public_network_id):
msg = ('Either project_networks_reachable must be "true", or '
'public_network_id must be defined.')
raise cls.skipException(msg)

24
vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_provider_security_group.py

@ -225,18 +225,18 @@ class TestProviderSecurityGroup(manager.NetworkScenarioTest):
def _check_server_connectivity(self, floating_ip,
remote_ip, private_key,
should_connect=True):
ssh_source = self.get_remote_client(floating_ip,
private_key=private_key)
msg = "ip address %s is reachable" % remote_ip
try:
self.assertTrue(self._check_remote_connectivity
(ssh_source, remote_ip, should_connect),
msg)
except Exception:
LOG.exception("Unable to access {dest} via ssh to "
"floating-ip {src}".format(dest=remote_ip,
src=floating_ip))
raise
ssh_source = self.get_remote_client(floating_ip,
private_key=private_key)
msg = "ip address %s is reachable" % remote_ip
try:
self.assertTrue(self._check_remote_connectivity
(ssh_source, remote_ip, should_connect),
msg)
except Exception:
LOG.exception("Unable to access {dest} via ssh to "
"floating-ip {src}".format(dest=remote_ip,
src=floating_ip))
raise
def _create_vms_without_psg(self, network_topo):
server_name_default = data_utils.rand_name('server-default-sec-group')

4
vmware_nsx_tempest_plugin/tests/scenario/manager.py

@ -817,8 +817,8 @@ class NetworkScenarioTest(ScenarioTest):
port_map = [(p["id"], fxip["ip_address"])
for p in ports
for fxip in p["fixed_ips"]
if netutils.is_valid_ipv4(fxip["ip_address"])
and p['status'] in p_status]
if netutils.is_valid_ipv4(fxip["ip_address"]) and
p['status'] in p_status]
inactive = [p for p in ports if p['status'] != 'ACTIVE']
if inactive:
LOG.warning("Instance has ports that are not ACTIVE: %s", inactive)

13
vmware_nsx_tempest_plugin/tests/scenario/test_designate.py

@ -12,14 +12,13 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import dns.resolver
import subprocess
import time
from oslo_log import log as logging
import dns.resolver
from oslo_log import log as logging
from tempest import config
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
@ -65,8 +64,8 @@ class TestZonesV2Ops(feature_manager.FeatureManager):
vlan_flag = 0
vxlan_flag = 0
for tz in out:
if "transport_type" in tz.keys() and (vlan_flag == 0
or vxlan_flag == 0):
if "transport_type" in tz.keys() and \
(vlan_flag == 0 or vxlan_flag == 0):
if vxlan_flag == 0 and tz['transport_type'] == "OVERLAY":
cls.overlay_id = tz['id']
vxlan_flag = 1
@ -391,8 +390,8 @@ class TestZonesScenario(TestZonesV2Ops):
answer = my_resolver.query(record['name'])
except Exception:
LOG.error('ns lookup failed on ext-vm')
if (record['name'] not in answer.response.to_text()
or fip not in answer.response.to_text()):
if (record['name'] not in answer.response.to_text() or
fip not in answer.response.to_text()):
LOG.error('failed to resolve dns for the instance')
raise Exception('DNS response does not have entry '
'for the instance')

3
vmware_nsx_tempest_plugin/tests/scenario/test_new_case_coverage.py

@ -14,9 +14,10 @@
# under the License.
import re
import testtools
import time
import testtools
from oslo_utils import uuidutils
from tempest import config
from tempest.lib.common.utils import data_utils

4
vmware_nsx_tempest_plugin/tests/scenario/test_provider_networks.py

@ -56,8 +56,8 @@ class ProviderNetworks(feature_manager.FeatureManager):
vlan_flag = 0
vxlan_flag = 0
for tz in out:
if "transport_type" in tz.keys() and (vlan_flag == 0
or vxlan_flag == 0):
if "transport_type" in tz.keys() and \
(vlan_flag == 0 or vxlan_flag == 0):
if vxlan_flag == 0 and tz['transport_type'] == "OVERLAY":
cls.overlay_id = tz['id']
vxlan_flag = 1

17
vmware_nsx_tempest_plugin/tests/scenario/test_qos.py

@ -12,12 +12,11 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_log import log as logging
from subprocess import PIPE
from subprocess import Popen
from subprocess import STDOUT
import subprocess
import time
from oslo_log import log as logging
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
@ -26,8 +25,6 @@ from tempest import test
from vmware_nsx_tempest_plugin.lib import feature_manager
from vmware_nsx_tempest_plugin.services import nsx_client
import time
CONF = config.CONF
CONF.validation.auth_method = 'None'
@ -286,8 +283,9 @@ class TestQosOps(feature_manager.FeatureManager):
src_server=self.topology_servers["qos_src_vm"],
dst_server=self.topology_servers["qos_dst_vm"],
traffic_type='udp', send_dscp='0', interface='eth0')
"""Check the entire file to see if any UDP packets are sent without configured
dscp value.Example capture all UDP packets with DSCP value !=12"""
# Check the entire file to see if any UDP packets are sent without
# configured dscp value.Example capture all UDP packets with
# DSCP value !=12
src_vm_ip_dict = self.topology_servers['qos_src_vm']['floating_ips'][0]
filter_string = ('tshark -r %s -Y '
'\"ip.dsfield.dscp != %s && udp.dstport == 49162 '
@ -295,7 +293,8 @@ class TestQosOps(feature_manager.FeatureManager):
(dscp_filename, str(dscp_value),
src_vm_ip_dict['fixed_ip_address'],
self.topology_servers['qos_dst_vm']))
p = Popen(filter_string, shell=True, stdout=PIPE, stderr=STDOUT)
p = subprocess.Popen(filter_string, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout, stderr = p.communicate()
LOG.info(stdout)
LOG.info(stderr)

2
vmware_nsx_tempest_plugin/tests/uni-scale/test_dhcp_uni_dimensionalscale.py

@ -77,7 +77,7 @@ class DHCPUnidimensionalScaleTest(feature_manager.FeatureManager):
self.assertIsNotNone(len(scale_switches), error_msg)
dhcp_servers = self.nsx.get_logical_dhcp_servers()
scale_dhcp_servers = [ds for ds in dhcp_servers
if ls['display_name'].startswith('uniscale-')]
if ds['display_name'].startswith('uniscale-')]
error_msg = ("Logical DHCP servers on backend doesn't match the "
"number of networks on OpenStack")
self.assertIsNotNone(len(scale_dhcp_servers), scale, error_msg)

Loading…
Cancel
Save