Skip to content

Commit

Permalink
Merge "Parse and send session persistence info to lbaas driver in cas…
Browse files Browse the repository at this point in the history
…e of lbaasv2"
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Apr 5, 2016
2 parents 09c1751 + dd13bce commit 7aac764
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
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,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 @@ -484,6 +483,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 @@ -492,6 +492,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 7aac764

Please sign in to comment.