Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions ansible/config_sonic_basedon_testbed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,34 @@
connection: local

- block:
- name: get platform info
shell: show platform summary | grep 'Platform' | awk '{print $2}'
register: platform_name
become: yes

- name: platform_name
debug: var=platform_name.stdout

- name: get image info
shell: ls /host/ | grep 'image'
register: image_name
become: yes

- name: image_name
debug: var=image_name.stdout

- name: saved original minigraph file (if original file may don't exist, then ignore errors)
shell: mv /etc/sonic/minigraph.xml /etc/sonic/minigraph.xml.orig
shell: mv /usr/share/sonic/device/{{ platform_name.stdout }}/minigraph.xml /usr/share/sonic/device/{{ platform_name.stdout }}/minigraph.xml.orig
become: true
ignore_errors: true

- name: create minigraph file for SONiC device
template: src=templates/topo/{{ template_name }}.j2
dest=/etc/sonic/minigraph.xml
dest=/usr/share/sonic/device/{{ platform_name.stdout }}/minigraph.xml
become: true

- name: set the status of dut as first time configuration
shell: touch /host/{{ image_name.stdout }}/platform/firsttime
become: true

- name: disable automatic minigraph update if we are deploying new minigraph into SONiC
Expand Down
3 changes: 3 additions & 0 deletions ansible/roles/test/files/ptftests/IP_decap_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ def runTest(self):
"""
# IPv4 Test
for ip_range in self.fib.ipv4_ranges():
# add this to skip default route 0.0.0.0/0
if str(ip_range.get_first_ip()) == "0.0.0.0":
continue
# Get the expected list of ports that would receive the packets
exp_port_list = self.fib[ip_range.get_first_ip()].get_next_hop_list()
# Choose random one source port from all ports excluding the expected ones
Expand Down
11 changes: 7 additions & 4 deletions ansible/roles/test/files/ptftests/fib.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ def get_next_hop_list(self):
# Initialize FIB with FIB file
def __init__(self, file_path):
self._ipv4_lpm_dict = LpmDict()
for ip in EXCLUDE_IPV4_PREFIXES:
self._ipv4_lpm_dict[ip] = self.NextHop()
# no need to add EXCLUDE_IPV4_PREFIXES into test
# for ip in EXCLUDE_IPV4_PREFIXES:
# os.system("echo NH: " + str(ip) + " >> ~/ip_decap.txt")
# self._ipv4_lpm_dict[ip] = self.NextHop()

self._ipv6_lpm_dict = LpmDict(ipv4=False)
for ip in EXCLUDE_IPV6_PREFIXES:
self._ipv6_lpm_dict[ip] = self.NextHop()
# no need to add EXCLUDE_IPV^_PREFIXES into test
# for ip in EXCLUDE_IPV6_PREFIXES:
# self._ipv6_lpm_dict[ip] = self.NextHop()

with open(file_path, 'r') as f:
for line in f.readlines():
Expand Down
5 changes: 3 additions & 2 deletions ansible/roles/test/files/ptftests/lpm.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import random

from ipaddress import ip_address, ip_network
from SubnetTree import SubnetTree

Expand Down Expand Up @@ -101,5 +100,7 @@ def ranges(self):
interval = self.IpInterval(sorted_boundaries[index], ip_address(u'255.255.255.255'))
else:
interval = self.IpInterval(sorted_boundaries[index], ip_address(u'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'))
ranges.append(interval)
# add this to prevent incorrect intervals generated by IpInterval
if index % 2 == 1:
ranges.append(interval)
return ranges