summaryrefslogtreecommitdiff
path: root/src/conf_mode/protocols_mpls.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-11-09 21:37:49 +0100
committerGitHub <noreply@github.com>2020-11-09 21:37:49 +0100
commitad856600ca29ba463de2b288189d3f40b9e91846 (patch)
tree3d99e54db9a9d88144cd280639ba620bc7b97253 /src/conf_mode/protocols_mpls.py
parented6e1f556b290231f1683a06ec366dbeb4c0776a (diff)
parent9ab26d3ffa870bdcc0310618ff1050804e694440 (diff)
downloadvyos-1x-ad856600ca29ba463de2b288189d3f40b9e91846.tar.gz
vyos-1x-ad856600ca29ba463de2b288189d3f40b9e91846.zip
Merge pull request #597 from Cheeze-It/current
mpls-conf: T915: Add targeted LDP neighbors with parameters
Diffstat (limited to 'src/conf_mode/protocols_mpls.py')
-rwxr-xr-xsrc/conf_mode/protocols_mpls.py122
1 files changed, 97 insertions, 25 deletions
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)