Skip to content

Testing Guide

maggiemsft edited this page Jul 21, 2017 · 50 revisions

Testlab/Testbed

  • Requirement to Setup SONiC Testbed and Run SONiC Test Suite

    • Hardware/Software You are going to need
      • Repo that has all SONiC tests

      • There are two ways to setup the repo and run test:

        • One Regular Linux Server(Ubuntu) that has docker engine installed (this is the recommend method and will get support) Details please see Run Test

        • one Regular Linux Server(Ubuntu) that has Python and 'Ansible' installed (NOT RECOMMEND, unless you maintain it by yourself)

          • We are using Python version is 2.7, you may need some Python packages
          • We are using Ansible version 2.0.0.2
          • git pull/clone sonic-mgmt repo to get most current tests
      • At least one 'Fanout' layer-2 switch to connect all your SONiC Switch ports and Linux test server port, you may have more 'Fanout' Switches connects to multiple SONiC switches as DUTs. for more info, please read 'Testbed How To' section

      • One high performance Linux Server that acts as packet generating test server sending/receiving packets to/from your Sonic Switch, if you want to duplicate Sonic test, minimum memory requirement should be 92G for one testbed. We are using 192G. More Detailed information of testbed design and implementation is available in 'Testbed How To' section

  • Testbed How To

    Testbed Design, Deploy and Examples

  • Minigraph

    Minigraph is the only resource/starting point for configuring a SONiC device. Minigraph is a XML format file. Each SONiC device must have a matching Minigraph file for device configuration and test. SONiC devices Minigraph files could be saved locally or centralized saved in a remote location. All local Minigraph files are saved under ansible/minigraph folder. The file name must match your SONiC device name specified in 'lab' inventory file under ansible/ folder Generate Minigraph

  • Ansible Files to Manage Testlab

    • Ansible Inventory File:
      • ansible/lab

        include all lab DUTs, fanout switches and testbed server topologies

      • ansible/veos:

        all servers vmset vms

  • Testbed Fanout Graph Files

    • ansible/files/sonic_lab_devices.csv

      Helper file helps you create lab_connection_graph.xml, list all devices that are physically connected to fanout testbed (all devices should be in ansible/lab)

    • ansible/files/sonic_lab_links.csv

      Helper file helps you to create lab_connection_graph.xml, list all physical links between DUT, Fanoutleaf and Fanout root switches, servers and vlan configurations for each link

    • ansible/files/creategraph.py

      Helper file helps you generate a lab_connection_graph.xml based on the device file and link file specified above.

    • ansible/files/lab_connection_graph.xml

      This is the lab graph file for library/conn_graph_facts.py to parse and get all lab fanout switch connections information. If you have only one fanout switch, you may go head manually modify the sample lab_connection_graph.xml file to set bot your fanout leaf and fanout root switch management IP point to the same fanout switch management IP and make sure all DUT and Fanout name and IP are matching your testbed.

      Based on ansible_facts, you may write ansible playbooks to deploy fanout switches or run test which requires to know the DUT physical connections to fanout switch

Run Tests

  • Run all tests from docker container 'docker-sonic-mtmt'

    • Have a Linux(We are using Ubuntu) machine with docker installed and is reachable to your testbed If you are not familiar with Docker, please download docker and follow https://docs.docker.com/ for general tutorial
  • Build docker-sonic-mgmt docker from sonic-buildimage repo Follow the instructions https://github.com/Azure/sonic-buildimage/blob/master/README.md * make docker-sonic-mgmt. docker command make target/docker-sonic-mgmt.gz * then start and login to newly built docker: docker run -it your-newly-built-image bash

         This docker will automatically sync newest 'https://gitHub.com/azure/sonic-mgmt' repo into '/var/yourloginalias/sonic-mgmt' at build time.
    
         you may then pactch your own lab information into this folder and start to run test.
    

Tests one should run to validate SONiC on your platform

  • Test List

  • general test cases:

    ansible-playbook -i lab --limit your-dut-name test_sonic.yml --tags your-test-tag

  • Example: run fib test

    ansible-playbook -i lab --limit your-dut-name test_sonic.yml --tags fib -e "ptf_host=10.64.246.19 testbed_type=t1"

Here are some test design docs

Clone this wiki locally