Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion netsim/ansible/templates/bgp/routeros7.j2
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
{% import "routeros7.macro.j2" as bgpcfg %}

/routing/bgp/template add name=main as={{ bgp.as }} output.network=bgp-networks
{# Needed for > 7.18 #}
/routing/bgp/instance add name=main as={{ bgp.as }}

{% if bgp.router_id is defined %}
/routing/bgp/template set main router-id={{ bgp.router_id }}
{# /routing/bgp/template set main router-id={{ bgp.router_id }} #}
{# Needed for > 7.18 #}
/routing/id add name=bgp_router_id id={{ bgp.router_id }} select-dynamic-id=""
{% endif %}

{% if bgp.rr|default(False) and bgp.rr_cluster_id|default(False) %}
/routing/bgp/template set main cluster-id={{ bgp.rr_cluster_id }}
{% endif %}
Expand Down
4 changes: 3 additions & 1 deletion netsim/ansible/templates/bgp/routeros7.macro.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
{% macro neighbor(n,ip,bgp,instance) %}

{% set neigh_id = ip|replace('.', '_')|replace(':', '_') %}
/routing/bgp/connection add template={{instance}} name={{ neigh_id }} remote.address={{ ip }} remote.as={{ n.as }} comment="{{ n.name }}" local.role=ebgp
/routing/bgp/connection add template={{ instance }} instance={{ instance }} name={{ neigh_id }} remote.address={{ ip }} remote.as={{ n.as }} comment="{{ n.name }}" local.role=ebgp
{# Needed for > 7.18 #}
/routing/bgp/connection set [/routing/bgp/connection find name={{ neigh_id }}] router-id=bgp_router_id

{% if n.type == 'ibgp' %}
/routing/bgp/connection set [/routing/bgp/connection find name={{ neigh_id }}] local.role=ibgp local.address=loopback
Expand Down
9 changes: 9 additions & 0 deletions netsim/ansible/templates/evpn/routeros7.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% for n in bgp.neighbors if n.ipv4 is defined and n.evpn|default(False) %}
{% set neigh_id = n.ipv4|replace('.', '_')|replace(':', '_') %}
/routing/bgp/connection set [/routing/bgp/connection find name={{ neigh_id }}] afi=evpn
{% if vlans is defined and 'vxlan' in module %}
{% for v in vlans.values() if v.evpn.evi is defined %}
/routing/bgp/evpn add name={{ neigh_id }}-evpn disabled=no instance=main export.route-targets={{ v.evpn.export|join(',') }} import.route-targets={{ v.evpn.import|join(',') }} vni={{ v.vni }}
{% endfor %}
{% endif %}
{% endfor %}
12 changes: 12 additions & 0 deletions netsim/ansible/templates/vxlan/routeros7.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% if vxlan.vlans is defined %}
{% for vname in vxlan.vlans if vlans[vname].vni is defined %}
{% set learning="no" if vxlan.flooding|default("") == "evpn" else "yes" %}
{% set v= vlans[vname] %}
/interface/vxlan add bridge=switch bridge-pvid={{ v.id }} local-address={{ vxlan.vtep }} name=vxlan-{{ v.vni }} vni={{ v.vni }} learning={{ learning }}
{% if v.vtep_list is defined %}
{% for remote_vtep in v.vtep_list %}
/interface/vxlan/vtep add interface=vxlan-{{ v.vni }} remote-ip={{ remote_vtep }}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
5 changes: 5 additions & 0 deletions netsim/devices/routeros7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ features:
vrf:
ospfv2: True
bgp: True
vxlan: True
evpn:
irb: True
transport: [ vxlan ]
evpn._start_transit_vlan: 3800
clab:
image: vrnetlab/mikrotik_routeros:7.18.2
build: https://containerlab.dev/manual/kinds/vr-ros/
Expand Down