What is the best way to collect active bots for upgrading?

I know that you can put inserter on roboport which should take excess robot out to store them.

You can use the same logic on filter inserters to take only older robots out of the network as soon as they dock. Make sure that all roboports are covered. You can even fill logistic chests so your robots will carry them to wherever you manufacture the upgraded robots.

I don't believe there is a good way to force robots to dock. Short of turning off all your logistic chests which would be a nightmare in a megabase.

I'm not familiar with what might be available with Angel's and Bob's, but this is what comes to mind from vanilla.

The laborious but complete option would be to do a rolling shutdown of your logistics network: starting from one edge, remove roboports, and then put them back but making sure the old network and the new network never touch, and the new network contains no old robots.

Assuming you don't want to do that:

(As Vyndicu's answer already mentioned, but for completeness:) For any given roboport, you can use filter inserters to extract specific types of robots. This can be used to collect the stragglers automatically in the long run, but requires you to make a change at every roboport whenever you get a new upgrade.

You can encourage robots to stop in particular roboports by creating a very large jobs which will be finished in the vicinity. The best procedure I have thought of is:

  1. Set up inserters to extract robots from the area(s) where you keep your storage chests, and an unused area nearby.
  2. In the unused area, make many requester chests with large requests of something you have stockpiled (e.g. stone or coal you mined before building on top of the deposit). Your logistic robots will do this job, and then park themselves in the nearest roboports.
  3. Order deconstruction of those requester chests. Your construction robots will do this job, and then park themselves in the nearest roboports.

There is a mod designed exactly for that: https://mods.factorio.com/mods/Peppe/botReplacer