diff --git a/ansible/roles/vm_set/tasks/add_topo.yml b/ansible/roles/vm_set/tasks/add_topo.yml index d80577c8999..a23d029dd1c 100644 --- a/ansible/roles/vm_set/tasks/add_topo.yml +++ b/ansible/roles/vm_set/tasks/add_topo.yml @@ -1,10 +1,22 @@ + +# The PTF image built from different branches may be incompatible. The ptf_imagetag variable added here is to +# support using different PTF images for different branches. When the ptf_imagetag variable is not specified, +# the PTF image with default "latest" tag will be used. When a specific PTF image version is required, we can +# specify a value for the ptf_imagetag variable somewhere, for example, specify from command line: +# ./testbed-cli.sh add-topo - vault -e ptf_imagetag=201811 +# By using this practice, we suggest to add different tags for different PTF image versions in docker registry. +- name: Set default value for ptf_imagetag + set_fact: + ptf_imagetag: "latest" + when: ptf_imagetag is not defined + - name: Create a docker container ptf_{{ vm_set_name }} docker: registry: "{{ docker_registry_host }}" username: "{{ docker_registry_username }}" password: "{{ docker_registry_password }}" name: ptf_{{ vm_set_name }} - image: "{{ docker_registry_host }}/{{ ptf_imagename }}" + image: "{{ docker_registry_host }}/{{ ptf_imagename }}:{{ ptf_imagetag }}" pull: always state: reloaded net: none diff --git a/ansible/testbed-cli.sh b/ansible/testbed-cli.sh index 0979dd381c0..5d416b2ad63 100755 --- a/ansible/testbed-cli.sh +++ b/ansible/testbed-cli.sh @@ -34,6 +34,8 @@ function usage echo " $0 start-vms server-name vault-password-file -e autostart=yes" echo "To stop VMs on a server: $0 stop-vms 'server-name' ~/.password" echo "To deploy a topology on a server: $0 add-topo 'topo-name' ~/.password" + echo " Optional argument for add-topo:" + echo " -e ptf_imagetag= # Use PTF image with specified tag for creating PTF container" echo "To remove a topology on a server: $0 remove-topo 'topo-name' ~/.password" echo "To renumber a topology on a server: $0 renumber-topo 'topo-name' ~/.password" echo "To connect a topology: $0 connect-topo 'topo-name' ~/.password"