The Assimilation Monitoring Project
cma::cma::CMAdb Class Reference

Public Member Functions

def __init__
def initglobal
def delete_all
def node_new
def new_ring
def new_drone
def new_switch
def new_nic
def new_IPaddr
def new_ipproc
def new_tcpipport
def empty

Data Fields

 db
 dbversion

Static Public Attributes

string NODE_nodetype = 'nodetype'
 Indexes: ringindex - index of all Ring objects [nodetype=ring] droneindex - index of all Drone objects [nodetype=drone] ipindex - index of all IP address objects [nodetype=ipaddr] macindex - index of all interfaces by MAC address [nodetype=nic].
string NODE_ring = 'Ring'
string NODE_drone = 'Drone'
string NODE_switch = 'Switch'
string NODE_NIC = 'NIC'
string NODE_ipaddr = 'IPaddr'
string NODE_ipproc = 'tcp-process'
string NODE_tcpipport = 'IP:tcpport'
string REL_isa = 'IS_A'
string REL_nicowner = 'nicowner'
string REL_wiredto = 'wiredto'
string REL_iphost = 'iphost'
string REL_ipowner = 'ipowner'
string REL_parentring = 'parentring'
string REL_baseip = 'baseip'
string REL_ipphost = 'ipphost'
string REL_tcpservice = 'tcpservice'
string REL_runningon = 'runningon'
string REL_tcpclient = 'tcpclient'
 debug = False
dictionary nodetypes
list indices = [key for key in nodetypes.keys() if nodetypes[key]]
list nodetypeindex = self.indextbl['nodetype']
tuple nodezero = self.db.get_node(0)
tuple top

Detailed Description

Class defining our Neo4J database.

Definition at line 150 of file cma.py.


Constructor & Destructor Documentation

def cma::cma::CMAdb::__init__ (   self,
  host = 'localhost',
  port = 7474 
)

Definition at line 192 of file cma.py.


Member Function Documentation

def cma::cma::CMAdb::delete_all (   self)

Definition at line 255 of file cma.py.

def cma::cma::CMAdb::empty (   self)

Definition at line 424 of file cma.py.

def cma::cma::CMAdb::initglobal (   io,
  cleanoutdb = False 
)

Definition at line 240 of file cma.py.

def cma::cma::CMAdb::new_drone (   self,
  designation,
  kw 
)

Definition at line 309 of file cma.py.

def cma::cma::CMAdb::new_IPaddr (   self,
  nic,
  ipaddr,
  kw 
)
Create a new IP address (or return a pre-existing one), and point it at its parent
NIC and its grandparent drone

Definition at line 351 of file cma.py.

def cma::cma::CMAdb::new_ipproc (   self,
  name,
  jsonobj,
  drone 
)
Create a new ipproc object from its JSON discovery data

Definition at line 372 of file cma.py.

def cma::cma::CMAdb::new_nic (   self,
  nicname,
  macaddr,
  owner,
  kw 
)
Create a new NIC (or return a pre-existing one), and put it in the mac address index,
and point it at its parent owner.

Definition at line 325 of file cma.py.

def cma::cma::CMAdb::new_ring (   self,
  name,
  parentring = None,
  kw 
)

Definition at line 302 of file cma.py.

def cma::cma::CMAdb::new_switch (   self,
  designation,
  kw 
)

Definition at line 317 of file cma.py.

def cma::cma::CMAdb::new_tcpipport (   self,
  name,
  isserver,
  jsonobj,
  dronenode,
  ipproc,
  ipaddrnode 
)
Create a new (ip, port) object related to some IPaddr object

Definition at line 393 of file cma.py.

def cma::cma::CMAdb::node_new (   self,
  nodetype,
  nodename,
  unique = True,
  properties 
)
Possibly creates a new node, puts it in its appropriate index and creates an IS_A
relationship with the nodetype object corresponding its nodetype.
It is created and added to indexes if it doesn't already exist in its corresponding index
- if there is one.
If it already exists, the pre-existing node is returned.
If this object type doesn't have an index, it will always be created.
Note that the nodetype has to be in the nodetypetable - even if it's NULL
    (for error detection).
The IS_A relationship may be useful -- or not.  Hard to say at this point...

Definition at line 263 of file cma.py.


Field Documentation

Definition at line 192 of file cma.py.

Definition at line 192 of file cma.py.

cma::cma::CMAdb::debug = False [static]

Definition at line 189 of file cma.py.

list cma::cma::CMAdb::indices = [key for key in nodetypes.keys() if nodetypes[key]] [static]

Definition at line 215 of file cma.py.

string cma::cma::CMAdb::NODE_drone = 'Drone' [static]

Definition at line 165 of file cma.py.

string cma::cma::CMAdb::NODE_ipaddr = 'IPaddr' [static]

Definition at line 168 of file cma.py.

string cma::cma::CMAdb::NODE_ipproc = 'tcp-process' [static]

Definition at line 169 of file cma.py.

Definition at line 167 of file cma.py.

string cma::cma::CMAdb::NODE_nodetype = 'nodetype' [static]

Indexes: ringindex - index of all Ring objects [nodetype=ring] droneindex - index of all Drone objects [nodetype=drone] ipindex - index of all IP address objects [nodetype=ipaddr] macindex - index of all interfaces by MAC address [nodetype=nic].

Node types [nodetype enumeration values]:

Definition at line 163 of file cma.py.

Definition at line 164 of file cma.py.

string cma::cma::CMAdb::NODE_switch = 'Switch' [static]

Definition at line 166 of file cma.py.

string cma::cma::CMAdb::NODE_tcpipport = 'IP:tcpport' [static]

Definition at line 170 of file cma.py.

list cma::cma::CMAdb::nodetypeindex = self.indextbl['nodetype'] [static]

Definition at line 223 of file cma.py.

dictionary cma::cma::CMAdb::nodetypes [static]
Initial value:
{
            CMAdb.NODE_ring:    True
        ,   CMAdb.NODE_drone:   True
        ,   CMAdb.NODE_switch:  True
        ,   CMAdb.NODE_NIC:     True    # NICs are indexed by MAC address
                                        # MAC addresses are not always unique...
        ,   CMAdb.NODE_ipaddr:  True    # Note that IPaddrs also might not be unique
        ,   CMAdb.NODE_tcpipport:  True    # We index IP and port - handy to have...
        ,   CMAdb.NODE_ipproc:  False
        }

Definition at line 204 of file cma.py.

tuple cma::cma::CMAdb::nodezero = self.db.get_node(0) [static]

Definition at line 224 of file cma.py.

string cma::cma::CMAdb::REL_baseip = 'baseip' [static]

Definition at line 182 of file cma.py.

string cma::cma::CMAdb::REL_iphost = 'iphost' [static]

Definition at line 179 of file cma.py.

string cma::cma::CMAdb::REL_ipowner = 'ipowner' [static]

Definition at line 180 of file cma.py.

string cma::cma::CMAdb::REL_ipphost = 'ipphost' [static]

Definition at line 183 of file cma.py.

string cma::cma::CMAdb::REL_isa = 'IS_A' [static]

Definition at line 176 of file cma.py.

string cma::cma::CMAdb::REL_nicowner = 'nicowner' [static]

Definition at line 177 of file cma.py.

string cma::cma::CMAdb::REL_parentring = 'parentring' [static]

Definition at line 181 of file cma.py.

string cma::cma::CMAdb::REL_runningon = 'runningon' [static]

Definition at line 186 of file cma.py.

string cma::cma::CMAdb::REL_tcpclient = 'tcpclient' [static]

Definition at line 187 of file cma.py.

string cma::cma::CMAdb::REL_tcpservice = 'tcpservice' [static]

Definition at line 184 of file cma.py.

string cma::cma::CMAdb::REL_wiredto = 'wiredto' [static]

Definition at line 178 of file cma.py.

tuple cma::cma::CMAdb::top [static]
Initial value:
nodetypeindex.get_or_create('nodetype', index
        ,                      {'name':index, 'nodetype':'nodetype'})

Definition at line 226 of file cma.py.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines