Command Meta Description. Define a set of commands that can be run.
data may contain one or more command Args:
sock: the socket that receive the data.
- data: data is a sequence of json encode string. “event” key
is required and is the name of the command that will be run a example is: {“password”: [“1234”], “event”: [“verify_master”]}
install the command set to node.
start the command set, execuate the start_action specifed in desc
Virtual Base Class For all nodes All Type of Nodes Should Implment API in this abstract first
sock_seq_set is the sequence of socks in this type of sock. for example, if _type = ‘client’, socks_seq_set = [0], then the first client sock need to be closed.
connect the sock to the server with address and port specfied by addr_port
create_sock with parameter specified by desc, desc can be the address and port it tries to connect and the type of the connection
listen to the sock. backlog is the max number of connection it can maintain
send ping traffic using sock and the server information is stored in data. A new thread will be created if the threaded is true
receive some data from sock, - bufsize is the max size for the buffer. - dispatecher is a function handler that will manipulate the data - threaded if it is true a new thread wiill be created to avoid
blocking the main process. Only real node suppport this. in sim Node and netns3 node, threading is not allowed.
set the sock to be the master sock. If a sock is master sock, then node will for commands from the master socks
This section contains the functions for emulation support.
base class for Topology Reader
reader for inet topology generator file
This is python implementation of NS3 topology-reader module pybindgen is far from mature and cannot generate usable python binding for this module, so I simply reimplement it in python.
Complex Network contains different types of Subnets.
For example, some parts is Csma Network, which some other parts is PointToPoint Network.
reader for inet topology generator file
Topology network with manual ip settings
Load Topology File and Contruct the Network Accordingly
base class for Topology Reader
Load Topology File and Contruct the Network Accordingly
Construct Point to Point Link in the Network
Initial the ip address and network devices
Install Internet Stack
Load Topology File
This section contains the functions for NS3 support.
Simulated Node in NS3 Adapted for Imalse Simulation
add message to pacekt
encode the message to the packet
schedue a even after t seconds
Will set Connect callback function. If succeeded, self.recv will be called. otherwise the sock will be closed
node level dispatcher, it will read data from the socket, parse the data into approariate format and handle the data to cmd.dispatcher()
get message from the pacetk
get_msg and add_msg are two hack function
The attributes you can customize
StartTime StopTime Remote: The address of the machine we want to ping. Verbose: Produce usual output. Interval: Wait interval seconds between sending each packet. Size: The number of data bytes to be sent, real packet will
be 8 (ICMP) + 20 (IP) bytes longer.
Pure Sim Experiemtn Doesn’t depend on netns3 can run in simulated time
schedule an event to simulator
Contents: