Skip to content

Testing jobs can specify the VM base dynamically during deploy the test environment.#2211

Open
gord1306 wants to merge 1 commit intosonic-net:masterfrom
gord1306:vmbase_selectable
Open

Testing jobs can specify the VM base dynamically during deploy the test environment.#2211
gord1306 wants to merge 1 commit intosonic-net:masterfrom
gord1306:vmbase_selectable

Conversation

@gord1306
Copy link
Contributor

@gord1306 gord1306 commented Sep 14, 2020

Description of PR

Testing jobs can specify the VM base dyanmically during deploy the test environment.

  1. add/remove topo - add a new argument to specify the VM Base nubmer
    The usage will be ./testbed-cli.sh -b VM0108 add-topo 1-1_t0 ~/.password​

  2. deploy minigraph - fix to deploy correct VM METADAT in to minigraph when
    user specify vm_base dynamically. The vm_base can be assgined from 2 sources,
    one is read from testbed.csv file, another is from extra argument.
    assigned from testbed.csv file
    ansible-playbook -i lab config_sonic_basedon_testbed.yml -l as7816-64x -e testbed_name=1-1_t0 -e deploy=true -e save=true

    assigned from extra arguments
    ansible-playbook -i lab config_sonic_basedon_testbed.yml -l as7816-64x -e vm_base=VM0108 -e topo=t0 -e deploy=true -e save=true

Signed-off-by: Gord Chen [email protected]

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Approach

What is the motivation for this PR?

User can dynamically specify the VM base and make multiple users can perform testing on a single host concurrently

How did you do it?

How did you verify/test it?

add/remove topolgoy

Any platform specific information?

No

Supported testbed topology if it's a new test case?

All

Documentation

@gord1306 gord1306 changed the title User can specify the VM base dyanmically during deploy the test environment. Testing jobs can specify the VM base dynamically during deploy the test environment. Sep 14, 2020
@yxieca
Copy link
Collaborator

yxieca commented Sep 14, 2020

@gord1306 can you elaborate the motivation of this change?

I feel that this change can leave the dut at uncertain state. e.g. minigraph and deployment don't match. And for test cases needs to access the VM, e.g. advanced reboot. They will likely find wrong VM and cause test to fail. Is there a particular reason you don't want to check in the testbed detail?

@gord1306
Copy link
Contributor Author

@gord1306 can you elaborate the motivation of this change?

I feel that this change can leave the dut at uncertain state. e.g. minigraph and deployment don't match. And for test cases needs to access the VM, e.g. advanced reboot. They will likely find wrong VM and cause test to fail. Is there a particular reason you don't want to check in the testbed detail?

@gord1306 can you elaborate the motivation of this change?

I feel that this change can leave the dut at uncertain state. e.g. minigraph and deployment don't match. And for test cases needs to access the VM, e.g. advanced reboot. They will likely find wrong VM and cause test to fail. Is there a particular reason you don't want to check in the testbed detail?

@yxieca , for deployment, the options already exists in https://github.com/Azure/sonic-mgmt/blob/master/ansible/config_sonic_basedon_testbed.yml#L14 I just fix the yml to make it work.

And the motivation is to make the topology deployment more flexible on a single host, if the user wants to perform multiple testing jobs concurrently.

For the case advanced reboot, I am not clear what case you concerned. the deployment will write the VM IP address in the METADATA according to the selected VM Base, if the add topology/deployment use same VM base, it should have no match issue

Copy link
Collaborator

@wangxin wangxin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why dynamically specifying vm_base is for concurrent deploy. If you need to concurrently deploy multiple topologies, then the VMs must not overlap. That means multiple test setups will co-exist on a same test server. Then, in testbed.csv, the vm_base must be correctly specified to avoid overlap in the first place. If vm_base is already correctly specified, why need to dynamically specify it again?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate the purpose of moving platform.json to platform.json.bak?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unnecessary modification, will remove it

Copy link
Contributor Author

@gord1306 gord1306 Sep 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why dynamically specifying vm_base is for concurrent deploy. If you need to concurrently deploy multiple topologies, then the VMs must not overlap. That means multiple test setups will co-exist on a same test server. Then, in testbed.csv, the vm_base must be correctly specified to avoid overlap in the first place. If vm_base is already correctly specified, why need to dynamically specify it again?

My description is not suitable before, it's not concurrency, this modification should be related to the VMs' utilization. It depend on different deployment scenario of the testbed. If the content of testbed.csv is not dynamically/frequently generated , that means the VM base are defined solid. I would like to maximum the VM utilization in this kind of case. If there are any VMs are free, they can be dynamically assigned to new testing job, and be not restrict by the testbed.csv.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean testbed.csv is outdated? The vm_base information in testbed.csv is too old and inaccurate?
We have to manually check if VMs are free, right? I am not sure whether it is easy to do that. Assume we have a large pool of VMs, it is usually not straightforward to tell which VMs are used by which testbed. Maybe the better way is to code correct vm_base info in testbed.csv.

Copy link
Contributor Author

@gord1306 gord1306 Sep 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not outdated, in our testing environment, the vm_base of testbed.csv more likes the default value. There is extra service (e.g. Jenkins) to arrange the VM resources for testing. We also check the bridges' interfaces to get the VMs' usages,
e.g. VM0212~VM0215 are allocated to the 2-7 testbed, the other VMs are free

sonic@sonic-server-02:~$ for i in $(sudo ovs-vsctl list-br | grep br-b); do echo ""; echo $i ; sudo ovs-vsctl list-ifaces $i ; done;
[sudo] password for sonic:

br-b-vms2-7
veth-bb-VM0212
veth-bb-VM0213
veth-bb-VM0214
veth-bb-VM0215

Therefore we add this extra argument and we can specify the VM base dynamically when perform the testing

User can specify the VM base dyanmically during deploy the test environment.

1. add/remove topo - add a new argument to specify the VM Base nubmer
   The usage will be ./testbed-cli.sh -b VM0108 add-topo 1-1_t0 ~/.password​

2. deploy minigraph - fix to deploy correct VM METADAT in to minigraph when
user specify vm_base dynamically. The vm_base can  be assgined from 2 sources,
one is read from testbed.csv file, another is from extra argument.
 assigned from testbed.csv file
   ansible-playbook -i lab config_sonic_basedon_testbed.yml -l as7816-64x -e testbed_name=2-1_t0 -e deploy=true -e save=true

 assigned from extra arguments
   ansible-playbook -i lab config_sonic_basedon_testbed.yml -l as7816-64x -e vm_base=VM0108 -e topo=t0 -e deploy=true -e save=true
when: "VM_topo | bool and testbed_name is defined"

- name: gather testbed VM informations from extra variables
testbed_vm_info: base_vm={{ vm_base }} topo={{ topo }} vm_file={{ vm_file }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated file config_sonic_basedon_testbed.yml is called by testbed-cli.sh in generate_minigraph, deploy_minigraph and test_minigraph. Let's take generate_minigraph as an example:

function generate_minigraph
{
  topology=$1
  inventory=$2
  passfile=$3
  shift
  shift
  shift

  echo "Generating minigraph '$topology'"

  read_file $topology

  ansible-playbook -i "$inventory" config_sonic_basedon_testbed.yml --vault-password-file="$passfile" -l "$duts" -e testbed_name="$topology" -e testbed_file=$tbfile -e vm_file=$vmfile -e local_minigraph=true $@

  echo Done
}

According to the ansible-playbook command line, variables vm_base and topo are not passed to the playbook. I suspect that in this playbook, variables vm_base and topo are undefined.

@gord1306 gord1306 requested a review from a team as a code owner March 2, 2022 17:37
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
Update sonic-utilities submodule pointer to include the following:
* [route_check]: Ignore standalone tunnel routes (sonic-net#2325) ([sonic-net#2346](sonic-net/sonic-utilities#2346))
* [VRF]Adding CLI checks to ensure Vrf is valid in interface bind and static route commands ([sonic-net#2333](sonic-net/sonic-utilities#2333))
* Subinterface vrf bind issue fix ([sonic-net#2211](sonic-net/sonic-utilities#2211))
* [decode-syseeprom] Fix setting use_db based on support_eeprom_db ([sonic-net#2270](sonic-net/sonic-utilities#2270))
* Fix vrf UT failed issue ([sonic-net#2309](sonic-net/sonic-utilities#2309))

Signed-off-by: dprital <[email protected]>

Signed-off-by: dprital <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants