Skip to content

Commit 475e859

Browse files
sihuihan88Shuotian Cheng
authored andcommitted
[bgp_speaker]: Specify VLAN IP route in case LPM to other nexthop (#394)
Signed-off-by: Sihui Han <[email protected]>
1 parent 5ef1d3e commit 475e859

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

ansible/roles/test/tasks/bgp_speaker.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
set_fact:
2525
bgp_speaker_asn={{cfggen_out.stdout}}
2626

27+
- set_fact: addr_family='ipv4'
28+
when: addr_family is not defined
29+
30+
- set_fact: portchannel_name="{{minigraph_portchannel_interfaces[0].attachto}}"
31+
when: addr_family == 'ipv6'
32+
2733
- name: print bgp speaker asn number
2834
debug: msg="{{bgp_speaker_asn}}"
2935

@@ -47,6 +53,18 @@
4753
- name: Set the value of ips in bgp speaker peer range
4854
set_fact: speaker_ips={{generated_ips}}
4955

56+
- name: Flush vlan ips route
57+
command: ip route flush {{item.split('/')[0]}}/32
58+
when: addr_family == 'ipv4'
59+
become: yes
60+
with_items: "{{vlan_ips}}"
61+
62+
- name: Add vlan ips route
63+
command: ip route add {{item.split('/')[0]}}/32 dev {{minigraph_vlan_interfaces[0]['attachto']}}
64+
when: addr_family == 'ipv4'
65+
become: yes
66+
with_items: "{{vlan_ips}}"
67+
5068
- debug: msg="{{generated_ips}}"
5169

5270
# vlan_ips[0], speaker_ips[0], speaker_ips[1] are IPs for three bgp speakers
@@ -76,12 +94,6 @@
7694
- {file_name: "config_3.ini", local_ip: '{{vlan_ips[0]}}', port_num: '7000'}
7795
delegate_to: "{{ptf_host}}"
7896

79-
- set_fact: addr_family='ipv4'
80-
when: addr_family is not defined
81-
82-
- set_fact: portchannel_name="{{minigraph_portchannel_interfaces[0].attachto}}"
83-
when: addr_family == 'ipv6'
84-
8597
- set_fact: portchannel_peer="{%for p in minigraph_portchannel_interfaces%}{%if p['attachto']==portchannel_name and p['peer_addr']|ipv6%}{{p['peer_addr']}}{%endif %}{%endfor%}"
8698
when: addr_family == 'ipv6'
8799

@@ -180,6 +192,7 @@
180192
ptf_test_dir: ptftests
181193
ptf_test_path: fib_test.FibTest
182194
ptf_platform: remote
195+
ptf_platform_dir: ptftests
183196
ptf_test_params:
184197
- testbed_type='{{testbed_type}}'
185198
- router_mac='{{ansible_Ethernet0['macaddress']}}'
@@ -192,6 +205,12 @@
192205
shell: pkill exabgp
193206
delegate_to: "{{ptf_host}}"
194207

208+
- name: Flush vlan ips route
209+
command: ip route flush {{item.split('/')[0]}}/32
210+
when: addr_family == 'ipv4'
211+
become: yes
212+
with_items: "{{vlan_ips}}"
213+
195214
- name: Remove Assigned IPs
196215
shell: ip addr flush dev eth{{ '%d' % (minigraph_vlans[minigraph_vlan_interfaces[0]['attachto']]['members'][0] | replace("Ethernet", "") | int / 4)}}
197216
delegate_to: "{{ptf_host}}"

0 commit comments

Comments
 (0)