Skip to content

Cheatsheet

Yan Chen edited this page Apr 19, 2018 · 2 revisions
  • Dump contrail db in json format
python /usr/lib/python2.7/dist-packages/cfgm_common/db_json_exim.py --export-to db-dump.json
  • Enable bash tab command completion
pip install argcomplete
activate-global-python-argcomplete
exit
  • Set default json file
export DB_JSON_FILE=<json_file>

  • List all virtual-networks in config_db_uuid fqn table (including modification time)
python db_explorer.py --json_file <json_file_name> show config_db fqn --type virtual_network
python db_explorer.py --json_file <json_file_name> show config_db fqn --type virtual_network -t
  • List all virtual-networks in config_db_uuid obj_uuid table (including modification time)
python db_explorer.py --json_file <json_file_name> show config_db uuid --type virtual_network 
python db_explorer.py --json_file <json_file_name> show config_db uuid --type virtual_network -t
  • List all vmi owned by a vm
python db_explorer.py --json_file <json_file_name> show config_db uuid --type virtual_machine_interface --re ref:virtual_machine:<vm-uuid>

  • Compare two db json files
python db_explorer.py --json_file <old_json_file> comp <new_json_file>  all
python db_explorer.py --json_file <old_json_file> comp <new_json_file>  all -d
  • Compare objects in obj_uuid_table
python db_explorer.py --json_file <old_json_file> comp <new_json_file>  object <uuid>

Clone this wiki locally