From the looks of your diagram, I'm not sure what you would be afforded by doing it this way if you only have the single link to the BGP. I may be misunderstanding something though.
E1 routes are always preferred over E2 routes. The E1 route will be in the routing table, and will be the route that will be redistributing when redistribution is configured. Is there a reason that you want both routes in at the same time?
Okay. I'm not sure how deep you want to go with this solution, but here's what I did. AS30 is your primary router that would allow you to control where your failover path is. It has a bgp peering with both AS10 and AS20. AS10 and AS20 both have ospf neighborships with Main and Backup, and AS30 has an ospf neighborship with Client. The loopbacks (I'm assuming this is your test network that you want to failover for) are on main and backup. AS10 is learning about this network from Main and AS20 is learning about the network from Backup.
Since AS30 is the only router that your client goes through, the client will send its traffic to the AS30 router. The AS30 router needs to know both paths on how to get to 172.16.2.0. On AS30, I manipulated local pref:
access-list 1 permit 172.16.2.0 0.0.0.255
route-map OSPFRoute permit 10 match address 1 set local-pref 150
route-map OSPFRoute permit 20
Under "router bgp 30", I changed the peering with AS10 to prefer this route to go over that link:
router bgp 30
neighbor x.x.x.x route-map OSPFRoute in
That changed the local pref for the route and selects it as best on the AS30 router.
I then shut the 192.168.2.x interface on the Main router while doing a ping to 172.16.2.1 from the Client router. The pings start to fail. Due to the reconvergence differences, I had to wait for AS10 to notice that the Main router link was no longer available. Once that happens, the 172.16.2.0 route is no longer available in ospf and can't be redistributed into BGP. The route now was going over AS20 to the other router.
So here's why I said it depends on how complicated you intend to make this. The above was done in about 10 minutes, but there are so many paths this could go which means that you're going to have to manipulate all of the paths to prefer which direction you want to go. For example:
Client - AS30 - AS10 - Main
Client - AS30 - AS20 - AS10 - Main (in case link between AS10 and 30 goes down)
Client - AS30 - AS10 - AS20 - Backup - Main (in case link between 10 and main go down)
There are a lot of possibilities that you'll need to take into consideration...
We are pleased to announce availability of Beta software for 16.6.3. 16.6.3 will be the second rebuild on the 16.6 release train targeted towards Catalyst 9500/9400/9300/3850/3650 switching platforms. We are looking for early feedback from custome...