BGPCEP-577: Neighbor’s local AS configurable
[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                             <local-as-path-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
30                         </bgp-actions>
31                     </actions>
32                 </statement>
33                 <statement>
34                     <name>from-non-external</name>
35                     <conditions>
36                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
37                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
38                                 <from-role>
39                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
40                                     <match-set-options>INVERT</match-set-options>
41                                 </from-role>
42                             </match-role-set>
43                             <!--https://tools.ietf.org/html/rfc4456#section-8-->
44                             <match-originator-id-set-condition xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
45                                 <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>
46                                 <match-set-options>INVERT</match-set-options>
47                             </match-originator-id-set-condition>
48                             <match-cluster-id-set-condition xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
49                                 <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>
50                                 <match-set-options>INVERT</match-set-options>
51                             </match-cluster-id-set-condition>
52                         </bgp-conditions>
53                     </conditions>
54                     <actions>
55                         <accept-route/>
56                     </actions>
57                 </statement>
58             </statements>
59         </policy-definition>
60         <policy-definition>
61             <name>default-odl-export-policy</name>
62             <statements>
63                 <statement>
64                     <name>to-odl-internal</name>
65                     <conditions>
66                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
67                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
68                                 <to-role>
69                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-internal"]</role-set>
70                                 </to-role>
71                             </match-role-set>
72                         </bgp-conditions>
73                     </conditions>
74                     <actions>
75                         <reject-route/>
76                     </actions>
77                 </statement>
78                 <statement>
79                     <name>to-external</name>
80                     <conditions>
81                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
82                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
83                                 <from-role>
84                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
85                                 </from-role>
86                                 <to-role>
87                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
88                                 </to-role>
89                             </match-role-set>
90                         </bgp-conditions>
91                     </conditions>
92                     <actions>
93                         <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
94                             <non-transitive-attributes-filter xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
95                             <local-as-path-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
96                             <set-as-path-prepend/>
97                         </bgp-actions>
98                     </actions>
99                 </statement>
100                 <statement>
101                     <name>from-internal-to-internal</name>
102                     <conditions>
103                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
104                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
105                                 <from-role>
106                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
107                                 </from-role>
108                                 <to-role>
109                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
110                                 </to-role>
111                             </match-role-set>
112                         </bgp-conditions>
113                     </conditions>
114                     <actions>
115                         <reject-route/>
116                     </actions>
117                 </statement>
118                 <statement>
119                     <name>from-external-to-internal</name>
120                     <conditions>
121                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
122                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
123                                 <from-role>
124                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
125                                 </from-role>
126                                 <to-role>
127                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
128                                 </to-role>
129                             </match-role-set>
130                         </bgp-conditions>
131                     </conditions>
132                     <actions>
133                         <accept-route/>
134                     </actions>
135                 </statement>
136                 <statement>
137                     <name>from-odl-internal-to-internal-or-rr-client</name>
138                     <conditions>
139                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
140                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
141                                 <from-role>
142                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-internal"]</role-set>
143                                 </from-role>
144                                 <to-role>
145                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="ibgp-rr-client"]</role-set>
146                                 </to-role>
147                             </match-role-set>
148                         </bgp-conditions>
149                     </conditions>
150                     <actions>
151                         <accept-route/>
152                     </actions>
153                 </statement>
154                 <statement>
155                     <name>from-rr-client-to-internal</name>
156                     <conditions>
157                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
158                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
159                                 <from-role>
160                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
161                                 </from-role>
162                                 <to-role>
163                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
164                                 </to-role>
165                             </match-role-set>
166                         </bgp-conditions>
167                     </conditions>
168                     <actions>
169                         <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
170                             <set-cluster-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
171                             <set-originator-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
172                         </bgp-actions>
173                     </actions>
174                 </statement>
175                 <statement>
176                     <name>from-external-to-route-reflector</name>
177                     <conditions>
178                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
179                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
180                                 <from-role>
181                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
182                                 </from-role>
183                                 <to-role>
184                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
185                                 </to-role>
186                             </match-role-set>
187                         </bgp-conditions>
188                     </conditions>
189                     <actions>
190                         <accept-route/>
191                     </actions>
192                 </statement>
193                 <statement>
194                     <name>from-internal-or-rr-client-to-route-reflector</name>
195                     <conditions>
196                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
197                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
198                                 <from-role>
199                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="ibgp-rr-client"]</role-set>
200                                 </from-role>
201                                 <to-role>
202                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
203                                 </to-role>
204                             </match-role-set>
205                         </bgp-conditions>
206                     </conditions>
207                     <actions>
208                         <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
209                             <set-cluster-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
210                             <set-originator-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
211                         </bgp-actions>
212                     </actions>
213                 </statement>
214             </statements>
215         </policy-definition>
216     </policy-definitions>
217     <defined-sets>
218         <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
219             <role-sets xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
220                 <role-set>
221                     <role-set-name>only-ibgp</role-set-name>
222                     <role>ibgp</role>
223                 </role-set>
224                 <role-set>
225                     <role-set-name>only-rr-client</role-set-name>
226                     <role>rr-client</role>
227                 </role-set>
228                 <role-set>
229                     <role-set-name>only-ebgp</role-set-name>
230                     <role>ebgp</role>
231                 </role-set>
232                 <role-set>
233                     <role-set-name>only-internal</role-set-name>
234                     <role>internal</role>
235                 </role-set>
236                 <role-set>
237                     <role-set-name>ibgp-rr-client</role-set-name>
238                     <role>ibgp</role>
239                     <role>rr-client</role>
240                 </role-set>
241                 <role-set>
242                     <role-set-name>all</role-set-name>
243                     <role>ebgp</role>
244                     <role>ibgp</role>
245                     <role>rr-client</role>
246                     <role>internal</role>
247                 </role-set>
248             </role-sets>
249             <originator-id-sets xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
250                 <originator-id-set>
251                     <originator-id-set-name>local-originator-id</originator-id-set-name>
252                     <local/>
253                 </originator-id-set>
254             </originator-id-sets>
255             <cluster-id-sets xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
256                 <cluster-id-set>
257                     <cluster-id-set-name>local-cluster-id</cluster-id-set-name>
258                     <local/>
259                 </cluster-id-set>
260             </cluster-id-sets>
261         </bgp-defined-sets>
262     </defined-sets>
263 </routing-policy>