Jump to: navigation, search

Difference between revisions of "TricircleHowToReadCode"

Line 1: Line 1:
 
== (Work in progress)How to read the source code of Tricircle ==
 
== (Work in progress)How to read the source code of Tricircle ==
 +
 +
== Learn the source code step by step, Case 1==
  
 
=== Experience the  single node Tricircle networking first ===
 
=== 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
 
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 1 ~ Step 7: no code of Tricircle will be involved ===

Revision as of 13:58, 19 February 2017

(Work in progress)How to read the source code of Tricircle

Learn the source code step by step, Case 1

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

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 the post function in PodsController. Post function will create the pod and az mapping record in pod table:
 tricircle/tricircle/api/controllers/pod.py
 ...
 class PodsController(rest.RestController):
   ...
   @expose(generic=True, template='json')
   def post(self, **kw):
       context = t_context.extract_context_from_environ()
       ...
       new_pod = core.create_resource(
                   context, models.Pod,
                   {'pod_id': _uuid,
                    'region_name': region_name,
                    'pod_az_name': pod_az_name,
                    'dc_name': dc_name,
                    'az_name': az_name})