Python code posted down-here utilizes NeutronClient V2 API. It creates router RouterDVS for particular tenant, interface to private sub-net “demo1_network” (90.0.0.0/24) and gateway to external flat network “public” (192.169.142.0/24). As usual posting was inspired by question been posted at ask.openstack.org. Actually, API calls core design I was able to find at openstack/python-neutronclient at github.com
Code is intentionally updated and simplified to become understandable by people without strong python development background.
Complete text may be found here