Pytest: Add networking test cases
1. 237-Online-Static-Configuration.robot 2. 238-Show-Data-Network-Api.robot 3. 239-Show-Data-Network-Range-Api.robot 4. 411-Test-NAT-On-Router.robot 5. 419-Vxlan-Data-Network-Valid-Port-Creation.robot 6. 431-Vxlan-Interface-Address-Mode-Modifiable-When-Host-Locked.robot 7. 432-Vxlan-Data-Network-With-Valid-Multicast-Address.robot 8. 433-Vxlan-Data-Interface-Duplicate-Address-Not-Allowed.robot 9. 434-Verify-Vxlan-Data-Network-Segment-Range-Overlap.robot 10. 425-LLDP-Accelerated-NIC.robot 11. 421-Vxlan-DataInterface-Address-Mode-Set-To-Static.robot 12. 354-Create-And-Delete-Trunk.robot 13. 364-Create-Trunk-Childport-Equal-Mac-address.robot 14. 233-Verify-VSwitch-Settings-Cli.robot 15. 376-Verify-Horizon-Network-Topology-Config-Details.robot 16. 377-Horizon-Network-Topology-Select-Data-Networklist.robot 17. 395-Horizon-Topology-Provider-Network-Setup-Failure.robot 18. 401-Test-Verify-Compatible-NTP-Configuration.robot 19. 402-Not-Compatible-Configuration-External-OAM.robot 20. 403-Configuration-Validation-External-OAM.robot 21. 253-Provider-Network-Type.robot 22. 255-Verify-DVR-Router-Deletion.robot 23. 256-Multiple-Ports-Same-Network.robot 24. 329-QoS-Policy-Creation-Api.robot Signed-off-by: Yong Fu <fuyong@neusoft.com> Change-Id: Ic179bdb5734e128dda6cc4d181562c360204720f
This commit is contained in:
parent
005b2d5dc2
commit
6f51f1550b
|
@ -1,3 +1,12 @@
|
|||
from pytest import fixture, skip
|
||||
|
||||
from testfixtures.resource_mgmt import *
|
||||
from testfixtures.resource_create import *
|
||||
from testfixtures.config_host import *
|
||||
from keywords import system_helper
|
||||
from utils.tis_log import LOG
|
||||
|
||||
|
||||
@fixture(scope='session')
|
||||
def no_aio_system():
|
||||
LOG.fixture_step("(Session) Skip if AIO system")
|
||||
if system_helper.is_aio_system():
|
||||
skip('skip if AIO system')
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Configuration validation External OAM.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from keywords import system_helper
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_configuration_validation_external_oam():
|
||||
"""
|
||||
403-Configuration-Validation-External-OAM.robot
|
||||
Args:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
message = system_helper.modify_oam_ips(**{'oam_subnet': '10.10.0.0/164'}, fail_ok=True)[1]
|
||||
assert 'Invalid subnet oam_subnet 10.10.0.0/164.Please configure a valid' in message
|
|
@ -0,0 +1,69 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# This test case creates a trunk network and assosiate port to it.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
import getpass
|
||||
import os
|
||||
|
||||
import yaml
|
||||
from pytest import mark
|
||||
|
||||
from consts.auth import HostLinuxUser, Tenant
|
||||
from keywords import container_helper, network_helper, common
|
||||
from utils import cli, table_parser
|
||||
from utils.clients.ssh import ControllerClient
|
||||
|
||||
desired_caps = {"conf": {"neutron": {"DEFAULT": {"service_plugins": ['router', 'trunk']}}}}
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_create_and_delete_trunk(no_simplex):
|
||||
"""
|
||||
354-Create-And-Delete-Trunk.robot
|
||||
Args:
|
||||
no_simplex:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
try:
|
||||
con_ssh = ControllerClient.get_active_controller()
|
||||
net_id = network_helper.create_network(network_type='vlan',
|
||||
name='net-a', cleanup="function")[1]
|
||||
network_helper.create_subnet(net_id, subnet_range='192.168.3.0/24',
|
||||
name='subnet-a', cleanup="function")
|
||||
user_name = getpass.getuser()
|
||||
yaml_path = os.path.join('/home/{}/'.format(user_name), "neutron-overrides-trunk.yaml")
|
||||
with open(yaml_path, "w", encoding="utf-8") as f:
|
||||
yaml.dump(desired_caps, f)
|
||||
common.scp_from_test_server_to_active_controller(yaml_path, HostLinuxUser.get_home())
|
||||
app_dir = HostLinuxUser.get_home()
|
||||
file_path = os.path.join(app_dir, "neutron-overrides-trunk.yaml")
|
||||
container_helper.update_helm_override(app_name='stx-openstack', chart='neutron',
|
||||
namespace='openstack', yaml_file=file_path)
|
||||
container_helper.apply_app(app_name='stx-openstack', applied_timeout=1200,
|
||||
check_interval=30)
|
||||
network_helper.create_port(net_id, 'parentport', cleanup="function")
|
||||
network_helper.create_port(net_id, 'subport', cleanup="function")
|
||||
args = '--parent-port parentport --subport port=subport,segmentation-type=vlan,' \
|
||||
'segmentation-id=123 trunk00'
|
||||
code, output = cli.openstack('network trunk create', args,
|
||||
ssh_client=con_ssh, fail_ok=False,
|
||||
auth_info=Tenant.get('admin'))
|
||||
table_ = table_parser.table(output)
|
||||
trunk_id = table_parser.get_value_two_col_table(table_, 'id')
|
||||
network_helper.unset_trunk(trunk_id, sub_ports="subport")
|
||||
network_helper.delete_trunks(trunk_id)
|
||||
finally:
|
||||
cli.system('helm-override-delete', "stx-openstack neutron openstack",
|
||||
ssh_client=con_ssh, auth_info=Tenant.get('admin_platform'))
|
||||
container_helper.apply_app(app_name='stx-openstack', applied_timeout=1200,
|
||||
check_interval=30)
|
|
@ -0,0 +1,75 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# This test case creates a trunk network and assign parent port
|
||||
# and and child port with the same MAC address.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
import getpass
|
||||
import os
|
||||
|
||||
import yaml
|
||||
from pytest import mark
|
||||
|
||||
from consts.auth import HostLinuxUser, Tenant
|
||||
from keywords import network_helper, common, container_helper
|
||||
from utils import cli, table_parser
|
||||
from utils.clients.ssh import ControllerClient
|
||||
|
||||
desired_caps = {"conf": {"neutron": {"DEFAULT": {"service_plugins": ['router', 'trunk']}}}}
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_create_trunk_childport_equal_mac_address(no_simplex):
|
||||
"""
|
||||
364-Create-Trunk-Childport-Equal-Mac-address.robot
|
||||
Args:
|
||||
no_simplex:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
con_ssh = ControllerClient.get_active_controller()
|
||||
net_id_a = network_helper.create_network(network_type='vlan',
|
||||
name='net-a', cleanup="function")[1]
|
||||
network_helper.create_subnet(net_id_a, subnet_range='192.168.3.0/24',
|
||||
name='subnet-a', cleanup="function")
|
||||
net_id_b = network_helper.create_network(network_type='vlan',
|
||||
name='net-b', cleanup="function")[1]
|
||||
network_helper.create_subnet(net_id_b, subnet_range='192.168.4.0/24',
|
||||
name='subnet-b', cleanup="function")
|
||||
user_name = getpass.getuser()
|
||||
yaml_path = os.path.join('/home/{}/'.format(user_name), "neutron-overrides-trunk.yaml")
|
||||
with open(yaml_path, "w", encoding="utf-8") as f:
|
||||
yaml.dump(desired_caps, f)
|
||||
common.scp_from_test_server_to_active_controller(yaml_path, HostLinuxUser.get_home())
|
||||
app_dir = HostLinuxUser.get_home()
|
||||
file_path = os.path.join(app_dir, "neutron-overrides-trunk.yaml")
|
||||
container_helper.update_helm_override(app_name='stx-openstack', chart='neutron',
|
||||
namespace='openstack', yaml_file=file_path)
|
||||
container_helper.apply_app(app_name='stx-openstack', applied_timeout=1200,
|
||||
check_interval=30)
|
||||
parent_port = network_helper.create_port(net_id_a, 'parentport', cleanup="function")[1]
|
||||
mac_address = network_helper.get_port_values(parent_port, ('mac_address',))[0]
|
||||
child_port = network_helper.create_port(net_id_b, 'subport',
|
||||
mac_addr=mac_address, cleanup="function")[1]
|
||||
args = '--parent-port parentport --subport port=subport,segmentation-type=vlan,' \
|
||||
'segmentation-id=123 trunk00'
|
||||
code, output = cli.openstack('network trunk create', args,
|
||||
ssh_client=con_ssh, fail_ok=False,
|
||||
auth_info=Tenant.get('admin'))
|
||||
table_ = table_parser.table(output)
|
||||
trunk_id = table_parser.get_value_two_col_table(table_, 'id')
|
||||
child_address = network_helper.get_port_values(child_port, ('mac_address',))[0]
|
||||
assert child_address == child_address
|
||||
network_helper.delete_trunks(trunk_id)
|
||||
cli.system('helm-override-delete', "stx-openstack neutron openstack",
|
||||
ssh_client=con_ssh, auth_info=Tenant.get('admin_platform'))
|
||||
container_helper.apply_app(app_name='stx-openstack', applied_timeout=1200,
|
||||
check_interval=30)
|
|
@ -0,0 +1,38 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# In Horizon data network page select each data network.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from testfixtures.horizon import *
|
||||
|
||||
from utils.tis_log import LOG
|
||||
from utils.horizon.pages.admin.platform import datanetworks
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_horizon_network_topology_select_data_networklist(tenant_home_pg_container_starlingx):
|
||||
"""
|
||||
377-Horizon-Network-Topology-Select-Data-Networklist.robot
|
||||
Args:
|
||||
tenant_home_pg_container_starlingx:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
LOG.info("Go to Admin Data Networks")
|
||||
datanetworks_pg = datanetworks.DatanetworksPage(
|
||||
tenant_home_pg_container_starlingx.driver, tenant_home_pg_container_starlingx.port)
|
||||
datanetworks_pg.go_to_target_page()
|
||||
datanetworks_pg.go_to_datanetwork_detail_page('physnet0')
|
||||
datanetworks_pg.go_to_target_page()
|
||||
datanetworks_pg.go_to_datanetwork_detail_page('physnet1')
|
||||
datanetworks_pg.go_to_target_page()
|
|
@ -0,0 +1,38 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# In Horizon network page to create data network with
|
||||
# existing network name, It throughs error while creation of network.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from testfixtures.horizon import *
|
||||
from utils.horizon.regions import messages
|
||||
|
||||
from utils.tis_log import LOG
|
||||
from utils.horizon.pages.admin.platform import datanetworks
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_horizon_topology_provider_network_setup_failure(tenant_home_pg_container_starlingx):
|
||||
"""
|
||||
395-Horizon-Topology-Provider-Network-Setup-Failure.robot
|
||||
Args:
|
||||
tenant_home_pg_container_starlingx:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
LOG.info("Go to Admin Data Networks")
|
||||
datanetworks_pg = datanetworks.DatanetworksPage(
|
||||
tenant_home_pg_container_starlingx.driver, tenant_home_pg_container_starlingx.port)
|
||||
datanetworks_pg.go_to_target_page()
|
||||
datanetworks_pg.create_datanetwork('physnet0', network_type='vlan')
|
||||
assert datanetworks_pg.find_message_and_dismiss(messages.ERROR)
|
|
@ -0,0 +1,47 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# LLDP TLVs accelerated Data NIC bonded.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from keywords import system_helper, host_helper
|
||||
from utils import cli
|
||||
from utils.tis_log import LOG
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_lldp_accelerated_nic(no_aio_system):
|
||||
"""
|
||||
425-LLDP-Accelerated-NIC.robot
|
||||
Args:
|
||||
no_aio_system:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
if system_helper.is_aio_system():
|
||||
hosts = system_helper.get_controllers()
|
||||
else:
|
||||
hosts = system_helper.get_computes()
|
||||
for host in hosts:
|
||||
lldps = host_helper.get_host_lldp_agents(host, field="local_port")
|
||||
for lldp in lldps:
|
||||
args = "{} -a | grep {} | awk '{{print$4}}'".format(host, lldp)
|
||||
interface = cli.system('host-if-list', args)[1]
|
||||
if 'data' not in interface:
|
||||
continue
|
||||
accelerated = host_helper.get_host_interface_values(host, interface, fields='accelerated')[0]
|
||||
LOG.info("accelerated is {}".format(accelerated))
|
||||
assert '[True]' == accelerated
|
||||
port = host_helper.get_host_interface_values(host, interface, fields='ports')[0]
|
||||
port = port.split('\'')[1]
|
||||
with host_helper.ssh_to_host(host) as node_ssh:
|
||||
node_ssh.exec_cmd('ip addr show {}'.format(port), fail_ok=False)
|
|
@ -0,0 +1,45 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Networking/VM Same networks used for 2 virtual devices.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
import os
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from consts.stx import GuestImages
|
||||
from keywords import glance_helper, network_helper, nova_helper, vm_helper
|
||||
from utils import cli
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_multiple_ports_same_network():
|
||||
"""
|
||||
256-Multiple-Ports-Same-Network.robot
|
||||
Args:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
fl_id = nova_helper.get_flavors(name="m1.tiny")[0]
|
||||
im_id = glance_helper.create_image(name="cirros_image", source_image_file=os.path.join(
|
||||
GuestImages.DEFAULT["image_dir"], "cirros-0.4.0-x86_64-disk.img"), disk_format="qcow2",
|
||||
cleanup="module")[1]
|
||||
net_id = network_helper.get_networks(full_name='private-net0')[0]
|
||||
net_id_list = [{"net-id": net_id}]
|
||||
vm_id = vm_helper.boot_vm(flavor=fl_id, nics=net_id_list, source="image",
|
||||
source_id=im_id, cleanup="module")[1]
|
||||
vm_id_1 = vm_helper.boot_vm(flavor=fl_id, nics=net_id_list, source="image",
|
||||
source_id=im_id, cleanup="module")[1]
|
||||
vm_ip_1 = vm_helper.get_vm_values(vm_id, 'addresses')[0].split('=')[1]
|
||||
vm_ip_2 = vm_helper.get_vm_values(vm_id_1, 'addresses')[0].split('=')[1]
|
||||
arg1 = "| grep {} | awk '{{print$2}}'".format(vm_ip_1)
|
||||
arg2 = "| grep {} | awk '{{print$2}}'".format(vm_ip_2)
|
||||
assert cli.openstack('port list', arg1)[1] != cli.openstack('port list', arg2)[1]
|
|
@ -0,0 +1,36 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Test case to verify a router can enable and diable NAT.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from keywords import network_helper
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_nat_on_router():
|
||||
"""
|
||||
411-Test-NAT-On-Router.robot
|
||||
Args:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
router_id = network_helper.create_router(name="router_test", cleanup="function")[1]
|
||||
network_helper.set_router(router="router_test", enable_snat=False, external_gateway="external-net0")
|
||||
values = network_helper.get_router_values(router_id, fields='external_gateway_info')
|
||||
assert re.search("\"enable_snat\": false", json.dumps(values[0]))
|
||||
network_helper.set_router(router="router_test", enable_snat=True, external_gateway="external-net0")
|
||||
values = network_helper.get_router_values(router_id, fields='external_gateway_info')
|
||||
assert re.search("\"enable_snat\": true", json.dumps(values[0]))
|
|
@ -0,0 +1,39 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Not compatible configuration for "External OAM".
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from keywords import system_helper
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_not_compatible_configuration_external_oam():
|
||||
"""
|
||||
402-Not-Compatible-Configuration-External-OAM.robot
|
||||
Args:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
oam_info = system_helper.get_oam_values(fields='oam_c0_ip')
|
||||
oam_ip = None
|
||||
for key, value in oam_info.items():
|
||||
if value is not None:
|
||||
oam_ip = value
|
||||
message = system_helper.modify_oam_ips(fail_ok=True, **{'oam_c0_ip': 'abcdafd'})[1]
|
||||
assert 'Invalid address abcdafd in oam_c0_ip' in message
|
||||
oam_info_now = system_helper.get_oam_values(fields='oam_c0_ip')
|
||||
oam_ip_now = None
|
||||
for key, value in oam_info_now.items():
|
||||
if value is not None:
|
||||
oam_ip_now = value
|
||||
assert oam_ip_now == oam_ip
|
|
@ -0,0 +1,82 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Test to check ntp servers can change.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
import time
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from consts.auth import HostLinuxUser, Tenant
|
||||
from consts.stx import EventLogID
|
||||
from keywords import system_helper, host_helper
|
||||
from utils import cli
|
||||
from utils.clients import ssh
|
||||
from utils.clients.ssh import SSHClient, CONTROLLER_PROMPT
|
||||
from utils.tis_log import LOG
|
||||
|
||||
|
||||
def swact_host(host):
|
||||
con_ssh = ssh.ControllerClient.get_active_controller()
|
||||
if host == 'controller-0':
|
||||
oam_ip = 'oam_c1_ip'
|
||||
else:
|
||||
oam_ip = 'oam_c0_ip'
|
||||
cmd = "oam-show |grep {} | awk '{{print $4}}'".format(oam_ip)
|
||||
oam_c1_ip = cli.system(cmd)[1]
|
||||
node_ssh = SSHClient(oam_c1_ip, HostLinuxUser.get_user(),
|
||||
HostLinuxUser.get_password(),
|
||||
CONTROLLER_PROMPT)
|
||||
exitcode, msg = cli.system('host-swact', host, ssh_client=con_ssh,
|
||||
fail_ok=False, auth_info=Tenant.get('admin_platform'))
|
||||
assert exitcode == 0, msg
|
||||
time.sleep(120)
|
||||
con_ssh.close()
|
||||
node_ssh.connect(retry=True, retry_timeout=30)
|
||||
ssh.ControllerClient.set_active_controller(node_ssh)
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_online_static_configuration():
|
||||
"""
|
||||
237-Online-Static-Configuration.robot
|
||||
Args:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
ntp = system_helper.get_ntp_values()
|
||||
system_helper.modify_ntp(ntp_servers='test.ntp.intel.com', check_first=False, clear_alarm=False)
|
||||
new_ntp = system_helper.get_ntp_values()
|
||||
LOG.info("new ntp is {}".format(new_ntp))
|
||||
assert 'test.ntp.intel.com' in new_ntp
|
||||
system_helper.modify_ntp(ntp_servers=ntp, check_first=False, clear_alarm=False)
|
||||
ntp_1 = system_helper.get_ntp_values()
|
||||
assert ntp == ntp_1
|
||||
hosts = system_helper.get_controllers()
|
||||
host_helper.lock_unlock_hosts(hosts[-1])
|
||||
if not system_helper.is_aio_simplex():
|
||||
swact_host("controller-0")
|
||||
host_helper.lock_unlock_hosts("controller-0")
|
||||
swact_host("controller-1")
|
||||
if not system_helper.is_aio_system():
|
||||
computes = system_helper.get_computes()
|
||||
for compute in computes:
|
||||
status = system_helper.get_host_values(compute, fields="config_status")[0]
|
||||
if "Config out-of-date" == status:
|
||||
host_helper.lock_unlock_hosts(compute)
|
||||
if system_helper.is_storage_system():
|
||||
storages = system_helper.get_storage_nodes()
|
||||
for storage in storages:
|
||||
status = system_helper.get_host_values(storage, fields="config_status")[0]
|
||||
if "Config out-of-date" == status:
|
||||
host_helper.lock_unlock_hosts(storage)
|
||||
assert EventLogID.CONFIG_OUT_OF_DATE not in \
|
||||
system_helper.get_alarms(fields=("Alarm ID",), alarm_id=EventLogID.CONFIG_OUT_OF_DATE)
|
|
@ -0,0 +1,34 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Provider network type must be: flat, vlan or vxlan.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from keywords import kube_helper
|
||||
from utils import exceptions
|
||||
|
||||
|
||||
@mark.system_inventory
|
||||
def test_provider_network_type():
|
||||
"""
|
||||
253-Provider-Network-Type.robot
|
||||
Args:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
pods = kube_helper.get_pods(namespace='openstack')
|
||||
pod_list = list(filter(lambda i: 'neutron-server' in i, pods))
|
||||
result = kube_helper.exec_kube_cmd(sub_cmd='exec',
|
||||
args='{} -it -n openstack cat '
|
||||
'/etc/neutron/plugins/ml2/ml2_conf.ini'.format(pod_list[0]))[1]
|
||||
if "vlan,vxlan" not in result and "flat" not in result:
|
||||
raise exceptions.VMTimeout("Provider network type must be: flat, vlan or vxlan.")
|
|
@ -0,0 +1,66 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Test to create QoS Policy using REST api.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
import getpass
|
||||
import os
|
||||
|
||||
import yaml
|
||||
from pytest import mark
|
||||
|
||||
from consts.auth import HostLinuxUser, Tenant
|
||||
from keywords import common, container_helper, html_helper
|
||||
from utils import cli
|
||||
from utils.clients import ssh
|
||||
from utils.tis_log import LOG
|
||||
|
||||
dest_path = {"conf": {"neutron": {"DEFAULT": {"service_plugins": ['router', 'qos']}},
|
||||
"plugins": {"ml2_conf": {"ml2": {"extension_drivers": ['port_security', 'qos']}},
|
||||
"openvswitch_agent": {"agent": {"extensions": ['qos']}}}}}
|
||||
|
||||
part1 = "Content-Type: application/json"
|
||||
part2 = "User-Agent: openstacksdk/0.25.0 keystoneauth1/0.0.0 python-requests/2.14.2 CPython/2.7.5"
|
||||
|
||||
url = "http://neutron.openstack.svc.cluster.local:80/v2.0/qos/policies"
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_qos_policy_creation_api():
|
||||
"""
|
||||
329-QoS-Policy-Creation-Api.robot
|
||||
Args:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
con_ssh = ssh.ControllerClient.get_active_controller()
|
||||
token = html_helper.get_user_token()
|
||||
user_name = getpass.getuser()
|
||||
yaml_path = os.path.join('/home/{}/'.format(user_name), "neutron-overrides-qos.yaml")
|
||||
with open(yaml_path, "w", encoding="utf-8") as f:
|
||||
yaml.dump(dest_path, f)
|
||||
common.scp_from_test_server_to_active_controller(yaml_path, HostLinuxUser.get_home())
|
||||
app_dir = HostLinuxUser.get_home()
|
||||
file_path = os.path.join(app_dir, "neutron-overrides-qos.yaml")
|
||||
container_helper.update_helm_override(app_name='stx-openstack', chart='neutron',
|
||||
namespace='openstack', yaml_file=file_path)
|
||||
container_helper.apply_app(app_name='stx-openstack', applied_timeout=1200,
|
||||
check_interval=30)
|
||||
part3 = "X-Auth-Token: {}".format(token)
|
||||
part4 = '{"policy": {"name": "bw-limiter"}}'
|
||||
cmd = "curl -g -i -X POST {} -H '{}' -H '{}' -H '{}' -d '{}'".format(url, part1, part2, part3, part4)
|
||||
LOG.info("cmd is {}".format(cmd))
|
||||
code, out = con_ssh.exec_cmd(cmd)
|
||||
assert code == 0
|
||||
cli.system('helm-override-delete', "stx-openstack neutron openstack",
|
||||
ssh_client=con_ssh, auth_info=Tenant.get('admin_platform'))
|
||||
container_helper.apply_app(app_name='stx-openstack', applied_timeout=1200,
|
||||
check_interval=30)
|
|
@ -0,0 +1,42 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Test to show network details using REST api on given network.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from keywords import network_helper, html_helper
|
||||
from utils.clients import ssh
|
||||
from utils.tis_log import LOG
|
||||
|
||||
|
||||
part1 = "Accept: "
|
||||
part2 = "User-Agent: opencksdk/0.17.2 keystoneauth1/3.10.0 python-requests/2.14.2 CPython/2.7.5"
|
||||
|
||||
url = "http://neutron.openstack.svc.cluster.local:80/v2.0/networks/"
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_show_data_network_api():
|
||||
"""
|
||||
238-Show-Data-Network-Api.robot
|
||||
Args:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
con_ssh = ssh.ControllerClient.get_active_controller()
|
||||
network_id = network_helper.get_networks()[0]
|
||||
token = html_helper.get_user_token()
|
||||
part3 = "X-Auth-Token: {}".format(token)
|
||||
cmd = "curl -g -i -X GET {}{} -H '{}' -H '{}' -H '{}'".format(url, network_id, part1, part2, part3)
|
||||
LOG.info("cmd is {}".format(cmd))
|
||||
code, out = con_ssh.exec_cmd(cmd)
|
||||
assert code == 0
|
|
@ -0,0 +1,45 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Test to show data network range using REST api for given network.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from consts.auth import Tenant
|
||||
from keywords import system_helper, html_helper
|
||||
from utils import table_parser, cli
|
||||
from utils.clients import ssh
|
||||
from utils.tis_log import LOG
|
||||
|
||||
part1 = "Accept: application/json"
|
||||
part2 = "User-Agent: openstacksdk/0.25.0 keystoneauth1/0.0.0 python-requests/2.21.0 CPython/2.7.5"
|
||||
|
||||
url = "http://neutron-server.openstack.svc.cluster.local:9696/v2.0/network_segment_ranges/"
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_show_data_network_range_api():
|
||||
"""
|
||||
239-Show-Data-Network-Range-Api.robot
|
||||
Args:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
con_ssh = ssh.ControllerClient.get_active_controller()
|
||||
data_network = system_helper.get_data_networks(**{'network_type': 'vlan'})[0]
|
||||
table_ = table_parser.table(
|
||||
cli.openstack('network segment range list', ssh_client=con_ssh, auth_info=Tenant.get('admin'))[1])
|
||||
val = table_parser.get_values(table_, "ID", **{'Physical Network': data_network})[0]
|
||||
token = html_helper.get_user_token()
|
||||
part3 = "X-Auth-Token: {}".format(token)
|
||||
cmd = "curl -g -i -X GET {}{} -H '{}' -H '{}' -H '{}'".format(url, val, part1, part2, part3)
|
||||
code, out = con_ssh.exec_cmd(cmd)
|
||||
assert code == 0
|
|
@ -0,0 +1,90 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# This test case creates a trunk network with subport
|
||||
# and assign the intance to the port of trunk then execute
|
||||
# instance lifecycle.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
import getpass
|
||||
import os
|
||||
|
||||
import yaml
|
||||
from pytest import mark
|
||||
|
||||
from consts.auth import Tenant, HostLinuxUser
|
||||
from consts.stx import GuestImages
|
||||
from keywords import network_helper, common, container_helper, nova_helper, glance_helper, vm_helper
|
||||
from utils import cli, table_parser
|
||||
from utils.clients.ssh import ControllerClient
|
||||
|
||||
desired_caps = {"conf": {"neutron": {"DEFAULT": {"service_plugins": ['router', 'trunk']}}}}
|
||||
|
||||
|
||||
# Creating Instance
|
||||
def launch_instance(net_id):
|
||||
fl_id = nova_helper.get_flavors(name="m1.tiny")[0]
|
||||
im_id = glance_helper.create_image(name="cirros_image", source_image_file=os.path.join(
|
||||
GuestImages.DEFAULT["image_dir"], "cirros-0.4.0-x86_64-disk.img"), disk_format="qcow2",
|
||||
cleanup="module")[1]
|
||||
net_id_list = [{"net-id": net_id}]
|
||||
vm_id = vm_helper.boot_vm_openstack(name="portinstance", flavor=fl_id, nics=net_id_list, source="image",
|
||||
source_id=im_id, cleanup="module", port="parentport")[1]
|
||||
return vm_id
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_trunk_with_vm_lifecycle(no_simplex):
|
||||
"""
|
||||
405-Trunk-With-VM-Lifecycle.robot
|
||||
Args:
|
||||
no_simplex:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
con_ssh = ControllerClient.get_active_controller()
|
||||
net_id = network_helper.create_network(network_type='vlan',
|
||||
name='net-a', cleanup="function")[1]
|
||||
network_helper.create_subnet(net_id, subnet_range='192.168.3.0/24',
|
||||
name='subnet-a', cleanup="function")
|
||||
user_name = getpass.getuser()
|
||||
yaml_path = os.path.join('/home/{}/'.format(user_name), "neutron-overrides-trunk.yaml")
|
||||
with open(yaml_path, "w", encoding="utf-8") as f:
|
||||
yaml.dump(desired_caps, f)
|
||||
common.scp_from_test_server_to_active_controller(yaml_path, HostLinuxUser.get_home())
|
||||
app_dir = HostLinuxUser.get_home()
|
||||
file_path = os.path.join(app_dir, "neutron-overrides-trunk.yaml")
|
||||
container_helper.update_helm_override(app_name='stx-openstack', chart='neutron',
|
||||
namespace='openstack', yaml_file=file_path)
|
||||
container_helper.apply_app(app_name='stx-openstack', applied_timeout=1200,
|
||||
check_interval=30)
|
||||
network_helper.create_port(net_id, 'parentport', cleanup="function")
|
||||
network_helper.create_port(net_id, 'subport', cleanup="function")
|
||||
args = '--parent-port parentport --subport port=subport,segmentation-type=vlan,' \
|
||||
'segmentation-id=10 trunkseg'
|
||||
code, output = cli.openstack('network trunk create', args,
|
||||
ssh_client=con_ssh, fail_ok=False,
|
||||
auth_info=Tenant.get('admin'))
|
||||
table_ = table_parser.table(output)
|
||||
trunk_id = table_parser.get_value_two_col_table(table_, 'id')
|
||||
vm_id = launch_instance(net_id)
|
||||
vm_helper.stop_vms(vm_id)
|
||||
vm_helper.start_vms(vm_id)
|
||||
vm_helper.pause_vm(vm_id)
|
||||
vm_helper.unpause_vm(vm_id)
|
||||
vm_helper.suspend_vm(vm_id)
|
||||
vm_helper.resume_vm(vm_id)
|
||||
vm_helper.cold_migrate_vm(vm_id)
|
||||
network_helper.unset_trunk(trunk_id, sub_ports="subport")
|
||||
network_helper.delete_trunks(trunk_id)
|
||||
cli.system('helm-override-delete', "stx-openstack neutron openstack",
|
||||
ssh_client=con_ssh, auth_info=Tenant.get('admin_platform'))
|
||||
container_helper.apply_app(app_name='stx-openstack', applied_timeout=1200,
|
||||
check_interval=30)
|
|
@ -0,0 +1,64 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Test to verify compatible NTP configuration.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
import time
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from consts.auth import HostLinuxUser, Tenant
|
||||
from keywords import system_helper, host_helper
|
||||
from utils import cli
|
||||
from utils.clients import ssh
|
||||
from utils.clients.ssh import SSHClient, CONTROLLER_PROMPT
|
||||
|
||||
|
||||
def swact_host(host):
|
||||
con_ssh = ssh.ControllerClient.get_active_controller()
|
||||
if host == 'controller-0':
|
||||
oam_ip = 'oam_c1_ip'
|
||||
else:
|
||||
oam_ip = 'oam_c0_ip'
|
||||
cmd = "oam-show |grep {} | awk '{{print $4}}'".format(oam_ip)
|
||||
oam_c1_ip = cli.system(cmd)[1]
|
||||
node_ssh = SSHClient(oam_c1_ip, HostLinuxUser.get_user(),
|
||||
HostLinuxUser.get_password(),
|
||||
CONTROLLER_PROMPT)
|
||||
exitcode, msg = cli.system('host-swact', host, ssh_client=con_ssh,
|
||||
fail_ok=False, auth_info=Tenant.get('admin_platform'))
|
||||
assert exitcode == 0, msg
|
||||
time.sleep(120)
|
||||
con_ssh.close()
|
||||
node_ssh.connect(retry=True, retry_timeout=30)
|
||||
ssh.ControllerClient.set_active_controller(node_ssh)
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_verify_compatible_ntp_configuration():
|
||||
"""
|
||||
401-Test-Verify-Compatible-NTP-Configuration.robot
|
||||
Args:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
ntp = system_helper.get_ntp_values()
|
||||
system_helper.modify_ntp(ntp_servers='10.22.1.1,10.22.1.2',
|
||||
check_first=False, clear_alarm=False)
|
||||
new_ntp = system_helper.get_ntp_values()
|
||||
assert '10.22.1.1,10.22.1.2' in new_ntp
|
||||
system_helper.modify_ntp(ntp_servers=ntp, check_first=False, clear_alarm=False)
|
||||
hosts = system_helper.get_controllers()
|
||||
host_helper.lock_unlock_hosts(hosts[-1])
|
||||
if not system_helper.is_aio_simplex():
|
||||
swact_host("controller-0")
|
||||
host_helper.lock_unlock_hosts("controller-0")
|
||||
swact_host("controller-1")
|
|
@ -0,0 +1,120 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Test to verify DVR can be deleted.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
import os
|
||||
|
||||
from pytest import fixture, mark
|
||||
|
||||
from consts.stx import GuestImages
|
||||
from keywords import network_helper, nova_helper, glance_helper, vm_helper, host_helper
|
||||
from utils import cli
|
||||
from utils.tis_log import LOG
|
||||
|
||||
|
||||
@fixture(scope="module")
|
||||
def launch_instance():
|
||||
net_id_0 = network_helper.create_network(name='vm-0-net', cleanup="module")[1]
|
||||
subnet_id_0 = network_helper.create_subnet(name='vm-0-subnet', network='vm-0-net',
|
||||
subnet_range='10.0.0.0/24', dhcp=True,
|
||||
ip_version=4, cleanup="module")[1]
|
||||
net_id_1 = network_helper.create_network(name='vm-1-net', cleanup="module")[1]
|
||||
subnet_id_1 = network_helper.create_subnet(name='vm-1-subnet', network='vm-1-net',
|
||||
subnet_range='10.0.1.0/24', dhcp=True,
|
||||
ip_version=4, cleanup="module")[1]
|
||||
net_id_list_0 = [{"net-id": net_id_0}]
|
||||
net_id_list_1 = [{"net-id": net_id_1}]
|
||||
fl_id_0 = nova_helper.create_flavor(name='vm-0-flavor', vcpus=1, ram=2048, root_disk=4,
|
||||
is_public=True, add_default_specs=False, cleanup="module")[1]
|
||||
im_id_0 = glance_helper.create_image(name="vm-0-image", source_image_file=os.path.join(
|
||||
GuestImages.DEFAULT["image_dir"], "cirros-0.4.0-x86_64-disk.img"), disk_format="qcow2",
|
||||
cleanup="module")[1]
|
||||
vm_id_0 = vm_helper.boot_vm(name="vm-0", flavor=fl_id_0, nics=net_id_list_0, source="image",
|
||||
source_id=im_id_0, cleanup="module")[1]
|
||||
fl_id_1 = nova_helper.create_flavor(name='vm-0-flavor', vcpus=1, ram=2048, root_disk=4,
|
||||
is_public=True, add_default_specs=False, cleanup="module")[1]
|
||||
im_id_1 = glance_helper.create_image(name="vm-0-image", source_image_file=os.path.join(
|
||||
GuestImages.DEFAULT["image_dir"], "cirros-0.4.0-x86_64-disk.img"), disk_format="qcow2",
|
||||
cleanup="module")[1]
|
||||
vm_id_1 = vm_helper.boot_vm(name="vm-1", flavor=fl_id_1, nics=net_id_list_1, source="image",
|
||||
source_id=im_id_1, cleanup="module")[1]
|
||||
network_helper.create_security_group('group', project='admin', cleanup='module')
|
||||
|
||||
network_helper.create_security_group_rule(group='group', dst_port='22:22', project='admin',
|
||||
protocol='tcp', remote_ip='0.0.0.0/0',
|
||||
cleanup='module')
|
||||
network_helper.create_security_group_rule(group='group', project='admin', protocol='icmp',
|
||||
remote_ip='0.0.0.0/0', cleanup='module')
|
||||
# Add Security Group To VM
|
||||
vm_helper.add_security_group(vm_id_0, 'group')
|
||||
vm_helper.add_security_group(vm_id_1, 'group')
|
||||
return {
|
||||
"subnet_id_0": subnet_id_0,
|
||||
"subnet_id_1": subnet_id_1,
|
||||
"vm_id_0": vm_id_0,
|
||||
"vm_id_1": vm_id_1,
|
||||
"net_id_0": net_id_0,
|
||||
"net_id_1": net_id_1
|
||||
}
|
||||
|
||||
|
||||
def _check_ping_instance(ip, netid):
|
||||
LOG.info('start to check ping instance')
|
||||
host_list = host_helper.get_hypervisors()
|
||||
for host in host_list:
|
||||
with host_helper.ssh_to_host(host) as node_ssh:
|
||||
cmd = 'ip netns | grep --color=never {}'.format(netid)
|
||||
rc, ns = node_ssh.exec_cmd(cmd=cmd)
|
||||
if ns and netid in ns.split()[0]:
|
||||
target = host
|
||||
netns = ns.split()[0]
|
||||
break
|
||||
with host_helper.ssh_to_host(target) as node_ssh:
|
||||
ping_cmd = "ip netns exec {} ping -c 5 {} " \
|
||||
.format(netns, ip)
|
||||
node_ssh.send_sudo(cmd=ping_cmd)
|
||||
index = node_ssh.expect(['5 packets received'])
|
||||
assert index == 0, "Ping instance from instance failed"
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_verify_dvr_router_deletion(launch_instance):
|
||||
"""
|
||||
255-Verify-DVR-Router-Deletion.robot
|
||||
Args:
|
||||
launch_instance:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
subnet_id_0 = launch_instance['subnet_id_0']
|
||||
subnet_id_1 = launch_instance['subnet_id_1']
|
||||
vm_id_0 = launch_instance['vm_id_0']
|
||||
vm_id_1 = launch_instance['vm_id_1']
|
||||
net_id_0 = launch_instance['net_id_0']
|
||||
net_id_1 = launch_instance['net_id_1']
|
||||
network_helper.create_router('router1', cleanup="module")
|
||||
network_helper.add_router_interface('router1', subnet=subnet_id_0)
|
||||
network_helper.add_router_interface('router1', subnet=subnet_id_1)
|
||||
net_id = network_helper.get_networks(full_name='external-net0')[0]
|
||||
subnet_id = network_helper.get_subnets(full_name='external-subnet0')[0]
|
||||
network_helper.set_router('router1', external_gateway=net_id)
|
||||
float_ip0 = network_helper.create_floating_ip(external_net=net_id,
|
||||
subnet=subnet_id, cleanup="module")[1]
|
||||
float_ip1 = network_helper.create_floating_ip(external_net=net_id,
|
||||
subnet=subnet_id, cleanup="module")[1]
|
||||
cli.openstack('server add floating ip', "{} {}".format(vm_id_0, float_ip0))
|
||||
cli.openstack('server add floating ip', "{} {}".format(vm_id_1, float_ip1))
|
||||
_check_ping_instance(float_ip0, net_id_0)
|
||||
_check_ping_instance(float_ip1, net_id_1)
|
||||
network_helper.unset_router('router1', external_gateway=net_id)
|
||||
network_helper.remove_router_interface('router1', subnet=subnet_id_0)
|
||||
network_helper.remove_router_interface('router1', subnet=subnet_id_1)
|
|
@ -0,0 +1,50 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# In Horizon Topology Navigation and details check.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
import time
|
||||
|
||||
from pytest import mark
|
||||
from selenium.webdriver.common import by
|
||||
|
||||
from testfixtures.horizon import *
|
||||
|
||||
from keywords import system_helper
|
||||
|
||||
from utils.horizon.pages.admin.platform import providernetworkstopology
|
||||
from utils.tis_log import LOG
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_verify_horizon_network_topology_config_details(no_aio_system, tenant_home_pg_container_starlingx):
|
||||
"""
|
||||
376-Verify-Horizon-Network-Topology-Config-Details.robot
|
||||
Args:
|
||||
no_aio_system:
|
||||
tenant_home_pg_container_starlingx:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
LOG.info("Go to Admin Data Network Topology")
|
||||
providernetworktopology_pg = providernetworkstopology.ProviderNetworkTopologyPage(
|
||||
tenant_home_pg_container_starlingx.driver, tenant_home_pg_container_starlingx.port)
|
||||
providernetworktopology_pg.go_to_target_page()
|
||||
time.sleep(10)
|
||||
for data_network in system_helper.get_data_networks():
|
||||
providernetworktopology_pg.driver.find_element_by_id('%s%s' % ('net-', data_network)).click()
|
||||
providernetworktopology_pg._get_element(by.By.LINK_TEXT, 'Related Alarms').click()
|
||||
assert not providernetworktopology_pg.alarm_table.rows
|
||||
for compute in system_helper.get_computes():
|
||||
providernetworktopology_pg.driver.find_element_by_id('%s%s' % ('host-', compute)).click()
|
||||
providernetworktopology_pg._get_element(by.By.LINK_TEXT, 'LLDP').click()
|
||||
providernetworktopology_pg._get_element(by.By.LINK_TEXT, 'Related Alarms').click()
|
||||
assert not providernetworktopology_pg.alarm_table.rows
|
|
@ -0,0 +1,44 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# This test is to verify the vSwitch settings from the cli,
|
||||
# This test pass if any vswitch configuration was found.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from consts.auth import Tenant
|
||||
from keywords import system_helper
|
||||
from utils import cli, table_parser
|
||||
from utils.clients.ssh import ControllerClient
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_verify_vswitch_settings_cli():
|
||||
"""
|
||||
233-Verify-VSwitch-Settings-Cli.robot
|
||||
Args:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
if system_helper.is_aio_simplex():
|
||||
host = "controller-0"
|
||||
else:
|
||||
host = system_helper.get_computes()[0]
|
||||
con_ssh = ControllerClient.get_active_controller()
|
||||
table_ = table_parser.table(cli.system('host-cpu-list', host)[1])
|
||||
functions = table_parser.get_values(table_=table_,
|
||||
target_header='assigned_function')
|
||||
assert "vSwitch" in functions, "vSwitch not configured"
|
||||
uuids = table_parser.get_values(table_=table_, target_header='uuid',
|
||||
**{'assigned_function': 'vSwitch'})
|
||||
for uuid in uuids:
|
||||
cli.system("host-cpu-show", "1 {}".format(uuid), ssh_client=con_ssh,
|
||||
auth_info=Tenant.get('admin_platform'))
|
|
@ -0,0 +1,60 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Test case for vxlan data network segmentation range should not be overlap.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from keywords import system_helper, host_helper, network_helper
|
||||
from utils import cli, table_parser
|
||||
|
||||
addr_list = ['192.168.100.30 24', '192.168.100.40 24']
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_verify_vxlan_data_network_segment_range_overlap(no_aio_system):
|
||||
"""
|
||||
434-Verify-Vxlan-Data-Network-Segment-Range-Overlap.robot
|
||||
Args:
|
||||
no_aio_system:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
computes = system_helper.get_computes()
|
||||
for compute in computes:
|
||||
host_helper.lock_host(compute)
|
||||
system_helper.create_data_network("physnet3", "vxlan", multicast_group='224.0.0.1',
|
||||
ttl='255', port_num='4789', cleanup='function')
|
||||
for index, compute in enumerate(computes):
|
||||
uuid = host_helper.get_host_interfaces(compute, field='uuid', **{'name': 'data0'})[0]
|
||||
cli.system('host-if-modify', "-m 1600 -n data0 -c data {} {} --ipv4-mode=static".
|
||||
format(compute, uuid))
|
||||
cli.system('interface-datanetwork-assign', "{} {} physnet3".format(compute, uuid))
|
||||
cli.system('host-addr-add', "{} {} {}".format(compute, uuid, addr_list[index]))
|
||||
host_helper.unlock_host(compute)
|
||||
if index == 1:
|
||||
break
|
||||
network_helper.create_segmentation_range('vxlan-seg0', minimum='300',
|
||||
maximum='350', network_type='vxlan')
|
||||
network_helper.create_segmentation_range('vxlan-seg1', minimum='399',
|
||||
maximum='450', network_type='vxlan')
|
||||
for compute in computes:
|
||||
host_helper.lock_host(compute)
|
||||
addr_uuid = host_helper.get_host_addresses(compute, field='uuid', ifname='data0')[0]
|
||||
cli.system('host-addr-delete', addr_uuid)
|
||||
cli.system('host-if-modify', "-m 1500 -n data0 -c data {} {} --ipv4-mode=disabled".
|
||||
format(compute, uuid))
|
||||
table_ = table_parser.table(
|
||||
cli.system('interface-datanetwork-list', "{}".format(compute))[1])
|
||||
val = table_parser.get_values(table_, "uuid", **{'datanetwork_name': 'physnet3'})[0]
|
||||
cli.system('interface-datanetwork-remove', "{}".format(val))
|
||||
host_helper.unlock_host(compute)
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Test case for vxlan data interface should not allow duplicate ip address.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from keywords import system_helper, host_helper
|
||||
from utils import cli
|
||||
|
||||
addr_list = ['192.168.100.30 24', '192.168.100.40 24']
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_vxlan_data_interface_duplicate_address_not_allowed(no_aio_system):
|
||||
"""
|
||||
433-Vxlan-Data-Interface-Duplicate-Address-Not-Allowed.robot
|
||||
Args:
|
||||
no_aio_system:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
computes = system_helper.get_computes()
|
||||
for compute in computes:
|
||||
host_helper.lock_host(compute)
|
||||
data_network_uuid = system_helper.create_data_network("physnet3", "vxlan", multicast_group='224.0.0.1',
|
||||
ttl='255', port_num='4789')[1]
|
||||
for index, compute in enumerate(computes):
|
||||
uuid = host_helper.get_host_interfaces(compute, field='uuid', **{'name': 'data0'})[0]
|
||||
cli.system('host-if-modify', "-n data0 -c data {} {} --ipv4-mode=static".
|
||||
format(compute, uuid))
|
||||
cli.system('host-addr-add', "{} {} {}".format(compute, uuid, addr_list[index]))
|
||||
code = cli.system('host-addr-add', "{} {} {}".
|
||||
format(compute, uuid, addr_list[index]), fail_ok=True)[0]
|
||||
assert code != 0, "Again add host same ip address to compute-0 data0, should through error"
|
||||
host_helper.unlock_host(compute)
|
||||
if index == 1:
|
||||
break
|
||||
for compute in computes:
|
||||
host_helper.lock_host(compute)
|
||||
addr_uuid = host_helper.get_host_addresses(compute, field='uuid', ifname='data0')[0]
|
||||
uuid = host_helper.get_host_interfaces(compute, field='uuid', **{'name': 'data0'})[0]
|
||||
cli.system('host-addr-delete', addr_uuid)
|
||||
cli.system('host-if-modify', "-n data0 -c data {} {} --ipv4-mode=disabled".
|
||||
format(compute, uuid))
|
||||
host_helper.unlock_host(compute)
|
||||
system_helper.delete_data_network(data_network_uuid)
|
|
@ -0,0 +1,38 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Test case for vxlan data network must have a valid port number.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from keywords import system_helper, host_helper
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_vxlan_data_network_valid_port_creation(no_aio_system):
|
||||
"""
|
||||
419-Vxlan-Data-Network-Valid-Port-Creation.robot
|
||||
Args:
|
||||
no_aio_system:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
computes = system_helper.get_computes()
|
||||
for compute in computes:
|
||||
host_helper.lock_host(compute)
|
||||
uuid = system_helper.create_data_network("physnet3", "vxlan", multicast_group="224.0.0.1",
|
||||
ttl="255", port_num="4789")[1]
|
||||
system_helper.delete_data_network(uuid)
|
||||
uuid = system_helper.create_data_network("physnet3", "vxlan", multicast_group="224.0.0.1",
|
||||
ttl="255", port_num="8472")[1]
|
||||
system_helper.delete_data_network(uuid)
|
||||
for compute in computes:
|
||||
host_helper.unlock_host(compute)
|
|
@ -0,0 +1,35 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Test case for vxlan data network with valid multicast address.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from keywords import system_helper
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_vxlan_data_network_with_valid_multicast_address():
|
||||
"""
|
||||
432-Vxlan-Data-Network-With-Valid-Multicast-Address.robot
|
||||
Args:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
code = system_helper.create_data_network("physnet3", "vxlan", multicast_group='172.31.255.255',
|
||||
ttl='255', port_num='4789', fail_ok=True)[0]
|
||||
assert code != 0, '172.31.255.255 is not a valid multicast ip address'
|
||||
code = system_helper.create_data_network("physnet3", "vxlan", multicast_group='0:0:0:0:0:0:0:0',
|
||||
ttl='255', port_num='4789', fail_ok=True)[0]
|
||||
assert code != 0, '0:0:0:0:0:0:0:0 is not a valid multicast ip address'
|
||||
data_network_uuid = system_helper.create_data_network("physnet3", "vxlan", multicast_group='224.0.0.1',
|
||||
ttl='255', port_num='4789')[1]
|
||||
system_helper.delete_data_network(data_network_uuid)
|
|
@ -0,0 +1,45 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Test case for vxlan data network creation and verify
|
||||
# data interface address mode must be set to static
|
||||
# before applying any ip address.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from keywords import system_helper, host_helper
|
||||
from utils import cli
|
||||
|
||||
|
||||
def test_vxlan_datainterface_address_mode_set_to_static(no_aio_system):
|
||||
"""
|
||||
421-Vxlan-DataInterface-Address-Mode-Set-To-Static.robot
|
||||
Args:
|
||||
no_aio_system:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
host = system_helper.get_computes()[0]
|
||||
host_helper.lock_host(host)
|
||||
data_network_uuid = system_helper.create_data_network("physnet3", "vxlan", multicast_group='224.0.0.1',
|
||||
ttl='255', port_num='4789')[1]
|
||||
uuid = host_helper.get_host_interfaces(host, field='uuid', **{'name': 'data0'})[0]
|
||||
code = cli.system('host-addr-add', "{} {} 192.168.100.60 24".format(host, uuid), fail_ok=True)[0]
|
||||
assert code != 0, "Non static mode, can't add host address"
|
||||
cli.system('host-if-modify', "-n data0 -c data {} {} --ipv4-mode=static".
|
||||
format(host, uuid))
|
||||
cli.system('host-addr-add', "{} {} 192.168.100.60 24".format(host, uuid))
|
||||
host_helper.unlock_host(host)
|
||||
host_helper.lock_host(host)
|
||||
addr_uuid = host_helper.get_host_addresses(host, field='uuid', ifname='data0')[0]
|
||||
cli.system('host-addr-delete', addr_uuid)
|
||||
cli.system('host-if-modify', "-n data0 -c data {} {} --ipv4-mode=disabled".
|
||||
format(host, uuid))
|
||||
system_helper.delete_data_network(data_network_uuid)
|
||||
host_helper.unlock_host(host)
|
|
@ -0,0 +1,60 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Test case for interface to be modifiable, when host is locked.
|
||||
# And create vxlan data network to modify data0 interface
|
||||
# address ipv4/ipv6 mode change(static, disabled). if setting static
|
||||
# should be set ip address.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from keywords import system_helper, host_helper
|
||||
from utils import cli
|
||||
|
||||
addr_list = ['192.168.100.30 24', '192.168.100.40 24']
|
||||
|
||||
|
||||
@mark.networking
|
||||
def test_vxlan_interface_address_mode_modifiable_when_host_locked(no_aio_system):
|
||||
"""
|
||||
431-Vxlan-Interface-Address-Mode-Modifiable-When-Host-Locked.robot
|
||||
Args:
|
||||
no_aio_system:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
computes = system_helper.get_computes()
|
||||
for compute in computes:
|
||||
uuid = host_helper.get_host_interfaces(compute, field='uuid', **{'name': 'data0'})[0]
|
||||
code = cli.system('host-if-modify', "-n data0 -c data {} {} --ipv4-mode=static".
|
||||
format(compute, uuid), fail_ok=True)[0]
|
||||
assert code != 0, "without host lock to modify data0 interface, will through error"
|
||||
for compute in computes:
|
||||
host_helper.lock_host(compute)
|
||||
data_network_uuid = system_helper.create_data_network("physnet3", "vxlan", multicast_group='224.0.0.1',
|
||||
ttl='255', port_num='4789')[1]
|
||||
for index, compute in enumerate(computes):
|
||||
uuid = host_helper.get_host_interfaces(compute, field='uuid', **{'name': 'data0'})[0]
|
||||
cli.system('host-if-modify', "-n data0 -c data {} {} --ipv4-mode=static".
|
||||
format(compute, uuid))
|
||||
cli.system('host-addr-add', "{} {} {}".format(compute, uuid, addr_list[index]))
|
||||
host_helper.unlock_host(compute)
|
||||
if index == 1:
|
||||
break
|
||||
for compute in computes:
|
||||
host_helper.lock_host(compute)
|
||||
addr_uuid = host_helper.get_host_addresses(compute, field='uuid', ifname='data0')[0]
|
||||
uuid = host_helper.get_host_interfaces(compute, field='uuid', **{'name': 'data0'})[0]
|
||||
cli.system('host-addr-delete', addr_uuid)
|
||||
cli.system('host-if-modify', "-n data0 -c data {} {} --ipv4-mode=disabled".
|
||||
format(compute, uuid))
|
||||
host_helper.unlock_host(compute)
|
||||
system_helper.delete_data_network(data_network_uuid)
|
Loading…
Reference in New Issue