• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python sample_configs.sample_loadbalancer_tuple函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中neutron_lbaas.tests.unit.services.loadbalancer.drivers.haproxy.sample_configs.sample_configs.sample_loadbalancer_tuple函数的典型用法代码示例。如果您正苦于以下问题:Python sample_loadbalancer_tuple函数的具体用法?Python sample_loadbalancer_tuple怎么用?Python sample_loadbalancer_tuple使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_render_template_https

 def test_render_template_https(self):
     fe = ("frontend sample_listener_id_1\n"
           "    option tcplog\n"
           "    maxconn 98\n"
           "    bind 10.0.0.2:443\n"
           "    mode tcp\n"
           "    default_backend sample_pool_id_1\n\n")
     be = ("backend sample_pool_id_1\n"
           "    mode tcp\n"
           "    balance roundrobin\n"
           "    cookie SRV insert indirect nocache\n"
           "    timeout check 31\n"
           "    option httpchk GET /index.html\n"
           "    http-check expect rstatus %s\n"
           "    option ssl-hello-chk\n"
           "    server sample_member_id_1 10.0.0.99:82 "
           "weight 13 check inter 30s fall 3 cookie sample_member_id_1\n"
           "    server sample_member_id_2 10.0.0.98:82 "
           "weight 13 check inter 30s fall 3 cookie sample_member_id_2\n\n"
           % sample_configs.PIPED_CODES)
     rendered_obj = jinja_cfg.render_loadbalancer_obj(
         sample_configs.sample_loadbalancer_tuple(proto='HTTPS'),
         'nogroup', '/sock_path', '/v2')
     self.assertEqual(sample_configs.sample_base_expected_config(
         frontend=fe, backend=be), rendered_obj)
开发者ID:varunarya10,项目名称:neutron-lbaas,代码行数:25,代码来源:test_jinja_cfg.py


示例2: test_render_template_appsession_persistence

 def test_render_template_appsession_persistence(self):
     with mock.patch('os.makedirs') as md:
         with mock.patch.object(jinja_cfg, 'utils'):
             md.return_value = '/data/dirs/'
             be = ("backend sample_pool_id_1\n"
                   "    mode http\n"
                   "    balance roundrobin\n"
                   "    appsession APP_COOKIE len 56 timeout 3h\n"
                   "    timeout check 31\n"
                   "    option httpchk GET /index.html\n"
                   "    http-check expect rstatus %s\n"
                   "    option forwardfor\n"
                   "    server sample_member_id_1 10.0.0.99:82 "
                   "weight 13 check inter 30s fall 3\n"
                   "    server sample_member_id_2 10.0.0.98:82 "
                   "weight 13 check inter 30s fall 3\n\n"
                   % sample_configs.PIPED_CODES)
             rendered_obj = jinja_cfg.render_loadbalancer_obj(
                 sample_configs.sample_loadbalancer_tuple(
                     persistence_type='APP_COOKIE'),
                 'nogroup', '/sock_path',
                 '/v2')
             self.assertEqual(
                 sample_configs.sample_base_expected_config(backend=be),
                 rendered_obj)
开发者ID:varunarya10,项目名称:neutron-lbaas,代码行数:25,代码来源:test_jinja_cfg.py


示例3: test_render_template_no_persistence_http

 def test_render_template_no_persistence_http(self):
     be = ("backend sample_pool_id_1\n"
           "    mode http\n"
           "    balance roundrobin\n"
           "    server sample_member_id_1 10.0.0.99:82 weight 13\n"
           "    server sample_member_id_2 10.0.0.98:82 weight 13\n\n")
     rendered_obj = jinja_cfg.render_loadbalancer_obj(
         sample_configs.sample_loadbalancer_tuple(
             proto='HTTP', monitor=False, persistence=False),
         'nogroup', '/sock_path', '/v2')
     self.assertEqual(sample_configs.sample_base_expected_config(
         backend=be), rendered_obj)
开发者ID:F5Networks,项目名称:neutron-lbaas,代码行数:12,代码来源:test_jinja_cfg.py


示例4: test_render_template_no_monitor_http

 def test_render_template_no_monitor_http(self):
     be = ("backend sample_pool_id_1\n"
           "    mode http\n"
           "    balance roundrobin\n"
           "    cookie SRV insert indirect nocache\n"
           "    option forwardfor\n"
           "    server sample_member_id_1 10.0.0.99:82 weight 13 "
           "cookie sample_member_id_1\n"
           "    server sample_member_id_2 10.0.0.98:82 weight 13 "
           "cookie sample_member_id_2\n\n")
     rendered_obj = jinja_cfg.render_loadbalancer_obj(
         sample_configs.sample_loadbalancer_tuple(
             proto='HTTP', monitor=False),
         'nogroup', '/sock_path', '/v2')
     self.assertEqual(sample_configs.sample_base_expected_config(
         backend=be), rendered_obj)
开发者ID:varunarya10,项目名称:neutron-lbaas,代码行数:16,代码来源:test_jinja_cfg.py


示例5: test_render_template_tls_termination

    def test_render_template_tls_termination(self):
        lb = sample_configs.sample_loadbalancer_tuple(
            proto='TERMINATED_HTTPS', tls=True, sni=True)

        fe = ("frontend sample_listener_id_1\n"
              "    option tcplog\n"
              "    maxconn 98\n"
              "    option forwardfor\n"
              "    bind 10.0.0.2:443"
              " ssl crt /v2/sample_listener_id_1/fakeCNM.pem"
              " crt /v2/sample_listener_id_1\n"
              "    mode http\n"
              "    default_backend sample_pool_id_1\n\n")
        be = ("backend sample_pool_id_1\n"
              "    mode http\n"
              "    redirect scheme https if !{ ssl_fc }\n"
              "    balance roundrobin\n"
              "    cookie SRV insert indirect nocache\n"
              "    timeout check 31\n"
              "    option httpchk GET /index.html\n"
              "    http-check expect rstatus %s\n"
              "    option forwardfor\n"
              "    server sample_member_id_1 10.0.0.99:82"
              " weight 13 check inter 30s fall 3 cookie sample_member_id_1\n"
              "    server sample_member_id_2 10.0.0.98:82"
              " weight 13 check inter 30s fall 3 cookie "
              "sample_member_id_2\n\n"
              % sample_configs.PIPED_CODES)
        with mock.patch('os.makedirs'):
            with mock.patch('os.listdir'):
                with mock.patch.object(jinja_cfg, 'utils'):
                    with mock.patch.object(
                            jinja_cfg, '_process_tls_certificates') as crt:
                        crt.return_value = {
                            'tls_cert': lb.listeners[0]
                            .default_tls_container,
                            'sni_certs': [lb.listeners[0]
                                          .sni_containers[0].tls_container]}
                        rendered_obj = jinja_cfg.render_loadbalancer_obj(
                            lb, 'nogroup',
                            '/sock_path',
                            '/v2')
                        self.assertEqual(
                            sample_configs.sample_base_expected_config(
                                frontend=fe, backend=be),
                            rendered_obj)
开发者ID:varunarya10,项目名称:neutron-lbaas,代码行数:46,代码来源:test_jinja_cfg.py


示例6: test_render_template_no_persistence_https

 def test_render_template_no_persistence_https(self):
     fe = ("frontend sample_listener_id_1\n"
           "    option tcplog\n"
           "    maxconn 98\n"
           "    bind 10.0.0.2:443\n"
           "    mode tcp\n"
           "    default_backend sample_pool_id_1\n\n")
     be = ("backend sample_pool_id_1\n"
           "    mode tcp\n"
           "    balance roundrobin\n"
           "    server sample_member_id_1 10.0.0.99:82 weight 13\n"
           "    server sample_member_id_2 10.0.0.98:82 weight 13\n\n")
     rendered_obj = jinja_cfg.render_loadbalancer_obj(
         sample_configs.sample_loadbalancer_tuple(
             proto='HTTPS', monitor=False, persistence=False),
         'nogroup', '/sock_path', '/v2')
     self.assertEqual(sample_configs.sample_base_expected_config(
         frontend=fe, backend=be), rendered_obj)
开发者ID:varunarya10,项目名称:neutron-lbaas,代码行数:18,代码来源:test_jinja_cfg.py


示例7: test_render_template_http

 def test_render_template_http(self):
     be = ("backend sample_pool_id_1\n"
           "    mode http\n"
           "    balance roundrobin\n"
           "    cookie SRV insert indirect nocache\n"
           "    timeout check 31\n"
           "    option httpchk GET /index.html\n"
           "    http-check expect rstatus %s\n"
           "    server sample_member_id_1 10.0.0.99:82 "
           "weight 13 check inter 30s fall 3 cookie sample_member_id_1\n"
           "    server sample_member_id_2 10.0.0.98:82 "
           "weight 13 check inter 30s fall 3 cookie sample_member_id_2\n\n"
           % sample_configs.PIPED_CODES)
     rendered_obj = jinja_cfg.render_loadbalancer_obj(
         sample_configs.sample_loadbalancer_tuple(),
         'nogroup', '/sock_path', '/v2')
     self.assertEqual(
         sample_configs.sample_base_expected_config(backend=be),
         rendered_obj)
开发者ID:F5Networks,项目名称:neutron-lbaas,代码行数:19,代码来源:test_jinja_cfg.py


示例8: test_render_template_sourceip_persistence

 def test_render_template_sourceip_persistence(self):
     be = (
         "backend sample_pool_id_1\n"
         "    mode http\n"
         "    balance roundrobin\n"
         "    stick-table type ip size 10k\n"
         "    stick on src\n"
         "    timeout check 31\n"
         "    option httpchk GET /index.html\n"
         "    http-check expect rstatus %s\n"
         "    option forwardfor\n"
         "    server sample_member_id_1 10.0.0.99:82 "
         "weight 13 check inter 30s fall 3\n"
         "    server sample_member_id_2 10.0.0.98:82 "
         "weight 13 check inter 30s fall 3\n\n" % sample_configs.PIPED_CODES
     )
     rendered_obj = jinja_cfg.render_loadbalancer_obj(
         sample_configs.sample_loadbalancer_tuple(persistence_type="SOURCE_IP"), "nogroup", "/sock_path", "/v2"
     )
     self.assertEqual(sample_configs.sample_base_expected_config(backend=be), rendered_obj)
开发者ID:rishabhdas,项目名称:neutron-lbaas,代码行数:20,代码来源:test_jinja_cfg.py


示例9: test_render_template_tls_termination_no_sni

    def test_render_template_tls_termination_no_sni(self):
        lb = sample_configs.sample_loadbalancer_tuple(proto="TERMINATED_HTTPS", tls=True)

        fe = (
            "frontend sample_listener_id_1\n"
            "    option tcplog\n"
            "    maxconn 98\n"
            "    option forwardfor\n"
            "    bind 10.0.0.2:443"
            " ssl crt /v2/sample_listener_id_1/fakeCNM.pem\n"
            "    mode http\n"
            "    default_backend sample_pool_id_1\n\n"
        )
        be = (
            "backend sample_pool_id_1\n"
            "    mode http\n"
            "    redirect scheme https if !{ ssl_fc }\n"
            "    balance roundrobin\n"
            "    cookie SRV insert indirect nocache\n"
            "    timeout check 31\n"
            "    option httpchk GET /index.html\n"
            "    http-check expect rstatus %s\n"
            "    option forwardfor\n"
            "    server sample_member_id_1 10.0.0.99:82 "
            "weight 13 check inter 30s fall 3 cookie sample_member_id_1\n"
            "    server sample_member_id_2 10.0.0.98:82 "
            "weight 13 check inter 30s fall 3 cookie sample_member_id_2\n\n" % sample_configs.PIPED_CODES
        )
        with mock.patch("os.makedirs"):
            with mock.patch("neutron.agent.linux.utils.replace_file"):
                with mock.patch("os.listdir"):
                    with mock.patch.object(jinja_cfg, "utils"):
                        with mock.patch.object(jinja_cfg, "_process_tls_certificates") as crt:
                            crt.return_value = {"tls_cert": lb.listeners[0].default_tls_container, "sni_certs": []}
                            rendered_obj = jinja_cfg.render_loadbalancer_obj(lb, "nogroup", "/sock_path", "/v2")
                            self.assertEqual(
                                sample_configs.sample_base_expected_config(frontend=fe, backend=be), rendered_obj
                            )
开发者ID:rishabhdas,项目名称:neutron-lbaas,代码行数:38,代码来源:test_jinja_cfg.py


示例10: test_render_template_no_monitor_https

 def test_render_template_no_monitor_https(self):
     fe = (
         "frontend sample_listener_id_1\n"
         "    option tcplog\n"
         "    maxconn 98\n"
         "    bind 10.0.0.2:443\n"
         "    mode tcp\n"
         "    default_backend sample_pool_id_1\n\n"
     )
     be = (
         "backend sample_pool_id_1\n"
         "    mode tcp\n"
         "    balance roundrobin\n"
         "    cookie SRV insert indirect nocache\n"
         "    server sample_member_id_1 10.0.0.99:82 weight 13 "
         "cookie sample_member_id_1\n"
         "    server sample_member_id_2 10.0.0.98:82 weight 13 "
         "cookie sample_member_id_2\n\n"
     )
     rendered_obj = jinja_cfg.render_loadbalancer_obj(
         sample_configs.sample_loadbalancer_tuple(proto="HTTPS", monitor=False), "nogroup", "/sock_path", "/v2"
     )
     self.assertEqual(sample_configs.sample_base_expected_config(frontend=fe, backend=be), rendered_obj)
开发者ID:rishabhdas,项目名称:neutron-lbaas,代码行数:23,代码来源:test_jinja_cfg.py


示例11: test_transform_loadbalancer

 def test_transform_loadbalancer(self):
     in_lb = sample_configs.sample_loadbalancer_tuple()
     ret = jinja_cfg._transform_loadbalancer(in_lb, '/v2')
     self.assertEqual(sample_configs.RET_LB, ret)
开发者ID:varunarya10,项目名称:neutron-lbaas,代码行数:4,代码来源:test_jinja_cfg.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python _i18n._函数代码示例发布时间:2022-05-27
下一篇:
Python sample_configs.sample_base_expected_config函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap