diff options
-rw-r--r-- | interface-definitions/pppoe-server.xml | 28 | ||||
-rwxr-xr-x | src/conf_mode/accel_pppoe.py | 22 |
2 files changed, 48 insertions, 2 deletions
diff --git a/interface-definitions/pppoe-server.xml b/interface-definitions/pppoe-server.xml index 4f39d7950..ea77140c2 100644 --- a/interface-definitions/pppoe-server.xml +++ b/interface-definitions/pppoe-server.xml @@ -594,6 +594,34 @@ </leafNode> </children> </node> + <tagNode name="pado-delay"> + <properties> + <help>PADO delays</help> + <valueHelp> + <format>1-999999</format> + <description>Number in ms</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 1-999999"/> + </constraint> + <constraintErrorMessage>Invalid PADO delay</constraintErrorMessage> + </properties> + <children> + <leafNode name="sessions"> + <properties> + <help>Number of sessions</help> + <valueHelp> + <format>1-999999</format> + <description>Number of sessions</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 1-999999"/> + </constraint> + <constraintErrorMessage>Invalid number of delayed sessions</constraintErrorMessage> + </properties> + </leafNode> + </children> + </tagNode> </children> </node> </children> diff --git a/src/conf_mode/accel_pppoe.py b/src/conf_mode/accel_pppoe.py index c8b570a87..1df873171 100755 --- a/src/conf_mode/accel_pppoe.py +++ b/src/conf_mode/accel_pppoe.py @@ -239,7 +239,9 @@ interface={{int}} {% if svc_name %} service-name={{svc_name}} {% endif %} -pado-delay=0 +{% if pado_delay %} +pado-delay={{pado_delay}} +{% endif %} # maybe: called-sid, tr101, padi-limit etc. {% if limits %} @@ -339,7 +341,8 @@ def get_config(): 'mtu' : '1492', 'ppp_options' : {}, 'limits' : {}, - 'snmp' : 'disable' + 'snmp' : 'disable', + 'pado_delay' : '' } c.set_level('service pppoe-server') @@ -522,6 +525,21 @@ def get_config(): if len(ppp_options) !=0: config_data['ppp_options'] = ppp_options + if c.exists('pado-delay'): + config_data['pado_delay'] = '0' + a = {} + for id in c.list_nodes('pado-delay'): + if not c.return_value('pado-delay {0} sessions'.format(id)): + a[id] = 0 + else: + a[id] = c.return_value('pado-delay {0} sessions'.format(id)) + + for k in sorted(a.keys()): + if k != sorted(a.keys())[-1]: + config_data['pado_delay'] += ",{0}:{1}".format(k,a[k]) + else: + config_data['pado_delay'] += ",{0}:{1}".format('-1',a[k]) + return config_data def verify(c): |