"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "octavia/tests/unit/common/jinja/haproxy/combined_listeners/test_jinja_cfg.py" between
octavia-7.1.1.tar.gz and octavia-8.0.0.tar.gz

About: OpenStack Octavia is an operator-grade reference implementation for Load Balancing as a Service (LBaaS).
The "Wallaby" series (latest release).

test_jinja_cfg.py  (octavia-7.1.1):test_jinja_cfg.py  (octavia-8.0.0)
skipping to change at line 1087 skipping to change at line 1087
"cookie sample_member_id_2 send-proxy\n\n").format( "cookie sample_member_id_2 send-proxy\n\n").format(
maxconn=constants.HAPROXY_DEFAULT_MAXCONN) maxconn=constants.HAPROXY_DEFAULT_MAXCONN)
rendered_obj = self.jinja_cfg.render_loadbalancer_obj( rendered_obj = self.jinja_cfg.render_loadbalancer_obj(
sample_configs_combined.sample_amphora_tuple(), sample_configs_combined.sample_amphora_tuple(),
[sample_configs_combined.sample_listener_tuple(be_proto='PROXY')]) [sample_configs_combined.sample_listener_tuple(be_proto='PROXY')])
self.assertEqual( self.assertEqual(
sample_configs_combined.sample_base_expected_config(backend=be), sample_configs_combined.sample_base_expected_config(backend=be),
rendered_obj) rendered_obj)
def test_render_template_pool_cert(self): def test_render_template_pool_cert(self):
feature_compatibility = {constants.POOL_ALPN: True}
cert_file_path = os.path.join(self.jinja_cfg.base_crt_dir,
'sample_listener_id_1', 'fake path')
be = ("backend sample_pool_id_1:sample_listener_id_1\n"
" mode http\n"
" balance roundrobin\n"
" cookie SRV insert indirect nocache\n"
" timeout check 31s\n"
" option httpchk GET /index.html HTTP/1.0\\r\\n\n"
" http-check expect rstatus 418\n"
" fullconn {maxconn}\n"
" option allbackups\n"
" timeout connect 5000\n"
" timeout server 50000\n"
" server sample_member_id_1 10.0.0.99:82 weight 13 "
"check inter 30s fall 3 rise 2 cookie sample_member_id_1 "
"{opts} alpn {alpn}\n"
" server sample_member_id_2 10.0.0.98:82 weight 13 "
"check inter 30s fall 3 rise 2 cookie sample_member_id_2 "
"{opts} alpn {alpn}\n\n").format(
maxconn=constants.HAPROXY_DEFAULT_MAXCONN,
opts="ssl crt %s verify none sni ssl_fc_sni" % cert_file_path +
" ciphers " + constants.CIPHERS_OWASP_SUITE_B +
" no-sslv3 no-tlsv10 no-tlsv11",
alpn=",".join(constants.AMPHORA_SUPPORTED_ALPN_PROTOCOLS))
rendered_obj = self.jinja_cfg.render_loadbalancer_obj(
sample_configs_combined.sample_amphora_tuple(),
[sample_configs_combined.sample_listener_tuple(
pool_cert=True, tls_enabled=True,
backend_tls_ciphers=constants.CIPHERS_OWASP_SUITE_B)],
tls_certs={
'sample_pool_id_1':
{'client_cert': cert_file_path,
'ca_cert': None, 'crl': None}},
feature_compatibility=feature_compatibility)
self.assertEqual(
sample_configs_combined.sample_base_expected_config(backend=be),
rendered_obj)
def test_render_template_pool_cert_no_alpn(self):
feature_compatibility = {constants.POOL_ALPN: False}
cert_file_path = os.path.join(self.jinja_cfg.base_crt_dir, cert_file_path = os.path.join(self.jinja_cfg.base_crt_dir,
'sample_listener_id_1', 'fake path') 'sample_listener_id_1', 'fake path')
be = ("backend sample_pool_id_1:sample_listener_id_1\n" be = ("backend sample_pool_id_1:sample_listener_id_1\n"
" mode http\n" " mode http\n"
" balance roundrobin\n" " balance roundrobin\n"
" cookie SRV insert indirect nocache\n" " cookie SRV insert indirect nocache\n"
" timeout check 31s\n" " timeout check 31s\n"
" option httpchk GET /index.html HTTP/1.0\\r\\n\n" " option httpchk GET /index.html HTTP/1.0\\r\\n\n"
" http-check expect rstatus 418\n" " http-check expect rstatus 418\n"
" fullconn {maxconn}\n" " fullconn {maxconn}\n"
skipping to change at line 1118 skipping to change at line 1159
" ciphers " + constants.CIPHERS_OWASP_SUITE_B + " ciphers " + constants.CIPHERS_OWASP_SUITE_B +
" no-sslv3 no-tlsv10 no-tlsv11") " no-sslv3 no-tlsv10 no-tlsv11")
rendered_obj = self.jinja_cfg.render_loadbalancer_obj( rendered_obj = self.jinja_cfg.render_loadbalancer_obj(
sample_configs_combined.sample_amphora_tuple(), sample_configs_combined.sample_amphora_tuple(),
[sample_configs_combined.sample_listener_tuple( [sample_configs_combined.sample_listener_tuple(
pool_cert=True, tls_enabled=True, pool_cert=True, tls_enabled=True,
backend_tls_ciphers=constants.CIPHERS_OWASP_SUITE_B)], backend_tls_ciphers=constants.CIPHERS_OWASP_SUITE_B)],
tls_certs={ tls_certs={
'sample_pool_id_1': 'sample_pool_id_1':
{'client_cert': cert_file_path, {'client_cert': cert_file_path,
'ca_cert': None, 'crl': None}}) 'ca_cert': None, 'crl': None}},
feature_compatibility=feature_compatibility)
self.assertEqual( self.assertEqual(
sample_configs_combined.sample_base_expected_config(backend=be), sample_configs_combined.sample_base_expected_config(backend=be),
rendered_obj) rendered_obj)
def test_render_template_pool_cert_no_versions(self): def test_render_template_pool_cert_no_versions(self):
feature_compatibility = {constants.POOL_ALPN: True}
cert_file_path = os.path.join(self.jinja_cfg.base_crt_dir, cert_file_path = os.path.join(self.jinja_cfg.base_crt_dir,
'sample_listener_id_1', 'fake path') 'sample_listener_id_1', 'fake path')
be = ("backend sample_pool_id_1:sample_listener_id_1\n" be = ("backend sample_pool_id_1:sample_listener_id_1\n"
" mode http\n" " mode http\n"
" balance roundrobin\n" " balance roundrobin\n"
" cookie SRV insert indirect nocache\n" " cookie SRV insert indirect nocache\n"
" timeout check 31s\n" " timeout check 31s\n"
" option httpchk GET /index.html HTTP/1.0\\r\\n\n" " option httpchk GET /index.html HTTP/1.0\\r\\n\n"
" http-check expect rstatus 418\n" " http-check expect rstatus 418\n"
" fullconn {maxconn}\n" " fullconn {maxconn}\n"
" option allbackups\n" " option allbackups\n"
" timeout connect 5000\n" " timeout connect 5000\n"
" timeout server 50000\n" " timeout server 50000\n"
" server sample_member_id_1 10.0.0.99:82 weight 13 " " server sample_member_id_1 10.0.0.99:82 weight 13 "
"check inter 30s fall 3 rise 2 cookie sample_member_id_1 " "check inter 30s fall 3 rise 2 cookie sample_member_id_1 "
"{opts}\n" "{opts} alpn {alpn}\n"
" server sample_member_id_2 10.0.0.98:82 weight 13 " " server sample_member_id_2 10.0.0.98:82 weight 13 "
"check inter 30s fall 3 rise 2 cookie sample_member_id_2 " "check inter 30s fall 3 rise 2 cookie sample_member_id_2 "
"{opts}\n\n").format( "{opts} alpn {alpn}\n\n").format(
maxconn=constants.HAPROXY_DEFAULT_MAXCONN, maxconn=constants.HAPROXY_DEFAULT_MAXCONN,
opts="ssl crt %s verify none sni ssl_fc_sni" % cert_file_path + opts="ssl crt %s verify none sni ssl_fc_sni" % cert_file_path +
" ciphers " + constants.CIPHERS_OWASP_SUITE_B) " ciphers " + constants.CIPHERS_OWASP_SUITE_B,
alpn=",".join(constants.AMPHORA_SUPPORTED_ALPN_PROTOCOLS))
rendered_obj = self.jinja_cfg.render_loadbalancer_obj( rendered_obj = self.jinja_cfg.render_loadbalancer_obj(
sample_configs_combined.sample_amphora_tuple(), sample_configs_combined.sample_amphora_tuple(),
[sample_configs_combined.sample_listener_tuple( [sample_configs_combined.sample_listener_tuple(
pool_cert=True, tls_enabled=True, pool_cert=True, tls_enabled=True,
backend_tls_ciphers=constants.CIPHERS_OWASP_SUITE_B, backend_tls_ciphers=constants.CIPHERS_OWASP_SUITE_B,
backend_tls_versions=None)], backend_tls_versions=None)],
tls_certs={ tls_certs={
'sample_pool_id_1': 'sample_pool_id_1':
{'client_cert': cert_file_path, {'client_cert': cert_file_path,
'ca_cert': None, 'crl': None}}) 'ca_cert': None, 'crl': None}},
feature_compatibility=feature_compatibility)
self.assertEqual( self.assertEqual(
sample_configs_combined.sample_base_expected_config(backend=be), sample_configs_combined.sample_base_expected_config(backend=be),
rendered_obj) rendered_obj)
def test_render_template_pool_cert_no_ciphers(self): def test_render_template_pool_cert_no_ciphers(self):
feature_compatibility = {constants.POOL_ALPN: True}
cert_file_path = os.path.join(self.jinja_cfg.base_crt_dir, cert_file_path = os.path.join(self.jinja_cfg.base_crt_dir,
'sample_listener_id_1', 'fake path') 'sample_listener_id_1', 'fake path')
be = ("backend sample_pool_id_1:sample_listener_id_1\n" be = ("backend sample_pool_id_1:sample_listener_id_1\n"
" mode http\n" " mode http\n"
" balance roundrobin\n" " balance roundrobin\n"
" cookie SRV insert indirect nocache\n" " cookie SRV insert indirect nocache\n"
" timeout check 31s\n" " timeout check 31s\n"
" option httpchk GET /index.html HTTP/1.0\\r\\n\n" " option httpchk GET /index.html HTTP/1.0\\r\\n\n"
" http-check expect rstatus 418\n" " http-check expect rstatus 418\n"
" fullconn {maxconn}\n" " fullconn {maxconn}\n"
" option allbackups\n" " option allbackups\n"
" timeout connect 5000\n" " timeout connect 5000\n"
" timeout server 50000\n" " timeout server 50000\n"
" server sample_member_id_1 10.0.0.99:82 weight 13 " " server sample_member_id_1 10.0.0.99:82 weight 13 "
"check inter 30s fall 3 rise 2 cookie sample_member_id_1 " "check inter 30s fall 3 rise 2 cookie sample_member_id_1 "
"{opts}\n" "{opts} alpn {alpn}\n"
" server sample_member_id_2 10.0.0.98:82 weight 13 " " server sample_member_id_2 10.0.0.98:82 weight 13 "
"check inter 30s fall 3 rise 2 cookie sample_member_id_2 " "check inter 30s fall 3 rise 2 cookie sample_member_id_2 "
"{opts}\n\n").format( "{opts} alpn {alpn}\n\n").format(
maxconn=constants.HAPROXY_DEFAULT_MAXCONN, maxconn=constants.HAPROXY_DEFAULT_MAXCONN,
opts="ssl crt %s verify none sni ssl_fc_sni" % cert_file_path + opts="ssl crt %s verify none sni ssl_fc_sni" % cert_file_path +
" no-sslv3 no-tlsv10 no-tlsv11") " no-sslv3 no-tlsv10 no-tlsv11",
alpn=",".join(constants.AMPHORA_SUPPORTED_ALPN_PROTOCOLS))
rendered_obj = self.jinja_cfg.render_loadbalancer_obj( rendered_obj = self.jinja_cfg.render_loadbalancer_obj(
sample_configs_combined.sample_amphora_tuple(), sample_configs_combined.sample_amphora_tuple(),
[sample_configs_combined.sample_listener_tuple( [sample_configs_combined.sample_listener_tuple(
pool_cert=True, tls_enabled=True)], pool_cert=True, tls_enabled=True)],
tls_certs={ tls_certs={
'sample_pool_id_1': 'sample_pool_id_1':
{'client_cert': cert_file_path, {'client_cert': cert_file_path,
'ca_cert': None, 'crl': None}}) 'ca_cert': None, 'crl': None}},
feature_compatibility=feature_compatibility)
self.assertEqual( self.assertEqual(
sample_configs_combined.sample_base_expected_config(backend=be), sample_configs_combined.sample_base_expected_config(backend=be),
rendered_obj) rendered_obj)
def test_render_template_pool_cert_no_ciphers_or_versions(self): def test_render_template_pool_cert_no_ciphers_or_versions_or_alpn(self):
cert_file_path = os.path.join(self.jinja_cfg.base_crt_dir, cert_file_path = os.path.join(self.jinja_cfg.base_crt_dir,
'sample_listener_id_1', 'fake path') 'sample_listener_id_1', 'fake path')
be = ("backend sample_pool_id_1:sample_listener_id_1\n" be = ("backend sample_pool_id_1:sample_listener_id_1\n"
" mode http\n" " mode http\n"
" balance roundrobin\n" " balance roundrobin\n"
" cookie SRV insert indirect nocache\n" " cookie SRV insert indirect nocache\n"
" timeout check 31s\n" " timeout check 31s\n"
" option httpchk GET /index.html HTTP/1.0\\r\\n\n" " option httpchk GET /index.html HTTP/1.0\\r\\n\n"
" http-check expect rstatus 418\n" " http-check expect rstatus 418\n"
" fullconn {maxconn}\n" " fullconn {maxconn}\n"
skipping to change at line 1220 skipping to change at line 1268
"check inter 30s fall 3 rise 2 cookie sample_member_id_1 " "check inter 30s fall 3 rise 2 cookie sample_member_id_1 "
"{opts}\n" "{opts}\n"
" server sample_member_id_2 10.0.0.98:82 weight 13 " " server sample_member_id_2 10.0.0.98:82 weight 13 "
"check inter 30s fall 3 rise 2 cookie sample_member_id_2 " "check inter 30s fall 3 rise 2 cookie sample_member_id_2 "
"{opts}\n\n").format( "{opts}\n\n").format(
maxconn=constants.HAPROXY_DEFAULT_MAXCONN, maxconn=constants.HAPROXY_DEFAULT_MAXCONN,
opts="ssl crt %s verify none sni ssl_fc_sni" % cert_file_path) opts="ssl crt %s verify none sni ssl_fc_sni" % cert_file_path)
rendered_obj = self.jinja_cfg.render_loadbalancer_obj( rendered_obj = self.jinja_cfg.render_loadbalancer_obj(
sample_configs_combined.sample_amphora_tuple(), sample_configs_combined.sample_amphora_tuple(),
[sample_configs_combined.sample_listener_tuple( [sample_configs_combined.sample_listener_tuple(
pool_cert=True, tls_enabled=True, backend_tls_versions=None)], pool_cert=True, tls_enabled=True, backend_tls_versions=None,
backend_alpn_protocols=None)],
tls_certs={ tls_certs={
'sample_pool_id_1': 'sample_pool_id_1':
{'client_cert': cert_file_path, {'client_cert': cert_file_path,
'ca_cert': None, 'crl': None}}) 'ca_cert': None, 'crl': None}})
self.assertEqual( self.assertEqual(
sample_configs_combined.sample_base_expected_config(backend=be), sample_configs_combined.sample_base_expected_config(backend=be),
rendered_obj) rendered_obj)
def test_render_template_pool_no_alpn(self):
be = ("backend sample_pool_id_1:sample_listener_id_1\n"
" mode http\n"
" balance roundrobin\n"
" cookie SRV insert indirect nocache\n"
" timeout check 31s\n"
" option httpchk GET /index.html HTTP/1.0\\r\\n\n"
" http-check expect rstatus 418\n"
" fullconn {maxconn}\n"
" option allbackups\n"
" timeout connect 5000\n"
" timeout server 50000\n"
" server sample_member_id_1 10.0.0.99:82 weight 13 "
"check inter 30s fall 3 rise 2 cookie sample_member_id_1\n"
" server sample_member_id_2 10.0.0.98:82 weight 13 "
"check inter 30s fall 3 rise 2 cookie sample_member_id_2"
"\n\n").format(
maxconn=constants.HAPROXY_DEFAULT_MAXCONN)
rendered_obj = self.jinja_cfg.render_loadbalancer_obj(
sample_configs_combined.sample_amphora_tuple(),
[sample_configs_combined.sample_listener_tuple(
backend_alpn_protocols=None)])
self.assertEqual(
sample_configs_combined.sample_base_expected_config(backend=be),
rendered_obj)
def test_render_template_with_full_pool_cert(self): def test_render_template_with_full_pool_cert(self):
feature_compatibility = {constants.POOL_ALPN: True}
pool_client_cert = '/foo/cert.pem' pool_client_cert = '/foo/cert.pem'
pool_ca_cert = '/foo/ca.pem' pool_ca_cert = '/foo/ca.pem'
pool_crl = '/foo/crl.pem' pool_crl = '/foo/crl.pem'
be = ("backend sample_pool_id_1:sample_listener_id_1\n" be = ("backend sample_pool_id_1:sample_listener_id_1\n"
" mode http\n" " mode http\n"
" balance roundrobin\n" " balance roundrobin\n"
" cookie SRV insert indirect nocache\n" " cookie SRV insert indirect nocache\n"
" timeout check 31s\n" " timeout check 31s\n"
" option httpchk GET /index.html HTTP/1.0\\r\\n\n" " option httpchk GET /index.html HTTP/1.0\\r\\n\n"
" http-check expect rstatus 418\n" " http-check expect rstatus 418\n"
" fullconn {maxconn}\n" " fullconn {maxconn}\n"
" option allbackups\n" " option allbackups\n"
" timeout connect 5000\n" " timeout connect 5000\n"
" timeout server 50000\n" " timeout server 50000\n"
" server sample_member_id_1 10.0.0.99:82 weight 13 " " server sample_member_id_1 10.0.0.99:82 weight 13 "
"check inter 30s fall 3 rise 2 cookie sample_member_id_1 " "check inter 30s fall 3 rise 2 cookie sample_member_id_1 "
"{opts}\n" "{opts} alpn {alpn}\n"
" server sample_member_id_2 10.0.0.98:82 weight 13 " " server sample_member_id_2 10.0.0.98:82 weight 13 "
"check inter 30s fall 3 rise 2 cookie sample_member_id_2 " "check inter 30s fall 3 rise 2 cookie sample_member_id_2 "
"{opts}\n\n").format( "{opts} alpn {alpn}\n\n").format(
maxconn=constants.HAPROXY_DEFAULT_MAXCONN, maxconn=constants.HAPROXY_DEFAULT_MAXCONN,
opts="%s %s %s %s %s %s" % ( opts="%s %s %s %s %s %s" % (
"ssl", "crt", pool_client_cert, "ssl", "crt", pool_client_cert,
"ca-file %s" % pool_ca_cert, "ca-file %s" % pool_ca_cert,
"crl-file %s" % pool_crl, "crl-file %s" % pool_crl,
"verify required sni ssl_fc_sni no-sslv3 no-tlsv10 no-tlsv11")) "verify required sni ssl_fc_sni no-sslv3 no-tlsv10 no-tlsv11"),
alpn=",".join(constants.AMPHORA_SUPPORTED_ALPN_PROTOCOLS))
rendered_obj = self.jinja_cfg.render_loadbalancer_obj( rendered_obj = self.jinja_cfg.render_loadbalancer_obj(
sample_configs_combined.sample_amphora_tuple(), sample_configs_combined.sample_amphora_tuple(),
[sample_configs_combined.sample_listener_tuple( [sample_configs_combined.sample_listener_tuple(
pool_cert=True, pool_ca_cert=True, pool_crl=True, pool_cert=True, pool_ca_cert=True, pool_crl=True,
tls_enabled=True)], tls_enabled=True)],
tls_certs={ tls_certs={
'sample_pool_id_1': 'sample_pool_id_1':
{'client_cert': pool_client_cert, {'client_cert': pool_client_cert,
'ca_cert': pool_ca_cert, 'ca_cert': pool_ca_cert,
'crl': pool_crl}}) 'crl': pool_crl}},
feature_compatibility=feature_compatibility)
self.assertEqual( self.assertEqual(
sample_configs_combined.sample_base_expected_config(backend=be), sample_configs_combined.sample_base_expected_config(backend=be),
rendered_obj) rendered_obj)
def test_transform_session_persistence(self): def test_transform_session_persistence(self):
in_persistence = ( in_persistence = (
sample_configs_combined.sample_session_persistence_tuple()) sample_configs_combined.sample_session_persistence_tuple())
ret = self.jinja_cfg._transform_session_persistence( ret = self.jinja_cfg._transform_session_persistence(
in_persistence, {}) in_persistence, {})
self.assertEqual(sample_configs_combined.RET_PERSISTENCE, ret) self.assertEqual(sample_configs_combined.RET_PERSISTENCE, ret)
 End of changes. 20 change blocks. 
15 lines changed or deleted 93 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)