compass.hdsdiscovery package


compass.hdsdiscovery.base module

Base class extended by specific vendor in vendors directory. a vendor need to implment abstract methods of base class.

class compass.hdsdiscovery.base.BasePlugin

Bases: object

Extended by vendor’s plugin, which processes request and retrieve info directly from the switch.

get(*args, **kwargs)

Get one record from a host

process_data(*args, **kwargs)
Each vendors will have some plugins to do some operations.
Plugin will process request data and return expected result.
  • args – arguments
  • kwargs – key-value pairs of arguments
scan(*args, **kwargs)

Get multiple records at once

set(*args, **kwargs)

Set value to desired variable

class compass.hdsdiscovery.base.BaseVendor

Bases: object

Basic Vendor object

is_this_vendor(*args, **kwargs)

Determine if the host is associated with this vendor. This function must be implemented by vendor itself

compass.hdsdiscovery.hdmanager module

Manage hdsdiscovery functionalities

class compass.hdsdiscovery.hdmanager.HDManager

Process a request.

get_vendor(host, credential)

Check and get vendor of the switch.

  • host – switch ip:
  • credential – credential to access switch
is_valid_vendor(host, credential, vendor)

Check if vendor is associated with this host and credential

  • host – switch ip
  • credential – credential to access switch
  • vendor – the vendor of switch
learn(host, credential, vendor, req_obj, oper='SCAN', **kwargs)
Insert/update record of switch_info. Get expected results from
switch according to sepcific operation.
  • req_obj – the object of a machine
  • host – switch IP address
  • credientials – credientials to access switch
  • oper – operations of the plugin (SCAN, GETONE, SET)
  • kwargs(optional) – key-value pairs

compass.hdsdiscovery.utils module

Utility functions Including functions of get/getbulk/walk/set of snmp for three versions

compass.hdsdiscovery.utils.load_module(mod_name, path, host=None, credential=None)

Load a module instance.

  • mod_name (str) – module name
  • path (str) – directory of the module
  • host (str) – switch ip address
  • credential (str) – credential used to access switch
compass.hdsdiscovery.utils.snmp_get(host, credential, object_type)

Impelmentation of snmp get functionality

  • object_type – mib object
  • host – switch ip
  • credential – the dict of credential to access switch
compass.hdsdiscovery.utils.snmp_walk(host, credential, *args)

Impelmentation of snmpwalk functionality

  • host – switch ip
  • credential – credential to access switch
  • args – OIDs
compass.hdsdiscovery.utils.ssh_remote_execute(host, username, password, cmd, *args)

SSH to execute script on remote machine

  • host – ip of the remote machine
  • username – username to access the remote machine
  • password – password to access the remote machine
  • cmd – command to execute

Valid the format of an Ip address

Module contents