From b7056f819b99dc61b9d011794fb7a619a1cf1442 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <ak@geant.org> Date: Mon, 30 Sep 2024 15:32:21 +0100 Subject: [PATCH] Destination class Accounting --- .../bc_templates/routers/nokia/base_config.j2 | 1 + .../roles/bc_templates/routers/nokia/cards.j2 | 14 +++++++++++++ .../routers/nokia/pe_promotion_base_config.j2 | 1 + .../routers/nokia/router/bgp_group.j2 | 5 ++++- .../routers/nokia/router/routing_options.j2 | 20 +++++++++++++++++++ 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 geant/gap_ansible/roles/bc_templates/routers/nokia/router/routing_options.j2 diff --git a/geant/gap_ansible/roles/bc_templates/routers/nokia/base_config.j2 b/geant/gap_ansible/roles/bc_templates/routers/nokia/base_config.j2 index a3fc0e26..12bb30fd 100644 --- a/geant/gap_ansible/roles/bc_templates/routers/nokia/base_config.j2 +++ b/geant/gap_ansible/roles/bc_templates/routers/nokia/base_config.j2 @@ -16,6 +16,7 @@ {% include 'filter_log.j2' %} {% include 'policy_options/policy_options.j2' %} {% include 'service_vprn.j2' %} + {% include 'router/routing_options.j2' %} {% endif %} {# This is because `ip_prefix_list` is related to what defined in VPRN apply_paths #} {% include 'ip_prefix_list.j2' %} diff --git a/geant/gap_ansible/roles/bc_templates/routers/nokia/cards.j2 b/geant/gap_ansible/roles/bc_templates/routers/nokia/cards.j2 index 7af88af9..578a0930 100644 --- a/geant/gap_ansible/roles/bc_templates/routers/nokia/cards.j2 +++ b/geant/gap_ansible/roles/bc_templates/routers/nokia/cards.j2 @@ -34,6 +34,20 @@ </mda> {% endfor %} {% endif %} + {#Policy accounting config#} + {% if card.fps is defined %} + {% for fp in card.fps %} + <fp> + <fp-number>{{ fp.id }}</fp-number> + <ingress> + <policy-accounting> + <policers>{{ fp.ingress.policy_accounting.policers }}</policers> + <classes>{{ fp.ingress.policy_accounting.classes }}</classes> + </policy-accounting> + </ingress> + </fp> + {% endfor %} + {% endif %} </card> {% endfor %} diff --git a/geant/gap_ansible/roles/bc_templates/routers/nokia/pe_promotion_base_config.j2 b/geant/gap_ansible/roles/bc_templates/routers/nokia/pe_promotion_base_config.j2 index 36365193..ce52b1dd 100644 --- a/geant/gap_ansible/roles/bc_templates/routers/nokia/pe_promotion_base_config.j2 +++ b/geant/gap_ansible/roles/bc_templates/routers/nokia/pe_promotion_base_config.j2 @@ -8,5 +8,6 @@ {% include 'system/security/security.j2' %} {% include 'router/router_base.j2' %} {% include 'sdp_mesh.j2' %} + {% include 'router/routing_options.j2' %} </configure> </config> diff --git a/geant/gap_ansible/roles/bc_templates/routers/nokia/router/bgp_group.j2 b/geant/gap_ansible/roles/bc_templates/routers/nokia/router/bgp_group.j2 index 78e3216a..3f1162e3 100644 --- a/geant/gap_ansible/roles/bc_templates/routers/nokia/router/bgp_group.j2 +++ b/geant/gap_ansible/roles/bc_templates/routers/nokia/router/bgp_group.j2 @@ -5,6 +5,9 @@ {% if group.auth_key is defined %} <authentication-key>{{ group.auth_key }}</authentication-key> {% endif %} + {% if group.vpn_apply_import is defined %} + <vpn-apply-import>{{ group.vpn_apply_import|quote }}</vpn-apply-import> + {% endif %} {% if group.nhs is defined %} <next-hop-self>{{ group.nhs }}</next-hop-self> {% endif %} @@ -31,7 +34,7 @@ </local-as> {% endif %} {% if group.capability_neg is defined %} - <capability-negotiation>{{ group.capability_neg }}</capability-negotiation> + <capability-negotiation>{{ group.capability_neg|quote }}</capability-negotiation> {% endif %} {% if bgp_group_context != 'vprn' %} {% if (group.local_address is defined) and group.local_address == 'ipv4' %} diff --git a/geant/gap_ansible/roles/bc_templates/routers/nokia/router/routing_options.j2 b/geant/gap_ansible/roles/bc_templates/routers/nokia/router/routing_options.j2 new file mode 100644 index 00000000..54281455 --- /dev/null +++ b/geant/gap_ansible/roles/bc_templates/routers/nokia/router/routing_options.j2 @@ -0,0 +1,20 @@ + +<routing-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"> + <policy-accounting> + {% if nokia_pe_policy_acct_templates is defined %} + <policy-acct-template alu:operation="replace"> + {% for template in nokia_pe_policy_acct_templates %} + <name>{{ template.name }}</name> + {% if template.destination_classes is defined %} + {% for dst_class in template.destination_classes %} + <destination-class> + <index>{{ dst_class }}</index> + </destination-class> + {% endfor %} + {% endif %} + {% endfor %} + </policy-acct-template> + {% endif %} + </policy-accounting> +</routing-options> + -- GitLab