Skip to content

Commit 299d51a

Browse files
authored
OpenBSD: redistribution of static/connected routes into OSPFv2/v3 (ipspace#2762)
1 parent 9f43da4 commit 299d51a

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

netsim/ansible/templates/ospf/openbsd.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{% import "openbsd.ospfv2.j2" as ospfv2 %}
22
{% import "openbsd.ospfv3.j2" as ospfv3 %}
3+
#!/bin/sh
34
{% if ospf.af.ipv4 is defined %}
45
{{ ospfv2.config(False,ospf,netlab_interfaces) }}
56
{% endif %}

netsim/ansible/templates/ospf/openbsd.ospfv2.j2

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{% macro config(ospf_vrf,ospf_data,intf_data) %}
22
{%- set areas = intf_data|selectattr('ipv4', 'defined')|map(attribute='ospf.area', default='')|reject('eq', '')|sort|unique %}
3-
#!/bin/sh
4-
53
cat <<OSPFD_CONF >/etc/ospfd.conf
64
{% if ospf_data.router_id|ipv4 %}
75
router-id {{ ospf_data.router_id }}
@@ -12,6 +10,11 @@ spf-holdtime msec 200
1210
{% set dfd = ospf_data.default %}
1311
redistribute default set { metric {{ dfd.cost|default(100) }} type {{ dfd.type|default('e1')|replace('e','') }} }
1412
{% endif %}
13+
{% if ospf_data.import is defined %}
14+
{% for proto in ospf_data.import %}
15+
redistribute {{ proto }}
16+
{% endfor %}
17+
{% endif %}
1518

1619
{% for a in areas %}
1720
area {{ a }} {

netsim/ansible/templates/ospf/openbsd.ospfv3.j2

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{% macro config(ospf_vrf,ospf_data,intf_data) %}
22
{%- set areas = intf_data|selectattr('ipv6', 'defined')|map(attribute='ospf.area', default='')|reject('eq', '')|sort|unique %}
3-
#!/bin/sh
4-
53
cat <<OSPFD_CONF >/etc/ospf6d.conf
64
{% if ospf_data.router_id is defined %}
75
router-id {{ ospf_data.router_id }}
@@ -12,6 +10,11 @@ spf-holdtime 1
1210
{% set dfd = ospf_data.default %}
1311
redistribute default set { metric {{ dfd.cost|default(100) }} type {{ dfd.type|default('e1')|replace('e','') }} }
1412
{% endif %}
13+
{% if ospf_data.import is defined %}
14+
{% for proto in ospf_data.import %}
15+
redistribute {{ proto }}
16+
{% endfor %}
17+
{% endif %}
1518

1619
{% for a in areas %}
1720
area {{ a }} {

0 commit comments

Comments
 (0)