-
Notifications
You must be signed in to change notification settings - Fork 38
EMANE Shell
The EMANE shell (emanesh) is a Python CLI which provides access to emulator configuration, statistics, statistic tables and log control using the EMANE Remote Control Port API.
$ emanesh -h
Usage: emanesh [OPTION].. hostname [command]
Options:
-h, --help show this help message and exit
-p PORT, --port=PORT Server listen port [default: 47000]
===
- Interactive Mode
- help Command
- show Command
- get Command
- set Command
- clear Command
- loglevel Command
- info Command
- Shell Commands from the Command Line
- Manifest XML Search Path
- emane Python Module
===
To enter interactive mode, start emanesh with the address of the emulator instance you wish to connect to. You will see the emanesh prompt which will show the address and port of the connected emulator instance.
$ emanesh localhost
[emanesh (localhost:47000)] ##
===
You can get a list of available commands by typing help:
[emanesh (localhost:47000)] ## help
Documented commands (type help <topic>):
========================================
EOF clear exit get help info loglevel set show
You can get command specific help by specifying the command name:
[emanesh (localhost:47000)] ## help show
The show command is used to display manifest information provided
by the connected control port server.
The displayed information will include the NEM ids, component layer
types present and the name of the component layer plugin.
usage: show
example:
## show
===
You can use the show command to see the list of NEMs running in the emulator instance.
[emanesh (localhost:47000)] ## show
nem 1 mac(rfpipemaclayer) phy(emanephy)
nem 2 mac(rfpipemaclayer) phy(emanephy)
===
The get command is used to request configuration, statistic and statistic table information from one or more components.
[emanesh (node-1:47000)] ## help get
The get command is used to get configuration, statistic and
statistic table values.
All get types use optional target-specific name parameters:
* 'config' names specify configuration parameter names
* 'stat' names specify statistic element names
* 'table' names specify table names
When no names are specified all items are retrieved.
usage: get <type> <targets> <layer> [<target-specific>]
<type> ::= 'config' | 'stat' | 'table'
<targets> ::= <nem> | <nem> <target> | 'emulator' |
'nems'| '*'
<layer> ::= 'all' | 'mac' | 'phy' | <shim>
<nem> ::= [1-9] | [1-9][0-9]+
<shim> ::= 'shim'[0-9]+
<target-specific> ::= <names> | ''
<names> ::= <name> | <name> <names>
<name> ::= [A-Za-z0-9]+
example:
Get all configuration info from all NEM layers and the emulator
## get config * all
Get all statistic tables from all NEM mac layers
## get table nems mac
Get two statistic items from the mac layers of NEM 1 and 2
## get stat 1 2 mac processedEvents processedDownstreamControl
All the get types work the same way. To get the configuration from NEM 1's physical layer:
[emanesh (localhost:47000)] ## get config 1 phy
nem 1 phy bandwidth = 1000000
nem 1 phy fixedantennagain = 0.0
nem 1 phy fixedantennagainenable = True
nem 1 phy frequency = 2347000000
nem 1 phy frequencyofinterest = 2347000000
nem 1 phy noisebinsize = 20
nem 1 phy noisemaxclampenable = False
nem 1 phy noisemaxmessagepropagation = 200000
nem 1 phy noisemaxsegmentduration = 1000000
nem 1 phy noisemaxsegmentoffset = 300000
nem 1 phy noisemode = all
nem 1 phy propagationmodel = precomputed
nem 1 phy subid = 2
nem 1 phy systemnoisefigure = 4.0
nem 1 phy timesyncthreshold = 10000
nem 1 phy txpower = 0.0
To get the configuration from all NEM physical layers you can list each NEM Id:
[emanesh (localhost:47000)] ## get config 1 2 phy
or use nems:
[emanesh (localhost:47000)] ## get config nems phy
nem 1 phy bandwidth = 1000000
nem 1 phy fixedantennagain = 0.0
nem 1 phy fixedantennagainenable = True
nem 1 phy frequency = 2347000000
nem 1 phy frequencyofinterest = 2347000000
nem 1 phy noisebinsize = 20
nem 1 phy noisemaxclampenable = False
nem 1 phy noisemaxmessagepropagation = 200000
nem 1 phy noisemaxsegmentduration = 1000000
nem 1 phy noisemaxsegmentoffset = 300000
nem 1 phy noisemode = all
nem 1 phy propagationmodel = precomputed
nem 1 phy subid = 2
nem 1 phy systemnoisefigure = 4.0
nem 1 phy timesyncthreshold = 10000
nem 1 phy txpower = 0.0
nem 2 phy bandwidth = 1000000
nem 2 phy fixedantennagain = 0.0
nem 2 phy fixedantennagainenable = True
nem 2 phy frequency = 2347000000
nem 2 phy frequencyofinterest = 2347000000
nem 2 phy noisebinsize = 20
nem 2 phy noisemaxclampenable = False
nem 2 phy noisemaxmessagepropagation = 200000
nem 2 phy noisemaxsegmentduration = 1000000
nem 2 phy noisemaxsegmentoffset = 300000
nem 2 phy noisemode = all
nem 2 phy propagationmodel = precomputed
nem 2 phy subid = 2
nem 2 phy systemnoisefigure = 4.0
nem 2 phy timesyncthreshold = 10000
nem 2 phy txpower = 0.0
To get statistics from all of NEM 1's components use the all keyword:
[emanesh (localhost:47000)] ## get stat 1 all
nem 1 mac avgDownstreamPacketSizeBroadcastGenerated0 = 0.0
nem 1 mac avgDownstreamPacketSizeBroadcastRx0 = 0.0
nem 1 mac avgDownstreamPacketSizeBroadcastTx0 = 0.0
nem 1 mac avgDownstreamPacketSizeGenerated0 = 0.0
nem 1 mac avgDownstreamPacketSizeRx0 = 0.0
nem 1 mac avgDownstreamPacketSizeTx0 = 0.0
nem 1 mac avgDownstreamPacketSizeUnicastGenerated0 = 0.0
nem 1 mac avgDownstreamPacketSizeUnicastRx0 = 0.0
nem 1 mac avgDownstreamPacketSizeUnicastTx0 = 0.0
nem 1 mac avgDownstreamProcessingDelay0 = 0.0
... lots more
nem 1 phy avgDownstreamPacketSizeBroadcastGenerated0 = 0.0
nem 1 phy avgDownstreamPacketSizeBroadcastRx0 = 0.0
nem 1 phy avgDownstreamPacketSizeBroadcastTx0 = 0.0
nem 1 phy avgDownstreamPacketSizeGenerated0 = 0.0
nem 1 phy avgDownstreamPacketSizeRx0 = 0.0
nem 1 phy avgDownstreamPacketSizeTx0 = 0.0
nem 1 phy avgDownstreamPacketSizeUnicastGenerated0 = 0.0
nem 1 phy avgDownstreamPacketSizeUnicastRx0 = 0.0
nem 1 phy avgDownstreamPacketSizeUnicastTx0 = 0.0
nem 1 phy avgDownstreamProcessingDelay0 = 0.0
... lots more
To get a specific item such as one or more statistic tables, list each table at the end of the get command:
[emanesh (localhost:47000)] ## get table 1 phy EventReceptionTable PathlossEventInfoTable
nem 1 phy EventReceptionTable
| Event | Total Rx |
| 101 | 1 |
nem 1 phy PathlossEventInfoTable
| NEM | Forward Pathloss | Reverse Pathloss |
| 2 | 90.0 | 90.0 |
| 3 | 90.0 | 90.0 |
| 4 | 90.0 | 90.0 |
===
The set command is used to set one or more configuration item values for one or more components provided the specified configuration items permit running-state modification.
[emanesh (node-1:47000)] ## help set
The set command is used to set configuration elements that have
been designated as modifiable.
One or more configuration parameter value expressions can be
specified.
usage: set config <targets> <layer> <expressions>
<targets> ::= <nem> | <nem> <target> | 'nems' |
'*'
<layer> ::= 'all' | 'mac' | 'phy' | <shim>
<nem> ::= [1-9] | [1-9][0-9]+
<shim> ::= 'shim'[0-9]+
<nem> ::= [1-9] | [1-9][0-9]+
<expressions> ::= <expression> | <expression> <expressions>
<expression> ::= <name>'='<values>
<name> ::= [.A-Za-z0-9]+
<values> ::= <value> | <value>','<values>
<value> ::= value-string
example:
Set the txpower parameter for all NEM phy layers
## set config nems phy txpower=20
Set the cwmin0 and cwmax0 parameters for NEM 1, 2 and 3 mac layers
## set config 1 2 3 mac cwmin0=100 cwmax0=200
To set the txpower of all physical layer instances to 30dBm with before and after configuration item gets for illustrative purposes:
[emanesh (localhost:47000)] ## get config nems phy txpower
nem 1 phy txpower = 0.0
nem 2 phy txpower = 0.0
[emanesh (localhost:47000)] ## set config nems phy txpower=30
nem 1 phy configuration udpated
nem 2 phy configuration udpated
[emanesh (localhost:47000)] ## get config nems phy txpower
nem 1 phy txpower = 30.0
nem 2 phy txpower = 30.0
Don't worry if you make a mistake. Depending on the type of error, either emanesh or the Remote Control Port will catch it.
[emanesh (localhost:47000)] ## get config nems mac txpower
nem 1 mac Unknown configuration parameter: txpower
nem 2 mac Unknown configuration parameter: txpower
nem 3 mac Unknown configuration parameter: txpower
nem 4 mac Unknown configuration parameter: txpower
[emanesh (localhost:47000)] ## show
nem 1 mac(ieee80211abgmaclayer) phy(emanephy)
nem 2 mac(ieee80211abgmaclayer) phy(emanephy)
[emanesh (localhost:47000)] ## set config * mac cwmin0=1025
nem 1 mac Validator failure: cwmin0 must be less than cwmax0
nem 2 mac Validator failure: cwmin0 must be less than cwmax0
[emanesh (localhost:47000)] ## set config 1 2 phy systemnoisefigure=4.1
nem 1 phy Parameter not running state modifiable systemnoisefigure
nem 2 phy Parameter not running state modifiable systemnoisefigure
===
The clear command is used to clear statistics and statistic tables that allow external clearing.
[emanesh (node-1:47000)] ## help clear
The clear command is used to clear statistic elements that have
been designated as clearable.
Optional target-specific statistic element names can be specified.
When no names are specified all clearable statistic elements will
be cleared.
usage: clear stat <targets> <layer> [<target-specific>]
<type> ::= 'stat' | 'table'
<targets> ::= <nem> | <nem> <target> | 'emulator' |
'nems'| '*'
<layer> ::= 'all' | 'mac' | 'phy' | <shim>
<nem> ::= [1-9] | [1-9][0-9]+
<shim> ::= 'shim'[0-9]+
<target-specific> ::= <names> | ''
<names> ::= <name> | <name> <names>
<name> ::= [A-Za-z0-9]+
example:
Clear all statistics from all NEM layers and the emulator
## clear stat * all
Clear all statistics from all NEM mac layers
## clear stat nems mac
Clear two statistic items from the phy layers of NEM 1 and 2
## clear stat 1 2 phy processedEvents processedDownstreamControl
The clear command is similar in usage to the get command. You can only clear statistics and statistic tables.
[emanesh (localhost:47000)] ## get stat 1 2 phy processedEvents
nem 1 phy processedEvents = 1
nem 2 phy processedEvents = 1
[emanesh (localhost:47000)] ## clear stat 1 2 phy processedEvents
nem 1 phy statistics cleared
nem 2 phy statistics cleared
[emanesh (localhost:47000)] ## get stat 1 2 phy processedEvents
nem 1 phy processedEvents = 0
nem 2 phy processedEvents = 0
===
The loglevel command is used to dynamically change the emulator's log level. If you are running a daemonized instance of the emulator and not logging to file, loglevel changes will have no affect.
emanesh (localhost:47000)] ## help loglevel
The loglevel command is used to set the emulator loglevel.
0 - No log messages
1 - Abort log messages
2 - Error log messages
3 - Info log messages
4 - Debug log messages
usage: loglevel [0,4]
example:
## loglevel 4
===
The info command is used to display descriptive information about component configuration items, statistics and statistic tables. The information displayed comes from plugin manifests which are XML files generated from plugin DLLs and loaded on emanesh startup.
[emanesh (localhost:47000)] ## help info
The info command is used to display information loaded from plugin
manifest files. There are four types of info commands: manifest,
config, stat and table. The manifest info command is used to display
the names of discovered plugins. The config, stat and table info
commands are used to display plugin specific item descriptions.
The config, stat and table info commands use a single optional
plugin-specific name parameter:
* config name specifies a configuration parameter name
* stat name specifies a statistic element name
* table name specifies a table name
When no name is specified all known names are listed.
usage: info <type> <plugin> [<plugin-specific>]
<type> ::= 'config' | 'stat' | 'table'
<plugin> ::= plugin-name
<plugin-specific> ::= <names>
<names> ::= <name> | <name> <names>
<name> ::= [A-Za-z0-9]+
info 'manifest'
example:
## info manifest
## info config rfpipemaclayer
## info config rfpipemaclayer neighbormetricdeletetime
## info stat emanephy processedEvents
Use info manifest to list the currently loaded plugin manifests:
[emanesh (localhost:47000)] ## info manifest
Loaded plugin manifests
bypassmaclayer
bypassphylayer
commeffectshim
eelgenerator
emanephy
gpsdlocationagent
ieee80211abgmaclayer
phyapitestshim
rfpipemaclayer
tdmaeventschedulerradiomodel
timinganalysisshim
transraw
transvirtual
You can get a listing of available configuration, statistics or static tables for a given plugin:
[emanesh (localhost:47000)] ## info config rfpipemaclayer
Available configuration parameters for rfpipemaclayer
datarate
delay
enablepromiscuousmode
flowcontrolenable
flowcontroltokens
jitter
neighbormetricdeletetime
pcrcurveuri
radiometricenable
radiometricreportinterval
You can get specific configuration, statistics or static tables descriptions as well:
[emanesh (localhost:47000)] ## info config emanephy noisemode
Configuration parameter information for emanephy noisemode
Defines the noise processing mode of operation: none, all or outofband.
default : True
required : False
modifiable: False
type : string
regex : ^(none|all|outofband)$
occurs : [1,1]
default : all
===
You can run emanesh commands from the command line in a manner similar to ssh:
$ emanesh localhost get stat nems all processedEvents processedTimedEvents processedDownstreamPackets processedUpstreamPackets
nem 1 mac processedDownstreamPackets = 0
nem 1 mac processedEvents = 0
nem 1 mac processedTimedEvents = 58916
nem 1 mac processedUpstreamPackets = 0
nem 1 phy processedDownstreamPackets = 0
nem 1 phy processedEvents = 0
nem 1 phy processedTimedEvents = 0
nem 1 phy processedUpstreamPackets = 0
nem 2 mac processedDownstreamPackets = 0
nem 2 mac processedEvents = 0
nem 2 mac processedTimedEvents = 58916
nem 2 mac processedUpstreamPackets = 0
nem 2 phy processedDownstreamPackets = 0
nem 2 phy processedEvents = 0
nem 2 phy processedTimedEvents = 0
nem 2 phy processedUpstreamPackets = 0
===
emansh will look for Manifest XML files in /usr/share/emane/manifest. The EMANEMANIFESTPATH environment variable can be used to specify your Manifest XML search path using a colon (:) separated directory list.
export EMANEMANIFESTPATH:/usr/share/emane/manifest:/path/to/your/local/model/manifests
===
You can also reuse emane Python module classes in your own applications:
- emane.shell.ControlPortClient
- emane.shell.Manifest
- emane.events.EventService
- emane.events.AntennaProfileEvent
- emane.events.CommEffectEvent
- emane.events.LocationEvent
- emane.events.PathlossEvent
- emane.events.TDMAScheduleEvent
- emane.events.FadingSelectionEvent
- Home
- Introduction
- EMANE Shell
- Emulator Physical Layer
- Radio Models
- Utility Models
- Transports
- Event Generators
- Event Agents
- Building Packages
- Installing Packages
- Developer Documentation
- FAQ
- Copyright