Difference between revisions of "TricircleHowToReadCode"
Chaoyi Huang (talk | contribs) (→Step 8: Create pod instances) |
Chaoyi Huang (talk | contribs) (→Step 8: Create pod instances) |
||
| Line 8: | Line 8: | ||
=== Step 1 ~ Step 7: no code of Tricircle will be involved === | === Step 1 ~ Step 7: no code of Tricircle will be involved === | ||
=== Step 8: Create pod instances === | === Step 8: Create pod instances === | ||
| − | * The restful API request will be routed to V1Controller from RootController for the version is 'v1.0': | + | |
| + | * The restful API request will be routed to V1Controller from RootController for the version is 'v1.0': | ||
| + | |||
| + | *: tricircle/tricircle/api/controllers/root.py | ||
| + | |||
| + | <code> | ||
| + | class RootController(object): | ||
| + | |||
| + | @expose() | ||
| + | def _lookup(self, version, *remainder): | ||
| + | if version == 'v1.0': | ||
| + | return V1Controller(), remainder | ||
| + | </code> | ||
| + | |||
* In V1Controller, because the request is to create pod, so the request will be forwarded to PodsController: https://github.com/openstack/tricircle/blob/master/tricircle/api/controllers/root.py#L76 | * In V1Controller, because the request is to create pod, so the request will be forwarded to PodsController: https://github.com/openstack/tricircle/blob/master/tricircle/api/controllers/root.py#L76 | ||
* The pod creation will be handled in the post function: https://github.com/openstack/tricircle/blob/master/tricircle/api/controllers/pod.py#L44~#L116 | * The pod creation will be handled in the post function: https://github.com/openstack/tricircle/blob/master/tricircle/api/controllers/pod.py#L44~#L116 | ||
Revision as of 13:48, 19 February 2017
Contents
How to read the source code of Tricircle
Experience the single node Tricircle networking first
Follow the single node installation guide: https://docs.openstack.org/developer/tricircle/installation-guide.html#single-pod-installation-with-devstack
Learn the source code step by step
Step 1 ~ Step 7: no code of Tricircle will be involved
Step 8: Create pod instances
- The restful API request will be routed to V1Controller from RootController for the version is 'v1.0':
- tricircle/tricircle/api/controllers/root.py
class RootController(object):
@expose()
def _lookup(self, version, *remainder):
if version == 'v1.0':
return V1Controller(), remainder
- In V1Controller, because the request is to create pod, so the request will be forwarded to PodsController: https://github.com/openstack/tricircle/blob/master/tricircle/api/controllers/root.py#L76
- The pod creation will be handled in the post function: https://github.com/openstack/tricircle/blob/master/tricircle/api/controllers/pod.py#L44~#L116