From 9ab26d3ffa870bdcc0310618ff1050804e694440 Mon Sep 17 00:00:00 2001 From: Cheeze_It Date: Sun, 8 Nov 2020 14:41:09 -0700 Subject: mpls-conf: T915: Add targeted LDP neighbors with parameters The commit has to do with the addition of targeted LDP neighbors and parameters being added. FRR allows for this functionality and I just wanted to add it. We have basically 4 options that are added. Enabling targeted LDP functionality, the targeted neighbor, the hello interval of targeted sessions, and the hold time of targeted sessions. Both IPv4 and IPv6 has been coded in. --- src/conf_mode/protocols_mpls.py | 122 ++++++++++++++++++++++++++++++++-------- 1 file changed, 97 insertions(+), 25 deletions(-) (limited to 'src/conf_mode') diff --git a/src/conf_mode/protocols_mpls.py b/src/conf_mode/protocols_mpls.py index 177fd265c..0972e337a 100755 --- a/src/conf_mode/protocols_mpls.py +++ b/src/conf_mode/protocols_mpls.py @@ -38,32 +38,48 @@ def get_config(config=None): 'router_id' : None, 'mpls_ldp' : False, 'old_ldp' : { - 'interfaces' : [], - 'neighbors' : {}, - 'd_transp_ipv4' : None, - 'd_transp_ipv6' : None, - 'hello_ipv4_holdtime' : None, - 'hello_ipv4_interval' : None, - 'hello_ipv6_holdtime' : None, - 'hello_ipv6_interval' : None, - 'ses_ipv4_hold' : None, - 'ses_ipv6_hold' : None, - 'export_ipv4_exp' : False, - 'export_ipv6_exp' : False + 'interfaces' : [], + 'neighbors' : {}, + 'd_transp_ipv4' : None, + 'd_transp_ipv6' : None, + 'hello_ipv4_holdtime' : None, + 'hello_ipv4_interval' : None, + 'hello_ipv6_holdtime' : None, + 'hello_ipv6_interval' : None, + 'ses_ipv4_hold' : None, + 'ses_ipv6_hold' : None, + 'export_ipv4_exp' : False, + 'export_ipv6_exp' : False, + 'target_ipv4_addresses' : [], + 'target_ipv6_addresses' : [], + 'target_ipv4_enable' : False, + 'target_ipv6_enable' : False, + 'target_ipv4_hello_int' : None, + 'target_ipv6_hello_int' : None, + 'target_ipv4_hello_hold' : None, + 'target_ipv6_hello_hold' : None }, 'ldp' : { - 'interfaces' : [], - 'neighbors' : {}, - 'd_transp_ipv4' : None, - 'd_transp_ipv6' : None, - 'hello_ipv4_holdtime' : None, - 'hello_ipv4_interval' : None, - 'hello_ipv6_holdtime' : None, - 'hello_ipv6_interval' : None, - 'ses_ipv4_hold' : None, - 'ses_ipv6_hold' : None, - 'export_ipv4_exp' : False, - 'export_ipv6_exp' : False + 'interfaces' : [], + 'neighbors' : {}, + 'd_transp_ipv4' : None, + 'd_transp_ipv6' : None, + 'hello_ipv4_holdtime' : None, + 'hello_ipv4_interval' : None, + 'hello_ipv6_holdtime' : None, + 'hello_ipv6_interval' : None, + 'ses_ipv4_hold' : None, + 'ses_ipv6_hold' : None, + 'export_ipv4_exp' : False, + 'export_ipv6_exp' : False, + 'target_ipv4_addresses' : [], + 'target_ipv6_addresses' : [], + 'target_ipv4_enable' : False, + 'target_ipv6_enable' : False, + 'target_ipv4_hello_int' : None, + 'target_ipv6_hello_int' : None, + 'target_ipv4_hello_hold' : None, + 'target_ipv6_hello_hold' : None } } if not (conf.exists('protocols mpls') or conf.exists_effective('protocols mpls')): @@ -150,6 +166,62 @@ def get_config(config=None): if conf.exists('export ipv6 explicit-null'): mpls_conf['ldp']['export_ipv6_exp'] = True + # Get target_ipv4_addresses + if conf.exists_effective('targeted-neighbor ipv4 address'): + mpls_conf['old_ldp']['target_ipv4_addresses'] = conf.return_effective_values('targeted-neighbor ipv4 address') + + if conf.exists('targeted-neighbor ipv4 address'): + mpls_conf['ldp']['target_ipv4_addresses'] = conf.return_values('targeted-neighbor ipv4 address') + + # Get target_ipv4_enable + if conf.exists_effective('targeted-neighbor ipv4 enable'): + mpls_conf['old_ldp']['target_ipv4_enable'] = True + + if conf.exists('targeted-neighbor ipv4 enable'): + mpls_conf['ldp']['target_ipv4_enable'] = True + + # Get target_ipv4_hello_int + if conf.exists_effective('targeted-neighbor ipv4 hello-interval'): + mpls_conf['old_ldp']['target_ipv4_hello_int'] = conf.return_effective_value('targeted-neighbor ipv4 hello-interval') + + if conf.exists('targeted-neighbor ipv4 hello-interval'): + mpls_conf['ldp']['target_ipv4_hello_int'] = conf.return_value('targeted-neighbor ipv4 hello-interval') + + # Get target_ipv4_hello_hold + if conf.exists_effective('targeted-neighbor ipv4 hello-holdtime'): + mpls_conf['old_ldp']['target_ipv4_hello_hold'] = conf.return_effective_value('targeted-neighbor ipv4 hello-holdtime') + + if conf.exists('targeted-neighbor ipv4 hello-holdtime'): + mpls_conf['ldp']['target_ipv4_hello_hold'] = conf.return_value('targeted-neighbor ipv4 hello-holdtime') + + # Get target_ipv6_addresses + if conf.exists_effective('targeted-neighbor ipv6 address'): + mpls_conf['old_ldp']['target_ipv6_addresses'] = conf.return_effective_values('targeted-neighbor ipv6 address') + + if conf.exists('targeted-neighbor ipv6 address'): + mpls_conf['ldp']['target_ipv6_addresses'] = conf.return_values('targeted-neighbor ipv6 address') + + # Get target_ipv6_enable + if conf.exists_effective('targeted-neighbor ipv6 enable'): + mpls_conf['old_ldp']['target_ipv6_enable'] = True + + if conf.exists('targeted-neighbor ipv6 enable'): + mpls_conf['ldp']['target_ipv6_enable'] = True + + # Get target_ipv6_hello_int + if conf.exists_effective('targeted-neighbor ipv6 hello-interval'): + mpls_conf['old_ldp']['target_ipv6_hello_int'] = conf.return_effective_value('targeted-neighbor ipv6 hello-interval') + + if conf.exists('targeted-neighbor ipv6 hello-interval'): + mpls_conf['ldp']['target_ipv6_hello_int'] = conf.return_value('targeted-neighbor ipv6 hello-interval') + + # Get target_ipv6_hello_hold + if conf.exists_effective('targeted-neighbor ipv6 hello-holdtime'): + mpls_conf['old_ldp']['target_ipv6_hello_hold'] = conf.return_effective_value('targeted-neighbor ipv6 hello-holdtime') + + if conf.exists('targeted-neighbor ipv6 hello-holdtime'): + mpls_conf['ldp']['target_ipv6_hello_hold'] = conf.return_value('targeted-neighbor ipv6 hello-holdtime') + # Get interfaces if conf.exists_effective('interface'): mpls_conf['old_ldp']['interfaces'] = conf.return_effective_values('interface') @@ -245,4 +317,4 @@ if __name__ == '__main__': apply(c) except ConfigError as e: print(e) - exit(1) \ No newline at end of file + exit(1) -- cgit v1.2.3