Skip to content

Generate Minigraph File Based On Testbed Type

maggiemsft edited this page Jul 20, 2017 · 1 revision

Background

Current SONiC device configuration is based on Minigraph as we mentioned before. And SONiC Testbed is deployed by topology type.

Back ground for this playbook is when user call testbed-cli to deploy a testbed topology, user may use this playbook to generate matching SONiC minigraph file and deploy it into SONiC switch under test and start to run test playbook.

Before running this playbook

  1. you have a SONiC DUT which is reachable

  2. you have your testbed.csv configured to reflect your testbed type.

Then run config_sonic_basedon_testbed.yml to generate the matching Minigraph of your testbed.

Playbook: config_sonic_basedon_testbed.yml:

Generate matching configuration file for SONiC switch(Minigraph) based on a specific testbed topology specified in testbed.csv

Sample line in testbed.csv

ms-t0,vms1-0,t0,docker-ptf-sai-mlnx,10.255.0.178/24,server_1,VM0100,str-msn2700-01,Tests vms

VM topologies are defined inside of vars/ directory in files vars/topo_{{ topology_name}}.yml VMs inventory file is also required to have all VMs ready for generating the minigraph file VMs inventory is in file 'veos'

Template files for generating minigraph.xml are defined in template/topo directory

To generate and deploy minigraph for SONiC switch matching the VM topology please use following command

ansible-playbook -i lab config_sonic_basedon_testbed.yml -l sonic_dut_name -e vm_base=VM0300 -e topo=t0 [-e deploy=true]

Arguments:

-l str-msn2700-01
  • the sonic_dut_name you are going to generate Minigraph for(matching the DUT name in testbed.csv)
-e vm_base=VM0100
  • the VM name which is used to as base to calculate VM name for this set(matching the base vm in testbed.csv)
-e topo=t0
  • the name of topology to generate Minigraph file (matching the topology in testbed.csv)

-e deploy=True

  • if deploy the newly generated Minigraph to the targent DUT, default is false if not defined

After minigraph.xml is generated, the playbook will replace the original minigraph.xml file under ansible/minigraph with the newly generated minigraph.xml file for the SONiC device. The playbook will based on deploy=True or False to decide if load the SONiC device with new minigraph.xml or not. If deploy=true, the playbook will reboot the SONiC switch after change to new Minigraph to make it take effect

Clone this wiki locally