Have questions? Stuck? Please check our FAQ for some common questions and answers.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This page provides guidelines for testing SONA in an automated way to help developers test their changes do not break anything. As SONA is an implementation of Neutron ML2 mechanism driver, we can make use of general OpenStack testing tools. Particularly, Tempest is OpenStack's official test suit for running a set of functional tests against an OpenStack cluster. Most OpenStack projects employ Tempest as a gate for automated testing of committed change. It is strongly recommended to run Tempest API and scenarios tests described here against your changes to SONA before submitting. Some test cases specific to SONA still need manual testing.

Setup Test Environment

Some Tempest scenario tests include accessing a VM with floating IP. That means you have to prepare a test machine reachable to the floating range. If you're using all-in-one gateway node, which has Quagga container for external router inside a gateway node, you can run the test at the gateway node. We use Rally for installing and configuring Tempest easily.

1. Install Docker

$ sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
$ sudo apt-get update
$ sudo apt-get install docker-ce

 

2. Create admin-openrc.sh with access information to target OpenStack deployment.

admin-openrc.sh
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=nova
export OS_AUTH_URL=http://10.1.1.161:35357/v2.0
export LC_ALL=C

 

3. Create Tempest configuration file for SONA.

sona-tempest.conf
[network-feature-enabled]
ipv6_subnet_attributes = False
ipv6 = False
 
[compute-feature-enabled]
metadata_service = False
 
[network]
floating_network_name = net-public

 

4. Run Rally container.

$ sudo mkdir /var/lib/rally_container
$ sudo chown 65500 /var/lib/rally_container
$ sudo cp ~/admin-openrc.sh /var/lib/rally_container
$ sudo cp ~/sona-tempest.conf /var/lib/rally_container
$ sudo docker run -it -v /var/lib/rally_container:/home/rally rallyforge/rally

 

5. Register target OpenStack deployment.

rally@1cc98e0b5941:~$ rally-manage db recreate
rally@1cc98e0b5941:~$ source admin-openrc.sh
rally@1cc98e0b5941:~$ rally deployment create --fromenv --name sona-test

 

6. Create Tempest verifier and configure it.

rally@1cc98e0b5941:~$ rally verify create-verifier --type tempest --name tempest-verifier
rally@1cc98e0b5941:~$ rally verify configure-verifier --extend sona-tempest.conf

Run API Test

1. Start Tempest network API tests.

rally@1cc98e0b5941:~$ rally verify start --pattern set=network
2017-05-10 07:36:35.584 597 INFO tempest-verifier [-] {2} tempest.api.network.admin.test_agent_management.AgentManagementTestJSON.test_list_agent ... success [0.082s]
2017-05-10 07:36:35.687 597 INFO tempest-verifier [-] {2} tempest.api.network.admin.test_agent_management.AgentManagementTestJSON.test_list_agents_non_admin ... success [0.102s]
2017-05-10 07:36:35.736 597 INFO tempest-verifier [-] {2} tempest.api.network.admin.test_agent_management.AgentManagementTestJSON.test_show_agent ... success [0.046s]
...
...
======
Totals
======
Ran: 261 tests in 233.000 sec.
 - Success: 208
 - Skipped: 51
 - Expected failures: 0
 - Unexpected success: 0
 - Failures: 2
Using verification (UUID=733812b2-e4d4-4bdd-96dd-7b7ccbe482b7) as the default verification for the future operations.

Run Scenario Test

1. Create floating IP pool with the name of "floating_network_name" in the sona-tempest.conf file. Make sure your gateway node is configured to the floating IP range, 172.27.0.0/24 in this example.

$ neutron net-create net-public --router:external True --provider:physical_network public --provider:network_type flat
$ neutron subnet-create net-public 172.27.0.0/24

 

2. If you're using all-in-one gateway node, add a static routing to forward floating IP packet to emulated external router container, 172.17.0.4 in this example.

$ sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' router-01
172.17.0.4
$ route add -net 172.27.0.0/24 gateway 172.17.0.4

 

3. Run test_server_basic_ops scenario, which creates a VM, allows SSH and ICMP by adding a security group, associates a floating IP to the VM, and then tries SSH.

$ rally verify start --pattern tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops --detail
2017-05-11 05:08:20.019 493 INFO rally.api [-] Starting verification (UUID=cc0434e8-c05e-4590-8037-601429f47f7f) for deployment 'sona-test' (UUID=11a61d7c-2c63-40dc-add1-d08930b4d933) by verifier 'tempest-verifier' (UUID=be0963df-3f1a-4bfd-a1a0-1ec2b9a3a948).
 
Congratulations! Verification doesn't have failed tests! :)
 
======
Totals
======
Ran: 1 tests in 30.259 sec.
 - Success: 1
 - Skipped: 0
 - Expected failures: 0
 - Unexpected success: 0
 - Failures: 0

SONA specific checks

After test ends, please make sure there left no stale flow rules with "flows" command from ONOS CLI.

  • No labels