cohydra.node.interface¶
Classes
A Interface Node represents a node (or network) behind an local network interface. |
-
class
cohydra.node.interface.
InterfaceNode
(name, ifname='eth0')[source]¶ Bases:
cohydra.node.base.Node
A Interface Node represents a node (or network) behind an local network interface. This is an easy and simple way to include external nodes inside of the simulation.
- Parameters
name (str) – The name of the node. It must consist only of alphanumeric characters and
-
,_
and.
.ifname (str) – The name of the local network interface. Default is eth0.
-
ifname
= None¶ The interface name on the local machine.
-
command_executor
= None¶ 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
-
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.
Inheritance Diagramm