Use name from topology in container name

This commit is contained in:
Théophile Bastian 2022-03-08 15:21:14 +01:00
parent 21afacc96c
commit 9a5b6a996d

View file

@ -35,7 +35,7 @@ def requires_id_in_link_range(func):
class Topology:
""" A generic network topology """
"""A generic network topology"""
class InvalidConfiguration(Exception):
def __init__(self, reason):
@ -58,9 +58,9 @@ class Topology:
@requires_parsed
@requires_id_in_link_range
def net_setstate_single(self, link_id, state, verbose=False, verbose_inline=False):
""" Start or stop a single network.
* `net_id`: the link to be affected
* `verbose`: if true, prints progress
"""Start or stop a single network.
* `net_id`: the link to be affected
* `verbose`: if true, prints progress
"""
link = self.links[link_id]
@ -91,9 +91,9 @@ class Topology:
@requires_parsed
@requires_id_in_dom_range
def dom_setstate_single(self, dom_id, state, verbose=False, verbose_inline=False):
""" Start or stop a single domain.
* `dom_id`: the domain to be affected
* `verbose`: if true, prints progress
"""Start or stop a single domain.
* `dom_id`: the domain to be affected
* `verbose`: if true, prints progress
"""
dom = self.domains[dom_id]
@ -135,8 +135,8 @@ class Topology:
@requires_parsed
def net_setstate(self, state, verbose=False):
""" Start or stop the networks.
* `verbose`: if true, prints progress
"""Start or stop the networks.
* `verbose`: if true, prints progress
"""
if verbose:
@ -151,8 +151,8 @@ class Topology:
@requires_parsed
def dom_setstate(self, state, verbose=False):
""" Start or stop the domains.
* `verbose`: if true, prints progress
"""Start or stop the domains.
* `verbose`: if true, prints progress
"""
if verbose:
@ -188,9 +188,9 @@ del requires_parsed
class YamlTopology(Topology):
""" Parse a YAML description of a network topology. The networks' links and domains
"""Parse a YAML description of a network topology. The networks' links and domains
are contained in the `links` and `domains` attributes, but their `create` methods
are not called. """
are not called."""
def __init__(self, path, conn):
super().__init__(conn)
@ -215,7 +215,8 @@ class YamlTopology(Topology):
)
cur_link = network.Network(
self.conn, enable_v4=link_conf.get("enable_v4", True),
self.conn,
enable_v4=link_conf.get("enable_v4", True),
)
self.links.append(cur_link)
@ -246,6 +247,7 @@ class YamlTopology(Topology):
self.conn,
dom_descr[dom]["links"],
enable_v4=dom_descr[dom].get("enable_v4", True),
name=dom,
)
for dom in sorted_dom_names
]