Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bgp_speaker]: Specify vlan ip route in case LPM match to other nexthop #394

Merged
merged 1 commit into from
Dec 22, 2017
Merged
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
31 changes: 25 additions & 6 deletions ansible/roles/test/tasks/bgp_speaker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
set_fact:
bgp_speaker_asn={{cfggen_out.stdout}}

- set_fact: addr_family='ipv4'
when: addr_family is not defined

- set_fact: portchannel_name="{{minigraph_portchannel_interfaces[0].attachto}}"
when: addr_family == 'ipv6'

- name: print bgp speaker asn number
debug: msg="{{bgp_speaker_asn}}"

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

- name: Flush vlan ips route
command: ip route flush {{item.split('/')[0]}}/32
when: addr_family == 'ipv4'
become: yes
with_items: "{{vlan_ips}}"

- name: Add vlan ips route
command: ip route add {{item.split('/')[0]}}/32 dev {{minigraph_vlan_interfaces[0]['attachto']}}
when: addr_family == 'ipv4'
become: yes
with_items: "{{vlan_ips}}"

- debug: msg="{{generated_ips}}"

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

- set_fact: addr_family='ipv4'
when: addr_family is not defined

- set_fact: portchannel_name="{{minigraph_portchannel_interfaces[0].attachto}}"
when: addr_family == 'ipv6'

- 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%}"
when: addr_family == 'ipv6'

Expand Down Expand Up @@ -180,6 +192,7 @@
ptf_test_dir: ptftests
ptf_test_path: fib_test.FibTest
ptf_platform: remote
ptf_platform_dir: ptftests
ptf_test_params:
- testbed_type='{{testbed_type}}'
- router_mac='{{ansible_Ethernet0['macaddress']}}'
Expand All @@ -192,6 +205,12 @@
shell: pkill exabgp
delegate_to: "{{ptf_host}}"

- name: Flush vlan ips route
command: ip route flush {{item.split('/')[0]}}/32
when: addr_family == 'ipv4'
become: yes
with_items: "{{vlan_ips}}"

- name: Remove Assigned IPs
shell: ip addr flush dev eth{{ '%d' % (minigraph_vlans[minigraph_vlan_interfaces[0]['attachto']]['members'][0] | replace("Ethernet", "") | int / 4)}}
delegate_to: "{{ptf_host}}"