当前位置: 首页>>代码示例>>Python>>正文


Python ServiceModelAdapter._add_profiles_session_persistence方法代码示例

本文整理汇总了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
开发者ID:jputrino,项目名称:f5-openstack-agent,代码行数:34,代码来源:test_service_adapter.py

示例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
开发者ID:jputrino,项目名称:f5-openstack-agent,代码行数:14,代码来源:test_service_adapter.py

示例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
开发者ID:jputrino,项目名称:f5-openstack-agent,代码行数:17,代码来源:test_service_adapter.py

示例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
开发者ID:jputrino,项目名称:f5-openstack-agent,代码行数:18,代码来源:test_service_adapter.py


注:本文中的f5_openstack_agent.lbaasv2.drivers.bigip.service_adapter.ServiceModelAdapter._add_profiles_session_persistence方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。