3. Scripts¶
3.1. ONU simulation server¶
TR-451 ONU simulator.
Simulates one or more ONU instances on a single channel termination.
Examples
ONU channel termination name x with ONU ids 0 through 99 and with
support for extended messages:
onusim.py --ctermname x --onuidfirst 0 --onuidlast 99 --extended
All defaults with logging level 2 (debug):
onusim.py -l 2
Messages addressed to an invalid channel termination name or ONU id are ignored (no response will be generated). This might be a mistake.
Usage
usage: onusim [-h] [-a ADDRESS] [-p PORT] [-n CTERMNAME] [-i ONUIDFIRST] [-I ONUIDLAST] [-e] [-d [DUMPFILE]] [-l LOGLEVEL]
Named Arguments¶
- -a, --address
server DNS name or IP address; default: ‘0.0.0.0’
- -p, --port
server UDP port number; default: 12345
- -n, --ctermname
channel termination name; default: ‘cterm’
- -i, --onuidfirst
first ONU id; default: 42
- -I, --onuidlast
last ONU id; default: same as first
- -e, --extended
whether to use/support extended messages
- -d, --dumpfile
file to which to dump hex messages; default (if value omitted): ‘dump.txt’
- -l, --loglevel
logging level (0=errors+warnings, 1=info, 2=debug); default: 0
3.2. ONU test client¶
TR-451 ONU command-line client.
Sends OMCI commands to an ONU simulator instance on a single channel termination.
Examples
These examples assume that an ONU simulator instance is listening on the default address and port. If not, commands will time out after 10 seconds.
Get (using all defaults):
% ./onucli.py get
<TBD; ADD LATER>
Get (using extended messages):
% ./onucli.py --extended get
<TBD; ADD LATER>
The returned attribute mask is 0xf600, indicating that the
response includes ONU-G attributes 1-4, 6 and 7 (these are the mandatory
ones). The optional-attribute mask is 0x0807, indicating that
attributes 5 and 14-16 are unsupported (these are the deprecated and
undefined ones). The remaining (optional) attributes are implemented but
not present in ONU-G instance 0.
Get (help text):
% ./onucli.py get --help
usage: onucli get [-h] [me_class] [me_inst] [attr_mask]
positional arguments:
me_class ME class; default: 256
me_inst ME instance; default: 0
attr_mask ME instance; default: 65535
optional arguments:
-h, --help show this help message and exit
Usage
usage: onucli [-h] [-a ADDRESS] [-p PORT] [-n CTERMNAME] [-i ONUIDFIRST] [-I ONUIDLAST] [-e] [-d [DUMPFILE]] [-l LOGLEVEL] [-t TCI]
{set,s,get,g,reset,r,upload,u,upload-next,un} ...
Positional Arguments¶
- cmd
Possible choices: set, s, get, g, reset, r, upload, u, upload-next, un
Named Arguments¶
- -a, --address
server DNS name or IP address; default: ‘127.0.0.1’
- -p, --port
server UDP port number; default: 12345
- -n, --ctermname
channel termination name; default: ‘cterm’
- -i, --onuidfirst
first ONU id; default: 42
- -I, --onuidlast
last ONU id; default: same as first
- -e, --extended
whether to use/support extended messages
- -d, --dumpfile
file to which to dump hex messages; default (if value omitted): ‘dump.txt’
- -l, --loglevel
logging level (0=errors+warnings, 1=info, 2=debug); default: 1
- -t, --tci
first TCI (Transaction Correlation Identifier); default: 0
Sub-commands:¶
set (s)¶
Set MIB instance attribute values.
Supply the values as one or more name=value pairs, where name is the attribute name or number.
onucli set [-h] [me_class] [me_inst] attrs [attrs ...]
Positional Arguments¶
- me_class
ME class; default: 256
- me_inst
ME instance; default: 0
- attrs
attributes to set; each is of the form name=value
get (g)¶
Get MIB instance attribute values.
onucli get [-h] [me_class] [me_inst] [attr_mask]
Positional Arguments¶
- me_class
ME class; default: 256
- me_inst
ME instance; default: 0
- attr_mask
Attribute mask (0b, 0o and 0x prefixes are OK); default: 65535
upload (u)¶
Prepare for upload of MIB instance values.
The MIB instance values are latched and will remain valid for 60 seconds. The returned num_upload_nexts value is the number of upload-next invocations needed to return them
onucli upload [-h]
upload-next (un)¶
Upload the next set of MIB instance values.
The supplied sequence number must be in the range 0 to num_upload_nexts - 1.
If upload hasn’t been called, or was called more than 60 seconds ago, no data will be returned.
onucli upload-next [-h] [seq_num]
Positional Arguments¶
- seq_num
Sequence number; default: 0