-
Notifications
You must be signed in to change notification settings - Fork 1k
[test]: Update BGP speaker test #236
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
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,32 +77,62 @@ | |
| - {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' | ||
|
|
||
| - set_fact: mux_ip_1="{% if addr_family=='ipv4' %}{{vlan_ips[1]}}{% else %}{{portchannel_peer}}{% endif %}" | ||
| - set_fact: mux_ip_2="{% if addr_family=='ipv4' %}{{vlan_ips[2]}}{% else %}{{portchannel_peer}}{% endif %}" | ||
|
|
||
| - name: Set the prefix to be announced | ||
| set_fact: announce_prefix="10.10.10.10/26" | ||
| set_fact: | ||
| announce_prefix: "{% if addr_family=='ipv4' %}10.10.10.0/26{% else %}2010::/126{% endif %}" | ||
|
|
||
| - name: Generate routes to be announced | ||
| template: src=roles/test/templates/exabgp/routes.j2 dest={{exabgp_dir}}/routes | ||
| with_items: | ||
| - {speaker_ip: '{{vlan_ips[0]}}', mux_ip_1: '{{vlan_ips[1]}}', mux_ip_2: '{{vlan_ips[2]}}', port_num_1: '5000', port_num_2: '6000', port_num_3: '7000'} | ||
| - {speaker_ip: '{{vlan_ips[0]}}', | ||
| mux_ip_1: "{{mux_ip_1}}", | ||
| mux_ip_2: "{{mux_ip_2}}", | ||
| port_num_1: '5000', | ||
| port_num_2: '6000', | ||
| port_num_3: '7000'} | ||
| delegate_to: "{{ptf_host}}" | ||
|
|
||
| - name: Generate start file for exabgp instances | ||
| template: src=roles/test/templates/exabgp/start.j2 dest={{exabgp_dir}}/{{item.file_name}} mode=u+rwx | ||
| with_items: | ||
| - {file_name: 'start.sh', config_file_1: 'config_1.ini', config_file_2: 'config_2.ini', config_file_3: 'config_3.ini', phy_ip: '{{vlan_ips[0]}}', logical_ip_1: '{{speaker_ips[0]}}', logical_ip_2: '{{speaker_ips[1]}}'} | ||
| - {file_name: 'start.sh', | ||
| config_file_1: 'config_1.ini', | ||
| config_file_2: 'config_2.ini', | ||
| config_file_3: 'config_3.ini', | ||
| phy_ip: '{{vlan_ips[0]}}', | ||
| logical_ip_1: '{{speaker_ips[0]}}', | ||
| logical_ip_2: '{{speaker_ips[1]}}', | ||
| mux_ip_1: "{{mux_ip_1}}", | ||
| mux_ip_2: "{{mux_ip_2}}"} | ||
| delegate_to: "{{ptf_host}}" | ||
|
|
||
| - name: Start exabgp instances | ||
| shell: sh {{exabgp_dir}}/start.sh | ||
| delegate_to: "{{ptf_host}}" | ||
|
|
||
| - pause: | ||
| seconds: 5 | ||
| prompt: "make sure dynamic bgp neighbors appear" | ||
|
|
||
| - name: Announce the routes | ||
| shell: python {{helper_dir}}/announce_routes.py {{exabgp_dir}}/routes >/dev/null 2>&1 & | ||
| delegate_to: "{{ptf_host}}" | ||
|
|
||
| - pause: | ||
| seconds: 10 | ||
| prompt: "make sure dynamic bgp neighbors appear" | ||
| seconds: 30 | ||
| prompt: "make sure routes announced to dynamic bgp neighbors" | ||
|
|
||
| - name: Gather bgp facts from bgp container | ||
| bgp_facts: | ||
|
|
@@ -117,6 +147,43 @@ | |
| assert: {that: "'{{ bgp_neighbors[item]['accepted prefixes'] }}' == '1'"} | ||
| with_items: "['{{speaker_ips[0].split('/')[0]}}', '{{speaker_ips[1].split('/')[0]}}', '{{vlan_ips[0].split('/')[0]}}'] " | ||
|
|
||
| # Send packets to verify that accepted prefixes are correctly applied in HW. | ||
| # PTF FIB test is used to send the packets. | ||
|
|
||
| - name: Generate route-port map information | ||
| template: src=roles/test/templates/bgp_speaker_route.j2 | ||
| dest=/tmp/bgp_speaker_route.txt | ||
| connection: local | ||
|
|
||
| - name: Copy the bgp_speaker_route to ptf container | ||
| copy: src=/tmp/bgp_speaker_route.txt dest=/root | ||
| delegate_to: "{{ptf_host}}" | ||
|
|
||
| - name: Copy the test to ptf container | ||
| copy: src=roles/test/files/ptftests dest=/root | ||
| delegate_to: "{{ ptf_host }}" | ||
|
|
||
| - set_fact: ipv4=true | ||
| when: addr_family == 'ipv4' | ||
|
|
||
| - set_fact: ipv6=true | ||
| when: addr_family == 'ipv6' | ||
|
|
||
| - name: "Start PTF runner" | ||
| include: ptf_runner.yml | ||
| vars: | ||
| ptf_test_name: FIB test | ||
| ptf_test_dir: ptftests | ||
| ptf_test_path: fib_test.FibTest | ||
| ptf_platform: remote | ||
| ptf_test_params: | ||
| - testbed_type='{{testbed_type}}' | ||
| - router_mac='{{ansible_Ethernet0['macaddress']}}' | ||
| - fib_info='/root/bgp_speaker_route.txt' | ||
| - ipv4={{ ipv4|default(false) }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. default true for ipv4?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes and default value is set to IPv4 in line 80. |
||
| - ipv6={{ ipv6|default(false) }} | ||
| ptf_extra_options: "--relax --debug info --log-file /tmp/bgp_speaker_test.FibTest.log" | ||
|
|
||
| - name: Kill exabgp instances | ||
| shell: pkill exabgp | ||
| delegate_to: "{{ptf_host}}" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| {% if addr_family == 'ipv6' %} | ||
| {{announce_prefix}} [{% for member in minigraph_portchannels[portchannel_name].members %}{{ '%d' % minigraph_port_indices[member]}}{% if not loop.last %} {% endif %}{% endfor %}]{% if not loop.last %} {% endif %} | ||
|
|
||
| {% elif addr_family == 'ipv4' %} | ||
| 0.0.0.0/0 {% for portchannel, v in minigraph_portchannels.iteritems() %}[{% for member in v.members %}{{ '%d' % minigraph_port_indices[member]}}{% if not loop.last %} {% endif %}{% endfor %}]{% if not loop.last %} {% endif %}{% endfor %} | ||
|
|
||
| {{announce_prefix}} {% for vlan, v in minigraph_vlans.iteritems() %}{% for member in v.members %}[{{ '%d' % minigraph_port_indices[member]}}]{% if not loop.last %} {% endif %}{% endfor %}{% if not loop.last %} {% endif %}{% endfor %} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the nexthop vlan or portchannel?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Portchannel. Fixed it.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't sound right to me. We have announced the next-hop of the route as VLAN. Shouldn't expect packets on Portchannels. We might need to change both ipv4 and ipv6 to VLAN here. I tested it locally, I think we also need to config the ips of two mux on PTF host to make sure it will not use default route. one example: In in exabgp/start.sh template, to config one mux_ip: ifconfig eth{{ '%d' % (minigraph_vlans[minigraph_vlan_interfaces[0]['attachto']]['members'][1] | replace("Ethernet", "") | int / 4)}} {{item.mux_ip_1}}
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| {% endif %} | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also add this to the bgpd.conf.j2 in buildimage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is already in buildimage (hash commit 127a73a), so removed these changes.