From 8753ca4bb97482b43cad488dfe9b3fd8281b2565 Mon Sep 17 00:00:00 2001 From: Sihui Han Date: Thu, 21 Dec 2017 21:17:06 +0000 Subject: [PATCH] [bgp_speaker]: Specify vlan ip route in case LPM to other nexthop Signed-off-by: Sihui Han --- ansible/roles/test/tasks/bgp_speaker.yml | 31 +++++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/ansible/roles/test/tasks/bgp_speaker.yml b/ansible/roles/test/tasks/bgp_speaker.yml index 52617b6b7b..a885fe71ad 100644 --- a/ansible/roles/test/tasks/bgp_speaker.yml +++ b/ansible/roles/test/tasks/bgp_speaker.yml @@ -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}}" @@ -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 @@ -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' @@ -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']}}' @@ -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}}"