1 .. _bgp-user-guide-ip-unicast-family:
5 The BGP-4 allows to carry IPv4 specific information only.
6 The basic BGP Multiprotocol extension brings *Unicast* Subsequent Address Family (SAFI) - intended to be used for IP unicast forwarding.
7 The combination of IPv4 and IPv6 Address Family (AF) and Unicast SAFI is essential for Internet routing.
8 The IPv4 Unicast routes are interchangeable with BGP-4 routes, as they can carry the same type of routing information.
10 .. contents:: Contents
16 This section shows a way to enable IPv4 and IPv6 Unicast family in BGP speaker and peer configuration.
20 To enable IPv4 and IPv6 Unicast support in BGP plugin, first configure BGP speaker instance:
22 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
26 **Content-Type:** ``application/xml``
32 <protocol xmlns="http://openconfig.net/yang/network-instance">
33 <name>bgp-example</name>
34 <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
35 <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
38 <router-id>192.0.2.2</router-id>
43 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
46 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
55 Here is an example for BGP peer configuration with enabled IPv4 and IPv6 Unicast family.
57 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/neighbors``
61 **Content-Type:** ``application/xml``
67 <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
68 <neighbor-address>192.0.2.1</neighbor-address>
71 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
74 <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
81 Following trees illustrate the BGP IP Unicast routes structures.
85 .. code-block:: console
89 +--ro ipv4-route* [route-key path-id]
90 +--ro route-key string
91 +--ro prefix inet:ipv4-prefix
95 | +--ro value bgp-t:bgp-origin
98 | +--ro as-sequence* inet:as-number
99 | +--ro as-set* inet:as-number
101 | +--:(ipv4-next-hop-case)
102 | | +--ro ipv4-next-hop
103 | | +--ro global? inet:ipv4-address
104 | +--:(ipv6-next-hop-case)
105 | | +--ro ipv6-next-hop
106 | | +--ro global? inet:ipv6-address
107 | | +--ro link-local? inet:ipv6-address
108 | +--:(empty-next-hop-case)
109 | +--ro empty-next-hop? empty
110 +--ro multi-exit-disc
114 +--ro atomic-aggregate!
116 | +--ro as-number? inet:as-number
117 | +--ro network-address? inet:ipv4-address
119 | +--ro as-number? inet:as-number
120 | +--ro semantics? uint16
121 +--ro extended-communities*
122 | +--ro transitive? boolean
123 | +--ro (extended-community)?
124 | +--:(as-specific-extended-community-case)
125 | | +--ro as-specific-extended-community
126 | | +--ro global-administrator? short-as-number
127 | | +--ro local-administrator? binary
128 | +--:(inet4-specific-extended-community-case)
129 | | +--ro inet4-specific-extended-community
130 | | +--ro global-administrator? inet:ipv4-address
131 | | +--ro local-administrator? binary
132 | +--:(opaque-extended-community-case)
133 | | +--ro opaque-extended-community
134 | | +--ro value? binary
135 | +--:(route-target-extended-community-case)
136 | | +--ro route-target-extended-community
137 | | +--ro global-administrator? short-as-number
138 | | +--ro local-administrator? binary
139 | +--:(route-origin-extended-community-case)
140 | | +--ro route-origin-extended-community
141 | | +--ro global-administrator? short-as-number
142 | | +--ro local-administrator? binary
143 | +--:(route-target-ipv4-case)
144 | | +--ro route-target-ipv4
145 | | +--ro global-administrator? inet:ipv4-address
146 | | +--ro local-administrator? uint16
147 | +--:(route-origin-ipv4-case)
148 | | +--ro route-origin-ipv4
149 | | +--ro global-administrator? inet:ipv4-address
150 | | +--ro local-administrator? uint16
151 | +--:(link-bandwidth-case)
152 | | +--ro link-bandwidth-extended-community
153 | | +--ro bandwidth netc:bandwidth
154 | +--:(as-4-generic-spec-extended-community-case)
155 | | +--ro as-4-generic-spec-extended-community
156 | | +--ro as-4-specific-common
157 | | +--ro as-number inet:as-number
158 | | +--ro local-administrator uint16
159 | +--:(as-4-route-target-extended-community-case)
160 | | +--ro as-4-route-target-extended-community
161 | | +--ro as-4-specific-common
162 | | +--ro as-number inet:as-number
163 | | +--ro local-administrator uint16
164 | +--:(as-4-route-origin-extended-community-case)
165 | | +--ro as-4-route-origin-extended-community
166 | | +--ro as-4-specific-common
167 | | +--ro as-number inet:as-number
168 | | +--ro local-administrator uint16
169 | +--:(encapsulation-case)
170 | +--ro encapsulation-extended-community
171 | +--ro tunnel-type encapsulation-tunnel-type
173 | +--ro originator? inet:ipv4-address
175 | +--ro cluster* bgp-t:cluster-identifier
178 | +--ro metric? netc:accumulated-igp-metric
179 +--ro unrecognized-attributes* [type]
180 +--ro partial boolean
181 +--ro transitive boolean
187 .. code-block:: console
191 +--ro ipv6-route* [route-key path-id]
192 +--ro route-key string
193 +--ro prefix inet:ipv6-prefix
194 +--ro path-id path-id
202 The IPv4 Unicast table in an instance of the speaker's Loc-RIB can be verified via REST:
204 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/ipv4-routes``
212 <ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
214 <route-key>193.0.2.1/32</route-key>
216 <prefix>193.0.2.1/32</prefix>
226 <global>10.0.0.1</global>
234 The IPv6 Unicast table in an instance of the speaker's Loc-RIB can be verified via REST:
236 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/ipv6-routes``
244 <ipv6-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
246 <route-key>2a02:b80:0:1::/64</route-key>
248 <prefix>2a02:b80:0:1::/64</prefix>
258 <global>2a02:b80:0:2::1</global>
264 .. note:: IPv4/6 routes mapping to topology nodes is supported by BGP Topology Provider.
270 This examples show how to originate and remove IPv4 route via programmable RIB.
271 Make sure the *Application Peer* is configured first.
273 .. note:: IPv4 Route Key must be equal to prefix.
275 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/bgp-inet:ipv4-routes``
279 **Content-Type:** ``application/xml``
285 <ipv4-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
286 <route-key>10.0.0.11/32</route-key>
287 <prefix>10.0.0.11/32</prefix>
298 <global>10.11.1.1</global>
305 To remove the route added above, following request can be used:
307 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-types:unicast-subsequent-address-family/bgp-inet:ipv4-routes/ipv4-route/10.0.0.11%2F32/0``
309 **Method:** ``DELETE``
313 This examples show how to originate and remove IPv6 route via programmable RIB:
315 .. note:: IPv6 Route Key must be equal to prefix.
317 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv6-address-family/bgp-types:unicast-subsequent-address-family/bgp-inet:ipv6-routes``
321 **Content-Type:** ``application/xml``
327 <ipv6-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-inet">
328 <route-key>2001:db8:30::3/128</route-key>
329 <prefix>2001:db8:30::3/128</prefix>
333 <global>2001:db8:1::6</global>
347 To remove the route added above, following request can be used:
349 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv6-address-family/bgp-types:unicast-subsequent-address-family/bgp-inet:ipv6-routes/ipv6-route/2001:db8:30::3%2F128/0``
351 **Method:** ``DELETE``
355 * `Multiprotocol Extensions for BGP-4 <https://tools.ietf.org/html/rfc4760>`_