Skip to content

miriyalar/debug_infra

Repository files navigation

Check out:
git clone https://github.com/miriyalar/debug_infra <contrail debug dir>

Authentication:
Multi tenany setup needs to make sure the debug.ini configured properly
Modify debug.ini to reflect the keystone auth info and config api server info

Usage:
You can clone debug infra code to any server, where it has access to config node.
git clone https://github.com/miriyalar/debug_infra <contrail debug dir>
cd <contrail debug dir>

Example:
python debugvmi.py --uuid 060c2b5f-d43a-4ea5-844d-393819ff36fd
python debugfip.py --floating_ip_addres 7.7.7.3
python debugsg.py --display_name default
python debugvn.py --display_name testvn

Output:
Debugs are located at debug_nodes.log
context output is at contrail_debug_output.json [Need to add browser jsonviewer plugin to view the json output]
or more contrail_debug_output.json | python -m json.tool
User has an option to print output in file structure format and json format
Usage:
   vp = vertexPrint(<vertex object>)
   vp.convert_json() --> for json output
   vp.convert_to_file_structure() --> for file structure output, default it will use the current dir (has an option to specify a path)

Process of writing the code for new debugnode/debug vertex:
Check debugsample.py for creating config objects debugging, and check debugflow.py for flows (non config objects debugging)
baseflowvertex.py and basevertex.py are base classes for flows and configuration objects

High level details:

Debugging of contrail system is not stright forward, as user needs to get to many components in the system for configuration and operational objects content/states.
User has to go through multiple hops for config, control, analytics and agent to troubleshoot issues, and also sometimes need to login into the nodes to check
the /var/log/contrail/<logs> to isolate issues.

The intent of this project (debug_infra) is to create an infrastructure for writing debuging use cases, let us call it as debug vertex.
These debug vertexes collects configuration objects from config/control/agent/analytics nodes, operational objects from control/agent nodes.
Verfication of objects as part of debug vertexes will be added.

Dependant vertexes can be specifed as part of the debug vertex code and infra code will invoke them automatically.
It is extedable to add any number of debug vertexes for a given usecase. 
Debug infra provides, show tech equalvalent for a use case will be collected, verfication of the data and potentially catch errors.

This infrastructure starts with a debug<vertex> and works on dependant vertexes specified in that vertex. Infra maintains the visited vertexes (uuids)
and skips those if it is already visited while processing. A context is maintained per use case, which has access to both vertex and dependant vertexes.

User will have an option to provide depth of dependancies to visit, default is no limit on the depth.
User will also have an option to create a file strucure of objects visisted and their details.

baseVertex class:
debug<vertexes> inherits baseVertex class, specifies the dependant vertexes to it.
baseVertex object gets config/control/analytics/agents nodes per given config uuid of the node (ex: VN uuid, SG uuid, VMI uuid and etc..)
baseVertex creates connection objects to those nodes and pulls configuration objects from all the above nodes automatically and stores in the vertex instance.
debug<vertex> codes adds the operational db related information, which can't be obtained automatically and also implements the business logic related to that
particular use case and also may perform verfication of data to report errors/warnings.

baseVertexFlow class:
Flow classes inherit baseVertexFlow class, which takes four-tuple and VN as input and gathers flow related information from all relavant contrail nodes.

introspect class:
This class provides handler to introspect for given ip/port. This provides methods to convert introspect xml to python dict objects.

contrail api class:
This class provides handler to config nodes for given ip/port. Methods to get objects from config node with select and where clauses (fileds and filters)

Analytics api class:
This class provides handler to analytics node for given ip/port. Methods to get analytics objects with where and select clauses (fileds and filters)

Utils:
Utility functions

Logger:
Logging functions


About

Debugging infrastructure code for contrail

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages