7a3c127dde7bee15926c85495ce3847a19b5a174
[bgpcep.git] / bgp / config-example / src / main / resources / initial / routing-policy-config.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3   ~ Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
4   ~
5   ~ This program and the accompanying materials are made available under the
6   ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
7   ~ and is available at http://www.eclipse.org/legal/epl-v10.html
8 -->
9 <!-- vi: set et smarttab sw=4 tabstop=4: -->
10 <routing-policy xmlns="http://openconfig.net/yang/routing-policy">
11     <policy-definitions>
12         <policy-definition>
13             <name>default-odl-import-policy</name>
14             <statements>
15                 <statement>
16                     <name>from-external</name>
17                     <conditions>
18                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
19                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
20                                 <from-role>
21                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
22                                 </from-role>
23                             </match-role-set>
24                         </bgp-conditions>
25                     </conditions>
26                     <actions>
27                         <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
28                             <non-transitive-attributes-filter xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
29                         </bgp-actions>
30                     </actions>
31                 </statement>
32                 <statement>
33                     <name>from-non-external</name>
34                     <conditions>
35                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
36                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
37                                 <from-role>
38                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
39                                     <match-set-options>INVERT</match-set-options>
40                                 </from-role>
41                             </match-role-set>
42                             <!--https://tools.ietf.org/html/rfc4456#section-8-->
43                             <match-originator-id-set-condition xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
44                                 <originator-id-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/originator-id-sets/originator-id-set[originator-set-name="local-originator-id"]</originator-id-set>
45                                 <match-set-options>INVERT</match-set-options>
46                             </match-originator-id-set-condition>
47                             <match-cluster-id-set-condition xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
48                                 <cluster-id-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/cluster-id-sets/cluster-id-set[cluster-set-name="local-cluster-id"]</cluster-id-set>
49                                 <match-set-options>INVERT</match-set-options>
50                             </match-cluster-id-set-condition>
51                         </bgp-conditions>
52                     </conditions>
53                     <actions>
54                         <accept-route/>
55                     </actions>
56                 </statement>
57             </statements>
58         </policy-definition>
59         <policy-definition>
60             <name>default-odl-export-policy</name>
61             <statements>
62                 <statement>
63                     <name>to-odl-internal</name>
64                     <conditions>
65                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
66                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
67                                 <to-role>
68                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-internal"]</role-set>
69                                 </to-role>
70                             </match-role-set>
71                         </bgp-conditions>
72                     </conditions>
73                     <actions>
74                         <reject-route/>
75                     </actions>
76                 </statement>
77                 <statement>
78                     <name>to-external</name>
79                     <conditions>
80                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
81                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
82                                 <from-role>
83                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
84                                 </from-role>
85                                 <to-role>
86                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
87                                 </to-role>
88                             </match-role-set>
89                         </bgp-conditions>
90                     </conditions>
91                     <actions>
92                         <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
93                             <non-transitive-attributes-filter xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
94                             <set-as-path-prepend/>
95                         </bgp-actions>
96                     </actions>
97                 </statement>
98                 <statement>
99                     <name>from-internal-to-internal</name>
100                     <conditions>
101                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
102                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
103                                 <from-role>
104                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
105                                 </from-role>
106                                 <to-role>
107                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
108                                 </to-role>
109                             </match-role-set>
110                         </bgp-conditions>
111                     </conditions>
112                     <actions>
113                         <reject-route/>
114                     </actions>
115                 </statement>
116                 <statement>
117                     <name>from-external-to-internal</name>
118                     <conditions>
119                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
120                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
121                                 <from-role>
122                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
123                                 </from-role>
124                                 <to-role>
125                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
126                                 </to-role>
127                             </match-role-set>
128                         </bgp-conditions>
129                     </conditions>
130                     <actions>
131                         <accept-route/>
132                     </actions>
133                 </statement>
134                 <statement>
135                     <name>from-odl-internal-to-internal-or-rr-client</name>
136                     <conditions>
137                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
138                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
139                                 <from-role>
140                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-internal"]</role-set>
141                                 </from-role>
142                                 <to-role>
143                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="ibgp-rr-client"]</role-set>
144                                 </to-role>
145                             </match-role-set>
146                         </bgp-conditions>
147                     </conditions>
148                     <actions>
149                         <accept-route/>
150                     </actions>
151                 </statement>
152                 <statement>
153                     <name>from-rr-client-to-internal</name>
154                     <conditions>
155                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
156                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
157                                 <from-role>
158                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
159                                 </from-role>
160                                 <to-role>
161                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
162                                 </to-role>
163                             </match-role-set>
164                         </bgp-conditions>
165                     </conditions>
166                     <actions>
167                         <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
168                             <set-cluster-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
169                             <set-originator-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
170                         </bgp-actions>
171                     </actions>
172                 </statement>
173                 <statement>
174                     <name>from-external-to-route-reflector</name>
175                     <conditions>
176                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
177                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
178                                 <from-role>
179                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
180                                 </from-role>
181                                 <to-role>
182                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
183                                 </to-role>
184                             </match-role-set>
185                         </bgp-conditions>
186                     </conditions>
187                     <actions>
188                         <accept-route/>
189                     </actions>
190                 </statement>
191                 <statement>
192                     <name>from-internal-or-rr-client-to-route-reflector</name>
193                     <conditions>
194                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
195                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
196                                 <from-role>
197                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="ibgp-rr-client"]</role-set>
198                                 </from-role>
199                                 <to-role>
200                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
201                                 </to-role>
202                             </match-role-set>
203                         </bgp-conditions>
204                     </conditions>
205                     <actions>
206                         <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
207                             <set-cluster-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
208                             <set-originator-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
209                         </bgp-actions>
210                     </actions>
211                 </statement>
212             </statements>
213         </policy-definition>
214     </policy-definitions>
215     <defined-sets>
216         <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
217             <role-sets xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
218                 <role-set>
219                     <role-set-name>only-ibgp</role-set-name>
220                     <role>ibgp</role>
221                 </role-set>
222                 <role-set>
223                     <role-set-name>only-rr-client</role-set-name>
224                     <role>rr-client</role>
225                 </role-set>
226                 <role-set>
227                     <role-set-name>only-ebgp</role-set-name>
228                     <role>ebgp</role>
229                 </role-set>
230                 <role-set>
231                     <role-set-name>only-internal</role-set-name>
232                     <role>internal</role>
233                 </role-set>
234                 <role-set>
235                     <role-set-name>ibgp-rr-client</role-set-name>
236                     <role>ibgp</role>
237                     <role>rr-client</role>
238                 </role-set>
239                 <role-set>
240                     <role-set-name>all</role-set-name>
241                     <role>ebgp</role>
242                     <role>ibgp</role>
243                     <role>rr-client</role>
244                     <role>internal</role>
245                 </role-set>
246             </role-sets>
247             <originator-id-sets xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
248                 <originator-id-set>
249                     <originator-id-set-name>local-originator-id</originator-id-set-name>
250                     <local/>
251                 </originator-id-set>
252             </originator-id-sets>
253             <cluster-id-sets xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
254                 <cluster-id-set>
255                     <cluster-id-set-name>local-cluster-id</cluster-id-set-name>
256                     <local/>
257                 </cluster-id-set>
258             </cluster-id-sets>
259         </bgp-defined-sets>
260     </defined-sets>
261 </routing-policy>