autotest: put `ip` calls in correct order in Perf test

The WiFi Perf test makes calls to the command `ip` on the test devices
in a order that cause the test to fail. The test first deletes the ip
address of a device, then it deletes the associated ip routes. Deleting
an ip address causes all associated ip routes to be deleted, so the test
is calling `ip route del` on a route which doesn't exist, which causes
the test to fail. This change puts the calls in the correct order.

BUG=b:172211699
TEST=test_that $DUT suite:wifi_perf
test_that --fast $DUT network_WiFi_Perf.vht80

Change-Id: Ia0b14fbb4020b4b9544cf36d32a8c2e8a422be2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/3092407
Tested-by: Kevin Lund <kglund@google.com>
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
Reviewed-by: Arowa Suliman <arowa@chromium.org>
Commit-Queue: Kevin Lund <kglund@google.com>
diff --git a/server/site_tests/network_WiFi_Perf/network_WiFi_Perf.py b/server/site_tests/network_WiFi_Perf/network_WiFi_Perf.py
index 3ad7c4a..c16e801 100644
--- a/server/site_tests/network_WiFi_Perf/network_WiFi_Perf.py
+++ b/server/site_tests/network_WiFi_Perf/network_WiFi_Perf.py
@@ -284,12 +284,6 @@
 
             # After each test, clear out all the changes that were made to the
             # device IP settings, routes, interfaces, etc.
-            self.context.router.host.run(
-                    'sudo ip addr del %s/24 dev %s' %
-                    (self._router_lan_ip_addr, self._router_lan_iface_name))
-            self.context.pcap_host.host.run(
-                    'sudo ip addr del %s/24 dev %s' %
-                    (self._pcap_lan_ip_addr, self._pcap_lan_iface_name))
             self.context.client.host.run(
                     'sudo ip route del table 255 %s via %s dev %s' %
                     (self._pcap_lan_ip_addr, self.context.router.wifi_ip,
@@ -298,6 +292,12 @@
                     'sudo ip route del table 255 %s via %s dev %s' %
                     (self.context.client.wifi_ip, self._router_lan_ip_addr,
                      self._router_lan_iface_name))
+            self.context.router.host.run(
+                    'sudo ip addr del %s/24 dev %s' %
+                    (self._router_lan_ip_addr, self._router_lan_iface_name))
+            self.context.pcap_host.host.run(
+                    'sudo ip addr del %s/24 dev %s' %
+                    (self._pcap_lan_ip_addr, self._pcap_lan_iface_name))
             self.context.router.host.run('sudo ip link set %s down' %
                                          self._router_lan_iface_name)
             self.context.pcap_host.host.run('sudo ip link set %s down' %