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

[dhcp_relay] Add link state change tests #1263

Merged
merged 1 commit into from
Dec 9, 2019
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
99 changes: 99 additions & 0 deletions ansible/roles/test/tasks/dhcp_relay.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,102 @@
- relay_iface_mac=\"{{ relay_iface_mac }}\"
- relay_iface_netmask=\"{{ minigraph_vlan_interfaces[0]['mask'] }}\"
ptf_extra_options: "--relax"

- name: Bring all uplink interfaces down
shell: ifconfig {{ item.key }} down
with_dict: minigraph_portchannels
become: true

- name: Pause to ensure uplinks are down
pause:
seconds: 10

- name: Bring all uplink interfaces up
shell: ifconfig {{ item.key }} up
with_dict: minigraph_portchannels
become: true

- name: Pause to ensure uplinks are up
pause:
seconds: 10

# Run the DHCP relay PTF test
- include_tasks: ptf_runner.yml
vars:
ptf_test_name: DHCP Relay Test
ptf_test_dir: ptftests
ptf_test_path: dhcp_relay_test.DHCPTest
ptf_platform: remote
ptf_platform_dir: ptftests
ptf_test_params:
- hostname=\"{{ inventory_hostname }}\"
- client_port_index=\"{{ client_port_index }}\"
- client_iface_alias=\"{{ client_iface_alias }}\"
- leaf_port_indices=\"{{ leaf_port_indices }}\"
- num_dhcp_servers=\"{{ dhcp_servers | length }}\"
- server_ip=\"{{ dhcp_servers[0] }}\"
- relay_iface_ip=\"{{ minigraph_vlan_interfaces[0]['addr'] }}\"
- relay_iface_mac=\"{{ relay_iface_mac }}\"
- relay_iface_netmask=\"{{ minigraph_vlan_interfaces[0]['mask'] }}\"
ptf_extra_options: "--relax"

- name: Stop DHCP relay service
become: true
service:
name: dhcp_relay
state: stopped

- name: Bring all uplink interfaces down
shell: ifconfig {{ item.key }} down
with_dict: minigraph_portchannels
become: true

- name: Pause to ensure uplinks are down
pause:
seconds: 10

- name: Start DHCP relay service with uplinks down
become: true
service:
name: dhcp_relay
state: restarted

- name: Give the DHCP relay container time to start up
pause:
seconds: 30

- name: Bring all uplink interfaces up
shell: ifconfig {{ item.key }} up
with_dict: minigraph_portchannels
become: true

- name: Pause to ensure uplinks are up
pause:
seconds: 10

# Run the DHCP relay PTF test
- include_tasks: ptf_runner.yml
vars:
ptf_test_name: DHCP Relay Test
ptf_test_dir: ptftests
ptf_test_path: dhcp_relay_test.DHCPTest
ptf_platform: remote
ptf_platform_dir: ptftests
ptf_test_params:
- hostname=\"{{ inventory_hostname }}\"
- client_port_index=\"{{ client_port_index }}\"
- client_iface_alias=\"{{ client_iface_alias }}\"
- leaf_port_indices=\"{{ leaf_port_indices }}\"
- num_dhcp_servers=\"{{ dhcp_servers | length }}\"
- server_ip=\"{{ dhcp_servers[0] }}\"
- relay_iface_ip=\"{{ minigraph_vlan_interfaces[0]['addr'] }}\"
- relay_iface_mac=\"{{ relay_iface_mac }}\"
- relay_iface_netmask=\"{{ minigraph_vlan_interfaces[0]['mask'] }}\"
ptf_extra_options: "--relax"

- name: Restart DHCP relay service to ensure it is in a healthy state
become: true
service:
name: dhcp_relay
state: restarted
tags: always