marvis.node.external
Physical Nodes that are connected to the simulation host.
Classes
An ExternalNode represents an external device. |
- class marvis.node.external.ExternalNode(name, bridge=None, ifname='eth0')[source]
Bases:
marvis.node.base.Node
An ExternalNode represents an external device.
To use this kind of node you need to setup the network before. This includes setting up network bridges that route packages to the real hardware / external devices. Please consider the
setup-external.py
script.- Parameters
bridge (str) – The name of the bridge (that alread exists) to connect the simulation node to. If not specified,
ns3-{name}
is used.ifname (str) – The name of the interface on the remote device.
- bridge
The name of the bridge the external node is connected to.
- ifname
The interface name on the remote device.
- command_executor
The executor for running commands on the external device. This is useful for a scripted
Workflow
.
- wants_ip_stack()[source]
Indicates whether a IP stack shall be installed onto the node.
Installing is handled by the Channel.
- Returns
True
indicates that a ns-3 IP stack shall be installed when preparing this node.- Return type
bool
- prepare(simulation)[source]
This also runs setup on the remote device by setting the IP address the device is assigned during simulation.
- setup_remote_address(address)[source]
Add the simulation IP address to the remote device.
- Parameters
address (str) – The address to assign to the external node in simulation.
- remove_remote_address(address)[source]
Remove the simulation IP address from the remote device.
- Parameters
address (str) – The address to remove from the external node.
- add_interface(interface, name=None, prefix='eth')
Add an interface to the node.
- Warning: Do not call this function manually.
The functionality is handled by the network and channels.
- Parameters
interface (
Interface
) – The interface to add.name (str) – The name of the interface.
prefix (str) – If no name is supplied, the function works out a name by appending a number to the prefix.
- execute_command(command, user=None)
Execute a command within the node.
- Parameters
command (str or list of str) – The command to execute.
user (str) – If a user (name) is specified, the command is executed as this user. Warning: Not all nodes support this feature.
- go_offline()
Disconnect the node from all channels.
- go_online()
Connect the node back to all channels.
- set_position(x, y, z=0)
Set the position of the node and updates the mobitlity model.
- Parameters
x (float) – The x-position.
y (float) – The y-position.
z (float) – The z-position.
- channels
The cannels the node is connected to.
- name
The name of the node.
- ns3_node
The ns-3 internal node.
- position
The position of the node (used by wifi models and visualization)
- color
The color of the node used in the visualization.
- interfaces
The interfaces (~network cards) of this node.
Inheritance Diagramm