-
Notifications
You must be signed in to change notification settings - Fork 66
Kathara.manager.docker.DockerLink
- BRIDGE_LINK_NAME
The class responsible for deploying Kathara collision domains as Docker networks and interact with them.
__init__(
client: docker.client.DockerClient,
docker_plugin: Kathara.manager.docker.DockerPlugin.DockerPlugin
) → None
create(link: Kathara.model.Link.Link) → None
Create a Docker network representing the collision domain object and assign it to link.api_object.
It also connects external collision domains, if present.
Args:
-
link
(Kathara.model.Link.Link): A Kathara collision domain.
Returns: None
Raises:
-
OSError
: If the link is attached to external interfaces and the host OS is not LINUX. -
PrivilegeError
: If the link is attached to external interfaces and the user does not have root privileges.
deploy_links(
lab: Kathara.model.Lab.Lab,
selected_links: Set[str] = None,
excluded_links: Set[str] = None
) → None
Deploy all the network scenario collision domains as Docker networks.
Args:
-
lab
(Kathara.model.Lab.Lab): A Kathara network scenario. -
selected_links
(Set[str]): A set containing the name of the collision domains to deploy. -
excluded_links
(Set[str]): A set containing the name of the collision domains to exclude.
Returns: None
Raises:
-
InvocationError
: If bothselected_links
andexcluded_links
are specified.
get_docker_bridge() → Optional[docker.models.networks.Network]
Return the Docker bridged network.
Returns:
-
Union[None, docker.models.networks.Network]
: The Docker bridged network if exists, else None
get_links_api_objects_by_filters(
lab_hash: str = None,
link_name: str = None,
user: str = None
) → List[docker.models.networks.Network]
Return the Docker networks specified by lab_hash and user.
Args:
-
lab_hash
(str): The hash of a network scenario. If specified, return all the networks in the scenario. -
link_name
(str): The name of a network. If specified, return the specified network of the scenario. -
user
(str): The name of a user on the host. If specified, return only the networks of the user.
Returns:
-
List[docker.models.networks.Network]
: A list of Docker networks.
get_links_stats(
lab_hash: str = None,
link_name: str = None,
user: str = None
) → Generator[Dict[str, Kathara.manager.docker.stats.DockerLinkStats.DockerLinkStats], NoneType, NoneType]
Return a generator containing the Docker networks' stats.
Args:
-
lab_hash
(str): The hash of a network scenario. If specified, return all the stats of the networks in the scenario. -
link_name
(str): The name of a device. If specified, return the specified network stats. -
user
(str): The name of a user on the host. If specified, return only the stats of the specified user.
Returns:
-
Generator[Dict[str, DockerMachineStats], None, None]
: A generator containing network names as keys and DockerLinkStats as values.
Raises:
-
PrivilegeError
: If user param is None and the user does not have root privileges.
get_network_name(link: Kathara.model.Link.Link) → str
Return the name of a Docker network.
Args:
-
link
(Kathara.model.Link): A Kathara collision domain.
Returns:
-
str
: The name of the Docker network in the format "|net_prefix||username_prefix||name|". -
If shared collision domains, the format is
: "|net_prefix|_|lab_hash|".
undeploy(lab_hash: str, selected_links: Optional[Set[str]] = None) → None
Undeploy all the collision domains of the scenario specified by lab_hash.
Args:
-
lab_hash
(str): The hash of the network scenario to undeploy. -
selected_links
(Set[str]): If specified, delete only the collision domains contained in the set.
Returns: None
wipe(user: str = None) → None
Undeploy all the Docker networks of the specified user. If user is None, it undeploy all the Docker networks.
Args:
-
user
(str): The name of a current user on the host
Returns: None
This file was automatically generated via lazydocs.
Website: kathara.org
Contact us: [email protected]