本文整理汇总了Python中f5_openstack_agent.lbaasv2.drivers.bigip.service_adapter.ServiceModelAdapter._add_profiles_session_persistence方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceModelAdapter._add_profiles_session_persistence方法的具体用法?Python ServiceModelAdapter._add_profiles_session_persistence怎么用?Python ServiceModelAdapter._add_profiles_session_persistence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类f5_openstack_agent.lbaasv2.drivers.bigip.service_adapter.ServiceModelAdapter
的用法示例。
在下文中一共展示了ServiceModelAdapter._add_profiles_session_persistence方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_session_persistence_app_cookie_persist
# 需要导入模块: from f5_openstack_agent.lbaasv2.drivers.bigip.service_adapter import ServiceModelAdapter [as 别名]
# 或者: from f5_openstack_agent.lbaasv2.drivers.bigip.service_adapter.ServiceModelAdapter import _add_profiles_session_persistence [as 别名]
def test_add_session_persistence_app_cookie_persist(
self, basic_service_no_persist):
adapter = ServiceModelAdapter(mock.MagicMock())
listener = basic_service_no_persist['listener']
pool = basic_service_no_persist['pools'][0]
pool['session_persistence'] = dict(type="APP_COOKIE")
vip_name = 'vip_name'
persist_name = "app_cookie_{}".format(vip_name)
vip = dict(name=vip_name)
adapter._add_profiles_session_persistence(listener, pool, vip)
expected = dict(
name=vip_name,
ipProtocol='tcp', profiles=['/Common/http',
'/Common/oneconnect'],
fallbackPersistence='',
persist=[dict(name=persist_name)])
assert vip == expected
pool['lb_algorithm'] = 'SOURCE_IP'
vip = dict(name=vip_name)
adapter._add_profiles_session_persistence(listener, pool, vip)
expected = dict(
name=vip_name,
ipProtocol='tcp', profiles=['/Common/http',
'/Common/oneconnect'],
fallbackPersistence='/Common/source_addr',
persist=[dict(name=persist_name)])
assert vip == expected
示例2: test_add_session_peristence_tcp_no_pool
# 需要导入模块: from f5_openstack_agent.lbaasv2.drivers.bigip.service_adapter import ServiceModelAdapter [as 别名]
# 或者: from f5_openstack_agent.lbaasv2.drivers.bigip.service_adapter.ServiceModelAdapter import _add_profiles_session_persistence [as 别名]
def test_add_session_peristence_tcp_no_pool(
self, basic_http_service_no_pool):
adapter = ServiceModelAdapter(mock.MagicMock())
listener = basic_http_service_no_pool['listener']
listener['protocol'] = 'TCP'
vip = dict()
adapter._add_profiles_session_persistence(listener, None, vip)
expected = dict(ipProtocol='tcp', profiles=['/Common/fastL4'],
fallbackPersistence='', persist=[])
assert vip == expected
示例3: test_add_session_persistence_pool_no_persist
# 需要导入模块: from f5_openstack_agent.lbaasv2.drivers.bigip.service_adapter import ServiceModelAdapter [as 别名]
# 或者: from f5_openstack_agent.lbaasv2.drivers.bigip.service_adapter.ServiceModelAdapter import _add_profiles_session_persistence [as 别名]
def test_add_session_persistence_pool_no_persist(
self, basic_service_no_persist):
adapter = ServiceModelAdapter(mock.MagicMock())
listener = basic_service_no_persist['listener']
pool = basic_service_no_persist['pools'][0]
vip = dict()
adapter._add_profiles_session_persistence(listener, pool, vip)
expected = dict(ipProtocol='tcp',
profiles=['/Common/http',
'/Common/oneconnect'],
fallbackPersistence='', persist=[])
assert vip == expected
示例4: test_add_session_persistence_pool_invalid_persist
# 需要导入模块: from f5_openstack_agent.lbaasv2.drivers.bigip.service_adapter import ServiceModelAdapter [as 别名]
# 或者: from f5_openstack_agent.lbaasv2.drivers.bigip.service_adapter.ServiceModelAdapter import _add_profiles_session_persistence [as 别名]
def test_add_session_persistence_pool_invalid_persist(
self, basic_service_no_persist):
adapter = ServiceModelAdapter(mock.MagicMock())
listener = basic_service_no_persist['listener']
pool = basic_service_no_persist['pools'][0]
pool['session_persistence'] = dict(type="INVALID")
f5_openstack_agent.lbaasv2.drivers.bigip.service_adapter.LOG = Mock()
vip = dict()
adapter._add_profiles_session_persistence(listener, pool, vip)
expected = dict(ipProtocol='tcp',
profiles=['/Common/http',
'/Common/oneconnect'],
fallbackPersistence='', persist=[])
assert vip == expected