paradrop.lib.config package

Submodules

paradrop.lib.config.configservice module

configservice module:
This module is responsible for “poking” the proper host OS services to change the host OS config. This would include things like changing the networking, DHCP server settings, wifi, etc..
reloadAll(update)[source]
reloadQos(update)[source]

paradrop.lib.config.devices module

Detect physical devices that can be used by chutes.

This module detects physical devices (for now just network interfaces) that can be used by chutes. This includes WAN interfaces for Internet connectivity and WiFi interfaces which can host APs.

It also makes sure certain entries exist in the system UCI files for these devices, for example “wifi-device” sections. These are shared between chutes, so they only need to be added when missing.

getSystemDevices(update)[source]

Detect devices on the system.

Store device information in cache key “networkDevices”.

isVirtual(ifname)[source]

Test if an interface is a virtual one.

FIXME: This just tests for the presence of certain strings in the interface name, so it is not very robust.

isWAN(ifname)[source]

Test if an interface is a WAN interface.

isWireless(ifname)[source]

Test if an interface is a wireless device.

setConfig(chuteName, sections, filepath)[source]
setSystemDevices(update)[source]

Initialize system configuration files.

Creates basic sections that all chutes require such as the “wan” interface.

paradrop.lib.config.dhcp module

getVirtDHCPSettings(update)[source]

Looks at the runtime rules the developer defined to see if they want a dhcp server. If so it generates the data and stores it into the chute cache key:virtDHCPSettings.

setVirtDHCPSettings(update)[source]

Takes a list of tuples (config, opts) and saves it to the dhcp config file.

paradrop.lib.config.dockerconfig module

getVirtPreamble(update)[source]

paradrop.lib.config.firewall module

findMatchingInterface(iface_name, interfaces)[source]

Search an interface list for one matching a given name.

iface_name can contain shell-style wildcards (* and ?).

getDeveloperFirewallRules(update)[source]

Generate other firewall rules requested by the developer such as redirects. The object returned is a list of tuples (config, options).

getOSFirewallRules(update)[source]

There is a set of default things that must exist just for the chute to function at all, generate those here.

Stored in key: osFirewallRules

setOSFirewallRules(update)[source]

Takes a list of tuples (config, opts) and saves it to the firewall config file.

paradrop.lib.config.network module

abortNetworkConfig(update)[source]

Release resources claimed by chute network configuration.

getNetworkConfig(update)[source]

For the Chute provided, return the dict object of a 100% filled out configuration set of network configuration. This would include determining what the IP addresses, interfaces names, etc...

getOSNetworkConfig(update)[source]

Takes the network interface obj created by NetworkManager.getNetworkConfiguration and returns a properly formatted object to be passed to the OpenWrtConfig class. The object returned is a list of tuples (config, options).

getVirtNetworkConfig(update)[source]
interfaceDefsEqual(iface1, iface2)[source]
reclaimNetworkResources(chute)[source]

Reclaim network resources for a previously running chute.

This function only applies to the special case in which pd starts up and loads a list of chutes that were running. This function marks their IP addresses and interface names as taken so that new chutes will not use the same values.

setOSNetworkConfig(update)[source]

Takes a list of tuples (config, opts) and saves it to the network config file.

paradrop.lib.config.osconfig module

osconfig module:
This module is in charge of changing configuration files for pdfcd on the host OS. This relates to things like network, dhcp, wifi, firewall changes. Pdfcd should be able to make simple abstracted calls into this module so that if we need to change what type of OS config we need to support only this module would change.
revertConfig(update, theType)[source]

Basically the UCI system saves a backup of the original config file, if we need to revert changes at all, we can just tell our UCI module to revert back using that backup copy.

paradrop.lib.config.pool module

class NetworkPool(network, subnetSize=24)[source]

Bases: paradrop.lib.config.pool.ResourcePool

class NumericPool(digits=4)[source]

Bases: paradrop.lib.config.pool.ResourcePool

class ResourcePool(values, numValues)[source]

Bases: object

next()[source]
release(item)[source]
reserve(item, strict=True)[source]

Mark item as used.

If strict is True, raises an exception if the item is already used.

paradrop.lib.config.uciutils module

appendListItem(options, name, value)[source]

Add a list item to UCI options.

The way we store lists for UCI options is rather bizarre, so this function takes care of that.

options: dictionary of options for a UCI section name: string name of the list option value: string value to append

removeConfigs(chute, cacheKeys, filepath)[source]

used to modify config file of each various setting in /etc/config/

restoreConfigFile(chute, configname)[source]

Restore a system config file from backup.

This can only be used during a chute update operation to revert changes that were made during that update operation.

configname: name of configuration file (“network”, “wireless”, etc.)

setConfig(chute, old, cacheKeys, filepath)[source]

Helper function used to modify config file of each various setting in /etc/config/ Returns:

True: if it modified a file False: if it did NOT cause any modifications
setList(options, name, values)[source]

Set a list item in UCI options.

The way we store lists for UCI options is rather bizarre, so this function takes care of that.

options: dictionary of options for a UCI section name: string name of the list option values: list of string values

paradrop.lib.config.wifi module

getOSWirelessConfig(update)[source]
setOSWirelessConfig(update)[source]

Module contents