From 2bc0e445bc09103b2a74af187a4babb2c3531f17 Mon Sep 17 00:00:00 2001 From: sever-sever Date: Thu, 15 Oct 2020 18:01:41 +0000 Subject: conf-mode: T915: Add mpls ldp explicit and holdtime commands --- data/templates/frr/ldpd.frr.tmpl | 24 ++++++++++++ interface-definitions/protocols-mpls.xml.in | 57 +++++++++++++++++++++++++++++ src/conf_mode/protocols_mpls.py | 42 ++++++++++++++++++++- 3 files changed, 121 insertions(+), 2 deletions(-) diff --git a/data/templates/frr/ldpd.frr.tmpl b/data/templates/frr/ldpd.frr.tmpl index dbaa917e8..5f080d75f 100644 --- a/data/templates/frr/ldpd.frr.tmpl +++ b/data/templates/frr/ldpd.frr.tmpl @@ -15,6 +15,12 @@ neighbor {{neighbor_id}} password {{ldp.neighbors[neighbor_id].password}} {% endfor -%} address-family ipv4 label local allocate host-routes +{% if old_ldp.export_ipv4_exp -%} +no label local advertise explicit-null +{% endif -%} +{% if ldp.export_ipv4_exp -%} +label local advertise explicit-null +{% endif -%} {% if old_ldp.d_transp_ipv4 -%} no discovery transport-address {{ old_ldp.d_transp_ipv4 }} {% endif -%} @@ -33,6 +39,12 @@ no discovery hello interval {{ old_ldp.hello_interval }} {% if ldp.hello_interval -%} discovery hello interval {{ ldp.hello_interval }} {% endif -%} +{% if old_ldp.ses_ipv4_hold -%} +no session holdtime {{ old_ldp.ses_ipv4_hold }} +{% endif -%} +{% if ldp.ses_ipv4_hold -%} +session holdtime {{ ldp.ses_ipv4_hold }} +{% endif -%} {% for interface in old_ldp.interfaces -%} no interface {{interface}} {% endfor -%} @@ -46,6 +58,18 @@ exit-address-family {% if ldp.d_transp_ipv6 -%} address-family ipv6 label local allocate host-routes +{% if old_ldp.export_ipv6_exp -%} +no label local advertise explicit-null +{% endif -%} +{% if ldp.export_ipv6_exp -%} +label local advertise explicit-null +{% endif -%} +{% if old_ldp.ses_ipv6_hold -%} +no session holdtime {{ old_ldp.ses_ipv6_hold }} +{% endif -%} +{% if ldp.ses_ipv6_hold -%} +session holdtime {{ ldp.ses_ipv6_hold }} +{% endif -%} {% if old_ldp.d_transp_ipv6 -%} no discovery transport-address {{ old_ldp.d_transp_ipv6 }} {% endif -%} diff --git a/interface-definitions/protocols-mpls.xml.in b/interface-definitions/protocols-mpls.xml.in index 3e9edbf72..3ea610d8b 100644 --- a/interface-definitions/protocols-mpls.xml.in +++ b/interface-definitions/protocols-mpls.xml.in @@ -78,6 +78,30 @@ + + + Session ipv4 holdtime + + 15-65535 + Time in seconds + + + + + + + + + Session ipv6 holdtime + + 15-65535 + Time in seconds + + + + + + Transport ipv4 address @@ -104,6 +128,39 @@ + + + Export parameters + + + + + IPv4 parameters + + + + + Explicit-Null Label + + + + + + + + IPv6 parameters + + + + + Explicit-Null Label + + + + + + + Listen interface for LDP diff --git a/src/conf_mode/protocols_mpls.py b/src/conf_mode/protocols_mpls.py index e515490d0..904d219e2 100755 --- a/src/conf_mode/protocols_mpls.py +++ b/src/conf_mode/protocols_mpls.py @@ -43,7 +43,12 @@ def get_config(config=None): 'd_transp_ipv4' : None, 'd_transp_ipv6' : None, 'hello_holdtime' : None, - 'hello_interval' : None + 'hello_interval' : None, + 'ses_ipv4_hold' : None, + 'ses_ipv6_hold' : None, + 'export_ipv4_exp' : False, + 'export_ipv6_exp' : False + }, 'ldp' : { 'interfaces' : [], @@ -51,7 +56,12 @@ def get_config(config=None): 'd_transp_ipv4' : None, 'd_transp_ipv6' : None, 'hello_holdtime' : None, - 'hello_interval' : None + 'hello_interval' : None, + 'ses_ipv4_hold' : None, + 'ses_ipv6_hold' : None, + 'export_ipv4_exp' : False, + 'export_ipv6_exp' : False + } } if not (conf.exists('protocols mpls') or conf.exists_effective('protocols mpls')): @@ -82,6 +92,20 @@ def get_config(config=None): if conf.exists('discovery hello-interval'): mpls_conf['ldp']['hello_interval'] = conf.return_value('discovery hello-interval') + # Get session-ipv4-holdtime + if conf.exists_effective('discovery session-ipv4-holdtime'): + mpls_conf['old_ldp']['ses_ipv4_hold'] = conf.return_effective_value('discovery session-ipv4-holdtime') + + if conf.exists('discovery session-ipv4-holdtime'): + mpls_conf['ldp']['ses_ipv4_hold'] = conf.return_value('discovery session-ipv4-holdtime') + + # Get session-ipv6-holdtime + if conf.exists_effective('discovery session-ipv6-holdtime'): + mpls_conf['old_ldp']['ses_ipv6_hold'] = conf.return_effective_value('discovery session-ipv6-holdtime') + + if conf.exists('discovery session-ipv6-holdtime'): + mpls_conf['ldp']['ses_ipv6_hold'] = conf.return_value('discovery session-ipv6-holdtime') + # Get discovery transport-ipv4-address if conf.exists_effective('discovery transport-ipv4-address'): mpls_conf['old_ldp']['d_transp_ipv4'] = conf.return_effective_value('discovery transport-ipv4-address') @@ -96,6 +120,20 @@ def get_config(config=None): if conf.exists('discovery transport-ipv6-address'): mpls_conf['ldp']['d_transp_ipv6'] = conf.return_value('discovery transport-ipv6-address') + # Get export ipv4 explicit-null + if conf.exists_effective('export ipv4 explicit-null'): + mpls_conf['old_ldp']['export_ipv4_exp'] = True + + if conf.exists('export ipv4 explicit-null'): + mpls_conf['ldp']['export_ipv4_exp'] = True + + # Get export ipv6 explicit-null + if conf.exists_effective('export ipv6 explicit-null'): + mpls_conf['old_ldp']['export_ipv6_exp'] = True + + if conf.exists('export ipv6 explicit-null'): + mpls_conf['ldp']['export_ipv6_exp'] = True + # Get interfaces if conf.exists_effective('interface'): mpls_conf['old_ldp']['interfaces'] = conf.return_effective_values('interface') -- cgit v1.2.3