compass.db package

Submodules

compass.db.database module

Provider interface to manipulate database.

compass.db.database.create_db()

Create database

compass.db.database.create_table(table)

Create table.

Parameters:table – Class of the Table defined in the model.
compass.db.database.current_session()

Get the current session scope when it is called.

Returns:database session.
compass.db.database.drop_db()

Drop database.

compass.db.database.drop_table(table)

Drop table.

Parameters:table – Class of the Table defined in the model.
compass.db.database.init(database_url)

Initialize database.

Parameters:database_url – string, database url.
compass.db.database.session(*args, **kwds)

database session scope. To operate database, it should be called in database session.

compass.db.model module

database model.

class compass.db.model.Adapter(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Base

Table stores ClusterHost installing Adapter information.

Parameters:
  • id – int, identity as primary key.
  • name – string, adapter name, unique.
  • os – string, os name for installing the host.
  • target_system – string, target system to be installed on the host.
  • clusters – refer to the list of Cluster.
id None
name None
os None
target_system None
class compass.db.model.Cluster(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Base

Cluster configuration information.

Parameters:
  • id – int, identity as primary key.
  • name – str, cluster name.
  • mutable – bool, if the Cluster is mutable.
  • security_config – str stores json formatted security information.
  • networking_config – str stores json formatted networking information.
  • partition_config – string stores json formatted parition information.
  • adapter_id – the refer id in the Adapter table.
  • raw_config – str stores json formatted other cluster information.
  • adapter – refer to the Adapter.
  • state – refer to the ClusterState.
adapter None
adapter_id None
config None

get config from security, networking, partition

id None
mutable None
name None
networking None

networking getter

networking_config None
partition None

partition getter

partition_config None
raw_config None
security None

security getter

security_config None
class compass.db.model.ClusterHost(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Base

ClusterHost information.

Parameters:
  • id – int, identity as primary key.
  • machine_id – int, the id of the Machine.
  • cluster_id – int, the id of the Cluster.
  • mutable – if the ClusterHost information is mutable.
  • hostname – str, host name.
  • config_data – string, json formatted config data.
  • cluster – refer to Cluster the host in.
  • machine – refer to the Machine the host on.
  • state – refer to HostState indicates the host state.
cluster None
cluster_id None
config None

config getter.

config_data None
hostname None
id None
machine None
machine_id None
mutable None
class compass.db.model.ClusterState(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Base

The state of the Cluster.

Parameters:
  • id – int, identity as primary key.
  • state – Enum, ‘UNINITIALIZED’: the cluster is ready to setup. ‘INSTALLING’: the cluster is not installing. ‘READY’: the cluster is setup. ‘ERROR’: the cluster has error.
  • progress – float, the installing progress from 0 to 1.
  • message – the latest installing message.
  • severity – Enum, the installing message severity. (‘INFO’, ‘WARNING’, ‘ERROR’).
  • update_timestamp – the lastest timestamp the entry got updated.
  • cluster – refer to Cluster.
cluster None
clustername None

clustername getter

id None
message None
progress None
severity None
state None
update_timestamp None
class compass.db.model.HostState(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Base

The state of the ClusterHost.

Parameters:
  • id – int, identity as primary key.
  • state – Enum. ‘UNINITIALIZED’: the host is ready to setup. ‘INSTALLING’: the host is not installing. ‘READY’: the host is setup. ‘ERROR’: the host has error.
  • progress – float, the installing progress from 0 to 1.
  • message – the latest installing message.
  • severity – Enum, the installing message severity. (‘INFO’, ‘WARNING’, ‘ERROR’)
  • update_timestamp – the lastest timestamp the entry got updated.
  • host – refer to ClusterHost.
host None
hostname None

hostname getter

id None
message None
progress None
severity None
state None
update_timestamp None
class compass.db.model.LogProgressingHistory(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Base

host installing log history for each file.

Parameters:
  • id – int, identity as primary key.
  • pathname – str, the full path of the installing log file. unique.
  • position – int, the position of the log file it has processed.
  • partial_line – str, partial line of the log.
  • progressing – float, indicate the installing progress between 0 to 1.
  • message – str, str, the installing message.
  • severity – Enum, the installing message severity. (‘ERROR’, ‘WARNING’, ‘INFO’)
  • line_matcher_name – str, the line matcher name of the log processor.
  • update_timestamp – datetime, the latest timestamp the entry updated.
id None
line_matcher_name None
message None
partial_line None
pathname None
position None
progress None
severity None
update_timestamp None
class compass.db.model.Machine(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Base

Machine table.Note: currently, we are taking care of management plane. Therefore, we assume one machine is connected to one switch.

Parameters:
  • id – int, identity as primary key
  • mac – string, the MAC address of the machine.
  • switch_id – switch id that this machine connected on to.
  • port – nth port of the switch that this machine connected.
  • vlan – vlan id that this machine connected on to.
  • update_timestamp – last time this entry got updated.
  • switch – refer to the Switch the machine connects to.
id None
mac None
port None
switch None
switch_id None
update_timestamp None
vlan None
class compass.db.model.Role(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Base

The Role table stores avaiable roles of one target system where the host can be deployed to one or several roles in the cluster.

Parameters:
  • id – int, identity as primary key.
  • name – role name.
  • target_system – str, the target_system.
  • description – str, the description of the role.
description None
id None
name None
target_system None
class compass.db.model.Switch(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Base

Switch table.

Parameters:
  • id – the unique identifier of the switch. int as primary key.
  • ip – the IP address of the switch.
  • vendor_info – the name of the vendor
  • credential_data – used for accessing and retrieving information from the switch. Store json format as string.
  • state – Enum.’not_reached’: polling switch fails or not complete to learn all MAC addresses of devices connected to the switch; ‘under_monitoring’: successfully learn all MAC addresses.
  • machines – refer to list of Machine connected to the switch.
credential None

credential data getter.

Returns:python primitive dictionary object.
credential_data None
id None
ip None
state None
vendor None

vendor property getter

vendor_info None

Module contents

Table Of Contents

Previous topic

compass.api package

Next topic

compass.hdsdiscovery package

This Page