瀏覽代碼

SDN: Activate OSPF on Wireguard tunnels

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
Maximilian Wilhelm 2 年之前
父節點
當前提交
c7d7222bf5
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      _modules/ffho_net.py

+ 10 - 0
_modules/ffho_net.py

@@ -1320,6 +1320,16 @@ def get_ospf_interface_config (node_config, grains_id):
 			elif iface.startswith ('ovpn-er-'):
 				ospf_config['type'] = 'broadcast'
 
+		# Active OSPF on Wireguard tunnels, cost 10000
+		elif iface.startswith ('wg-'):
+			ospf_on = True
+			ospf_config['stub'] = False
+			ospf_config['cost'] = 10000
+
+			# Inter-Core links should have cost 5000
+			if iface.startswith ('wg-cr') and grains_id.startswith ('cr'):
+				ospf_config['cost'] = 5000
+
 		# OSPF explicitly enabled for interface
 		elif 'ospf' in iface_config:
 			ospf_on = True