diff --git a/vmware_nsx_tempest_plugin/lib/feature_manager.py b/vmware_nsx_tempest_plugin/lib/feature_manager.py index afbdbf1..8a7f697 100644 --- a/vmware_nsx_tempest_plugin/lib/feature_manager.py +++ b/vmware_nsx_tempest_plugin/lib/feature_manager.py @@ -624,7 +624,7 @@ class FeatureManager(traffic_manager.IperfManager, def check_lbaas_project_weight_values(self, count=2, HTTPS=None, member_count=None, barbican_http=None, - persistence=False): + hash_persistence=False): vip = self.vip_ip_address time.sleep(constants.SLEEP_BETWEEN_VIRTUAL_SEREVRS_OPEARTIONS) if HTTPS is None: @@ -643,7 +643,7 @@ class FeatureManager(traffic_manager.IperfManager, no_of_vms = len(self.http_cnt) # if source_ip persistence enabled then the count # remains 1 as only one server will be actively responding - if persistence: + if hash_persistence: self.assertEqual(no_of_vms, 1) else: if no_of_vms: @@ -663,7 +663,7 @@ class FeatureManager(traffic_manager.IperfManager, no_of_vms = len(self.http_cnt) # if source_ip persistence enabled then the count # remains 1 as only one server will be actively responding - if persistence: + if hash_persistence: self.assertEqual(no_of_vms, 1) else: if no_of_vms: diff --git a/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_lbaas_scenario.py b/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_lbaas_scenario.py index e7f5e96..23c4212 100644 --- a/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_lbaas_scenario.py +++ b/vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_lbaas_scenario.py @@ -303,4 +303,53 @@ class LBaasRoundRobinBaseTest(feature_manager.FeatureManager): hm_type='PING', persistence=True, persistence_type="SOURCE_IP") self.check_lbaas_project_weight_values(constants.NO_OF_VMS_2, - persistence=True) + hash_persistence=True) + + @decorators.attr(type='nsxv3') + @decorators.idempotent_id('60e9adda-b8d6-48a9-b0d2-942e5bb38f38') + def test_lbaas_http_update_app_cookie_http_cookie_persistence(self): + """ + To verify the updation of session persistence from APP_COOKIE to + HTTP_COOKIE works fine. + """ + self.deploy_lbaas_topology() + if not CONF.nsxv3.ens: + self.start_web_servers(constants.HTTP_PORT) + self.create_project_lbaas(protocol_type="HTTP", protocol_port="80", + lb_algorithm="ROUND_ROBIN", + hm_type='PING', persistence=True, + persistence_type="APP_COOKIE", + persistence_cookie_name="application_cookie") + self.check_lbaas_project_weight_values(constants.NO_OF_VMS_2) + pool_id = self.pools_client.list_pools()['pools'][-1]['id'] + session_persistence = {} + session_persistence['type'] = "HTTP_COOKIE" + self.pools_client.update_pool(pool_id=pool_id, + session_persistence=session_persistence) + get_pool = self.pools_client.list_pools() + updated_pool = get_pool['pools'][0]['session_persistence']['type'] + self.assertEqual("HTTP_COOKIE", updated_pool) + self.check_lbaas_project_weight_values(constants.NO_OF_VMS_2) + + @decorators.attr(type='nsxv3') + @decorators.idempotent_id('60e30dda-b8d6-48a9-b0d2-942e5bb38f38') + def test_lbaas_http_round_robin_get_statistics(self): + """ + To verify statistics are updated on the Loadbalancer + for every new traffic that hits on the lb. + """ + self.deploy_lbaas_topology() + if not CONF.nsxv3.ens: + self.start_web_servers(constants.HTTP_PORT) + self.create_project_lbaas(protocol_type="HTTP", protocol_port="80", + lb_algorithm="ROUND_ROBIN", + hm_type='PING') + get_lb = self.load_balancers_client.list_load_balancers() + lb_id = get_lb['loadbalancers'][0]['id'] + stat = self.load_balancers_client.show_load_balancer_stats(lb_id) + assert (stat['stats']['bytes_in'] == 0 and + stat['stats']['bytes_out'] == 0) + self.check_lbaas_project_weight_values(constants.NO_OF_VMS_2) + stat = self.load_balancers_client.show_load_balancer_stats(lb_id) + assert (stat['stats']['bytes_in'] >= 0 and + stat['stats']['bytes_out'] >= 0)