This exception may happen if API and RPC workers are in different
processes.
Also make minor refactoring of auto_schedule_networks method
to avoid unnecessary db queries.
Add missing unit tests and adjust unit test naming style
Change-Id: I6460744e2cffec0b9f009da071597374d8c027f6
Closes-Bug: #1331456