cookie based persistence testcase & testcase for lb stats.

Change-Id: I25c14a5d40cf293861c4b256f4987bf7605f909e
This commit is contained in:
Bharath bhushan patel 2019-04-10 05:59:41 +00:00
parent c6176492a2
commit dfba66e4dc
2 changed files with 53 additions and 4 deletions

View File

@ -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:

View File

@ -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)