netclient

netclient.py interface to client tcp socket with - sr() send/receive a command

Created on Sun Jan 8 12:36:38 2017

@author: pgm

class Netclient[source]

Bases: object

connects and holds open a socket to defined port.

Parameters:
  • addr (str) – ip-address or dns name on network

  • port (int) – server port number.

trace = 0
connect_timeout = 0
receive_message(termex, maxlen=4096)[source]

Read the information from the socket line at a time.

Parameters:
  • termex (str) – regex defines line terminator

  • maxlen (int) – max read size

Returns:

string representing message

send(message)[source]
has_data()[source]
instances = []
__init__(addr, port)[source]
close()[source]
addr()[source]
port()[source]
static closeall()[source]
class Logclient[source]

Bases: Netclient

Netclient optimised for logging, line by line

__init__(addr, port)[source]
poll()[source]
class Siteclient[source]

Bases: Netclient

synchronized()[source]
pat = re.compile('[:.]')
sr(*args, **kwargs)[source]
build_knobs(knobstr)[source]
help(regex='.*')[source]

list available knobs, optionally filtered by regex.

eg

  • help() : list all

  • help(“SIG) : list all knobs with SIG

  • help(“SIG*FREQ”) list all knobs SIG*FREQ

get_knob(name)[source]
set_knob(name, value)[source]
__init__(addr, port)[source]
knobs = {}
trace = 0
prevent_autocreate = False
run_unit_test()[source]