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
57a7a20f
Commit
57a7a20f
authored
Jul 23, 2010
by
Martín Ferrari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A test with bridging.
parent
47dac15d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
src/netns/interface.py
src/netns/interface.py
+3
-0
t/test_core.py
t/test_core.py
+21
-0
No files found.
src/netns/interface.py
View file @
57a7a20f
...
@@ -315,11 +315,14 @@ class Link(ExternalInterface):
...
@@ -315,11 +315,14 @@ class Link(ExternalInterface):
self
.
disconnect
(
p
)
self
.
disconnect
(
p
)
except
:
except
:
pass
pass
self
.
up
=
False
netns
.
iproute
.
del_bridge
(
self
.
index
)
netns
.
iproute
.
del_bridge
(
self
.
index
)
def
connect
(
self
,
iface
):
def
connect
(
self
,
iface
):
assert
iface
.
control
.
index
not
in
self
.
_ports
assert
iface
.
control
.
index
not
in
self
.
_ports
netns
.
iproute
.
add_bridge_port
(
self
.
index
,
iface
.
control
.
index
)
netns
.
iproute
.
add_bridge_port
(
self
.
index
,
iface
.
control
.
index
)
# FIXME: up/down, mtu, etc should be automatically propagated?
iface
.
control
.
up
=
True
self
.
_ports
.
add
(
iface
.
control
.
index
)
self
.
_ports
.
add
(
iface
.
control
.
index
)
def
disconnect
(
self
,
iface
):
def
disconnect
(
self
,
iface
):
...
...
t/test_core.py
View file @
57a7a20f
...
@@ -44,5 +44,26 @@ class TestGlobal(unittest.TestCase):
...
@@ -44,5 +44,26 @@ class TestGlobal(unittest.TestCase):
self
.
assertEquals
(
a1
.
wait
(),
0
)
self
.
assertEquals
(
a1
.
wait
(),
0
)
self
.
assertEquals
(
a2
.
wait
(),
0
)
self
.
assertEquals
(
a2
.
wait
(),
0
)
@
test_util
.
skipUnless
(
os
.
getuid
()
==
0
,
"Test requires root privileges"
)
def
test_run_ping_bridging
(
self
):
n1
=
netns
.
Node
()
n2
=
netns
.
Node
()
i1
=
n1
.
add_if
()
i2
=
n2
.
add_if
()
i1
.
up
=
i2
.
up
=
True
l
=
netns
.
Link
()
l
.
connect
(
i1
)
l
.
connect
(
i2
)
l
.
up
=
True
i1
.
add_v4_address
(
'10.0.0.1'
,
24
)
i2
.
add_v4_address
(
'10.0.0.2'
,
24
)
null
=
file
(
'/dev/null'
,
'wb'
)
# the bridge seems to be quite slow!
a1
=
n1
.
Popen
([
'ping'
,
'-qc1'
,
'-w20'
,
'10.0.0.2'
],
stdout
=
null
)
a2
=
n2
.
Popen
([
'ping'
,
'-qc1'
,
'-w20'
,
'10.0.0.1'
],
stdout
=
null
)
self
.
assertEquals
(
a1
.
wait
(),
0
)
self
.
assertEquals
(
a2
.
wait
(),
0
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
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