diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-10-16 08:43:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-16 08:43:23 +0200 |
commit | a5a77c47168b888bf008dab139d1e5d023568bfe (patch) | |
tree | f793520db5e8ea534a3bee0ac1e88b2879a612e1 | |
parent | 741cd00fb687a1ce1e5f9e65c324bc229700e10b (diff) | |
parent | 2bc0e445bc09103b2a74af187a4babb2c3531f17 (diff) | |
download | vyos-1x-a5a77c47168b888bf008dab139d1e5d023568bfe.tar.gz vyos-1x-a5a77c47168b888bf008dab139d1e5d023568bfe.zip |
Merge pull request #571 from sever-sever/T915_holdtime_explicit
conf-mode: T915: Add mpls ldp explicit and holdtime commands
-rw-r--r-- | data/templates/frr/ldpd.frr.tmpl | 24 | ||||
-rw-r--r-- | interface-definitions/protocols-mpls.xml.in | 57 | ||||
-rwxr-xr-x | 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 @@ </constraint> </properties> </leafNode> + <leafNode name="session-ipv4-holdtime"> + <properties> + <help>Session ipv4 holdtime</help> + <valueHelp> + <format>15-65535</format> + <description>Time in seconds</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 15-65535"/> + </constraint> + </properties> + </leafNode> + <leafNode name="session-ipv6-holdtime"> + <properties> + <help>Session ipv6 holdtime</help> + <valueHelp> + <format>15-65535</format> + <description>Time in seconds</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 15-65535"/> + </constraint> + </properties> + </leafNode> <leafNode name="transport-ipv4-address"> <properties> <help>Transport ipv4 address</help> @@ -104,6 +128,39 @@ </leafNode> </children> </node> + <node name="export"> + <properties> + <help>Export parameters</help> + </properties> + <children> + <node name="ipv4"> + <properties> + <help>IPv4 parameters</help> + </properties> + <children> + <leafNode name="explicit-null"> + <properties> + <help>Explicit-Null Label</help> + <valueless/> + </properties> + </leafNode> + </children> + </node> + <node name="ipv6"> + <properties> + <help>IPv6 parameters</help> + </properties> + <children> + <leafNode name="explicit-null"> + <properties> + <help>Explicit-Null Label</help> + <valueless/> + </properties> + </leafNode> + </children> + </node> + </children> + </node> <leafNode name="interface"> <properties> <help>Listen interface for LDP</help> 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') |