Juniper local-as and BGP loops

I faced an interesting problem today. In a customer L3VPN/VRF a route was hidden and it was not apparent why. In JunOS when you do a show route ... command you will get a summary at the top that tells you some statistics. In this case, four routes are hidden (three were expected, the one displayed here should not have been hidden). You can display hidden routes by adding the hidden option to the show route command:

user@core1> show route table customer-vrf.inet.0 hidden

customer-vrf.inet.0: 31 destinations, 34 routes (30 active, 0 holddown, 4 hidden)
+ = Active Route, - = Last Active, * = Both      [BGP ] 1d 17:20:31, MED 0, localpref 100, from
                    AS path: 65003 ?, validation-state: unverified
                    to via ae1.0, Push 16, Push 300928(top)
                    > to via ae17.0, Push 16, Push 302608(top)

Read on