Skip to content

Commit d9ec5f8

Browse files
wangxinlguohan
authored andcommitted
[add-topo] Add support for specifying PTF docker image tag (#1046)
Signed-off-by: Xin Wang <[email protected]>
1 parent 57e4120 commit d9ec5f8

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

ansible/roles/vm_set/tasks/add_topo.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
1+
2+
# The PTF image built from different branches may be incompatible. The ptf_imagetag variable added here is to
3+
# support using different PTF images for different branches. When the ptf_imagetag variable is not specified,
4+
# the PTF image with default "201811" tag will be used in this sonic-mgmt 201811 branch. When a different PTF
5+
# image version is required, we can specify a different value for the ptf_imagetag variable somewhere to
6+
# override the default value, for example, specify from command line:
7+
# ./testbed-cli.sh add-topo <testbed_name>-<topo> vault -e ptf_imagetag=myversion
8+
# By using this practice, we suggest to add different tags for different PTF image versions in docker registry.
9+
# And we suggest to add tag "201811" for PTF image built from the 201811 branch.
10+
- name: Set default value for ptf_imagetag
11+
set_fact:
12+
ptf_imagetag: "201811"
13+
when: ptf_imagetag is not defined
14+
115
- name: Create a docker container ptf_{{ vm_set_name }}
216
docker:
317
registry: "{{ docker_registry_host }}"
418
username: "{{ docker_registry_username }}"
519
password: "{{ docker_registry_password }}"
620
name: ptf_{{ vm_set_name }}
7-
image: "{{ docker_registry_host }}/{{ ptf_imagename }}"
21+
image: "{{ docker_registry_host }}/{{ ptf_imagename }}:{{ ptf_imagetag }}"
822
pull: always
923
state: reloaded
1024
net: none

ansible/testbed-cli.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ function usage
3434
echo " $0 start-vms server-name vault-password-file -e autostart=yes"
3535
echo "To stop VMs on a server: $0 stop-vms 'server-name' ~/.password"
3636
echo "To deploy a topology on a server: $0 add-topo 'topo-name' ~/.password"
37+
echo " Optional argument for add-topo:"
38+
echo " -e ptf_imagetag=<tag> # Use PTF image with specified tag for creating PTF container"
3739
echo "To remove a topology on a server: $0 remove-topo 'topo-name' ~/.password"
3840
echo "To renumber a topology on a server: $0 renumber-topo 'topo-name' ~/.password"
3941
echo "To connect a topology: $0 connect-topo 'topo-name' ~/.password"

0 commit comments

Comments
 (0)