Camphor Networks Platform API
camphor_api.camphor_util Namespace Reference

Classes

class  Util
 
class  Sh
 
class  PasswordPromptAction
 
class  CamphorSingleNodeSetup
 

Functions

def CAMPHOR_LOG_TRACE (msg, exc_info=False, stacklevel=1, stack_info=False)
 
def CAMPHOR_LOG_DEBUG (msg, exc_info=False, stacklevel=1, stack_info=False, suppress_debug=False)
 
def CAMPHOR_LOG_INFO (msg, exc_info=False, stacklevel=1, stack_info=False)
 
def CAMPHOR_LOG_WARN (msg, exc_info=False, stacklevel=1, stack_info=False)
 
def CAMPHOR_LOG_ERROR (msg, exc_info=True, stacklevel=1, stack_info=True)
 
def CAMPHOR_LOG_FATAL (msg, exc_info=True, stacklevel=1, stack_info=True)
 
def CAMPHOR_LOG_EXCEPTION (msg, exc_info=True, stacklevel=1, stack_info=True)
 
def CAMPHOR_LOCAL_DIR (cluster=None)
 
def pause ()
 
def patch_pkg_resources_init ()
 
def sleep (duration, display_wait=True)
 
def camphor (o, json=False, var=False)
 

Variables

 SSHPASS_REGEXP = compile("sshpass -p\\s+.*?\\s+")
 
 CAMPHOR_INSTALL_ROOT = environ.get("CAMPHOR_INSTALL_ROOT", F"{environ.get('HOME', '/root')}/Camphor")
 
string CAMPHOR_IMAGES_SECRET_KEY_FILE = "/root/.camphor_secrets/.camphorLicense"
 
 TMPDIR = environ.get("TMPDIR", path.join(CAMPHOR_INSTALL_ROOT, "tmp"))
 
string CAMPHOR_DEMO_IMAGE_EXPORT = "/root/Camphor/images/export"
 
string CAMPHOR_IMAGE_CACHE = "/local/var/lib/Camphor/images/cache/"
 
 CAMPHOR_LOCAL_HOME = environ['HOME']
 
string CAMPHOR_REMOTE_USER = 'root'
 
string CAMPHOR_REMOTE_HOME = 'root' else ('/home/%s' % CAMPHOR_REMOTE_USER)
 
string CAMPHOR_REMOTE_DIR = '%s/.camphor' % CAMPHOR_REMOTE_HOME
 
string CAMPHOR_PREFIX = "camphor-"
 
string CAMPHOR_TOP = "/var/lib/camphor"
 
string DSI = "-i %s/.ssh/id_rsa -i %s/.ssh/id_rsa.device" % (CAMPHOR_REMOTE_HOME, CAMPHOR_REMOTE_HOME)
 
string SCPO = "-oBatchMode=yes -oConnectTimeout=3 -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -o LogLevel=QUIET"
 
string SSHO = "-ax %s" % SCPO
 
string WSSHO = "-ax %s" % SSHO
 
string SSHO2 = SSHO.replace('BatchMode=yes', 'BatchMode=no')
 
string SCPO2 = SCPO.replace('BatchMode=yes', 'BatchMode=no')
 
string IPO = "up"
 
string EXPOSED_TCP_PORTS = "22 25 80 8080 443 10022 8443 6082 18443 22767-42767 53".split()
 
string EXPOSED_UDP_PORTS = "53".split()
 
string APT_GET = "yes | sudo DEBIAN_FRONTEND=noninteractive apt-get -qq -y --allow-unauthenticated " + \
 
 format
 
 datefmt
 
 level
 

Function Documentation

◆ CAMPHOR_LOG_TRACE()

def camphor_api.camphor_util.CAMPHOR_LOG_TRACE (   msg,
  exc_info = False,
  stacklevel = 1,
  stack_info = False 
)

Definition at line 72 of file camphor_util.py.

◆ CAMPHOR_LOG_DEBUG()

◆ CAMPHOR_LOG_INFO()

def camphor_api.camphor_util.CAMPHOR_LOG_INFO (   msg,
  exc_info = False,
  stacklevel = 1,
  stack_info = False 
)

Definition at line 97 of file camphor_util.py.

Referenced by PasswordPromptAction.__call__(), Util.camphor_skip_test(), camphor_api.camphor_manage_device.main(), and Sh.run().

+ Here is the caller graph for this function:

◆ CAMPHOR_LOG_WARN()

def camphor_api.camphor_util.CAMPHOR_LOG_WARN (   msg,
  exc_info = False,
  stacklevel = 1,
  stack_info = False 
)

Definition at line 105 of file camphor_util.py.

Referenced by camphor_api.camphor_manage_device.push_conf(), camphor_api.camphor_manage_device.save_conf(), and Util.uploadImage().

+ Here is the caller graph for this function:

◆ CAMPHOR_LOG_ERROR()

def camphor_api.camphor_util.CAMPHOR_LOG_ERROR (   msg,
  exc_info = True,
  stacklevel = 1,
  stack_info = True 
)

◆ CAMPHOR_LOG_FATAL()

def camphor_api.camphor_util.CAMPHOR_LOG_FATAL (   msg,
  exc_info = True,
  stacklevel = 1,
  stack_info = True 
)

Definition at line 121 of file camphor_util.py.

◆ CAMPHOR_LOG_EXCEPTION()

def camphor_api.camphor_util.CAMPHOR_LOG_EXCEPTION (   msg,
  exc_info = True,
  stacklevel = 1,
  stack_info = True 
)

Definition at line 129 of file camphor_util.py.

Referenced by Sh.run().

+ Here is the caller graph for this function:

◆ CAMPHOR_LOCAL_DIR()

def camphor_api.camphor_util.CAMPHOR_LOCAL_DIR (   cluster = None)

Definition at line 137 of file camphor_util.py.

Referenced by Util.initializeNbProjectData().

+ Here is the caller graph for this function:

◆ pause()

def camphor_api.camphor_util.pause ( )

Definition at line 143 of file camphor_util.py.

References camphor_api.camphor_util.sleep().

+ Here is the call graph for this function:

◆ patch_pkg_resources_init()

def camphor_api.camphor_util.patch_pkg_resources_init ( )

Definition at line 160 of file camphor_util.py.

◆ sleep()

def camphor_api.camphor_util.sleep (   duration,
  display_wait = True 
)

◆ camphor()

def camphor_api.camphor_util.camphor (   o,
  json = False,
  var = False 
)

Definition at line 209 of file camphor_util.py.

Variable Documentation

◆ SSHPASS_REGEXP

SSHPASS_REGEXP = compile("sshpass -p\\s+.*?\\s+")

Definition at line 41 of file camphor_util.py.

◆ CAMPHOR_INSTALL_ROOT

CAMPHOR_INSTALL_ROOT = environ.get("CAMPHOR_INSTALL_ROOT", F"{environ.get('HOME', '/root')}/Camphor")

Definition at line 42 of file camphor_util.py.

◆ CAMPHOR_IMAGES_SECRET_KEY_FILE

string CAMPHOR_IMAGES_SECRET_KEY_FILE = "/root/.camphor_secrets/.camphorLicense"

Definition at line 43 of file camphor_util.py.

◆ TMPDIR

TMPDIR = environ.get("TMPDIR", path.join(CAMPHOR_INSTALL_ROOT, "tmp"))

Definition at line 44 of file camphor_util.py.

◆ CAMPHOR_DEMO_IMAGE_EXPORT

string CAMPHOR_DEMO_IMAGE_EXPORT = "/root/Camphor/images/export"

Definition at line 45 of file camphor_util.py.

◆ CAMPHOR_IMAGE_CACHE

string CAMPHOR_IMAGE_CACHE = "/local/var/lib/Camphor/images/cache/"

Definition at line 46 of file camphor_util.py.

◆ CAMPHOR_LOCAL_HOME

CAMPHOR_LOCAL_HOME = environ['HOME']

Definition at line 47 of file camphor_util.py.

◆ CAMPHOR_REMOTE_USER

string CAMPHOR_REMOTE_USER = 'root'

Definition at line 48 of file camphor_util.py.

◆ CAMPHOR_REMOTE_HOME

string CAMPHOR_REMOTE_HOME = 'root' else ('/home/%s' % CAMPHOR_REMOTE_USER)

Definition at line 49 of file camphor_util.py.

◆ CAMPHOR_REMOTE_DIR

string CAMPHOR_REMOTE_DIR = '%s/.camphor' % CAMPHOR_REMOTE_HOME

Definition at line 50 of file camphor_util.py.

◆ CAMPHOR_PREFIX

string CAMPHOR_PREFIX = "camphor-"

Definition at line 51 of file camphor_util.py.

◆ CAMPHOR_TOP

string CAMPHOR_TOP = "/var/lib/camphor"

Definition at line 52 of file camphor_util.py.

◆ DSI

string DSI = "-i %s/.ssh/id_rsa -i %s/.ssh/id_rsa.device" % (CAMPHOR_REMOTE_HOME, CAMPHOR_REMOTE_HOME)

Definition at line 53 of file camphor_util.py.

◆ SCPO

string SCPO = "-oBatchMode=yes -oConnectTimeout=3 -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -o LogLevel=QUIET"

Definition at line 54 of file camphor_util.py.

◆ SSHO

string SSHO = "-ax %s" % SCPO

Definition at line 55 of file camphor_util.py.

◆ WSSHO

string WSSHO = "-ax %s" % SSHO

Definition at line 56 of file camphor_util.py.

◆ SSHO2

string SSHO2 = SSHO.replace('BatchMode=yes', 'BatchMode=no')

Definition at line 58 of file camphor_util.py.

◆ SCPO2

string SCPO2 = SCPO.replace('BatchMode=yes', 'BatchMode=no')

Definition at line 59 of file camphor_util.py.

◆ IPO

string IPO = "up"

Definition at line 61 of file camphor_util.py.

◆ EXPOSED_TCP_PORTS

string EXPOSED_TCP_PORTS = "22 25 80 8080 443 10022 8443 6082 18443 22767-42767 53".split()

Definition at line 62 of file camphor_util.py.

◆ EXPOSED_UDP_PORTS

string EXPOSED_UDP_PORTS = "53".split()

Definition at line 63 of file camphor_util.py.

◆ APT_GET

string APT_GET = "yes | sudo DEBIAN_FRONTEND=noninteractive apt-get -qq -y --allow-unauthenticated " + \

Definition at line 64 of file camphor_util.py.

◆ format

format

Definition at line 67 of file camphor_util.py.

◆ datefmt

datefmt

Definition at line 68 of file camphor_util.py.

◆ level

level

Definition at line 68 of file camphor_util.py.