topology_docker utilities module.



Ensure that a path exists.

Parameters:path (str) – Directory path to create.

Return a valid temporal interface name.

Return type:str
Returns:A random valid network interface name.

Determine if the current user can run privileged commands and thus determines the command prefix to use.

Return type:str
Returns:The prefix to use for privileged commands.
topology_docker.utils.privileged_cmd(commands_tpl, **kwargs)

Run a privileged command.

This function will replace the tokens in the template with the provided keyword arguments, then it will split the lines of the template, strip them and execute them using the prefix for privileged commands, checking that the command returns 0.

  • commands_tpl (str) – Single line or multiline template for commands.
  • kwargs (dict) – Replacement tokens.
topology_docker.utils.get_iface_name(enode, netname)

Get interface name inside a container

This function will figure out the interface name inside the container for a given docker network.

  • enode – The platform (“engine”) node to get the iface name from.
  • netname (str) – The name of the docker network to which the interface we’re looking for is connected.