Skip to content

Commit 750b41f

Browse files
authored
Merge pull request #8 from vicitori/add_duplicate
Изменила источник mininet
2 parents bb953e8 + 41e35ce commit 750b41f

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

ipmininet/ipnet.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def addLink(self, node1: Node, node2: Node,
121121
igp_area: Optional[str] = None,
122122
igp_passive=False,
123123
v4_width=1, v6_width=1,
124+
duplicate: Optional[Union[str, float]] = None,
124125
*args, **params) -> IPLink:
125126
"""Register a link with additional properties
126127
@@ -142,12 +143,26 @@ def addLink(self, node1: Node, node2: Node,
142143
igp_metric = self.igp_metric
143144
if not igp_area:
144145
igp_area = self.igp_area
146+
147+
duplicate_val = None
148+
if isinstance(duplicate, str):
149+
duplicate_str = duplicate.strip()
150+
if duplicate_str.endswith('%'):
151+
duplicate_val = duplicate_str
152+
else:
153+
try:
154+
duplicate_val = float(duplicate_str)
155+
except ValueError:
156+
duplicate_val = None
157+
else:
158+
duplicate_val = duplicate
145159
# Register all link properties
146160
props = {'igp_metric': igp_metric,
147161
'igp_area': igp_area,
148162
'igp_passive': igp_passive,
149163
'v4_width': v4_width,
150-
'v6_width': v6_width}
164+
'v6_width': v6_width,
165+
'duplicate': duplicate_val}
151166
# Update interface properties with link properties
152167
for pstr in ('params1', 'params2'):
153168
try:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ version = "1.1"
88
description = "A mininet extension providing components to emulate IPnetworks running multiple protocols."
99
keywords = [ "networking", "OSPF", "IP", "BGP", "quagga", "mininet",]
1010
classifiers = [ "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", "Programming Language :: Python", "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Topic :: System :: Networking", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9",]
11-
dependencies = [ "setuptools", "mako>=1.1,<1.2", "mininet @ git+https://github.com/mininet/mininet@2.3.0",]
11+
dependencies = [ "setuptools", "mako>=1.1,<1.2", "mininet @ git+https://github.com/mimi-net/mininet.git",]
1212

1313
[[project.authors]]
1414
name = "Olivier Tilmans"

0 commit comments

Comments
 (0)