#L3VPN configuration (BGP as CE-PE protocol)

#URL

frinx-openconfig-network-instance:network-instances/network-instance=

#OPENCONFIG YANG

{ "network-instance": [ { "config": { "name": "", "type": "L3VRF", //matches vpws-instance-type in ietf "route-distinguisher": "", "frinx-huawei-network-instance-extension:prefix-limit-from": "", "frinx-huawei-network-instance-extension:prefix-limit-to": "", "enabled-address-families": "", "enabled": true }, "interfaces": { "interface": [ { "config": { "id": "" } } ] }, "protocols": { "protocol": [ { "config": { "identifier": "BGP", "enabled": true }, "local-aggregates": { "aggregate": [ { "config": { "prefix": "", "frinx-bgp-extension:apply-policy": [ "" ], "frinx-bgp-extension:summary-only": true, } } ] }, "bgp": { "global": { "as": "", "router-id": "", "afi-safis": { "afi-safi": [ "config": { "afi-safi-name": "ipv4", "enabled": true } ] } }, "neighbors": { "neighbor": [ { "config": { "neighbor-address": "", "enabled": true, "peer-as": "" }, "afi-safis": { "afi-safi": [ "config": { "afi-safi-name": "ipv4", "enabled": true }, "apply-policy": { "config": { "import-policy": "-route-target-import", "export-policy": "-route-target-export" } } ] } } ] } } } ] } } ] }
frinx-openconfig-routing-policy:routing-policy/defined-sets
{ "bgp-defined-sets" { ext-community-sets { ext-community-set [ { "config": { "ext-community-set-name": "-route-target-export-set" "ext-community-set-member": [ , , ] } } { "config": { "ext-community-set-name": "-route-target-import-set" "ext-community-set-member": [ , , ] } } ] } } }

CONSTRAINTS
Network-instance with name must exist before defined-sets or both must be created in the same transaction.
Delete must be executed in reverse order or in the same transaction.
Policy -route-target-import and -route-target-export must exist on device before are used in network-instance.

#OS Configuration Commands

#CISCO IOS XR (5.1.3) (6.1.2)

#CLI

vrf 
 address-family ipv4 unicast
  import route-target 
   
   
   
  export route-target 
   
   
   

interface 
 vrf 
 
router bgp 
 vrf 
  rd 
  
  address-family ipv4 unicast
   network 
   
  neighbor 
   remote-as 
   address-family ipv4 unicast
    route-policy -route-target-import in
    route-policy -route-target-export out

#CISCO IOS XR (6.6.1)

#CLI

router bgp 
 vrf 
  address-family ipv4 unicast
   aggregate-address  summary-only route-policy 

summary-only is a conversion of "frinx-bgp-extension:summary-only" set true

#Cisco IOS (VIOS 15.6(2)T)

#CLI

ip vrf 
 rd 
 route-target export 
 route-target export 
 route-target export 
 route-target import 
 route-target import 
 route-target import 

interface 
 ip vrf forwarding 

router bgp 
 address-family ipv4 vrf 
  network 
  neighbor  remote-as 
  neighbor  activate

#Junos 18.2R1-S2.1

#CLI

set routing-instances  routing-options aggregate route  policy 

#Huawei NE5000E (V800R009C10SPC310)

#CLI


ip vpn-instance 
 ipv4-family
  route-distinguisher 
  prefix limit   
  vpn-target  export-extcommunity
  vpn-target  import-extcommunity
  
interface 
 undo shutdown
 ip binding vpn-instance 

bgp 
 ipv4-family vpn-instance 
  network 
  peer  as-number 
  peer  route-policy -route-target-import import
  peer  route-policy -route-target-export export

1 to 100000 is conversion of set "frinx-huawei-network-instance-extension:prefix-limit-from"
1 to 100 is conversion of set "frinx-huawei-network-instance-extension:prefix-limit-to"

#Unit

Link to github : huawei-unit