From 60d575f25cb92d928cfb2430181693989d288c62 Mon Sep 17 00:00:00 2001 From: zatserklyany Date: Thu, 30 Jun 2016 16:32:32 +0300 Subject: [PATCH] Fix offloading checker Modify verification of applyed changes Change-Id: Ia9188e4654bafc3189964707bc4d2516765ebc4f Closes-Bug: 1594788 --- fuelweb_test/helpers/checkers.py | 10 ++-- fuelweb_test/tests/test_offloading_types.py | 51 ++++++++++----------- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/fuelweb_test/helpers/checkers.py b/fuelweb_test/helpers/checkers.py index 412e647c4..35e9168ae 100644 --- a/fuelweb_test/helpers/checkers.py +++ b/fuelweb_test/helpers/checkers.py @@ -1158,16 +1158,16 @@ def check_client_smoke(ip): def check_offload(ip, interface, offload_type): - command = "ethtool --show-offload {0} |" \ - " awk '/{1}/ {{print $2}}'".format(interface, offload_type) + command = ("ethtool --show-offload {0} | awk '/{1}/' " + "| cut -d ':' -f 2").format(interface, offload_type) result = ssh_manager.execute_on_remote( ip=ip, cmd=command, - err_msg="Failed to get Offload {0} " - "on node {1}".format(offload_type, ip) + err_msg=("Failed to get Offload {0} " + "on node {1}").format(offload_type, ip) ) - return ''.join(result['stdout']).rstrip() + return result['stdout_str'] def check_get_network_data_over_cli(ip, cluster_id, path): diff --git a/fuelweb_test/tests/test_offloading_types.py b/fuelweb_test/tests/test_offloading_types.py index 057a2d80e..3da46b824 100644 --- a/fuelweb_test/tests/test_offloading_types.py +++ b/fuelweb_test/tests/test_offloading_types.py @@ -50,6 +50,15 @@ class TestOffloading(TestBasic): 'offloading_modes': [{'name': name, 'state': state, 'sub': []} for name in types]}] + @staticmethod + def check_offloading_modes(nodes, offloadings, iface, state): + for node in nodes: + for name in offloadings: + result = check_offload(node['ip'], iface, name) + assert_equal(result, state, + "Offload type {0} is {1} on {2}".format( + name, result, node['name'])) + @test(depends_on=[SetupEnvironment.prepare_slaves_3], groups=["offloading_neutron_vlan", "offloading"]) @log_snapshot_after_test @@ -63,8 +72,8 @@ class TestOffloading(TestBasic): 4. Setup offloading types 5. Run network verification 6. Deploy the cluster - 7. Run network verification - 8. Verify offloading modes on nodes + 7. Verify offloading modes on nodes + 8. Run network verification 9. Run OSTF Duration 30m @@ -127,23 +136,16 @@ class TestOffloading(TestBasic): self.show_step(5) self.fuel_web.verify_network(cluster_id) + self.show_step(6) self.fuel_web.deploy_cluster_wait(cluster_id) + self.show_step(7) - self.fuel_web.verify_network(cluster_id) + self.check_offloading_modes(nodes, offloadings_1, iface1, 'off') + self.check_offloading_modes(nodes, offloadings_2, iface2, 'on') self.show_step(8) - for node in nodes: - for name in offloadings_1: - result = check_offload(node['ip'], iface1, name) - assert_equal(result, "off", - "Offload type {0} is {1} on {2}".format( - name, result, node['name'])) - for name in offloadings_2: - result = check_offload(node['ip'], iface2, name) - assert_equal(result, "on", - "Offload type {0} is {1} on {2}".format( - name, result, node['name'])) + self.fuel_web.verify_network(cluster_id) self.show_step(9) self.fuel_web.run_ostf(cluster_id=cluster_id) @@ -163,8 +165,8 @@ class TestOffloading(TestBasic): 4. Setup offloading types 5. Run network verification 6. Deploy the cluster - 7. Run network verification - 8. Verify offloading modes on nodes + 7. Verify offloading modes on nodes + 8. Run network verification 9. Run OSTF Duration 30m @@ -227,23 +229,16 @@ class TestOffloading(TestBasic): self.show_step(5) self.fuel_web.verify_network(cluster_id) + self.show_step(6) self.fuel_web.deploy_cluster_wait(cluster_id) + self.show_step(7) - self.fuel_web.verify_network(cluster_id) + self.check_offloading_modes(nodes, offloadings_1, iface1, 'off') + self.check_offloading_modes(nodes, offloadings_2, iface2, 'on') self.show_step(8) - for node in nodes: - for name in offloadings_1: - result = check_offload(node['ip'], iface1, name) - assert_equal(result, "off", - "Offload type {0} is {1} on {2}".format( - name, result, node['name'])) - for name in offloadings_2: - result = check_offload(node['ip'], iface2, name) - assert_equal(result, "on", - "Offload type {0} is {1} on {2}".format( - name, result, node['name'])) + self.fuel_web.verify_network(cluster_id) self.show_step(9) self.fuel_web.run_ostf(cluster_id=cluster_id)