From 49ee763a1892b011213446f5ccb12b53fbbd1622 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 19 Dec 2019 23:00:13 +0100 Subject: igmp-proxy: T1893: rename 'interface' dictionary key to 'interfaces' (cherry picked from commit 9a0f6371be5ef97974a4cc6d8f4fb97c3f9741ac) --- src/conf_mode/igmp_proxy.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/conf_mode') diff --git a/src/conf_mode/igmp_proxy.py b/src/conf_mode/igmp_proxy.py index b994369af..37744535e 100755 --- a/src/conf_mode/igmp_proxy.py +++ b/src/conf_mode/igmp_proxy.py @@ -50,17 +50,17 @@ config_tmpl = """ quickleave {% endif -%} -{% for i in interface %} -# Configuration for {{ i.interface }} ({{ i.role }} interface) -{% if i.role == 'disabled' -%} -phyint {{ i.interface }} disabled +{% for interface in interfaces %} +# Configuration for {{ interface.interface }} ({{ interface.role }} interface) +{% if interface.role == 'disabled' -%} +phyint {{ interface.interface }} disabled {%- else -%} -phyint {{ i.interface }} {{ i.role }} ratelimit 0 threshold {{ i.threshold }} +phyint {{ interface.interface }} {{ interface.role }} ratelimit 0 threshold {{ interface.threshold }} {%- endif -%} -{%- for subnet in i.alt_subnet %} +{%- for subnet in interface.alt_subnet %} altnet {{ subnet }} {%- endfor %} -{%- for subnet in i.whitelist %} +{%- for subnet in interface.whitelist %} whitelist {{ subnet }} {%- endfor %} {% endfor %} @@ -69,7 +69,7 @@ phyint {{ i.interface }} {{ i.role }} ratelimit 0 threshold {{ i.threshold }} default_config_data = { 'disable': False, 'disable_quickleave': False, - 'interface': [], + 'interfaces': [], } def get_config(): @@ -111,7 +111,7 @@ def get_config(): interface['whitelist'] = conf.return_values('whitelist') # Append interface configuration to global configuration list - igmp_proxy['interface'].append(interface) + igmp_proxy['interfaces'].append(interface) return igmp_proxy @@ -125,12 +125,12 @@ def verify(igmp_proxy): return None # at least two interfaces are required, one upstream and one downstream - if len(igmp_proxy['interface']) < 2: + if len(igmp_proxy['interfaces']) < 2: raise ConfigError('Must define an upstream and at least 1 downstream interface!') upstream = 0 - for i in igmp_proxy['interface']: - if "upstream" == i['role']: + for interface in igmp_proxy['interfaces']: + if "upstream" == interface['role']: upstream += 1 if upstream == 0: -- cgit v1.2.3