Skip to content

Commit

Permalink
Merge pull request #2693 from aapostoliuk/T5859-circinus
Browse files Browse the repository at this point in the history
T5859: Fixed format of pool range in the accel-ppp config
  • Loading branch information
c-po committed Dec 27, 2023
2 parents 7324edf + 714a6b1 commit 957c99f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
10 changes: 8 additions & 2 deletions data/templates/accel-ppp/config_ip_pool.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ gw-ip-address={{ gateway_address }}
{% endif %}
{% for pool in ordered_named_pools %}
{% for pool_name, pool_config in pool.items() %}
{% set iprange_str = pool_config.range %}
{% set iprange_list = pool_config.range.split('-') %}
{% if iprange_list | length == 2 %}
{% set last_ip_oct = iprange_list[1].split('.') %}
{% set iprange_str = iprange_list[0] + '-' + last_ip_oct[last_ip_oct | length - 1] %}
{% endif %}
{% if pool_config.next_pool is vyos_defined %}
{{ pool_config.range }},name={{ pool_name }},next={{ pool_config.next_pool }}
{{ iprange_str }},name={{ pool_name }},next={{ pool_config.next_pool }}
{% else %}
{{ pool_config.range }},name={{ pool_name }}
{{ iprange_str }},name={{ pool_name }}
{% endif %}
{% endfor %}
{% endfor %}
Expand Down
3 changes: 2 additions & 1 deletion smoketest/scripts/cli/base_accel_ppp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ def test_accel_ipv4_pool(self):
first_pool = "POOL1"
second_pool = "POOL2"
range = "192.0.2.10-192.0.2.20"
range_config = "192.0.2.10-20"

self.set(["gateway-address", gateway])
self.set(["client-ip-pool", first_pool, "range", subnet])
Expand All @@ -382,7 +383,7 @@ def test_accel_ipv4_pool(self):
self.assertEqual(
f"{first_pool},next={second_pool}", conf["ip-pool"][f"{subnet},name"]
)
self.assertEqual(second_pool, conf["ip-pool"][f"{range},name"])
self.assertEqual(second_pool, conf["ip-pool"][f"{range_config},name"])
self.assertEqual(gateway, conf["ip-pool"]["gw-ip-address"])
self.assertEqual(first_pool, conf[self._protocol_section]["ip-pool"])

Expand Down
3 changes: 2 additions & 1 deletion smoketest/scripts/cli/test_service_ipoe-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def test_accel_ipv4_pool(self):
first_pool = "POOL1"
second_pool = "POOL2"
range = "192.0.2.10-192.0.2.20"
range_config = "192.0.2.10-20"

for gw in gateway:
self.set(["gateway-address", gw])
Expand All @@ -141,7 +142,7 @@ def test_accel_ipv4_pool(self):
self.assertIn(
f"{first_pool},next={second_pool}", conf["ip-pool"][f"{subnet},name"]
)
self.assertIn(second_pool, conf["ip-pool"][f"{range},name"])
self.assertIn(second_pool, conf["ip-pool"][f"{range_config},name"])

gw_pool_config_list = conf.get("ip-pool", "gw-ip-address")
gw_ipoe_config_list = conf.get(self._protocol_section, "gw-ip-address")
Expand Down

0 comments on commit 957c99f

Please sign in to comment.