summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikos Karandreas <nick@intracom-telecom.com>2018-10-18 09:49:17 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-10-18 09:49:17 +0000
commit2147aa5c54101fa3bf58f2551315fc454c7dc2b6 (patch)
tree02585aac45a4e38f21d0bd6fae2fb408bcc404f8
parent90780e7d12b9003955cfbb8ff0155baf75b26323 (diff)
parent235cb921e06fbc979276aca8d753084033678df2 (diff)
Merge "Add flake8 and yamllint tox environments and fix tox errors"HEADmaster
-rw-r--r--docs/_static/favicon.icobin0 -> 15086 bytes
-rw-r--r--docs/_static/logo.pngbin0 -> 2829 bytes
-rw-r--r--docs/index.rst1
-rw-r--r--docs/release/release-notes/index.rst4
-rw-r--r--odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py1
-rwxr-xr-xodl-pipeline/lib/test_environment/test_environment.py1
-rwxr-xr-xodl-pipeline/lib/tripleo_introspector/tripleo_introspector.py1
-rwxr-xr-xodl-pipeline/lib/utils/processutils.py1
-rw-r--r--sdnvpn/lib/openstack_utils.py14
-rw-r--r--sdnvpn/test/functest/config.yaml19
-rw-r--r--sdnvpn/test/functest/testcase_10.py2
-rw-r--r--test-requirements.txt5
-rw-r--r--tox.ini46
13 files changed, 73 insertions, 22 deletions
diff --git a/docs/_static/favicon.ico b/docs/_static/favicon.ico
new file mode 100644
index 0000000..bbe55ab
--- /dev/null
+++ b/docs/_static/favicon.ico
Binary files differ
diff --git a/docs/_static/logo.png b/docs/_static/logo.png
new file mode 100644
index 0000000..1519503
--- /dev/null
+++ b/docs/_static/logo.png
Binary files differ
diff --git a/docs/index.rst b/docs/index.rst
index d07beb2..d58d5d5 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -17,6 +17,7 @@ OPNFV SDNVPN
release/configguide/index
release/userguide/index
release/installation/index
+ release/scenarios/os-odl-bgpvpn/index
development/requirements/index
development/overview/index
development/design/index
diff --git a/docs/release/release-notes/index.rst b/docs/release/release-notes/index.rst
index 2b6664a..c7e07ee 100644
--- a/docs/release/release-notes/index.rst
+++ b/docs/release/release-notes/index.rst
@@ -4,9 +4,9 @@
.. http://creativecommons.org/licenses/by/4.0
.. (c) Nikolas Hermanns, (nikolas.hermanns@ericsson.com) and others
-==================
+=====================
SDN VPN release notes
-==================
+=====================
.. toctree::
:maxdepth: 3
diff --git a/odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py b/odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py
index 9a8973f..3d29724 100644
--- a/odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py
+++ b/odl-pipeline/lib/odl_reinstaller/odl_reinstaller.py
@@ -281,5 +281,6 @@ class ODLReinstallerException(Exception):
def main():
ODLReInstaller().start()
+
if __name__ == '__main__':
main()
diff --git a/odl-pipeline/lib/test_environment/test_environment.py b/odl-pipeline/lib/test_environment/test_environment.py
index 65d40bb..a56c36f 100755
--- a/odl-pipeline/lib/test_environment/test_environment.py
+++ b/odl-pipeline/lib/test_environment/test_environment.py
@@ -157,5 +157,6 @@ def main():
main = TestEnvironment()
main.start()
+
if __name__ == '__main__':
main()
diff --git a/odl-pipeline/lib/tripleo_introspector/tripleo_introspector.py b/odl-pipeline/lib/tripleo_introspector/tripleo_introspector.py
index aa6ebbb..9258e83 100755
--- a/odl-pipeline/lib/tripleo_introspector/tripleo_introspector.py
+++ b/odl-pipeline/lib/tripleo_introspector/tripleo_introspector.py
@@ -122,5 +122,6 @@ class TripleOInspectorException(Exception):
def main():
TripleOIntrospector().start()
+
if __name__ == '__main__':
main()
diff --git a/odl-pipeline/lib/utils/processutils.py b/odl-pipeline/lib/utils/processutils.py
index 98162c8..901e74b 100755
--- a/odl-pipeline/lib/utils/processutils.py
+++ b/odl-pipeline/lib/utils/processutils.py
@@ -29,6 +29,7 @@ def _subprocess_setup():
# non-Python subprocesses expect.
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+
# NOTE(flaper87): The following globals are used by `mask_password`
_SANITIZE_KEYS = ['adminPass', 'admin_pass', 'password', 'admin_password']
diff --git a/sdnvpn/lib/openstack_utils.py b/sdnvpn/lib/openstack_utils.py
index cfacfa8..d377c33 100644
--- a/sdnvpn/lib/openstack_utils.py
+++ b/sdnvpn/lib/openstack_utils.py
@@ -410,7 +410,7 @@ def create_instance(flavor_name,
conn = get_os_connection()
try:
flavor = conn.compute.find_flavor(flavor_name, ignore_missing=False)
- except:
+ except Exception:
flavors = [flavor.name for flavor in conn.compute.flavors()]
logger.error("Error: Flavor '%s' not found. Available flavors are: "
"\n%s" % (flavor_name, flavors))
@@ -933,7 +933,7 @@ def create_secgroup_rule(conn, sg_id, direction, protocol,
try:
conn.network.create_security_group_rule(**secgroup_rule_attrs)
return True
- except:
+ except Exception:
logger.exception("Impossible to create_security_group_rule,"
"security group rule probably already exists")
return False
@@ -1168,7 +1168,7 @@ def delete_volume(cloud, volume_id, forced=False):
for attachment in volume.attachments:
server = cloud.get_server(attachment.server_id)
cloud.detach_volume(server, volume)
- except:
+ except Exception:
logger.error(sys.exc_info()[0])
cloud.delete_volume(volume_id, force=True)
else:
@@ -1295,9 +1295,9 @@ def get_or_create_tenant_for_vnf(keystone_client, tenant_name,
return True
else:
return False
- except:
+ except Exception:
raise Exception("Impossible to create a Tenant for the VNF {}".format(
- tenant_name))
+ tenant_name))
def create_user(keystone_client, user_name, user_password,
@@ -1355,10 +1355,10 @@ def get_or_create_user_for_vnf(keystone_client, vnf_ref):
role_id = get_role_id(keystone_client, 'admin')
tenant_id = get_tenant_id(keystone_client, vnf_ref)
add_role_user(keystone_client, user_id, role_id, tenant_id)
- except:
+ except Exception:
logger.warn("Cannot associate user to role admin on tenant")
return created
- except:
+ except Exception:
raise Exception("Impossible to create a user for the VNF {}".format(
vnf_ref))
diff --git a/sdnvpn/test/functest/config.yaml b/sdnvpn/test/functest/config.yaml
index cd398ee..f77e8d7 100644
--- a/sdnvpn/test/functest/config.yaml
+++ b/sdnvpn/test/functest/config.yaml
@@ -1,5 +1,6 @@
+---
defaults:
- flavor: m1.tiny # adapt to your environment
+ flavor: m1.tiny # adapt to your environment
testcases:
sdnvpn.test.functest.testcase_1:
@@ -116,7 +117,8 @@ testcases:
sdnvpn.test.functest.testcase_4:
enabled: true
order: 4
- description: VPN provides connectivity between subnets using router association
+ description: "VPN provides connectivity between subnets using router \
+ association"
instance_1_name: sdnvpn-4-1
instance_2_name: sdnvpn-4-2
instance_3_name: sdnvpn-4-3
@@ -180,12 +182,14 @@ testcases:
sdnvpn.test.functest.testcase_9:
enabled: true
order: 9
- description: Verify that all OpenStack nodes OVS br-int have fail_mode set to secure.
+ description: "Verify that all OpenStack nodes OVS br-int have fail_mode \
+ set to secure."
sdnvpn.test.functest.testcase_10:
enabled: true
order: 10
- description: Test if interupts occure during ping, when removing and adding instances
+ description: "Test if interupts occure during ping, when removing and \
+ adding instances"
instance_1_name: sdnvpn-10-1
instance_2_name: sdnvpn-10-2
instance_3_name: sdnvpn-10-3
@@ -201,7 +205,8 @@ testcases:
sdnvpn.test.functest.testcase_11:
enabled: true
order: 11
- description: Check relevant OVS groups are removed upon deletion of OpenStack topology
+ description: "Check relevant OVS groups are removed upon deletion of \
+ OpenStack topology"
instance_1_name: sdnvpn-11-1
instance_2_name: sdnvpn-11-2
image_name: sdnvpn-image
@@ -252,5 +257,5 @@ testcases:
targets1: '88:88'
targets2: '88:88'
route_distinguishers:
- - '12:12'
- - '13:13'
+ - '12:12'
+ - '13:13'
diff --git a/sdnvpn/test/functest/testcase_10.py b/sdnvpn/test/functest/testcase_10.py
index dbfbfd4..3ba93a9 100644
--- a/sdnvpn/test/functest/testcase_10.py
+++ b/sdnvpn/test/functest/testcase_10.py
@@ -55,7 +55,7 @@ def monitor(conn, in_data, out_data, vm):
logger.info("Ping from instance {}: {}".
format(vm.name, console_line))
lines_offset = len(vm_console_out_lines)
- except:
+ except Exception:
# Atomic write to std out
with std_out_lock:
logger.error("Failure in monitor_thread of instance {}".
diff --git a/test-requirements.txt b/test-requirements.txt
new file mode 100644
index 0000000..646bbae
--- /dev/null
+++ b/test-requirements.txt
@@ -0,0 +1,5 @@
+# The order of packages is significant, because pip processes them in the order
+# of appearance. Changing the order has an impact on the overall integration
+# process, which may cause wedges in the gate later.
+flake8 # MIT
+yamllint
diff --git a/tox.ini b/tox.ini
index 69aa189..7880718 100644
--- a/tox.ini
+++ b/tox.ini
@@ -2,16 +2,52 @@
minversion = 1.6
envlist =
docs,
- docs-linkcheck
+ docs-linkcheck,
+ pep8,
+ yamllint
skipsdist = true
+[testenv]
+usedevelop = False
+setenv=
+ HOME = {envtmpdir}
+ PYTHONPATH = {toxinidir}
+deps =
+ -chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=master
+ -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=master
+ -r{toxinidir}/test-requirements.txt
+ -r{toxinidir}/requirements.txt
+install_command = pip install {opts} {packages}
+
[testenv:docs]
-deps = -rdocs/requirements.txt
+basepython = python2.7
+deps = -r{toxinidir}/docs/requirements.txt
commands =
- sphinx-build -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html
+ sphinx-build -W -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html
echo "Generated docs available in {toxinidir}/docs/_build/html"
whitelist_externals = echo
[testenv:docs-linkcheck]
-deps = -rdocs/requirements.txt
-commands = sphinx-build -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck
+basepython = python2.7
+deps = -r{toxinidir}/docs/requirements.txt
+commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck
+
+[testenv:yamllint]
+basepython = python2.7
+files =
+ {toxinidir}/docs
+ {toxinidir}/sdnvpn/test/functest/
+commands =
+ yamllint -s {[testenv:yamllint]files}
+
+[testenv:pep8]
+basepython = python2.7
+commands = flake8 {toxinidir}
+
+[flake8]
+# E123, E125 skipped as they are invalid PEP-8.
+
+show-source = True
+ignore = E123,E125
+builtins = _
+exclude = build,dist,doc,legacy,.eggs,.git,.tox,.venv,testapi_venv,venv