Apmec WSGI/HTTP API layer

Apmec WSGI/HTTP API layer

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

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

Startup

Apmecs’s WSGI server is started from the server module and the entry point serve_wsgi is called to build an instance of the ApmecApiService, 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 ApmecApiService, 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 Apmec, which contains several methods that map MEC resources (such as mead, mea) to URLs, and the controller for each resource.

Further reading

Apmec wsgi is based on neutron’s extension. The following doc is still relevant.

Yong Sheng Gong: Deep Dive into Neutron

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.