cohydra.node.ssh

Physical hosts to connect to via SSH.

Functions

default_ip

Calculates the default IP address.

Classes

SSHNode

An SSH node represents an external device reachable via SSH.


cohydra.node.ssh.default_ip(ifname)[source]

Calculates the default IP address.

This takes the subnet and adds 1.

Parameters

ifname (str) – The name of the interface.

class cohydra.node.ssh.SSHNode(name, ip=None, bridge=None, ifname='eth0', username='pi', password='raspberry')[source]

Bases: cohydra.node.external.ExternalNode

An SSH node represents an external device reachable via SSH.

Parameters
  • username (str) – The username used to login onto the device.

  • password (str) – The password for the given user.

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.

prepare(simulation)

This also runs setup on the remote device by setting the IP address the device is assigned during simulation.

remove_remote_address(address)

Remove the simulation IP address from the remote device.

Parameters

address (str) – The address to remove from the external node.

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.

setup_remote_address(address)

Add the simulation IP address to the remote device.

Parameters

address (str) – The address to assign to the external node in simulation.

wants_ip_stack()

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

Inheritance Diagramm

Inheritance diagram of cohydra.node.ssh