Dynamic address-list

Hello,

I add an additional field in Service (custom) : “pat” (Port address Translation) as string or Bolean.

In config/radius Nas Mikrotik , Rate-Limit attributes I add the radius attribute:

Mikrotik-Address-List = pat

But I need to add the address list only if the “pat” field is “1” in case of Bolean or populated if it is a String;

I test this string but it doesn’t work:
{% if service_attributes.pat is not empty %} Mikrotik-Address-List = pat {% endif %}

Can you help me ?
Thank you.

Hi,

To use the atribute {% if service_attributes.pat is not empty %} Mikrotik-Address-List = pat {% endif %}, you need to work with a field in the internet service, is not posible with fields in custom service. If you want also to use as bolean, the correct attribute is:

{% if service_attributes.pat == 1 %} Mikrotik-Address-List = pat {% endif %}

or

{% if service_attributes.pat == 0 %} Mikrotik-Address-List = pat {% endif %}

Hi! This code working ONLY for internet services

Hi Mazapura,

Yes, but for me it doesn’t work, doesn’t work the rate limit and the address creation; can you tell me the command to view that debug mode.

Thank you, regards.

freeradius -Xxxxx

more info: https://splynx.com/3000/splynx-radius-configuration-and-troubleshooting/

ps: if boolean use “== 1” , not “is not empty” …

Hi,
maybe I understand the problem; in Mikrotik Rate Limit attributes I have the string:

Mikrotik-Rate-Limit = {{ rx_rate_limit }}/{{ tx_rate_limit }} {{ tariff_attributes.burst_up ? tariff_attributes.burst_up : rx_burst_rate }}/{{ tariff_attributes.burst_down ? tariff_attributes.burst_down : tx_burst_rate }} {{ rx_burst_threshold }}/{{ tx_burst_threshold }} {{ burst_time }}/{{ burst_time }} {{ mikrotik_priority }} {{ tariff_attributes.limit_up ? tariff_attributes.limit_up : rx-rate-min }}/{{ tariff_attributes.limit_down ? tariff_attributes.limit_down : tx-rate-min }}

If I add the string:
{% if service_attributes.pat is not empty %} Mikrotik-Address-List = pat {% endif %}

maybe it becomes too long; in fact after the page reload I see that:
Mikrotik-Rate-Limit = {{ rx_rate_limit }}/{{ tx_rate_limit }} {{ tariff_attributes.burst_up ? tariff_attributes.burst_up : rx_burst_rate }}/{{ tariff_attributes.burst_down ? tariff_attributes.burst_down : tx_burst_rate }} {{ rx_burst_threshold }}/{{ tx_burst_threshold }} {{ burst_time }}/{{ burst_time }} {{ mikrotik_priority }} {{ tariff_attributes.limit_up ? tariff_attributes.limit_up : rx-rate-min }}/{{ tariff_attributes.limit_down ? tariff_attributes.limit_down : tx-rate-min }}
{% if service_attributes.pat is not empty %} Mikr

and doesn’t work for rate limit and address list.

Any idea ?

Yes, there are problems with limits of symbols - 535 symbols only!