diff --git a/netsim/ansible/templates/mpls/srlinux.j2 b/netsim/ansible/templates/mpls/srlinux.j2 index 2a3273ce05..3d6dcae692 100644 --- a/netsim/ansible/templates/mpls/srlinux.j2 +++ b/netsim/ansible/templates/mpls/srlinux.j2 @@ -1,4 +1,7 @@ updates: {% if ldp is defined %} -{% include 'srlinux.ldp.j2' +%} +{% include 'srlinux/ldp.j2' +%} +{% endif %} +{% if mpls.vpn is defined %} +{% include 'srlinux/vpn.j2' +%} {% endif %} diff --git a/netsim/ansible/templates/mpls/srlinux.ldp.j2 b/netsim/ansible/templates/mpls/srlinux/ldp.j2 similarity index 100% rename from netsim/ansible/templates/mpls/srlinux.ldp.j2 rename to netsim/ansible/templates/mpls/srlinux/ldp.j2 diff --git a/netsim/ansible/templates/mpls/srlinux/vpn.j2 b/netsim/ansible/templates/mpls/srlinux/vpn.j2 new file mode 100644 index 0000000000..bc9db40b84 --- /dev/null +++ b/netsim/ansible/templates/mpls/srlinux/vpn.j2 @@ -0,0 +1,44 @@ +- path: /system/mpls/label-ranges/dynamic[name=vpn] + value: + start-label: 20000 + end-label: 30000 + +- path: /system/mpls/services + value: + network-instance: + dynamic-label-block: vpn + +{% for af in ['ipv4','ipv6'] if mpls.vpn[af] is defined %} +{% if loop.first %} +- path: /network-instance[name=default]/protocols/bgp + value: + afi-safi: +{% endif %} + - afi-safi-name: l3vpn-{{ af }}-unicast + admin-state: enable + l3vpn-{{ af }}-unicast: + rapid-update: True + keep-all-routes: True +{% endfor %} +{% for n_type in ['ibgp','ebgp'] %} +{% for af in ['ipv4','ipv6'] if n_type in mpls.vpn[af]|default([]) %} +{% if loop.first %} +- path: /network-instance[name=default]/protocols/bgp/group[group-name={{ n_type }}-ipv4] + value: + afi-safi: +{% endif %} + - afi-safi-name: l3vpn-{{ af }}-unicast + admin-state: enable + send-community-type: [ standard, extended ] +{% endfor %} +{% endfor %} +{% for v_name,v_data in vrfs|default({})|dictsort %} +- path: /network-instance[name={{ v_name }}]/protocols/bgp-ipvpn + value: + bgp-instance: + - id: 1 + admin-state: enable + mpls: + next-hop-resolution: + allowed-tunnel-types: [ ldp, sr-isis ] +{% endfor %} diff --git a/netsim/ansible/templates/vrf/srlinux.j2 b/netsim/ansible/templates/vrf/srlinux.j2 index 96f84eb622..d075fd042c 100644 --- a/netsim/ansible/templates/vrf/srlinux.j2 +++ b/netsim/ansible/templates/vrf/srlinux.j2 @@ -53,10 +53,17 @@ updates: - path: /network-instance[name={{vname}}]/protocols/bgp-vpn value: - bgp-instance: - - id: 1 - route-distinguisher: - rd: "{{ vdata.rd }}" + bgp-instance: + - id: 1 + route-distinguisher: + rd: "{{ vdata.rd }}" + route-target: +{% if vdata.import %} + import-rt: "target:{{ vdata.import[0] }}" +{% endif %} +{% if vdata.export %} + export-rt: "target:{{ vdata.export[0] }}" +{% endif %} {% if vdata.export|default([]) and vdata.import|default([]) %} - path: /network-instance[name={{vname}}]/inter-instance-policies diff --git a/netsim/devices/srlinux.yml b/netsim/devices/srlinux.yml index 46e47b5791..5004c611f6 100644 --- a/netsim/devices/srlinux.yml +++ b/netsim/devices/srlinux.yml @@ -81,8 +81,9 @@ features: ipv6: True network: True import: [ ospf, bgp, connected, static, vrf, no_policy ] - mpls: - ldp: True # on 7250 IXR only + mpls: # on 7250 IXR only + ldp: True + vpn: True ospf: unnumbered: True import: [ bgp, isis, connected, static, vrf, no_policy ]