diff --git a/ansible/TestbedProcessing.py b/ansible/TestbedProcessing.py
index c43737b8cf7..677d05f9a6a 100644
--- a/ansible/TestbedProcessing.py
+++ b/ansible/TestbedProcessing.py
@@ -195,11 +195,11 @@ def makeSonicLabDevices(data, outfile):
makeTestbed(data, outfile)
@:parameter data - the dictionary to look through (devices dictionary)
@:parameter outfile - the file to write to
-generates /testbed.csv by pulling confName, groupName, topo, ptf_image_name, ptf_ip, server, vm_base, dut, and comment
+generates /testbed.csv by pulling confName, groupName, topo, ptf_image_name, ptf_ip, ptf_ipv6, server, vm_base, dut, and comment
error handling: checks if attribute values are None type or string "None"
"""
def makeTestbed(data, outfile):
- csv_columns = "# conf-name,group-name,topo,ptf_image_name,ptf,ptf_ip,server,vm_base,dut,comment"
+ csv_columns = "# conf-name,group-name,topo,ptf_image_name,ptf,ptf_ip,ptf_ipv6,server,vm_base,dut,comment"
topology = data
csv_file = outfile
@@ -227,6 +227,8 @@ def makeTestbed(data, outfile):
ptf_image_name = ""
if not ptf_ip:
ptf_ip = ""
+ if not ptf_ipv6:
+ ptf_ipv6 = ""
if not server:
server = ""
if not vm_base:
@@ -238,7 +240,7 @@ def makeTestbed(data, outfile):
if not comment:
comment = ""
- row = confName + "," + groupName + "," + topo + "," + ptf_image_name + "," + ptf + "," + ptf_ip + "," + server + "," + vm_base + "," + dut + "," + comment
+ row = confName + "," + groupName + "," + topo + "," + ptf_image_name + "," + ptf + "," + ptf_ip + "," + ptf_ipv6 + ","+ server + "," + vm_base + "," + dut + "," + comment
f.write(row + "\n")
except IOError:
print("I/O error: issue creating testbed.csv")
diff --git a/ansible/lab b/ansible/lab
index e060560371f..b5b88c614c8 100644
--- a/ansible/lab
+++ b/ansible/lab
@@ -6,10 +6,10 @@ hwsku="ACS-MSN2700"
iface_speed='40000'
[sonic_s6000]
-lab-s6000-01 ansible_host=10.251.0.189
-vlab-01 ansible_host=10.250.0.101
-vlab-03 ansible_host=10.250.0.105
-vlab-04 ansible_host=10.250.0.107
+lab-s6000-01 ansible_host=10.251.0.189 ansible_hostv6=fec0::ffff:afa:9
+vlab-01 ansible_host=10.250.0.101 ansible_hostv6=fec0::ffff:afa:1
+vlab-03 ansible_host=10.250.0.105 ansible_hostv6=fec0::ffff:afa:5
+vlab-04 ansible_host=10.250.0.107 ansible_hostv6=fec0::ffff:afa:7
[sonic_s6000:vars]
hwsku="Force10-S6000"
diff --git a/ansible/library/test_facts.py b/ansible/library/test_facts.py
index a8696fe0e1c..0e26a0e1b7e 100644
--- a/ansible/library/test_facts.py
+++ b/ansible/library/test_facts.py
@@ -30,7 +30,7 @@
EXAMPLES = '''
Testbed CSV file example:
- # conf-name,group-name,topo,ptf_image_name,ptf_ip,server,vm_base,dut,comment
+ # conf-name,group-name,topo,ptf_image_name,ptf_ip,ptf_ipv6,server,vm_base,dut,comment
ptf1-m,ptf1,ptf32,docker-ptf-sai-mlnx,10.255.0.188/24,server_1,,str-msn2700-01,Tests ptf
vms-t1,vms1-1,t1,docker-ptf-sai-mlnx,10.255.0.178/24,server_1,VM0100,str-msn2700-01,Tests vms
vms-t1-lag,vms1-1,t1-lag,docker-ptf-sai-mlnx,10.255.0.178/24,server_1,VM0100,str-msn2700-01,Tests vms
@@ -108,7 +108,7 @@ def __init__(self, testbed_file):
self.testbed_topo = defaultdict()
def read_testbed_topo(self):
- CSV_FIELDS = ('conf-name', 'group-name', 'topo', 'ptf_image_name', 'ptf', 'ptf_ip', 'server', 'vm_base', 'dut', 'comment')
+ CSV_FIELDS = ('conf-name', 'group-name', 'topo', 'ptf_image_name', 'ptf', 'ptf_ip', 'ptf_ipv6', 'server', 'vm_base', 'dut', 'comment')
with open(self.testbed_filename) as f:
topo = csv.DictReader(f, fieldnames=CSV_FIELDS, delimiter=',')
@@ -125,6 +125,10 @@ def read_testbed_topo(self):
ptfaddress = ipaddress.IPNetwork(line['ptf_ip'])
line['ptf_ip'] = str(ptfaddress.ip)
line['ptf_netmask'] = str(ptfaddress.netmask)
+ if line['ptf_ipv6']:
+ ptfaddress = ipaddress.IPNetwork(line['ptf_ipv6'])
+ line['ptf_ipv6'] = str(ptfaddress.ip)
+ line['ptf_netmask_v6'] = str(ptfaddress.netmask)
line['duts'] = line['dut'].translate(string.maketrans("", ""), "[] ").split(';')
del line['dut']
diff --git a/ansible/roles/vm_set/library/vm_topology.py b/ansible/roles/vm_set/library/vm_topology.py
index 9019cad74e9..cf522f5045c 100644
--- a/ansible/roles/vm_set/library/vm_topology.py
+++ b/ansible/roles/vm_set/library/vm_topology.py
@@ -51,6 +51,7 @@
- vm_names: list of VMs represented on a current host
- vm_base: which VM consider the first VM in the current vm set
- ptf_mgmt_ip_addr: ip address with prefixlen for the injected docker container
+ - ptf_mgmt_ipv6_addr: ipv6 address with prefixlen for the injected docker container
- ptf_mgmt_ip_gw: default gateway for the injected docker container
- ptf_bp_ip_addr: ipv6 address with prefixlen for the injected docker container
- ptf_bp_ipv6_addr: ipv6 address with prefixlen for the injected docker container
@@ -75,6 +76,7 @@
vm_names: "{{ VM_hosts }}"
vm_base: "{{ VM_base }}"
ptf_mgmt_ip_addr: "{{ ptf_ip }}"
+ ptf_mgmt_ipv6_addr: "{{ ptf_ipv6 }}"
ptf_mgmt_ip_gw: "{{ mgmt_gw }}"
ptf_bp_ip_addr: "{{ ptf_ip }}"
ptf_bp_ipv6_addr: "{{ ptf_ip }}"
@@ -235,9 +237,9 @@ def add_veth_ports_to_docker(self):
return
- def add_mgmt_port_to_docker(self, mgmt_bridge, mgmt_ip, mgmt_gw):
+ def add_mgmt_port_to_docker(self, mgmt_bridge, mgmt_ip, mgmt_gw, mgmt_ipv6_addr=None):
self.add_br_if_to_docker(mgmt_bridge, PTF_MGMT_IF_TEMPLATE % self.vm_set_name, MGMT_PORT_NAME)
- self.add_ip_to_docker_if(MGMT_PORT_NAME, mgmt_ip, mgmt_gw=mgmt_gw)
+ self.add_ip_to_docker_if(MGMT_PORT_NAME, mgmt_ip, mgmt_ipv6_addr=mgmt_ipv6_addr, mgmt_gw=mgmt_gw)
return
@@ -672,6 +674,7 @@ def main():
vm_names=dict(required=True, type='list'),
vm_base=dict(required=False, type='str'),
ptf_mgmt_ip_addr=dict(required=False, type='str'),
+ ptf_mgmt_ipv6_addr=dict(required=False, type='str'),
ptf_mgmt_ip_gw=dict(required=False, type='str'),
ptf_bp_ip_addr=dict(required=False, type='str'),
ptf_bp_ipv6_addr=dict(required=False, type='str'),
@@ -709,6 +712,7 @@ def main():
check_params(module, ['vm_set_name',
'topo',
'ptf_mgmt_ip_addr',
+ 'ptf_mgmt_ipv6_addr',
'ptf_mgmt_ip_gw',
'ptf_bp_ip_addr',
'ptf_bp_ipv6_addr',
@@ -733,10 +737,11 @@ def main():
net.init(vm_set_name, topo, vm_base, dut_fp_ports)
ptf_mgmt_ip_addr = module.params['ptf_mgmt_ip_addr']
+ ptf_mgmt_ipv6_addr = module.params['ptf_mgmt_ipv6_addr']
ptf_mgmt_ip_gw = module.params['ptf_mgmt_ip_gw']
mgmt_bridge = module.params['mgmt_bridge']
- net.add_mgmt_port_to_docker(mgmt_bridge, ptf_mgmt_ip_addr, ptf_mgmt_ip_gw)
+ net.add_mgmt_port_to_docker(mgmt_bridge, ptf_mgmt_ip_addr, ptf_mgmt_ip_gw, ptf_mgmt_ipv6_addr)
ptf_bp_ip_addr = module.params['ptf_bp_ip_addr']
ptf_bp_ipv6_addr = module.params['ptf_bp_ipv6_addr']
@@ -787,6 +792,7 @@ def main():
check_params(module, ['vm_set_name',
'topo',
'ptf_mgmt_ip_addr',
+ 'ptf_mgmt_ipv6_addr',
'ptf_mgmt_ip_gw',
'ptf_bp_ip_addr',
'ptf_bp_ipv6_addr',
@@ -811,10 +817,11 @@ def main():
net.init(vm_set_name, topo, vm_base, dut_fp_ports, True)
ptf_mgmt_ip_addr = module.params['ptf_mgmt_ip_addr']
+ ptf_mgmt_ipv6_addr = module.params['ptf_mgmt_ipv6_addr']
ptf_mgmt_ip_gw = module.params['ptf_mgmt_ip_gw']
mgmt_bridge = module.params['mgmt_bridge']
- net.add_mgmt_port_to_docker(mgmt_bridge, ptf_mgmt_ip_addr, ptf_mgmt_ip_gw)
+ net.add_mgmt_port_to_docker(mgmt_bridge, ptf_mgmt_ip_addr, ptf_mgmt_ip_gw, ptf_mgmt_ipv6_addr)
ptf_bp_ip_addr = module.params['ptf_bp_ip_addr']
ptf_bp_ipv6_addr = module.params['ptf_bp_ipv6_addr']
diff --git a/ansible/roles/vm_set/tasks/add_topo.yml b/ansible/roles/vm_set/tasks/add_topo.yml
index 8b1dd6eb8e4..2af6e11b1eb 100644
--- a/ansible/roles/vm_set/tasks/add_topo.yml
+++ b/ansible/roles/vm_set/tasks/add_topo.yml
@@ -57,6 +57,7 @@
vm_names: "{{ VM_hosts }}"
vm_base: "{{ VM_base }}"
ptf_mgmt_ip_addr: "{{ ptf_ip }}"
+ ptf_mgmt_ipv6_addr: "{{ ptf_ipv6 }}"
ptf_mgmt_ip_gw: "{{ mgmt_gw }}"
ptf_bp_ip_addr: "{{ ptf_bp_ip }}"
ptf_bp_ipv6_addr: "{{ ptf_bp_ipv6 }}"
diff --git a/ansible/roles/vm_set/tasks/renumber_topo.yml b/ansible/roles/vm_set/tasks/renumber_topo.yml
index 2b25744bb91..b5607daea11 100644
--- a/ansible/roles/vm_set/tasks/renumber_topo.yml
+++ b/ansible/roles/vm_set/tasks/renumber_topo.yml
@@ -36,6 +36,7 @@
vm_names: "{{ VM_hosts }}"
vm_base: "{{ VM_base }}"
ptf_mgmt_ip_addr: "{{ ptf_ip }}"
+ ptf_mgmt_ipv6_addr: "{{ ptf_ipv6 }}"
ptf_mgmt_ip_gw: "{{ mgmt_gw }}"
mgmt_bridge: "{{ mgmt_bridge }}"
dut_fp_ports: "{{ dut_fp_ports }}"
diff --git a/ansible/templates/minigraph_dpg.j2 b/ansible/templates/minigraph_dpg.j2
index f337df68192..801abcfef42 100644
--- a/ansible/templates/minigraph_dpg.j2
+++ b/ansible/templates/minigraph_dpg.j2
@@ -32,9 +32,9 @@
V6HostIP
eth0
- FC00:2::32/64
+ {{ ansible_hostv6 }}/64
- FC00:2::32/64
+ {{ ansible_hostv6 }}/64
diff --git a/ansible/testbed-cli.sh b/ansible/testbed-cli.sh
index 8896c385482..d3b89591e1d 100755
--- a/ansible/testbed-cli.sh
+++ b/ansible/testbed-cli.sh
@@ -88,9 +88,10 @@ function read_file
ptf_imagename=${line_arr[3]}
ptf=${line_arr[4]}
ptf_ip=${line_arr[5]}
- server=${line_arr[6]}
- vm_base=${line_arr[7]}
- dut=${line_arr[8]//;/,}
+ ptf_ipv6=${line_arr[6]}
+ server=${line_arr[7]}
+ vm_base=${line_arr[8]}
+ dut=${line_arr[9]//;/,}
duts=${dut//[\[\] ]/}
}
@@ -153,7 +154,7 @@ function add_topo
read_file ${topology}
- ANSIBLE_SCP_IF_SSH=y ansible-playbook -i $vmfile testbed_add_vm_topology.yml --vault-password-file="${passwd}" -l "$server" -e topo_name="$topo_name" -e dut_name="$duts" -e VM_base="$vm_base" -e ptf_ip="$ptf_ip" -e topo="$topo" -e vm_set_name="$testbed_name" -e ptf_imagename="$ptf_imagename" -e vm_type="$vm_type" $@
+ ANSIBLE_SCP_IF_SSH=y ansible-playbook -i $vmfile testbed_add_vm_topology.yml --vault-password-file="${passwd}" -l "$server" -e topo_name="$topo_name" -e dut_name="$duts" -e VM_base="$vm_base" -e ptf_ip="$ptf_ip" -e topo="$topo" -e vm_set_name="$testbed_name" -e ptf_imagename="$ptf_imagename" -e vm_type="$vm_type" -e ptf_ipv6="$ptf_ipv6" $@
ansible-playbook fanout_connect.yml -i $vmfile --limit "$server" --vault-password-file="${passwd}" -e "dut=$duts" $@
@@ -173,7 +174,7 @@ function remove_topo
read_file ${topology}
- ANSIBLE_SCP_IF_SSH=y ansible-playbook -i $vmfile testbed_remove_vm_topology.yml --vault-password-file="${passwd}" -l "$server" -e topo_name="$topo_name" -e dut_name="$duts" -e VM_base="$vm_base" -e ptf_ip="$ptf_ip" -e topo="$topo" -e vm_set_name="$testbed_name" -e ptf_imagename="$ptf_imagename" -e vm_type="$vm_type" $@
+ ANSIBLE_SCP_IF_SSH=y ansible-playbook -i $vmfile testbed_remove_vm_topology.yml --vault-password-file="${passwd}" -l "$server" -e topo_name="$topo_name" -e dut_name="$duts" -e VM_base="$vm_base" -e ptf_ip="$ptf_ip" -e topo="$topo" -e vm_set_name="$testbed_name" -e ptf_imagename="$ptf_imagename" -e vm_type="$vm_type" -e ptf_ipv6="$ptf_ipv6" $@
echo Done
}
@@ -188,7 +189,7 @@ function renumber_topo
read_file ${topology}
- ANSIBLE_SCP_IF_SSH=y ansible-playbook -i $vmfile testbed_renumber_vm_topology.yml --vault-password-file="${passwd}" -l "$server" -e topo_name="$topo_name" -e dut_name="$duts" -e VM_base="$vm_base" -e ptf_ip="$ptf_ip" -e topo="$topo" -e vm_set_name="$testbed_name" -e ptf_imagename="$ptf_imagename" $@
+ ANSIBLE_SCP_IF_SSH=y ansible-playbook -i $vmfile testbed_renumber_vm_topology.yml --vault-password-file="${passwd}" -l "$server" -e topo_name="$topo_name" -e dut_name="$duts" -e VM_base="$vm_base" -e ptf_ip="$ptf_ip" -e topo="$topo" -e vm_set_name="$testbed_name" -e ptf_imagename="$ptf_imagename" -e ptf_ipv6="$ptf_ipv6"$@
ansible-playbook fanout_connect.yml -i $vmfile --limit "$server" --vault-password-file="${passwd}" -e "dut=$duts" $@
@@ -205,7 +206,7 @@ function refresh_dut
read_file ${topology}
- ANSIBLE_SCP_IF_SSH=y ansible-playbook -i $vmfile testbed_refresh_dut.yml --vault-password-file="${passwd}" -l "$server" -e topo_name="$topo_name" -e dut_name="$duts" -e VM_base="$vm_base" -e ptf_ip="$ptf_ip" -e topo="$topo" -e vm_set_name="$testbed_name" -e ptf_imagename="$ptf_imagename" $@
+ ANSIBLE_SCP_IF_SSH=y ansible-playbook -i $vmfile testbed_refresh_dut.yml --vault-password-file="${passwd}" -l "$server" -e topo_name="$topo_name" -e dut_name="$duts" -e VM_base="$vm_base" -e ptf_ip="$ptf_ip" -e topo="$topo" -e vm_set_name="$testbed_name" -e ptf_imagename="$ptf_imagename" -e ptf_ipv6="$ptf_ipv6" $@
echo Done
}
diff --git a/ansible/testbed_add_vm_topology.yml b/ansible/testbed_add_vm_topology.yml
index d8865b61134..633c8419501 100644
--- a/ansible/testbed_add_vm_topology.yml
+++ b/ansible/testbed_add_vm_topology.yml
@@ -24,6 +24,7 @@
# -e dut_name=str-msn2700-01 - the name of target dut
# -e VM_base=VM0300 - the VM name which is used to as base to calculate VM name for this set
# -e ptf_ip=10.255.0.255/23 - the ip address and prefix of ptf container mgmt interface
+# -e ptf_ipv6=fec0::ffff:afa:1/64 - the ipv6 address and prefix of ptf container mgmt interface
# -e topo=t0 - the name of removed topo
# -e ptf_imagename=docker-ptf - name of a docker-image which will be used for the ptf docker container
# -e vm_type=veos|ceos
@@ -53,6 +54,10 @@
fail: msg="Define ptf ip variable with -e ptf_ip=something"
when: ptf_ip is not defined
+ - name: Check that variable ptf_ipv6 is defined
+ fail: msg="Define ptf ipv6 variable with -e ptf_ipv6=something"
+ when: ptf_ipv6 is not defined
+
- name: Check that variable topo is defined
fail: msg="Define topo variable with -e topo=something"
when: topo is not defined
diff --git a/ansible/testbed_refresh_dut.yml b/ansible/testbed_refresh_dut.yml
index 2902f8e31a6..1ad3638e43a 100644
--- a/ansible/testbed_refresh_dut.yml
+++ b/ansible/testbed_refresh_dut.yml
@@ -24,6 +24,7 @@
# -e dut_name=str-msn2700-01 - the name of target dut
# -e VM_base=VM0300 - the VM name which is used to as base to calculate VM name for this set
# -e ptf_ip=10.255.0.255/23 - the ip address and prefix of ptf container mgmt interface
+# -e ptf_ipv6=fec0::ffff:afa:1/64 - the ipv6 address and prefix of ptf container mgmt interface
# -e topo=t0 - the name of removed topo
# -e ptf_imagename=docker-ptf - name of a docker-image which will be used for the ptf docker container
@@ -52,6 +53,10 @@
fail: msg="Define ptf ip variable with -e ptf_ip=something"
when: ptf_ip is not defined
+ - name: Check that variable ptf_ipv6 is defined
+ fail: msg="Define ptf ipv6 variable with -e ptf_ipv6=something"
+ when: ptf_ipv6 is not defined
+
- name: Check that variable topo is defined
fail: msg="Define topo variable with -e topo=something"
when: topo is not defined
diff --git a/ansible/testbed_renumber_vm_topology.yml b/ansible/testbed_renumber_vm_topology.yml
index 2f92ab7256c..5179a855f59 100644
--- a/ansible/testbed_renumber_vm_topology.yml
+++ b/ansible/testbed_renumber_vm_topology.yml
@@ -38,6 +38,10 @@
fail: msg="Define ptf ip variable with -e ptf_ip=something"
when: ptf_ip is not defined
+ - name: Check that variable ptf_ipv6 is defined
+ fail: msg="Define ptf ipv6 variable with -e ptf_ipv6=something"
+ when: ptf_ipv6 is not defined
+
- name: Check that variable topo is defined
fail: msg="Define topo variable with -e topo=something"
when: topo is not defined or topo not in topologies
diff --git a/ansible/veos.vtb b/ansible/veos.vtb
index 073598b23fa..48fed058998 100644
--- a/ansible/veos.vtb
+++ b/ansible/veos.vtb
@@ -56,9 +56,9 @@ server_1
topologies=['t1', 't1-lag', 't1-64-lag', 't1-64-lag-clet', 't0', 't0-16', 't0-56', 't0-52', 'ptf32', 'ptf64', 't0-64', 't0-64-32', 't0-116']
[sonic]
-vlab-01 ansible_host=10.250.0.101 type=kvm hwsku=Force10-S6000 serial_port=9000
-vlab-02 ansible_host=10.250.0.102 type=kvm hwsku=Force10-S6100 serial_port=9000
-vlab-03 ansible_host=10.250.0.105 type=kvm hwsku=Force10-S6000 serial_port=9001
-vlab-04 ansible_host=10.250.0.107 type=kvm hwsku=Force10-S6000 serial_port=9002
-vlab-simx-01 ansible_host=10.250.0.103 type=simx hwsku=MSN2700
-vlab-simx-02 ansible_host=10.250.0.104 type=simx hwsku=MSN3700
+vlab-01 ansible_host=10.250.0.101 ansible_hostv6=fec0::ffff:afa:1 type=kvm hwsku=Force10-S6000 serial_port=9000
+vlab-02 ansible_host=10.250.0.102 ansible_hostv6=fec0::ffff:afa:2 type=kvm hwsku=Force10-S6100 serial_port=9000
+vlab-03 ansible_host=10.250.0.105 ansible_hostv6=fec0::ffff:afa:5 type=kvm hwsku=Force10-S6000 serial_port=9001
+vlab-04 ansible_host=10.250.0.107 ansible_hostv6=fec0::ffff:afa:7 type=kvm hwsku=Force10-S6000 serial_port=9002
+vlab-simx-01 ansible_host=10.250.0.103 ansible_hostv6=fec0::ffff:afa:3 type=simx hwsku=MSN2700
+vlab-simx-02 ansible_host=10.250.0.104 ansible_hostv6=fec0::ffff:afa:4 type=simx hwsku=MSN3700
diff --git a/ansible/vtestbed.csv b/ansible/vtestbed.csv
index a68a449072e..6254b1c4806 100644
--- a/ansible/vtestbed.csv
+++ b/ansible/vtestbed.csv
@@ -1,5 +1,5 @@
-# conf-name,group-name,topo,ptf_image_name,ptf,ptf_ip,server,vm_base,dut,comment
-vms-kvm-t0,vms6-1,t0,docker-ptf,ptf-unknown,10.250.0.102/24,server_1,VM0100,[vlab-01],Tests virtual switch vm
-vms-kvm-t0-64,vms6-1,t0-64,docker-ptf,ptf-unknown,10.250.0.102/24,server_1,VM0100,[vlab-02],Tests virtual switch vm
-vms-kvm-t1-lag,vms6-2,t1-lag,docker-ptf,ptf-unknown,10.250.0.106/24,server_1,VM0104,[vlab-03],Tests virtual switch vm
-vms-kvm-t0-2,vms6-3,t0,docker-ptf,ptf-unknown,10.250.0.108/24,server_1,VM0104,[vlab-04],Tests virtual switch vm
+# conf-name,group-name,topo,ptf_image_name,ptf,ptf_ip,ptf_ipv6,server,vm_base,dut,comment
+vms-kvm-t0,vms6-1,t0,docker-ptf,ptf-unknown,10.250.0.102/24,fec0::ffff:afa:2/64,server_1,VM0100,[vlab-01],Tests virtual switch vm
+vms-kvm-t0-64,vms6-1,t0-64,docker-ptf,ptf-unknown,10.250.0.102/24,fec0::ffff:afa:2/64,server_1,VM0100,[vlab-02],Tests virtual switch vm
+vms-kvm-t1-lag,vms6-2,t1-lag,docker-ptf,ptf-unknown,10.250.0.106/24,fec0::ffff:afa:6/64,server_1,VM0104,[vlab-03],Tests virtual switch vm
+vms-kvm-t0-2,vms6-3,t0,docker-ptf,ptf-unknown,10.250.0.108/24,fec0::ffff:afa:8/64,server_1,VM0104,[vlab-04],Tests virtual switch vm
diff --git a/tests/common/plugins/tacacs.py b/tests/common/plugins/tacacs.py
index 31eabf33000..5938a6746ca 100644
--- a/tests/common/plugins/tacacs.py
+++ b/tests/common/plugins/tacacs.py
@@ -1,8 +1,7 @@
import pytest
import crypt
-@pytest.fixture(scope="module")
-def setup_tacacs(ptfhost, duthost, creds):
+def configure_tacacs(ptfhost, duthost, creds, tacacs_server_ip):
"""setup tacacs client and server"""
# disable tacacs server
@@ -15,9 +14,7 @@ def setup_tacacs(ptfhost, duthost, creds):
config_facts = duthost.config_facts(host=duthost.hostname, source="running")['ansible_facts']
for tacacs_server in config_facts.get('TACPLUS_SERVER', {}):
duthost.shell("sudo config tacacs delete %s" % tacacs_server)
-
- ptfip = ptfhost.host.options['inventory_manager'].get_host(ptfhost.hostname).vars['ansible_host']
- duthost.shell("sudo config tacacs add %s" % ptfip)
+ duthost.shell("sudo config tacacs add %s" % tacacs_server_ip)
duthost.shell("sudo config tacacs authtype login")
# enable tacacs+
@@ -36,15 +33,32 @@ def setup_tacacs(ptfhost, duthost, creds):
# start tacacs server
ptfhost.service(name="tacacs_plus", state="started")
- yield
+def cleanup_tacacs(ptfhost, duthost, tacacs_server_ip):
# stop tacacs server
ptfhost.service(name="tacacs_plus", state="stopped")
# reset tacacs client configuration
- duthost.shell("sudo config tacacs delete %s" % ptfip)
+ duthost.shell("sudo config tacacs delete %s" % tacacs_server_ip)
duthost.shell("sudo config tacacs default passkey")
duthost.shell("sudo config aaa authentication login default")
duthost.shell("sudo config aaa authentication failthrough default")
+@pytest.fixture(scope="module")
+def test_tacacs(ptfhost, duthost, creds):
+ tacacs_server_ip = ptfhost.host.options['inventory_manager'].get_host(ptfhost.hostname).vars['ansible_host']
+ configure_tacacs(ptfhost, duthost, creds, tacacs_server_ip)
+
+ yield
+
+ cleanup_tacacs(ptfhost, duthost, tacacs_server_ip)
+
+
+@pytest.fixture(scope="module")
+def test_tacacs_v6(ptfhost, duthost, creds):
+ tacacs_server_ip = ptfhost.host.options['inventory_manager'].get_host(ptfhost.hostname).vars['ansible_hostv6']
+ configure_tacacs(ptfhost, duthost, creds, tacacs_server_ip)
+
+ yield
+ cleanup_tacacs(ptfhost, duthost, tacacs_server_ip)
diff --git a/tests/conftest.py b/tests/conftest.py
index 86faca71be4..924c09083a6 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -42,7 +42,7 @@ class TestbedInfo(object):
def __init__(self, testbed_file):
self.testbed_filename = testbed_file
self.testbed_topo = defaultdict()
- CSV_FIELDS = ('conf-name', 'group-name', 'topo', 'ptf_image_name', 'ptf', 'ptf_ip', 'server', 'vm_base', 'dut', 'comment')
+ CSV_FIELDS = ('conf-name', 'group-name', 'topo', 'ptf_image_name', 'ptf', 'ptf_ip', 'ptf_ipv6', 'server', 'vm_base', 'dut', 'comment')
with open(self.testbed_filename) as f:
topo = csv.DictReader(f, fieldnames=CSV_FIELDS, delimiter=',')
@@ -61,6 +61,11 @@ def __init__(self, testbed_file):
line['ptf_ip'] = str(ptfaddress.ip)
line['ptf_netmask'] = str(ptfaddress.netmask)
+ if line['ptf_ipv6']:
+ ptfaddress = ipaddress.IPNetwork(line['ptf_ipv6'])
+ line['ptf_ipv6'] = str(ptfaddress.ip)
+ line['ptf_netmask_v6'] = str(ptfaddress.netmask)
+
line['duts'] = line['dut'].translate(string.maketrans("", ""), "[] ").split(';')
del line['dut']
diff --git a/tests/tacacs/test_ro_user.py b/tests/tacacs/test_ro_user.py
index 19549c03aac..d14b2e4ed6c 100644
--- a/tests/tacacs/test_ro_user.py
+++ b/tests/tacacs/test_ro_user.py
@@ -7,7 +7,20 @@
pytest.mark.device_type('vs')
]
-def test_ro_user(localhost, duthost, creds, setup_tacacs):
+def test_ro_user(localhost, duthost, creds, test_tacacs):
+
+ dutip = duthost.host.options['inventory_manager'].get_host(duthost.hostname).vars['ansible_host']
+ res = localhost.shell("sshpass -p {} ssh "\
+ "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "\
+ "{}@{} cat /etc/passwd".format(
+ creds['tacacs_ro_user_passwd'], creds['tacacs_ro_user'], dutip))
+
+ for l in res['stdout_lines']:
+ fds = l.split(':')
+ if fds[0] == "test":
+ assert fds[4] == "remote_user"
+
+def test_ro_user_ipv6(localhost, duthost, creds, test_tacacs_v6):
dutip = duthost.host.options['inventory_manager'].get_host(duthost.hostname).vars['ansible_host']
res = localhost.shell("sshpass -p {} ssh "\
diff --git a/tests/tacacs/test_rw_user.py b/tests/tacacs/test_rw_user.py
index 10c40124022..c3ce9354610 100644
--- a/tests/tacacs/test_rw_user.py
+++ b/tests/tacacs/test_rw_user.py
@@ -8,7 +8,21 @@
pytest.mark.device_type('vs')
]
-def test_rw_user(duthost, creds, setup_tacacs):
+def test_rw_user(duthost, creds, test_tacacs):
+ """test tacacs rw user
+ """
+
+ duthost.host.options['variable_manager'].extra_vars.update(
+ {'ansible_user':creds['tacacs_rw_user'], 'ansible_password':creds['tacacs_rw_user_passwd']})
+
+ res = duthost.shell("cat /etc/passwd")
+
+ for l in res['stdout_lines']:
+ fds = l.split(':')
+ if fds[0] == "testadmin":
+ assert fds[4] == "remote_user_su"
+
+def test_rw_user_ipv6(duthost, creds, test_tacacs_v6):
"""test tacacs rw user
"""
diff --git a/tests/veos.vtb b/tests/veos.vtb
index 9ff3ce88cea..0b5cb7c9651 100644
--- a/tests/veos.vtb
+++ b/tests/veos.vtb
@@ -61,11 +61,11 @@ vlab-02
vlab-03
[sonic]
-vlab-01 ansible_host=10.250.0.101 type=kvm hwsku=Force10-S6000 ansible_password=password ansible_user=admin
-vlab-02 ansible_host=10.250.0.102 type=kvm hwsku=Force10-S6100 ansible_password=password
-vlab-03 ansible_host=10.250.0.105 type=kvm hwsku=Force10-S6000 ansible_password=password ansible_user=admin
-vlab-04 ansible_host=10.250.0.107 type=kvm hwsku=Force10-S6000 ansible_password=password ansible_user=admin
+vlab-01 ansible_host=10.250.0.101 ansible_hostv6=fec0::ffff:afa:1 type=kvm hwsku=Force10-S6000 ansible_password=password ansible_user=admin
+vlab-02 ansible_host=10.250.0.102 ansible_hostv6=fec0::ffff:afa:2 type=kvm hwsku=Force10-S6100 ansible_password=password
+vlab-03 ansible_host=10.250.0.105 ansible_hostv6=fec0::ffff:afa:5 type=kvm hwsku=Force10-S6000 ansible_password=password ansible_user=admin
+vlab-04 ansible_host=10.250.0.107 ansible_hostv6=fec0::ffff:afa:7 type=kvm hwsku=Force10-S6000 ansible_password=password ansible_user=admin
-ptf-01 ansible_host=10.250.0.102 ansible_user=root ansible_password=root
-ptf-02 ansible_host=10.250.0.106 ansible_user=root ansible_password=root
-ptf-03 ansible_host=10.250.0.108 ansible_user=root ansible_password=root
+ptf-01 ansible_host=10.250.0.102 ansible_hostv6=fec0::ffff:afa:2 ansible_user=root ansible_password=root
+ptf-02 ansible_host=10.250.0.106 ansible_hostv6=fec0::ffff:afa:6 ansible_user=root ansible_password=root
+ptf-03 ansible_host=10.250.0.108 ansible_hostv6=fec0::ffff:afa:8 ansible_user=root ansible_password=root
diff --git a/tests/vtestbed.csv b/tests/vtestbed.csv
index 1f4844a0757..a4f578c8eed 100644
--- a/tests/vtestbed.csv
+++ b/tests/vtestbed.csv
@@ -1,5 +1,5 @@
-# conf-name,group-name,topo,ptf_image_name,ptf,ptf_ip,server,vm_base,dut,comment
-vms-kvm-t0,vms6-1,t0,docker-ptf,ptf-01,10.250.0.102/24,server_1,VM0100,[vlab-01],Tests virtual switch vm
-vms-kvm-t0-64,vms6-1,t0-64,docker-ptf,ptf-01,10.250.0.102/24,server_1,VM0100,[vlab-02],Tests virtual switch vm
-vms-kvm-t1-lag,vms6-2,t1-lag,docker-ptf,ptf-02,10.250.0.106/24,server_1,VM0104,[vlab-03],Tests virtual switch vm
-vms-kvm-t0-2,vms6-3,t0,docker-ptf,ptf-03,10.250.0.108/24,server_1,VM0104,[vlab-04],Tests virtual switch vm
+# conf-name,group-name,topo,ptf_image_name,ptf,ptf_ip,ptf_ipv6,server,vm_base,dut,comment
+vms-kvm-t0,vms6-1,t0,docker-ptf,ptf-01,10.250.0.102/24,fec0::ffff:afa:2/64,server_1,VM0100,[vlab-01],Tests virtual switch vm
+vms-kvm-t0-64,vms6-1,t0-64,docker-ptf,ptf-01,10.250.0.102/24,fec0::ffff:afa:2/64,server_1,VM0100,[vlab-02],Tests virtual switch vm
+vms-kvm-t1-lag,vms6-2,t1-lag,docker-ptf,ptf-02,10.250.0.106/24,fec0::ffff:afa:6/64,server_1,VM0104,[vlab-03],Tests virtual switch vm
+vms-kvm-t0-2,vms6-3,t0,docker-ptf,ptf-03,10.250.0.108/24,fec0::ffff:afa:8/64,server_1,VM0104,[vlab-04],Tests virtual switch vm