diff --git a/doc/requirements.txt b/doc/requirements.txt index 1a7c6cf..7080eba 100644 --- a/doc/requirements.txt +++ b/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 \ No newline at end of file diff --git a/lower-constraints.txt b/lower-constraints.txt index 1ea329c..62e4b4f 100644 --- a/lower-constraints.txt +++ b/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 diff --git a/requirements.txt b/requirements.txt index 08e435f..14fa1ab 100644 --- a/requirements.txt +++ b/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 diff --git a/test-requirements.txt b/test-requirements.txt index e9b22bd..732edb4 100644 --- a/test-requirements.txt +++ b/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 diff --git a/tox.ini b/tox.ini index a5f94fe..b925e9a 100644 --- a/tox.ini +++ b/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 diff --git a/vmware_nsx_tempest_plugin/lib/appliance_manager.py b/vmware_nsx_tempest_plugin/lib/appliance_manager.py index 2333cf2..a2b200e 100644 --- a/vmware_nsx_tempest_plugin/lib/appliance_manager.py +++ b/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 diff --git a/vmware_nsx_tempest_plugin/lib/traffic_manager.py b/vmware_nsx_tempest_plugin/lib/traffic_manager.py index 6f9df5e..6591a26 100644 --- a/vmware_nsx_tempest_plugin/lib/traffic_manager.py +++ b/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 diff --git a/vmware_nsx_tempest_plugin/plugin.py b/vmware_nsx_tempest_plugin/plugin.py index aeb9a39..b60ef23 100644 --- a/vmware_nsx_tempest_plugin/plugin.py +++ b/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 diff --git a/vmware_nsx_tempest_plugin/services/nsxv_client.py b/vmware_nsx_tempest_plugin/services/nsxv_client.py index 0639a4c..c7db2ab 100644 --- a/vmware_nsx_tempest_plugin/services/nsxv_client.py +++ b/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 \ diff --git a/vmware_nsx_tempest_plugin/services/openstack_network_clients.py b/vmware_nsx_tempest_plugin/services/openstack_network_clients.py index ab1e071..2e46e63 100644 --- a/vmware_nsx_tempest_plugin/services/openstack_network_clients.py +++ b/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 diff --git a/vmware_nsx_tempest_plugin/tests/api/test_provider_networks.py b/vmware_nsx_tempest_plugin/tests/api/test_provider_networks.py index 51d80c3..2211284 100644 --- a/vmware_nsx_tempest_plugin/tests/api/test_provider_networks.py +++ b/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 diff --git a/vmware_nsx_tempest_plugin/tests/api/test_qos.py b/vmware_nsx_tempest_plugin/tests/api/test_qos.py index 43636a6..85dd8cd 100644 --- a/vmware_nsx_tempest_plugin/tests/api/test_qos.py +++ b/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 diff --git a/vmware_nsx_tempest_plugin/tests/dvs/api/base_dvs.py b/vmware_nsx_tempest_plugin/tests/dvs/api/base_dvs.py index 638b186..ba4f9a8 100644 --- a/vmware_nsx_tempest_plugin/tests/dvs/api/base_dvs.py +++ b/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) diff --git a/vmware_nsx_tempest_plugin/tests/dvs/scenario/test_network_basic_ops.py b/vmware_nsx_tempest_plugin/tests/dvs/scenario/test_network_basic_ops.py index 8cbc6e3..70738fd 100644 --- a/vmware_nsx_tempest_plugin/tests/dvs/scenario/test_network_basic_ops.py +++ b/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) diff --git a/vmware_nsx_tempest_plugin/tests/nsxv/scenario/network_addon_methods.py b/vmware_nsx_tempest_plugin/tests/nsxv/scenario/network_addon_methods.py index 768fd6d..cd7e8b3 100644 --- a/vmware_nsx_tempest_plugin/tests/nsxv/scenario/network_addon_methods.py +++ b/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']) + 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 + return net_port # gateway=None means don't set gateway_ip in subnet diff --git a/vmware_nsx_tempest_plugin/tests/nsxv/scenario/test_admin_policy_basic_ops.py b/vmware_nsx_tempest_plugin/tests/nsxv/scenario/test_admin_policy_basic_ops.py index d8f934b..57ba6c6 100644 --- a/vmware_nsx_tempest_plugin/tests/nsxv/scenario/test_admin_policy_basic_ops.py +++ b/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)) diff --git a/vmware_nsx_tempest_plugin/tests/nsxv/scenario/test_dhcp_121.py b/vmware_nsx_tempest_plugin/tests/nsxv/scenario/test_dhcp_121.py index 2754d19..909bacb 100644 --- a/vmware_nsx_tempest_plugin/tests/nsxv/scenario/test_dhcp_121.py +++ b/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) diff --git a/vmware_nsx_tempest_plugin/tests/nsxv/scenario/test_multiple_transport_zones_basic_ops.py b/vmware_nsx_tempest_plugin/tests/nsxv/scenario/test_multiple_transport_zones_basic_ops.py index 99efe91..a3ebf29 100644 --- a/vmware_nsx_tempest_plugin/tests/nsxv/scenario/test_multiple_transport_zones_basic_ops.py +++ b/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) diff --git a/vmware_nsx_tempest_plugin/tests/nsxv3/api/test_ipv6_nsx_mac_learning.py b/vmware_nsx_tempest_plugin/tests/nsxv3/api/test_ipv6_nsx_mac_learning.py index 090b064..c97b7fb 100644 --- a/vmware_nsx_tempest_plugin/tests/nsxv3/api/test_ipv6_nsx_mac_learning.py +++ b/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' diff --git a/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_allowed_address_pair.py b/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_allowed_address_pair.py index 0d6ab8a..68a90e3 100644 --- a/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_allowed_address_pair.py +++ b/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 \ diff --git a/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_ipv6_provider_networks.py b/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_ipv6_provider_networks.py index 8314654..209d0b4 100644 --- a/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_ipv6_provider_networks.py +++ b/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 diff --git a/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_multi_hv_network_ops.py b/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_multi_hv_network_ops.py index 9f5518e..d47e56c 100644 --- a/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_multi_hv_network_ops.py +++ b/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) diff --git a/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_provider_security_group.py b/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_provider_security_group.py index a97822a..a9f08ba 100644 --- a/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_provider_security_group.py +++ b/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') diff --git a/vmware_nsx_tempest_plugin/tests/scenario/manager.py b/vmware_nsx_tempest_plugin/tests/scenario/manager.py index 584737e..0b6b75c 100644 --- a/vmware_nsx_tempest_plugin/tests/scenario/manager.py +++ b/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) diff --git a/vmware_nsx_tempest_plugin/tests/scenario/test_designate.py b/vmware_nsx_tempest_plugin/tests/scenario/test_designate.py index 00489b4..a6bc15c 100644 --- a/vmware_nsx_tempest_plugin/tests/scenario/test_designate.py +++ b/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') diff --git a/vmware_nsx_tempest_plugin/tests/scenario/test_new_case_coverage.py b/vmware_nsx_tempest_plugin/tests/scenario/test_new_case_coverage.py index 925cb38..a3b413f 100644 --- a/vmware_nsx_tempest_plugin/tests/scenario/test_new_case_coverage.py +++ b/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 diff --git a/vmware_nsx_tempest_plugin/tests/scenario/test_provider_networks.py b/vmware_nsx_tempest_plugin/tests/scenario/test_provider_networks.py index 3815f77..eb8af3c 100644 --- a/vmware_nsx_tempest_plugin/tests/scenario/test_provider_networks.py +++ b/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 diff --git a/vmware_nsx_tempest_plugin/tests/scenario/test_qos.py b/vmware_nsx_tempest_plugin/tests/scenario/test_qos.py index 14e89f3..d3d372e 100644 --- a/vmware_nsx_tempest_plugin/tests/scenario/test_qos.py +++ b/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. + +import subprocess +import time + from oslo_log import log as logging - -from subprocess import PIPE -from subprocess import Popen -from subprocess import STDOUT - 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) diff --git a/vmware_nsx_tempest_plugin/tests/uni-scale/test_dhcp_uni_dimensionalscale.py b/vmware_nsx_tempest_plugin/tests/uni-scale/test_dhcp_uni_dimensionalscale.py index 876ac26..d144a5f 100644 --- a/vmware_nsx_tempest_plugin/tests/uni-scale/test_dhcp_uni_dimensionalscale.py +++ b/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)