neutron/doc/source/contributor/internals/api_layer.rst
Akihiro Motoki 2a47ffd96d Rearrange existing documentation to fit the new standard layout
For more detail, see the doc migration spec.
http://specs.openstack.org/openstack/docs-specs/specs/pike/os-manuals-migration.html

Change-Id: I142a686a3abbe65138a9f3296cd21fc21fbd763a
2017-07-08 05:49:56 +00:00

2.9 KiB

Neutron WSGI/HTTP API layer

This section will cover the internals of Neutron's HTTP API, and the classes in Neutron that can be used to create Extensions to the Neutron API.

Python web applications interface with webservers through the Python Web Server Gateway Interface (WSGI) - defined in PEP 333

Startup

Neutron's WSGI server is started from the server module and the entry point serve_wsgi is called to build an instance of the NeutronApiService, which is then returned to the server module, which spawns a Eventlet GreenPool that will run the WSGI application and respond to requests from clients.

WSGI Application

During the building of the NeutronApiService, the _run_wsgi function creates a WSGI application using the load_paste_app function inside config.py - which parses api-paste.ini - in order to create a WSGI app using Paste's deploy.

The api-paste.ini file defines the WSGI applications and routes - using the Paste INI file format.

The INI file directs paste to instantiate the APIRouter class of Neutron, which contains several methods that map Neutron resources (such as Ports, Networks, Subnets) to URLs, and the controller for each resource.

Further reading

Yong Sheng Gong: Deep Dive into Neutron