-
Notifications
You must be signed in to change notification settings - Fork 68
Kathara.manager.docker.DockerManager
Tommaso Caiazzi edited this page Jan 17, 2023
·
16 revisions
check_docker_status(method)
Decorator function to check if Docker daemon is running properly.
The class responsible to interact between Kathara and the Docker APIs.
get_formatted_manager_name() → str
Return a formatted string containing the current manager name.
Returns:
-
str
: A formatted string containing the current manager name.
get_link_api_object(
link_name: str,
lab_hash: str = None,
lab_name: str = None,
all_users: bool = False
) → Network
Return the corresponding API object of a collision domain in a network scenario.
Args:
-
link_name
(str): The name of the collision domain. -
lab_hash
(str): The hash of the network scenario. Can be used as an alternative to lab_name. If None, lab_name should be set. -
lab_name
(str): The name of the network scenario. Can be used as an alternative to lab_name. If None, lab_hash should be set. -
all_users
(bool): If True, return information about collision domains of all users.
Returns:
-
docker.models.networks.Network
: Docker API object of the network.
Raises:
-
InvocationError
: If a running network scenario hash or name is not specified. -
LinkNotFoundError
: If the collision domain is not found.
get_link_stats(
link_name: str,
lab_hash: str = None,
lab_name: str = None,
all_users: bool = False
) → Generator[Kathara.manager.docker.stats.DockerLinkStats.DockerLinkStats, NoneType, NoneType]
Return information of the specified deployed network in a specified network scenario.
Args:
-
link_name
(str): The link name. -
lab_hash
(str): The hash of the network scenario. Can be used as an alternative to lab_name. If None, lab_name should be set. -
lab_name
(str): The name of the network scenario. Can be used as an alternative to lab_hash. If None, lab_hash should be set. -
all_users
(bool): If True, search the network among all the users networks.
Returns:
-
Generator[DockerLinkStats, None, None]
: A generator containing DockerLinkStats objects with the network statistics.
Raises:
-
InvocationError
: If a running network scenario hash or name is not specified.
get_links_api_objects(
lab_hash: str = None,
lab_name: str = None,
all_users: bool = False
) → List[docker.models.networks.Network]
Return API objects of collision domains in a network scenario.
Args:
-
lab_hash
(str): The hash of the network scenario. Can be used as an alternative to lab_name. -
lab_name
(str): The name of the network scenario. Can be used as an alternative to lab_name. -
all_users
(bool): If True, return information about collision domains of all users.
Returns:
-
List[docker.models.networks.Network]
: Docker API objects of networks.
get_links_stats(
lab_hash: str = None,
lab_name: str = None,
link_name: str = None,
all_users: bool = False
) → Generator[Dict[str, Kathara.manager.docker.stats.DockerLinkStats.DockerLinkStats], NoneType, NoneType]
Return information about deployed Docker networks.
Args:
-
lab_hash
(str): The hash of the network scenario. Can be used as an alternative to lab_name. -
lab_name
(str): The name of the network scenario. Can be used as an alternative to lab_hash. -
link_name
(str): If specified return all the networks with link_name. -
all_users
(bool): If True, return information about the networks of all users.
Returns:
-
Generator[Dict[str, DockerLinkStats], None, None]
: A generator containing dicts that has API Object identifier as keys and DockerLinksStats objects as values.
get_machines_api_objects(
lab_hash: str = None,
lab_name: str = None,
all_users: bool = False
) → List[docker.models.containers.Container]
Return API objects of running devices.
Args:
-
lab_hash
(str): The hash of the network scenario. Can be used as an alternative to lab_name. -
lab_name
(str): The name of the network scenario. Can be used as an alternative to lab_name. -
all_users
(bool): If True, return information about devices of all users.
Returns:
-
List[docker.models.containers.Container]
: Docker API objects of devices.
Website: kathara.org
Contact us: contact@kathara.org