Ask Your Question
0

Handling Api requests in quantum ?

asked 2013-04-17 08:38:08 -0600

anonymous user

Anonymous

updated 2013-06-08 22:37:56 -0600

fifieldt gravatar image

Hi,

I want to know when a api call such as GET /v2.0/networks Accept: application/json is made how and where does the server interpret it and respond to it.

I have been looking in the source code and this is what i have found. The server file at https://github.com/openstack/quantum/blob/master/bin/quantum-server starts the server.

Then the flow goes to the file service.py (https://github.com/openstack/quantum/blob/master/quantum/service.py)

Here the wsgi server is started at line # 104 and consequently the Quantum Service is started. All this is done with the aid of wsgi.py (https://github.com/openstack/quantum/blob/master/quantum/wsgi.py).

So now the quantum service has started. I checked the log information to verify.

What i want to know is if i make a request such as get network list GET /v2.0/networks Accept: application/json

what would be the flow of that. As asked above how would the Quantum server now read it interpret it and respond to it.

So far after this is what i have found out. In the wsgi.py (Same location as above) the request could go to Class Request (line # 266) As this would determine the most acceptable content-type, Accept* headers in the scenario described above.

Based on the request it would use the Router class (line # 904). As this, helps to maps incoming requests to WSGI app.

Then there is the attributes.py (https://github.com/openstack/quantum/blob/master/quantum/api/v2/attributes.py). This helps to form the response for resources like network, port and subnet. It has the resource attribute map (line # 475) which composes the response for network, port or subnet

Also there is the router.py(https://github.com/openstack/quantum/blob/master/quantum/api/v2/router.py) which has the class Api Router(line # 68). From its description it should route the api requests to its core functions.

Here is where i am lost. I don't have a clear idea how do these relate and work . Any help on this would be appreciated. Thank you.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-04-25 16:57:24 -0600

darragh-oreilly gravatar image

updated 2013-04-25 16:59:01 -0600

The quantum service needs to have a plugin configured in order for it to run - eg the https://github.com/openstack/quantum/blob/master/quantum/plugins/openvswitch/ovs_quantum_plugin.py (plugin for open vswitch) Then the quantum api calls will be mapped to the functions in this module - eg get_networks(). Try following the code from here.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

Stats

Asked: 2013-04-17 08:38:08 -0600

Seen: 124 times

Last updated: Apr 25 '13