Skip to content

Commit

Permalink
Parse and send session persistence info to lbaas driver in case of lb…
Browse files Browse the repository at this point in the history
…aasv2

Change-Id: Ie089f8481dc076aef78c87b7d5bfeb2fc3b6e116
Partial-Bug:#1565135
  • Loading branch information
Senthilnathan Murugappan committed Apr 2, 2016
1 parent 50927d3 commit e7c08ec
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/config/svc-monitor/svc_monitor/loadbalancer_agent.py
Expand Up @@ -390,7 +390,6 @@ def listener_get_reqdict(self, listener):
'protocol_port': props['protocol_port'],
'protocol': props['protocol'],
'loadbalancer_id': listener.loadbalancer,
'session_persistence': None,
'admin_state_up': props['admin_state'],
'status': self._get_object_status(listener)}

Expand Down Expand Up @@ -482,6 +481,7 @@ def loadbalancer_pool_get_reqdict(self, pool):
'name': pool.display_name,
'description': self._get_object_description(pool),
'status': self._get_object_status(pool),
'session_persistence': None,
}

props = pool.params
Expand All @@ -490,6 +490,12 @@ def loadbalancer_pool_get_reqdict(self, pool):
if value is not None:
res[mapping] = value

if props['session_persistence']:
sp = {'type': props['session_persistence']}
if props['session_persistence'] == 'APP_COOKIE':
sp['cookie_name'] = props['persistence_cookie_name']
res['session_persistence'] = sp

# provider
res['provider'] = pool.provider

Expand Down
3 changes: 2 additions & 1 deletion src/config/svc-monitor/svc_monitor/tests/test_f5_lb.py
Expand Up @@ -157,7 +157,8 @@ def create_pool(self, uuid, fq_name_str, project=None, vip=None, hm=None):
pool_obj['loadbalancer_pool_provider'] = 'f5'
pool_obj['loadbalancer_pool_properties'] = \
{'protocol': 'HTTP', 'subnet_id': 'pool_subnet_id',
'loadbalancer_method': 'ROUND_ROBIN', 'admin_state': 'true'}
'loadbalancer_method': 'ROUND_ROBIN', 'admin_state': 'true',
'session_persistence': None, 'persistence_cookie_name': None}
if vip:
pool_obj['virtual_ip_back_refs']=[{'uuid': vip.uuid}]
if hm:
Expand Down
3 changes: 2 additions & 1 deletion src/config/svc-monitor/svc_monitor/tests/test_ha_proxy.py
Expand Up @@ -171,7 +171,8 @@ def create_pool(self, uuid, fq_name_str, project=None, vip=None, hm=None):
pool_obj['loadbalancer_pool_provider'] = 'opencontrail'
pool_obj['loadbalancer_pool_properties'] = \
{'protocol': 'HTTP', 'subnet_id': 'subnet-id',
'loadbalancer_method': 'ROUND_ROBIN', 'admin_state': 'true'}
'loadbalancer_method': 'ROUND_ROBIN', 'admin_state': 'true',
'session_persistence': None, 'persistence_cookie_name': None}
if vip:
pool_obj['virtual_ip_back_refs']=[{'uuid': vip.uuid}]
if hm:
Expand Down
Expand Up @@ -132,6 +132,8 @@ def create_pool(self, fq_name_str, vip=None, hm=None):
pool_obj['loadbalancer_pool_properties'] = {'protocol': 'HTTP',
'subnet_id': 'subnet-id',
'loadbalancer_method': 'ROUND_ROBIN',
'session_persistence': None,
'persistence_cookie_name': None,
'admin_state': 'true'}
if vip:
pool_obj['virtual_ip_back_refs']=[{'uuid': vip.uuid}]
Expand Down
3 changes: 2 additions & 1 deletion src/config/svc-monitor/svc_monitor/tests/test_svc_monitor.py
Expand Up @@ -674,7 +674,8 @@ def add_pool(self, name, uuid, proj_obj, sas_obj):
pool_dict['loadbalancer_pool_provider'] = 'Test-SAS'
pool_dict['loadbalancer_pool_properties'] = \
{'protocol': 'TCP', 'subnet_id': 'subnet-id',
'loadbalancer_method': 'ROUND_ROBIN', 'admin_state': 'true'}
'loadbalancer_method': 'ROUND_ROBIN', 'admin_state': 'true',
'session_persistence': None, 'persistence_cookie_name': None}
pool_obj = LoadbalancerPool.from_dict(**pool_dict)
self._return_obj['loadbalancer_pool'] = pool_dict
config_db.LoadbalancerPoolSM.locate(uuid)
Expand Down

0 comments on commit e7c08ec

Please sign in to comment.