From 88d6c303286c6ed8d924e00e588226aad4a5cd57 Mon Sep 17 00:00:00 2001 From: DmitriyEshenko Date: Mon, 27 Jul 2020 11:28:20 +0000 Subject: pppoe-server: T1956: support PADO-delay --- interface-definitions/pppoe-server.xml | 28 ++++++++++++++++++++++++++++ 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 @@ + + + PADO delays + + 1-999999 + Number in ms + + + + + Invalid PADO delay + + + + + Number of sessions + + 1-999999 + Number of sessions + + + + + Invalid number of delayed sessions + + + + 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): -- cgit v1.2.3