Fix tests and flake8 issues.
-fix flake8 issues -fix smoke test -fix dvs_vcenter_security test Change-Id: If10cfb5f26aa386cee034335af6a6bc1648d3cad
This commit is contained in:
parent
3362afb42b
commit
5b65862cdc
@ -1,20 +1,22 @@
|
|||||||
# Copyright (c) 2015 Cloudbase Solutions.
|
"""Copyright 2015 Mirantis, Inc.
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# 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 neutron.plugins.ml2.drivers.vmware_dvs.agent.dvs_neutron_agent as agent_main
|
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
not use this file except in compliance with the License. You may obtain
|
||||||
|
copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
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 neutron.plugins.ml2.drivers.vmware_dvs.agent.dvs_neutron_agent\
|
||||||
|
as agent_main
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
"""TODO."""
|
||||||
agent_main.main()
|
agent_main.main()
|
||||||
|
@ -1,4 +1,19 @@
|
|||||||
# -*- coding: utf-8 -*-
|
"""Copyright 2016 Mirantis, Inc.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
not use this file except in compliance with the License. You may obtain
|
||||||
|
copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
License for the specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
"""
|
||||||
|
|
||||||
|
# -*- coding: utf-8 -*- # noqa
|
||||||
#
|
#
|
||||||
# Fuel VMware DVS plugin documentation build configuration file, created by
|
# Fuel VMware DVS plugin documentation build configuration file, created by
|
||||||
# sphinx-quickstart on Fri Aug 14 12:14:29 2015.
|
# sphinx-quickstart on Fri Aug 14 12:14:29 2015.
|
||||||
@ -12,8 +27,6 @@
|
|||||||
# All configuration values have a default; values that are commented out
|
# All configuration values have a default; values that are commented out
|
||||||
# serve to show the default.
|
# serve to show the default.
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
|
|
||||||
# If extensions (or modules to document with autodoc) are in another directory,
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
# add these directories to sys.path here. If the directory is relative to the
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
@ -44,7 +57,7 @@ master_doc = 'index'
|
|||||||
|
|
||||||
# General information about the project.
|
# General information about the project.
|
||||||
project = u'Fuel VMware DVS plugin'
|
project = u'Fuel VMware DVS plugin'
|
||||||
copyright = u'2015, Mirantis Inc.'
|
copyright = u'2015, Mirantis Inc.' # noqa
|
||||||
|
|
||||||
# The version info for the project you're documenting, acts as replacement for
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
@ -181,7 +194,8 @@ htmlhelp_basename = 'FuelVMwareDVSplugindoc'
|
|||||||
|
|
||||||
# -- Options for LaTeX output ---------------------------------------------
|
# -- Options for LaTeX output ---------------------------------------------
|
||||||
|
|
||||||
latex_elements = { 'classoptions': ',openany,oneside', 'babel': '\\usepackage[english]{babel}'
|
latex_elements = {
|
||||||
|
'classoptions': ',openany,oneside', 'babel': '\\usepackage[english]{babel}'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Grouping the document tree into LaTeX files. List of tuples
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
@ -232,8 +246,8 @@ man_pages = [
|
|||||||
# (source start file, target name, title, author,
|
# (source start file, target name, title, author,
|
||||||
# dir menu entry, description, category)
|
# dir menu entry, description, category)
|
||||||
texinfo_documents = [
|
texinfo_documents = [
|
||||||
('index', 'FuelVMwareDVSplugin', u'Fuel VMware DVS plugin user\
|
('index', 'FuelVMwareDVSplugin', u'Fuel VMware DVS plugin user guide',
|
||||||
guide', u'Mirantis Inc.', 'FuelVMwareDVSplugin',\
|
u'Mirantis Inc.', 'FuelVMwareDVSplugin',
|
||||||
'One line description of project.', 'Miscellaneous'),
|
'One line description of project.', 'Miscellaneous'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ from fuelweb_test.settings import SERVTEST_TENANT
|
|||||||
from fuelweb_test.settings import SERVTEST_USERNAME
|
from fuelweb_test.settings import SERVTEST_USERNAME
|
||||||
|
|
||||||
from fuelweb_test.tests.base_test_case import TestBasic
|
from fuelweb_test.tests.base_test_case import TestBasic
|
||||||
from tests.test_plugin_vmware_dvs_smoke import TestDVSSmoke
|
|
||||||
|
|
||||||
from helpers import openstack
|
from helpers import openstack
|
||||||
|
|
||||||
@ -34,6 +33,8 @@ from proboscis import test
|
|||||||
|
|
||||||
from proboscis.asserts import assert_true
|
from proboscis.asserts import assert_true
|
||||||
|
|
||||||
|
from tests.test_plugin_vmware_dvs_smoke import TestDVSSmoke
|
||||||
|
|
||||||
|
|
||||||
@test(groups=["plugins"])
|
@test(groups=["plugins"])
|
||||||
class TestDVSMaintenance(TestBasic):
|
class TestDVSMaintenance(TestBasic):
|
||||||
|
@ -245,7 +245,8 @@ class TestDVSSmoke(TestBasic):
|
|||||||
cmd = 'fuel plugins --remove {0}=={1}'.format(
|
cmd = 'fuel plugins --remove {0}=={1}'.format(
|
||||||
plugin.plugin_name, plugin.DVS_PLUGIN_VERSION)
|
plugin.plugin_name, plugin.DVS_PLUGIN_VERSION)
|
||||||
|
|
||||||
assert_true(self.env.d_env.get_admin_remote().execute(cmd) == 0,
|
assert_true(
|
||||||
|
self.env.d_env.get_admin_remote().execute(cmd)['exit_code'] == 0,
|
||||||
'Can not remove plugin.')
|
'Can not remove plugin.')
|
||||||
|
|
||||||
self.show_step(3)
|
self.show_step(3)
|
||||||
|
@ -462,7 +462,7 @@ class TestDVSSystem(TestBasic):
|
|||||||
subnet = os_conn.create_subnet(
|
subnet = os_conn.create_subnet(
|
||||||
subnet_name=network['name'],
|
subnet_name=network['name'],
|
||||||
network_id=network['id'],
|
network_id=network['id'],
|
||||||
cidr=self.net_data[0][self.net_data[0].keys()[0]],
|
cidr=self.net_data[0]['net_1'],
|
||||||
ip_version=4)
|
ip_version=4)
|
||||||
|
|
||||||
logger.info("Check that network are created.")
|
logger.info("Check that network are created.")
|
||||||
@ -493,7 +493,12 @@ class TestDVSSystem(TestBasic):
|
|||||||
)
|
)
|
||||||
openstack.verify_instance_state(os_conn)
|
openstack.verify_instance_state(os_conn)
|
||||||
|
|
||||||
|
# Remove default security group
|
||||||
srv_list = os_conn.get_servers()
|
srv_list = os_conn.get_servers()
|
||||||
|
for srv in srv_list:
|
||||||
|
srv.remove_security_group(srv.security_groups[0]['name'])
|
||||||
|
os_conn.goodbye_security()
|
||||||
|
|
||||||
self.show_step(5)
|
self.show_step(5)
|
||||||
sec_name = ['SG1', 'SG2']
|
sec_name = ['SG1', 'SG2']
|
||||||
sg1 = os_conn.nova.security_groups.create(
|
sg1 = os_conn.nova.security_groups.create(
|
||||||
@ -509,11 +514,8 @@ class TestDVSSystem(TestBasic):
|
|||||||
icmp["security_group_rule"]["security_group_id"] = sg2.id
|
icmp["security_group_rule"]["security_group_id"] = sg2.id
|
||||||
os_conn.neutron.create_security_group_rule(icmp)
|
os_conn.neutron.create_security_group_rule(icmp)
|
||||||
|
|
||||||
logger.info("""Remove default security group
|
logger.info("""Attach SG_1 and SG2 to instances""")
|
||||||
and attach SG_1 and SG2 to instances""")
|
|
||||||
srv_list = os_conn.get_servers()
|
|
||||||
for srv in srv_list:
|
for srv in srv_list:
|
||||||
srv.remove_security_group(srv.security_groups[0]['name'])
|
|
||||||
srv.add_security_group(sg1.id)
|
srv.add_security_group(sg1.id)
|
||||||
srv.add_security_group(sg2.id)
|
srv.add_security_group(sg2.id)
|
||||||
|
|
||||||
@ -549,8 +551,6 @@ class TestDVSSystem(TestBasic):
|
|||||||
for rule in sg_rules:
|
for rule in sg_rules:
|
||||||
os_conn.neutron.delete_security_group_rule(rule['id'])
|
os_conn.neutron.delete_security_group_rule(rule['id'])
|
||||||
|
|
||||||
time.sleep(20) # need wait to update rules on dvs
|
|
||||||
|
|
||||||
self.show_step(12)
|
self.show_step(12)
|
||||||
for ip in floating_ip:
|
for ip in floating_ip:
|
||||||
try:
|
try:
|
||||||
@ -566,54 +566,40 @@ class TestDVSSystem(TestBasic):
|
|||||||
tcp["security_group_rule"]["direction"] = "egress"
|
tcp["security_group_rule"]["direction"] = "egress"
|
||||||
os_conn.neutron.create_security_group_rule(tcp)
|
os_conn.neutron.create_security_group_rule(tcp)
|
||||||
|
|
||||||
time.sleep(20) # need wait to update rules on dvs ports
|
|
||||||
|
|
||||||
self.show_step(14)
|
self.show_step(14)
|
||||||
for ips in ip_pair:
|
for ips in ip_pair:
|
||||||
openstack.remote_execute_command(ips[0], ips[1], ' ')
|
wait(
|
||||||
|
lambda: openstack.remote_execute_command(
|
||||||
|
ips[0], ips[1], ' '), timeout=30, interval=5)
|
||||||
|
|
||||||
self.show_step(15)
|
self.show_step(15)
|
||||||
with self.fuel_web.get_ssh_for_node(controller.name) as ssh_contr:
|
|
||||||
openstack.check_connection_vms(
|
openstack.check_connection_vms(
|
||||||
os_conn, floating_ip, remote=ssh_contr,
|
os_conn, floating_ip, remote=ssh_contr,
|
||||||
command='pingv4', result_of_command=1)
|
command='pingv4', result_of_command=1)
|
||||||
|
|
||||||
self.show_step(16)
|
self.show_step(16)
|
||||||
logger.info("Add Ingress and egress rules for ICMP protocol to SG_1")
|
|
||||||
icmp["security_group_rule"]["security_group_id"] = sg1.id
|
icmp["security_group_rule"]["security_group_id"] = sg1.id
|
||||||
os_conn.neutron.create_security_group_rule(icmp)
|
os_conn.neutron.create_security_group_rule(icmp)
|
||||||
icmp["security_group_rule"]["direction"] = "egress"
|
icmp["security_group_rule"]["direction"] = "egress"
|
||||||
os_conn.neutron.create_security_group_rule(icmp)
|
os_conn.neutron.create_security_group_rule(icmp)
|
||||||
|
|
||||||
time.sleep(20) # need wait to update rules on dvs ports
|
time.sleep(30) # need wait to update rules on dvs ports
|
||||||
|
|
||||||
self.show_step(17)
|
self.show_step(17)
|
||||||
with self.fuel_web.get_ssh_for_node(controller.name) as ssh_contr:
|
|
||||||
openstack.check_connection_vms(
|
openstack.check_connection_vms(
|
||||||
os_conn, floating_ip, remote=ssh_contr,
|
os_conn, floating_ip, remote=ssh_contr,
|
||||||
command='pingv4')
|
command='pingv4')
|
||||||
|
|
||||||
self.show_step(21)
|
self.show_step(21)
|
||||||
self.show_step(22)
|
|
||||||
srv_list = os_conn.get_servers()
|
srv_list = os_conn.get_servers()
|
||||||
for srv in srv_list:
|
for srv in srv_list:
|
||||||
for sg in srv.security_groups:
|
for sg in srv.security_groups:
|
||||||
srv.remove_security_group(sg['name'])
|
srv.remove_security_group(sg['name'])
|
||||||
|
self.show_step(22)
|
||||||
|
for srv in srv_list:
|
||||||
srv.add_security_group('default')
|
srv.add_security_group('default')
|
||||||
# need add tcp rule for ssh to instances
|
|
||||||
tcp["security_group_rule"]["security_group_id"] = \
|
|
||||||
[
|
|
||||||
sg['id']
|
|
||||||
for sg in os_conn.neutron.list_security_groups()[
|
|
||||||
'security_groups']
|
|
||||||
if sg['tenant_id'] == os_conn.get_tenant(SERVTEST_TENANT).id
|
|
||||||
if sg['name'] == 'default'][0]
|
|
||||||
tcp["security_group_rule"]["direction"] = "ingress"
|
|
||||||
os_conn.neutron.create_security_group_rule(tcp)
|
|
||||||
time.sleep(20) # need wait to update rules on dvs ports
|
|
||||||
|
|
||||||
|
time.sleep(30) # need wait to update rules on dvs ports
|
||||||
self.show_step(23)
|
self.show_step(23)
|
||||||
with self.fuel_web.get_ssh_for_node(controller.name) as ssh_contr:
|
|
||||||
openstack.check_connection_vms(
|
openstack.check_connection_vms(
|
||||||
os_conn, floating_ip, remote=ssh_contr,
|
os_conn, floating_ip, remote=ssh_contr,
|
||||||
command='pingv4')
|
command='pingv4')
|
||||||
@ -835,7 +821,7 @@ class TestDVSSystem(TestBasic):
|
|||||||
ip_version=4)
|
ip_version=4)
|
||||||
|
|
||||||
self.show_step(8)
|
self.show_step(8)
|
||||||
router = admin.create_router('router_1', tenant=tenant)
|
router = admin.create_router('router_1', tenant=tenant_admin)
|
||||||
admin.add_router_interface(
|
admin.add_router_interface(
|
||||||
router_id=router["id"],
|
router_id=router["id"],
|
||||||
subnet_id=subnet["id"])
|
subnet_id=subnet["id"])
|
||||||
|
Loading…
Reference in New Issue
Block a user