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


Python service_adapter.ServiceModelAdapter类代码示例

本文整理汇总了Python中f5_openstack_agent.lbaasv2.drivers.bigip.service_adapter.ServiceModelAdapter的典型用法代码示例。如果您正苦于以下问题:Python ServiceModelAdapter类的具体用法?Python ServiceModelAdapter怎么用?Python ServiceModelAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ServiceModelAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_pool_monitor_no_monitor

    def test_get_pool_monitor_no_monitor(self, basic_service):
        adapter = ServiceModelAdapter(mock.MagicMock())
        pools = basic_service.get('pools', [None])
        assert not adapter._get_pool_monitor(pools[0], basic_service)

        pools[0]['healthmonitor_id'] = str(uuid.uuid4())
        assert not adapter._get_pool_monitor(pools[0], basic_service)
开发者ID:jputrino,项目名称:f5-openstack-agent,代码行数:7,代码来源:test_service_adapter.py

示例2: test_add_session_persistence_app_cookie_persist

    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,代码行数:32,代码来源:test_service_adapter.py

示例3: test_get_pool_monitor

    def test_get_pool_monitor(self, basic_service_with_monitor):
        basic_service = basic_service_with_monitor
        adapter = ServiceModelAdapter(mock.MagicMock())
        pools = basic_service.get('pools', [None])
        monitor = adapter._get_pool_monitor(pools[0], basic_service)

        assert monitor == basic_service.get('healthmonitors')[0]
开发者ID:jputrino,项目名称:f5-openstack-agent,代码行数:7,代码来源:test_service_adapter.py

示例4: test_get_vip_default_pool_pending_create

    def test_get_vip_default_pool_pending_create(self, basic_service):
        adapter = ServiceModelAdapter(mock.MagicMock())

        pools = basic_service.get('pools', [None])
        pools[0]['provisioning_status'] = "PENDING_CREATE"
        default_pool = adapter.get_vip_default_pool(basic_service)
        assert default_pool == pools[0]
开发者ID:jputrino,项目名称:f5-openstack-agent,代码行数:7,代码来源:test_service_adapter.py

示例5: test_pool_no_members_least_conns

    def test_pool_no_members_least_conns(self, pool_member_service):
        '''No members, lb method should be 'least-connections-member'.'''

        adapter = ServiceModelAdapter(mock.MagicMock())
        srvc = copy.deepcopy(pool_member_service)
        del srvc['members']
        pool = adapter.get_pool(srvc)
        assert pool['loadBalancingMode'] == 'least-connections-member'
开发者ID:jputrino,项目名称:f5-openstack-agent,代码行数:8,代码来源:test_service_adapter.py

示例6: test_vs_http_profiles

    def test_vs_http_profiles(self, service):
        adapter = ServiceModelAdapter(mock.MagicMock())

        # should have http and oneconnect but not fastL4
        vs = adapter.get_virtual(service)
        assert '/Common/http' in vs['profiles']
        assert '/Common/oneconnect' in vs['profiles']
        assert '/Common/fastL4' not in vs['profiles']
开发者ID:pjbreaux,项目名称:f5-openstack-agent,代码行数:8,代码来源:test_service_adapter.py

示例7: test_pool_member_with_weight_deleted

    def test_pool_member_with_weight_deleted(self, pool_member_service):
        '''If lb method does not exist, no change is made.'''

        adapter = ServiceModelAdapter(mock.MagicMock())
        srvc = copy.deepcopy(pool_member_service)
        del srvc['pool']['lb_algorithm']
        pool = adapter.get_pool(srvc)
        assert 'loadBalancingMode' not in pool
开发者ID:jputrino,项目名称:f5-openstack-agent,代码行数:8,代码来源:test_service_adapter.py

示例8: test_add_vlan_and_snat_no_snat

    def test_add_vlan_and_snat_no_snat(self, basic_service):
        adapter = ServiceModelAdapter(mock.MagicMock())
        listener = basic_service['listener']

        vip = dict()
        adapter._add_vlan_and_snat(listener, vip)
        expected = dict(vlansDisabled=True, vlans=[])
        assert vip == expected
开发者ID:jputrino,项目名称:f5-openstack-agent,代码行数:8,代码来源:test_service_adapter.py

示例9: test_pool_no_members_source_ip

    def test_pool_no_members_source_ip(self, pool_member_service):
        '''No members, lb method should be 'least-connections-node'.'''

        adapter = ServiceModelAdapter(mock.MagicMock())
        srvc = copy.deepcopy(pool_member_service)
        del srvc['members']
        srvc['pool']['lb_algorithm'] = 'SOURCE_IP'
        pool = adapter.get_pool(srvc)
        assert pool['loadBalancingMode'] == 'least-connections-node'
开发者ID:jputrino,项目名称:f5-openstack-agent,代码行数:9,代码来源:test_service_adapter.py

示例10: test_vs_terminated_https_profiles

    def test_vs_terminated_https_profiles(self, service):
        adapter = ServiceModelAdapter(mock.MagicMock())

        # should have http and oneconnect but not fastL4
        service['listener']['protocol'] = 'TERMINATED_HTTPS'
        vs = adapter.get_virtual(service)
        assert '/Common/http' in vs['profiles']
        assert '/Common/oneconnect' in vs['profiles']
        assert '/Common/fastL4' not in vs['profiles']
开发者ID:pjbreaux,项目名称:f5-openstack-agent,代码行数:9,代码来源:test_service_adapter.py

示例11: test_get_l7policy

    def test_get_l7policy(self, basic_l7service):

        adapter = ServiceModelAdapter(mock.MagicMock())
        vip = dict(policies=list())
        listener = basic_l7service['listener']
        policies = list()

        adapter._apply_l7_and_esd_policies(listener, policies, vip)
        assert vip == dict(policies=list())
开发者ID:jputrino,项目名称:f5-openstack-agent,代码行数:9,代码来源:test_service_adapter.py

示例12: test_pool_no_members_round_robin

    def test_pool_no_members_round_robin(self, pool_member_service):
        '''No members, lb method should be 'round-robin'.'''

        adapter = ServiceModelAdapter(mock.MagicMock())
        srvc = copy.deepcopy(pool_member_service)
        del srvc['members']
        srvc['pool']['lb_algorithm'] = 'ROUND_ROBIN'
        pool = adapter.get_pool(srvc)
        assert pool['loadBalancingMode'] == 'round-robin'
开发者ID:jputrino,项目名称:f5-openstack-agent,代码行数:9,代码来源:test_service_adapter.py

示例13: test_vs_tcp_profiles

    def test_vs_tcp_profiles(self, service):
        adapter = ServiceModelAdapter(mock.MagicMock())

        service['listener']['protocol'] = 'TCP'
        vs = adapter.get_virtual(service)

        # should have fastL4 but not http and oneconnect
        assert '/Common/http' not in vs['profiles']
        assert '/Common/oneconnect' not in vs['profiles']
        assert '/Common/fastL4' in vs['profiles']
开发者ID:pjbreaux,项目名称:f5-openstack-agent,代码行数:10,代码来源:test_service_adapter.py

示例14: test_pool_member_weight_least_conns

    def test_pool_member_weight_least_conns(self, pool_member_service):
        '''lb method changes if member has weight and lb method least conns.

        The pool's lb method should be set to 'ratio-least-connections-member'.
        '''

        adapter = ServiceModelAdapter(mock.MagicMock())

        pool = adapter.get_pool(pool_member_service)
        assert pool['loadBalancingMode'] == 'ratio-least-connections-member'
开发者ID:jputrino,项目名称:f5-openstack-agent,代码行数:10,代码来源:test_service_adapter.py

示例15: test_add_vlan_and_snat_automap

 def test_add_vlan_and_snat_automap(self, basic_service):
     adapter = ServiceModelAdapter(mock.MagicMock())
     listener = basic_service['listener']
     listener['use_snat'] = True
     vip = dict()
     adapter._add_vlan_and_snat(listener, vip)
     expected = dict(
         sourceAddressTranslation=dict(type='automap'),
         vlansDisabled=True, vlans=[])
     assert vip == expected
开发者ID:jputrino,项目名称:f5-openstack-agent,代码行数:10,代码来源:test_service_adapter.py


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