From 66744a0e8ef072a2867a4892814ad4eaf0bf0e5c Mon Sep 17 00:00:00 2001 From: "Claudio D. Gasparini" Date: Wed, 31 Jan 2018 14:02:51 +0100 Subject: [PATCH] BGPCEP-589: Define default routing policies create basic routing policies required for default bgp default rib policy. Change-Id: Ia9cdbdfa9f9ef6231a7bb774d6d66701dc777d26 Signed-off-by: Claudio D. Gasparini --- .../src/main/yang/odl-bgp-default-policy.yang | 253 ++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 bgp/openconfig-api/src/main/yang/odl-bgp-default-policy.yang diff --git a/bgp/openconfig-api/src/main/yang/odl-bgp-default-policy.yang b/bgp/openconfig-api/src/main/yang/odl-bgp-default-policy.yang new file mode 100644 index 0000000000..9fa1745cd8 --- /dev/null +++ b/bgp/openconfig-api/src/main/yang/odl-bgp-default-policy.yang @@ -0,0 +1,253 @@ +module odl-bgp-policy { + yang-version 1.1; + namespace "urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"; + prefix "odl-bgp-policy"; + + import yang-ext { prefix ext; revision-date 2013-07-09; } + import openconfig-network-instance { prefix netinst; } + import openconfig-bgp { prefix openconfig-bgp; } + import bgp-rib { prefix rib; revision-date 2017-12-07; } + import openconfig-routing-policy { prefix rpol; } + import openconfig-bgp-policy { prefix bgppol; } + import ietf-inet-types { prefix inet; revision-date 2013-07-15; } + import bgp-types { prefix bgp-t; revision-date 2013-09-19; } + + organization "AT&T Services, Inc."; + contact "Claudio D. Gasparini "; + + description + "This module contains odl bgp policy model + to be used under openconfig policy model definitions. + + Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which + accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html"; + + revision "2018-01-09" { + description + "ODL BGP policy models"; + } + + typedef match-set-direction-options-type { + type enumeration { + enum FROM { + description "from neighbor"; + } + enum TO { + description "to neighbor"; + } + } + default FROM; + } + + grouping match-role-set-condition-grouping { + description + "Match a list of referenced role-set according to the logic + defined in the match-set-options leaf"; + list match-role-set { + leaf role-set { + type leafref { + path "/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set/role-set-name"; + require-instance true; + } + description "References a defined neighbor roles set"; + } + + uses rpol:match-set-options-restricted-group; + + leaf match-set-direction-options { + type match-set-direction-options-type; + } + } + } + + grouping match-originator-id-set-condition-grouping { + description + "Match a list of referenced originator-id-set according to the logic + defined in the match-set-options leaf"; + + container match-originator-id-set-condition { + leaf originator-id-set { + type leafref { + path "/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/originator-id-sets/originator-id-set/originator-id-set-name"; + require-instance true; + } + description "References a defined Originator Id set"; + } + uses rpol:match-set-options-restricted-group; + } + } + + grouping match-cluster-id-set-condition-grouping { + description + "Match a list of referenced cluster-id-set according to the logic + defined in the match-set-options leaf"; + container match-cluster-id-set-condition { + leaf cluster-id-set { + type leafref { + path "/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/cluster-id-sets/cluster-id-set/cluster-id-set-name"; + require-instance true; + } + description "References a defined cluster Id set"; + } + uses rpol:match-set-options-group; + } + } + + grouping role-set { + description "Data definition for a list of Odl Bgp roles which + are matched as part of a policy"; + + list role-set { + key role-set-name; + description "List of the defined role sets"; + + leaf role-set-name { + type string; + description + "name / label of the role set -- this is used to + reference the set in match conditions"; + } + + leaf-list role { + type rib:peer-role; + description + "List of role expressions that are part of the set"; + } + } + } + + grouping originator-id-set { + description "Data definition for a list of Originators Ids which + are matched as part of a policy"; + + list originator-id-set { + key originator-id-set-name; + description "List of the defined Originators Ids sets"; + + leaf originator-id-set-name { + type string; + description + "name / label of the set -- this is used to + reference the set in match conditions"; + } + + leaf-list originator-id { + type inet:ipv4-address; + description + "List of role expressions that are part of the set"; + } + + container local { + presence "Local originator Id"; + description "Validates also Local Originator Id"; + } + } + } + + grouping cluster-id-set { + description "Data definition for a list of Cluster Ids which + are matched as part of a policy"; + + list cluster-id-set { + key cluster-id-set-name; + description "List of the defined cluster Ids sets"; + + leaf cluster-id-set-name { + type string; + description + "name / label of the set -- this is used to + reference the set in match conditions"; + } + + leaf-list cluster-id { + type bgp-t:cluster-identifier; + description + "List of role expressions that are part of the set"; + } + + container local { + presence "Local cluster Id"; + description "Validates also cluster Originator Id"; + } + } + } + + augment /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets { + ext:augment-identifier bgp-cluster-id-sets; + container cluster-id-sets { + description "Enclosing container for defined cluster-id sets for matching"; + uses cluster-id-set; + } + } + + augment /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets { + ext:augment-identifier bgp-role-sets; + container role-sets { + description "Enclosing container for defined role sets for matching"; + uses role-set; + } + } + + augment /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets { + ext:augment-identifier bgp-originator-id-sets; + container originator-id-sets { + description "Enclosing container for defined role sets for matching"; + uses originator-id-set; + } + } + + augment /rpol:routing-policy/rpol:policy-definitions/rpol:policy-definition/rpol:statements/rpol:statement/rpol:conditions/bgppol:bgp-conditions { + ext:augment-identifier match-role-set-condition; + uses match-role-set-condition-grouping; + } + + augment /rpol:routing-policy/rpol:policy-definitions/rpol:policy-definition/rpol:statements/rpol:statement/rpol:conditions/bgppol:bgp-conditions { + ext:augment-identifier match-originator-id-set-condition; + uses match-originator-id-set-condition-grouping; + } + + augment /rpol:routing-policy/rpol:policy-definitions/rpol:policy-definition/rpol:statements/rpol:statement/rpol:conditions/bgppol:bgp-conditions { + ext:augment-identifier match-cluster-id-set-condition; + uses match-cluster-id-set-condition-grouping; + } + + augment /rpol:routing-policy/rpol:policy-definitions/rpol:policy-definition/rpol:statements/rpol:statement/rpol:actions/bgp-pol:bgp-actions { + ext:augment-identifier reflect-attributes-actions; + container reflect-attributes-actions { + presence "Modify attributes so they are updated as per RFC4456 route reflection"; + } + } + + augment /rpol:routing-policy/rpol:policy-definitions/rpol:policy-definition/rpol:statements/rpol:statement/rpol:actions/bgp-pol:bgp-actions { + ext:augment-identifier non-transitive-attributes-filter; + container non-transitive-attributes-filter { + presence "Filters attributes, removing non transitive attributes"; + } + } + + augment /rpol:routing-policy/rpol:policy-definitions/rpol:policy-definition/rpol:statements/rpol:statement/rpol:actions/bgp-pol:bgp-actions { + ext:augment-identifier set-cluster-id-prepend; + container set-cluster-id-prepend { + + presence "node is present in the config data to use the Cluster Id prepend action"; + description "action to prepend local Cluster Id to the Cluster Id List"; + } + } + + augment /rpol:routing-policy/rpol:policy-definitions/rpol:policy-definition/rpol:statements/rpol:statement/rpol:actions/bgp-pol:bgp-actions { + ext:augment-identifier set-originator-id-prepend; + container set-originator-id-prepend { + presence "node is present in the config data to use the Originator Id prepend action"; + description "action to prepend Originator Id if non Originator Id is present. If no Originator Id" + + "is defined, local Originator Id is used."; + leaf originator-id { + type inet:ipv4-address; + description "Originator Id"; + } + } + } +} \ No newline at end of file -- 2.36.6