Browse Source

SDN: Remove route metric on non-router nodes.

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
Maximilian Wilhelm 3 years ago
parent
commit
bd650bbbd3
1 changed files with 5 additions and 0 deletions
  1. 5 0
      _modules/ffho_net.py

+ 5 - 0
_modules/ffho_net.py

@@ -937,6 +937,11 @@ def get_interface_config (node_config, sites_config, node_id = ""):
 		for key in [ 'automtu', 'batman_connect_sites', 'has_gateway', 'ospf', 'site', 'type', 'tagged_vlans' ]:
 			if key in config:
 				config.pop (key)
+
+		# Remove route metric on non-router nodes
+		if 'metric' in config and not 'router' in node_config.get ('roles', []):
+			config.pop ('metric')
+
 	# This leaves 'auto', 'prefixes' and 'desc' as keys which should not be directly
 	# printed into the remaining configuration. These are handled within the jinja
 	# interface template.