Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nemu3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
nemu3
Commits
ed14e260
Commit
ed14e260
authored
Aug 04, 2010
by
Martín Ferrari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some more tests. Fix for the bug found after those :)
parent
de652f18
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
src/netns/interface.py
src/netns/interface.py
+3
-3
t/test_link.py
t/test_link.py
+9
-1
No files found.
src/netns/interface.py
View file @
ed14e260
...
...
@@ -351,7 +351,7 @@ class Link(ExternalInterface):
def
disconnect
(
self
,
iface
):
assert
iface
.
control
.
index
in
self
.
_ports
netns
.
iproute
.
del_bridge_port
(
self
.
index
,
iface
.
control
.
index
)
netns
.
iproute
.
clear_tc
(
self
.
index
)
self
.
_apply_parameters
({},
iface
.
control
)
del
self
.
_ports
[
iface
.
control
.
index
]
def
set_parameters
(
self
,
bandwidth
=
None
,
...
...
@@ -375,6 +375,6 @@ class Link(ExternalInterface):
self
.
_parameters
=
parameters
def
_apply_parameters
(
self
,
parameters
,
port
=
None
):
for
i
in
[
port
]
if
port
else
self
.
_ports
:
netns
.
iproute
.
set_tc
(
self
.
index
,
**
parameters
)
for
i
in
[
port
]
if
port
else
self
.
_ports
.
values
()
:
netns
.
iproute
.
set_tc
(
i
.
index
,
**
parameters
)
t/test_link.py
View file @
ed14e260
...
...
@@ -4,7 +4,7 @@
import
os
,
unittest
import
netns
,
test_util
class
Test
Global
(
unittest
.
TestCase
):
class
Test
Link
(
unittest
.
TestCase
):
@
test_util
.
skipUnless
(
os
.
getuid
()
==
0
,
"Test requires root privileges"
)
def
test_link
(
self
):
n1
=
netns
.
Node
()
...
...
@@ -30,6 +30,14 @@ class TestGlobal(unittest.TestCase):
ifdata
=
netns
.
iproute
.
get_if_data
()[
0
]
self
.
assertEquals
(
ifdata
[
i1
.
control
.
index
].
up
,
True
,
"UP propagation"
)
self
.
assertEquals
(
ifdata
[
i2
.
control
.
index
].
up
,
True
,
"UP propagation"
)
# None => tbf
l
.
set_parameters
(
bandwidth
=
100
*
1024
*
1024
/
8
)
# 100 mbits
tcdata
=
netns
.
iproute
.
get_tc_data
()[
0
]
self
.
assertEquals
(
tcdata
[
i1
.
control
.
index
],
{
'bandwidth'
:
104858000
,
'qdiscs'
:
{
'tbf'
:
'1'
}})
self
.
assertEquals
(
tcdata
[
i2
.
control
.
index
],
{
'bandwidth'
:
104858000
,
'qdiscs'
:
{
'tbf'
:
'1'
}})
#bandwidth = 100*1024*1024/8, loss=10, loss_correlation=1,delay=0.001,dup_correlation=0.1);
# FIXME: more cases
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment