diff --git a/ansible/roles/test/files/ptftests/copp_tests.py b/ansible/roles/test/files/ptftests/copp_tests.py index 20933a7cd0..cdbc6f4042 100644 --- a/ansible/roles/test/files/ptftests/copp_tests.py +++ b/ansible/roles/test/files/ptftests/copp_tests.py @@ -53,12 +53,21 @@ def __init__(self): self.timeout_thr = None + self.minig_bgp = test_params.get('minig_bgp', None) + idx = 0 self.myip = {} self.peerip = {} - for i in xrange(self.MAX_PORTS): - self.myip[i] = "10.0.0.%d" % (i*2+1) - self.peerip[i] = "10.0.0.%d" % (i*2) - + + for peer in self.minig_bgp: + if str(peer['peer_addr']).find('10.0.0') == 0:#filter IPv6 info. + self.myip[idx] = peer['addr'] + self.peerip[idx] = peer['peer_addr'] + idx = idx+1 + #if port number is out of the total of IPv4, take the last IPv4 + if int(target_port_str) > idx-1: + self.myip[self.target_port] = self.myip[idx-1] + self.peerip[self.target_port] = self.peerip[idx-1] + return def log(self, message, debug=False): diff --git a/ansible/roles/test/tasks/copp.yml b/ansible/roles/test/tasks/copp.yml index 890a4c00f1..12fb97d2f1 100644 --- a/ansible/roles/test/tasks/copp.yml +++ b/ansible/roles/test/tasks/copp.yml @@ -67,6 +67,7 @@ - verbose=False - pkt_tx_count={{ pkt_tx_count|default(0) }} - target_port={{ nn_target_port }} + - minig_bgp={{ minigraph_bgp }} ptf_extra_options: "--device-socket 0-{{ nn_target_port }}@tcp://127.0.0.1:10900 --device-socket 1-{{ nn_target_port }}@tcp://{{ ansible_eth0['ipv4']['address'] }}:10900" with_items: - ARPTest