The AIGP (Accumulated IGP) metric, if it is being sent and if the receiver is configured to take it into consideration, is evaluated immediately after local preference. If multiple paths for a prefix are received, some with AIGP and some without, the prefixes without AIGP will be ignored unless bgp bestpath igp ignore is configured (syntax is the same for IOS and XR. It is a global BGP command).
The below diagram shows a scenario whereby AIGP is configured for both eBGP and iBGP peers from the point of view of R1.
More details on AIGP can be found here.
router bgp 100 bgp router-id 172.16.1.1 bgp log-neighbor-changes no bgp default ipv4-unicast neighbor 2001:DB8:1::2 remote-as 200 neighbor 2001:11:22::2 remote-as 200 neighbor 2001:11:22::2 update-source Loopback0 neighbor 10.1.1.2 remote-as 200 neighbor 172.16.1.2 remote-as 100 neighbor 172.16.1.2 update-source Loopback0 ! address-family ipv4 redistribute connected route-map REDISTRIBUTE-CONNECTED neighbor 220.127.116.11 activate ! the AIGP command is needed to send and receive AIGP metrics neighbor 18.104.22.168 aigp neighbor 172.16.6.6 activate neighbor 172.16.6.6 aigp neighbor 172.16.6.6 next-hop-self exit-address-family ! address-family ipv6 redistribute connected route-map REDISTRIBUTE-CONNECTED 2001:DB8:1::2 activate 2001:DB8:1::2 aigp neighbor 2001:11:22::2 activate neighbor 2001:11:22::2 aigp neighbor 2001:11:22::2 next-hop-self exit-address-family ! route-map REDISTRIBUTE-CONNECTED permit 10 set aigp-metric igp-metric !
route-policy REDISTRIBUTE-CONNECTED set aigp-metric igp-cost end-policy ! router bgp 100 bgp log neighbor changes detail bgp router-id 172.16.1.1 address-family ipv4 unicast redistribute connected route-policy REDISTRIBUTE-CONNECTED ! address-family ipv6 unicast redistribute connected route-policy REDISTRIBUTE-CONNECTED ! neighbor 10.1.1.2 remote-as 200 address-family ipv4 unicast aigp ! neighbor 172.16.1.2 remote-as 100 address-family ipv4 unicast aigp next-hop-self ! neighbor 2001:DB8:1::2 remote-as 200 address-family ipv6 unicast aigp ! neighbor 2001:11:22::2 remote-as 100 address-family ipv6 unicast aigp next-hop-self ! !