Models

The TestFramework isn’t based on the MVC paradigma but it is trying to encapsulate the data in its own classes.

Router

class router.router.Mode

The Router can be in two modes: normal and configuration. If the mode changes also the ip-address changes.

class router.router.Router(id: int, vlan_iface_name: str, vlan_iface_id: int, ip: str, ip_mask: int, config_ip: str, config_ip_mask: int, usr_name: str, usr_password: str, power_socket: int)

This class represent a Freifunk-Router

firmware

The Firmware that flashed on the Router.

Returns:Router_firmware
flashdriver

The Flashdriver of the Router.

Return type:Router_flashdriver
Returns:
id

ID of the Router

Returns:ID number as in
ip

IP number of the Router. In dependency of the Mode.

Returns:IP of the Router
ip_mask

Mask of the IP. In dependency of the Mode.

Returns:Mask of the IP
mac

The mac of the Router.

Returns:Router_mac
mode

The Mode of the Router.

Returns:Router_mode
model

The model and version of the router.

:return Router_model

namespace_name

The name of the Namespace, where the VLAN, that is used to communicate to the Router, is encapsulated.

Returns:Router_namespace_name
node_name

Name of the Router, that is seen from the community.

Returns:Router_node_name
power_socket

The port on the power_socker where the Router is connected to.

Returns:The port on the power_socker
public_key

Public-key of the Router, that is used to communicate with other Freifunk-Routers.

Returns:Router_public_key
ram

The RAM of the Router.

Returns:Router_ram
set_id(value: int)
update(new_router) → None

Updates the properties from this router :param new_router: router with newer property values :return:

usr_name

Username of the admin account on the router.

Returns:Router_user_name
usr_password

Password of the admin account on the router

Returns:Router_user_password
vlan_iface_id

The VLAN_interface_id from Router.

:return VLAN_interface_id

vlan_iface_name

The name of the VLAN, which the Router is connected to.

Returns:VLAN_iface_name

RemoteSystem

class network.remote_system.RemoteSystem

This abstract-class/interface provides the attributes that are necessary if we want to communicate with a system through the network.

id

The id to identify a RemoteSystem.

Returns:RemoteSystem_id
ip

The IP on which the RemoteSystem is listening.

Returns:RemoteSystem_ip
ip_mask

Mask of the IP on which the RemoteSystem is listening.

Returns:RemoteSystem_ip_mask
namespace_name

The name of the Namespace, where the VLAN, that is used to communicate to the RemoteSystem, is encapsulated.

Returns:Namespace_name
usr_name

The user-name that is used via SSH.

Returns:RemoteSystem_user_name
usr_password

The password that is used via SSH.

Returns:Remotesystem_user_password
vlan_iface_id

The id of the VLAN, which the RemoteSystem is connected to.

Returns:VLAN-iface_id
vlan_iface_name

The name of the VLAN, which the RemoteSystem is connected to.

Returns:VLAN_iface_name
class network.remote_system.RemoteSystemJob

The abstract class for Tasks which are executed in the specific namespace of a remote system.

It has the vars self/cls.remote_system and self/cls.all_routers.

The Server handles the job and is working in the following order:
  • data = job.pre_process(Server)
  • job.prepare(remote_sys)
  • executeWithVLAN: result = job.run()
  • job.post_process(result)
static post_process(data: {}, server)

Post process the result data from RemoteSystemJob in the main process.

Parameters:
  • data – result from run()
  • server – the Server
static pre_process(server) → {}

Pre process and aggregate data in the main process.

Parameters:server – the Server
Returns:Arbitrary data as an dictionary for the run method
prepare(remote_sys: network.remote_system.RemoteSystem, routers: typing.List)

Prepares the system job before the run method will started.

Parameters:
  • remote_sys – the RemoteSystem which are connected to this job
  • routers – all routers as a copy
run() → {}

The run method which will execute in the proper VLAN. As default you get a RemoteSystem with self.remote_system and optional the data from pre_process method with self.data.

Return Result data as dictionary for the post_process method:
 

Firmware

class firmware.firmware.Firmware(name: str, version: str, freifunk_verein: str, release_model: str, file: str, url: str)

Represents a FreiFunk-Firmware, that can be flashed on a router.

calc_hash()

Calculate the hash of the Firmware and sets it as an attribute.

check_hash(excep_hash: str) → bool

Checks whether the excepted hash equals the actual Hash of the Firmware.

Parameters:excep_hash – Hash excepted/ correct hash
Returns:‘True’ if Hash is correct
file

Path/file where the firmware-image is stored on the device.

Returns:Firmware_file
freifunk_verein

Like ‘ffda’ which stands for ‘freifunkdarmstadt’.

Returns:Firmware_freifunk_verein
static get_default_firmware()

Creates and returns a Firmware-Obj which can be used as a default value, if the firmware isn’t known already.

Returns:Default Frimware-Obj
hash

Hash of the firware-image.

Returns:Firmware_hash
name

Name of the Firmware, including: router_model_name, router_model_version, firmware_version, freifunk_verein.

Returns:Firmware_name
release_model
Can be: ‘stable’, ‘beta’ or ‘experimental’. Used in the url.
Returns:Firmware_release_model
url

URL of the server where the firmware-image can be downloaded.

Returns:Firmware_url
version

Version of the firmware. (not version of router !!!)

Returns:Firmware_version