Testbed actions and status - maggiemsft/SONiC GitHub Wiki
Testbed Command Line
testbed-cli.sh is the command line to setup/teardown the testbed, as well as add/remove/switch topology.
- Maintenance purposes only
- ./testbed-cli.sh start-vms {server_name} ~./password# after a server restarted
- ./testbed-cli.sh stop-vms {server_name} ~./password# before a server restarted
 
- General usage
- ./testbed-cli.sh add-topo {topo_name} ~./password# create topo with name {topo_name} from testbed.csv
- ./testbed-cli.sh remove-topo {topo_name} ~./password# destroy topo with name {topo_name} from testbed.csv
- ./testbed-cli.sh renumber-topo {topo_name} ~./password# renumber topo with name {topo_name} from testbed.csv
- ./testbed-cli.sh connect-vms {topo-name} ~./password# To connect a VM to a topology
- ./testbed-cli.sh disconnect-vms {topo-name} ~./password# To connect a VM to a topology
- ./testbed-cli.sh config-vm {topo-name} {vm-name} ~./password# To configure a VM on a server
- ./testbed-cli.sh gen-mg {topo-name} {inventory} ~./password#To generate minigraph for DUT in a topology
- ./testbed-cli.sh deploy-mg {topo-name} {inventory} ~./password#To gnerate and load minigraph to DUT in a topology
- ./testbed-cli.sh test-mg {topo-name} {inventory} ~./password#To test generated minigraph to DUT in a topology
 
Add/Remove topo
Goal is to  connect|disconnect SONiC DUT to the virtual topology defined in testbed file.
- 
To add a new testbed “vms1-1-t1”: - ./testbed-cli add-topo vms1-1-t1 ~/.password
 
- 
To switch from testbed “vms1-1-t1” to testbed “vms1-1-lag” - ./testbed-cli remove-topo vms1-1-t1 ~/.password
- ./testbed-cli add-topo vms1-1-t1-lag ~/.password
 
Feature: The VMs configuration will be updated while switching from one topo to another Feature: Might be used for renumbering too Caveat: Have to remember what was the initial topology. Should be fixed in future
Renumber topo
Goal is to use one VM set virtual topology against different DUTs
For Example:
you defined 2 topology vms2-2-b and vms2-2-m in testbed_topology.yaml file and you want to first connect this topology to sonic_dut_1, then after test finish, you shift this virtual topology to sonic_dut_2.
- 
To add a new testbed “vms2-2-b”: - ./testbed-cli add-topo vms2-2-b ~/.password
 
- 
To switch from testbed “vms2-2-b” to testbed “vms2-2-m” - ./testbed-cli renumber-topo vms2-2-m ~/.password
 
Feature: The VMs configuration will NOT be updated while switching from one topo to another (faster). TODO: check topo field when renumbering between topologies
Check Test bed status
can query what are current deployed topologies
can query if vms of specific topology are connected
can query free non-allocated vlan-ids
can query free not-allocated vms
can add or remove topology
can connect or disconnect vm
can destroy individual vm and recreate it( if there is topology being deployed and vm is connected status, reconnect vm)
Server need to save table:
vlan usage:
  200: used|free
  232: used|free
vm usage:
  VM0100: used|free
  VM0104: used|free
testbed status:
  testbedname1: connected|notconnect
  testbedname2: connected|notconnect
testbed assignment file:
topology_1:
  name: meaningful_name_for_user
  internal_name: tp_1 (unique name used in create backplane bridge name, <= 8 character)
  dut: sonic_dut_1
  topo: t0
  starting_vlan: 2000
  starting_vm: VM0100
  server: server_1