X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Futil%2Fnetgraph.py;fp=src%2Fnepi%2Futil%2Fnetgraph.py;h=dfa089750db465489da60f2d9dda9355abb540f7;hb=feb18eb5ff86f1b1fbc9158ca6d5f89f948cb389;hp=0b790b37b7f8c14d4ec27d4d4859157014dd40ce;hpb=2e262c488360bcc47d0e5c610715af952debfe84;p=nepi.git diff --git a/src/nepi/util/netgraph.py b/src/nepi/util/netgraph.py index 0b790b37..dfa08975 100644 --- a/src/nepi/util/netgraph.py +++ b/src/nepi/util/netgraph.py @@ -72,14 +72,14 @@ class NetGraph(object): :param assign_st: Select source and target nodes on the graph. :type assign_st: bool - :param sources_targets: dictionary with the list of sources (key = + :param sources_targets: dictionary with the list of sources (key = "sources") and list of targets (key = "targets") if defined, ignore assign_st - :type sources_targets: dictionary of lists + :type sources_targets: dictionary of lists - :param leaf_source: if True, random sources will be selected only + :param leaf_source: if True, random sources will be selected only from leaf nodes. - :type leaf_source: bool + :type leaf_source: bool NOTE: Only point-to-point like network topologies are supported for now. (Wireless and Ethernet networks were several nodes share the same @@ -107,11 +107,11 @@ class NetGraph(object): self.assign_p2p_ips(network = network, prefix = prefix, version = version) - sources_targets = kwargs.get("sources_targets") - if sources_targets: + sources_targets = kwargs.get("sources_targets") + if sources_targets: [self.set_source(n) for n in sources_targets["sources"]] - [self.set_target(n) for n in sources_targets["targets"]] - elif kwargs.get("assign_st"): + [self.set_target(n) for n in sources_targets["targets"]] + elif kwargs.get("assign_st"): self.select_target_zero() self.select_random_source(is_leaf = kwargs.get("leaf_source"))