Skip to content
Snippets Groups Projects
Commit 02964159 authored by Aleksandr Kurbatov's avatar Aleksandr Kurbatov
Browse files

Merge branch 'feature/nat-666-p-to-pe' into 'develop'

promote-p-to-pe role

See merge request !162
parents 59c2fe74 103cb902
No related branches found
No related tags found
1 merge request!162promote-p-to-pe role
Pipeline #88659 passed
Showing
with 466 additions and 0 deletions
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:alu="urn:ietf:params:xml:ns:netconf:base:1.0">
<configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf">
{% include 'filter_log.j2' %}
{% include 'ip_prefix_list.j2' %}
{% include 'filters/cpm_filters.j2' %}
{% include 'policy_options/policy_options.j2' %}
{% include 'cflowd.j2' %}
{% include 'router/router_base.j2' %}
{% include 'sdp_mesh.j2' %}
</configure>
</config>
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:alu="urn:ietf:params:xml:ns:netconf:base:1.0">
<configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf">
{% include 'service_vprn.j2' %}
</configure>
</config>
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:alu="urn:ietf:params:xml:ns:netconf:base:1.0">
<configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf">
{% include 'sdp_mesh.j2' %}
</configure>
</config>
{% for as_path in as_paths_obj %}
<as-path alu:operation="replace">
<name>{{ as_path.name }}</name>
<expression>{{ as_path.expression}}</expression>
</as-path>
{% endfor %}
{% for community in communities_obj %}
<community alu:operation="replace">
<name>{{ community.name }}</name>
<member>
<member>{{ community.member }}</member>
</member>
</community>
{% endfor %}
<policy-options xmlns="urn:nokia.com:sros:ns:yang:sr:conf" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nokia-attr="urn:nokia.com:sros:ns:yang:sr:attributes">
{% if nokia_po_prefix_lists is defined %}
{% with prefix_lists_obj=nokia_po_prefix_lists %}
{% include 'policy_options/prefix_lists.j2' %}
{% endwith %}
{% endif %}
{# Communities #}
{% if nokia_po_communities is defined %}
{% with communities_obj=nokia_po_communities %}
{% include 'policy_options/communities.j2' %}
{% endwith %}
{% endif %}
{# AS paths #}
{% if nokia_po_as_paths is defined %}
{% with as_paths_obj=nokia_po_as_paths %}
{% include 'policy_options/as_paths.j2' %}
{% endwith %}
{% endif %}
{# Policy statements #}
{% if nokia_po_policy_statements is defined %}
{% with policy_obj=nokia_po_policy_statements %}
{% include 'policy_options/policy_statements.j2' %}
{% endwith %}
{% endif %}
</policy-options>
{% for pol in policy_obj %}
<policy-statement alu:operation="replace">
<name>{{ pol.name }}</name>
<entry-type>{{ pol.entry_type }}</entry-type>
{% for entry in pol.entries %}
{% if pol.entry_type == 'named' %}
<named-entry>
{% endif %}
<entry-name>{{ entry.name }}</entry-name>
{% if entry.from is defined %}
<from>
{% if entry.from.as_path is defined %}
<as-path>
{% if entry.from.as_path.name is defined %}
<name>{{ entry.from.as_path.name }}</name>
{% endif %}
{% if entry.from.as_path.length is defined %}
<length>
<value>{{ entry.from.as_path.length }}</value>
</length>
{% endif %}
</as-path>
{% endif %}
{% if entry.from.prefix_list is defined %}
{% for pl in entry.from.prefix_list %}
<prefix-list>{{ pl }}</prefix-list>
{% endfor %}
{% endif %}
{% if entry.from.community is defined %}
<community>
<name>{{ entry.from.community }}</name>
</community>
{% endif %}
{% if entry.from.origin_validation_state is defined %}
<origin-validation-state>{{ entry.from.origin_validation_state }}</origin-validation-state>
{% endif %}
{% if entry.from.protocol is defined %}
{% for proto in entry.from.protocol %}
<protocol>
<name>{{ proto }}</name>
</protocol>
{% endfor %}
{% endif %}
</from>
{% endif %}
<action>
<action-type>{{ entry.action_type }}</action-type>
{% if entry.action is defined %}
{% for action_item in entry.action %}
{% for act_k, act_v in action_item.items() %}
{% if act_k == "community_add" %}
<community>
<add>{{ act_v }}</add>
</community>
{% else %}
<{{ act_k | replace("_", "-") }}>{{ act_v }}</{{act_k | replace("_", "-") }}>
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
</action>
</named-entry>
{% endfor %}
</policy-statement>
{% endfor %}
{% for prefix_list in prefix_lists_obj %}
<prefix-list alu:operation="replace">
<name>{{ prefix_list.name }}</name>
{% for prefix in prefix_list.prefixes %}
<prefix>
<ip-prefix>{{ prefix.ip }}</ip-prefix>
<type>{{ prefix.type }}</type>
{% if prefix.type == 'range' %}
<start-length>{{ prefix.range_start_length }}</start-length>
<end-length>{{ prefix.range_end_length }}</end-length>
{% endif %}
</prefix>
{% endfor %}
</prefix-list>
{% endfor %}
<bgp xmlns="urn:nokia.com:sros:ns:yang:sr:conf" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nokia-attr="urn:nokia.com:sros:ns:yang:sr:attributes">
{% if pe_bgp_base.best_path_selection is defined %}
<best-path-selection>
{% for bps in pe_bgp_base.best_path_selection %}
<{{ bps }}>true</{{ bps }}>
{% endfor %}
</best-path-selection>
{% endif %}
{% if pe_bgp_base.error_handling is defined %}
<error-handling>
<{{ pe_bgp_base.error_handling }}>true</{{ pe_bgp_base.error_handling }}>
</error-handling>
{% endif %}
{% if pe_bgp_base.next_hop_resolution.shortcut_tunnel is defined %}
<next-hop-resolution>
<shortcut-tunnel>
{% for nhr in pe_bgp_base.next_hop_resolution.shortcut_tunnel %}
<family>
<family-type>{{ nhr.type }}</family-type>
<resolution-filter>
<{{ nhr.resolution_filter }}>true</{{ nhr.resolution_filter }}>
</resolution-filter>
</family>
{% endfor %}
</shortcut-tunnel>
</next-hop-resolution>
{% endif %}
{% with bgp_obj=pe_bgp_tools %}
{% include "router/bgp_group.j2" %}
{% include "router/bgp_neighbor.j2" %}
{% endwith %}
{% with bgp_obj=pe_bgp_internal %}
{% include "router/bgp_group.j2" %}
{% endwith %}
</bgp>
<static-routes xmlns="urn:nokia.com:sros:ns:yang:sr:conf" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nokia-attr="urn:nokia.com:sros:ns:yang:sr:attributes">
{% with static_routes_obj=nokia_pe_static_routes %}
{% include 'router/static_routes.j2' %}
{% endwith %}
</static-routes>
{% for group in bgp_obj.groups %}
<group alu:operation="replace">
<group-name>{{ group.name }}</group-name>
<admin-state>{{ group.admin_state | default('enable') }}</admin-state>
{% if group.nhs is defined %}
<next-hop-self>{{ group.nhs }}</next-hop-self>
{% endif %}
<type>{{ group.type }}</type>
{% if group.bfd_liveness is defined %}
<bfd-liveness>{{ group.bfd_liveness }}</bfd-liveness>
{% endif %}
{% if group.ebgp_default_reject is defined %}
<ebgp-default-reject-policy>
{% for pk, pv in group.ebgp_default_reject.items() %}
<{{ pk }}>{{ pv }}</{{ pk }}>
{% endfor %}
</ebgp-default-reject-policy>
{% endif %}
{% if group.peer_as is defined %}
<peer-as>{{ group.peer_as }}</peer-as>
{% endif %}
{% if group.local_as is defined %}
<local-as>
<as-number>{{ group.local_as }}</as-number>
{% if group.prepend_global_as is defined %}
<prepend-global-as>{{ group.prepend_global_as }}</prepend-global-as>
{% endif %}
</local-as>
{% endif %}
{% if group.capability_neg is defined %}
<capability-negotiation>{{ group.capability_neg }}</capability-negotiation>
{% endif %}
{% if bgp_group_context != 'vprn' %}
{% if (group.local_address is defined) and group.local_address == 'ipv4' %}
<local-address>{{ lo_ipv4_address }}</local-address>
{% elif (group.local_address is defined) and group.local_address == 'ipv6' %}
<local-address>{{ lo_ipv6_address }}</local-address>
{% endif %}
{% endif %}
{% if group.hold_time is defined %}
<hold-time>
<seconds>{{ group.hold_time }}</seconds>
</hold-time>
{% endif %}
{% if group.origin_validattion is defined %}
<origin-validation>
{% for ov in group.origin_validattion %}
<{{ ov }}>true</{{ ov }}>
{% endfor %}
</origin-validation>
{% endif %}
{% if group.send_communities is defined %}
<send-communities>
{% for sc_k, sc_v in group.send_communities.items() %}
<{{ sc_k }}>{{ sc_v }}</{{ sc_k }}>
{% endfor %}
</send-communities>
{% endif %}
{% if group.families is defined %}
<family>
{% for family in group.families %}
<{{ family }}>true</{{ family }}>
{% endfor %}
</family>
{% endif %}
{% if group.policies.import is defined %}
<import>
{% for imp_pol in group.policies.import %}
<policy>{{ imp_pol }}</policy>
{% endfor %}
</import>
{% endif %}
{% if group.policies.export is defined %}
<export>
{% for exp_pol in group.policies.export %}
<policy>{{ exp_pol }}</policy>
{% endfor %}
</export>
{% endif %}
</group>
{% endfor %}
{% for neighbor in bgp_obj.neighbors %}
<neighbor alu:operation="replace">
<ip-address>{{ neighbor.ip }}</ip-address>
<description>{{ neighbor.description }}</description>
<group>{{ neighbor.group }}</group>
{% if neighbor.families is defined %}
<family>
{% for family in neighbor.families %}
<{{ family }}>true</{{ family }}>
{% endfor %}
</family>
{% endif %}
{% if neighbor.policies.import is defined %}
<import>
{% for imp_pol in neighbor.policies.import %}
<policy>{{ imp_pol }}</policy>
{% endfor %}
</import>
{% endif %}
{% if neighbor.policies.export is defined %}
<export>
{% for exp_pol in neighbor.policies.export %}
<policy>{{ exp_pol }}</policy>
{% endfor %}
</export>
{% endif %}
</neighbor>
{% endfor %}
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:alu="urn:ietf:params:xml:ns:netconf:base:1.0">
<configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf">
<router xmlns="urn:nokia.com:sros:ns:yang:sr:conf" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nokia-attr="urn:nokia.com:sros:ns:yang:sr:attributes">
<router-name>Base</router-name>
<static-routes xmlns="urn:nokia.com:sros:ns:yang:sr:conf" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nokia-attr="urn:nokia.com:sros:ns:yang:sr:attributes">
{% for route in nokia_static_routes %}
<route alu:operation="delete">
<ip-prefix>{{ route.ip_prefix }}</ip-prefix>
<route-type>{{ route.route_type }}</route-type>
</route>
{% endfor %}
</static-routes>
</router>
</configure>
</config>
<flowspec alu:operation="replace">
<ip-filter-max-size>{{ nokia_flowspec.ip_filter_max_size }}</ip-filter-max-size>
<ipv6-filter-max-size>{{ nokia_flowspec.ipv6_filter_max_size }}</ipv6-filter-max-size>
</flowspec>
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:alu="urn:ietf:params:xml:ns:netconf:base:1.0">
<configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf">
<router xmlns="urn:nokia.com:sros:ns:yang:sr:conf" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nokia-attr="urn:nokia.com:sros:ns:yang:sr:attributes">
<router-name>Base</router-name>
<isis>
<isis-instance>0</isis-instance>
{% if verb == 'set_isis_overload' %}
<overload xmlns="urn:nokia.com:sros:ns:yang:sr:conf" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nokia-attr="urn:nokia.com:sros:ns:yang:sr:attributes">
</overload>
{% endif %}
{% if verb == 'remove_isis_overload' %}
<overload xmlns="urn:nokia.com:sros:ns:yang:sr:conf" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nokia-attr="urn:nokia.com:sros:ns:yang:sr:attributes" alu:operation="delete">
</overload>
{% endif %}
</isis>
</router>
</configure>
</config>
<ldp xmlns="urn:nokia.com:sros:ns:yang:sr:conf" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nokia-attr="urn:nokia.com:sros:ns:yang:sr:attributes">
<admin-state>enable</admin-state>
<targeted-session>
<sdp-auto-targeted-session>true</sdp-auto-targeted-session>
</targeted-session>
</ldp>
<router xmlns="urn:nokia.com:sros:ns:yang:sr:conf" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nokia-attr="urn:nokia.com:sros:ns:yang:sr:attributes">
<router-name>Base</router-name>
{% with static_routes_obj=nokia_pe_static_routes %}
{% include 'router/static_routes.j2' %}
{% endwith %}
{% with bgp_group_context='bgp_base' %}
{% include 'router/base_bgp.j2' %}
{% endwith %}
{% include 'router/flowspec.j2' %}
{% include 'router/ldp.j2' %}
{% include 'router/rpki.j2' %}
</router>
<origin-validation xmlns="urn:nokia.com:sros:ns:yang:sr:conf" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nokia-attr="urn:nokia.com:sros:ns:yang:sr:attributes">
{% for validator in pe_rpki.validators %}
<rpki-session alu:operation="replace">
<ip-address>{{ validator.ip }}</ip-address>
<admin-state>{{ validator.admin_state | default('enable') }}</admin-state>
<connect-retry>{{ validator.connect_retry }}</connect-retry>
<local-address>{{ lo_ipv4_address }}</local-address>
<port>{{ validator.port }}</port>
<stale-time>{{ validator.stale_time }}</stale-time>
</rpki-session>
{% endfor %}
</origin-validation>
<static-routes xmlns="urn:nokia.com:sros:ns:yang:sr:conf" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nokia-attr="urn:nokia.com:sros:ns:yang:sr:attributes">
{% for route in static_routes_obj %}
<route alu:operation="replace">
<ip-prefix>{{ route.ip_prefix }}</ip-prefix>
<route-type>{{ route.route_type }}</route-type>
{% if route.indirect is defined %}
{% for ir in route.indirect %}
<indirect>
<ip-address>{{ ir.next_hop }}</ip-address>
<admin-state>{{ ir.admin_state }}</admin-state>
{% if ir.description is defined %}
<description>{{ ir.description }}</description>
{% endif %}
{% if ir.preference is defined %}
<preference>{{ ir.preference }}</preference>
{% endif %}
</indirect>
{% endfor %}
{% endif %}
{# Blackhole #}
{% if route.blackhole is defined %}
<blackhole>
<admin-state>{{ route.blackhole.admin_state }}</admin-state>
{% if route.blackhole.description is defined %}
<description>{{ route.blackhole.description }}</description>
{% endif %}
</blackhole>
{% endif %}
{# Communities #}
{% if route.communities is defined %}
{% for community in route.communities %}
<community>{{ community }}</community>
{% endfor %}
{% endif %}
</route>
{% endfor %}
</static-routes>
{% for vprn in pe_vprns %}
<vprn alu:operation="replace">
<service-name>{{ vprn.name }}</service-name>
<admin-state>{{ vprn.admin_state | default('enable') }}</admin-state>
{% if vprn.description is defined %}
<description>{{ vprn.description }}</description>
{% endif %}
<service-id>{{ vprn.service_id }}</service-id>
<customer>{{ vprn.customer_id }}</customer>
<autonomous-system>{{ vprn.asn }}</autonomous-system>
<bgp-ipvpn>
<mpls>
<admin-state>enable</admin-state>
<route-distinguisher>{{ vprn.bgp_ipvpn.mpls.rd }}</route-distinguisher>
<vrf-target>
<community>{{ vprn.bgp_ipvpn.mpls.target }}</community>
</vrf-target>
<auto-bind-tunnel>
<resolution>{{ vprn.bgp_ipvpn.mpls.auto_bind_tunnel.resolution }}</resolution>
<resolution-filter>
<{{ vprn.bgp_ipvpn.mpls.auto_bind_tunnel.resolution_filter }}>true</{{ vprn.bgp_ipvpn.mpls.auto_bind_tunnel.resolution_filter }}>
</resolution-filter>
</auto-bind-tunnel>
</mpls>
</bgp-ipvpn>
<bgp>
{% if vprn.bgp.families is defined %}
<family>
{% for fam in vprn.bgp.families %}
<{{ fam }}>true</{{ fam }}>
{% endfor %}
</family>
{% endif %}
{% if vprn.bgp.best_path_selection is defined %}
<best-path-selection>
{% for bps in vprn.bgp.best_path_selection %}
<{{ bps }}>true</{{ bps }}>
{% endfor %}
</best-path-selection>
{% endif %}
{% with bgp_obj=vprn.bgp, bgp_group_context='vprn' %}
{% include 'router/bgp_group.j2' %}
{% endwith %}
</bgp>
{% if vprn.static_routes is defined %}
{% with static_routes_obj=vprn.static_routes %}
{% include 'router/static_routes.j2' %}
{% endwith %}
{% endif %}
{% if vprn.flowspec is defined %}
<flowspec>
<ip-filter-max-size>{{ vprn.flowspec.ip_filter_max_size }}</ip-filter-max-size>
<ipv6-filter-max-size>{{ vprn.flowspec.ipv6_filter_max_size }}</ipv6-filter-max-size>
</flowspec>
{% endif %}
</vprn>
{% endfor %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment