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
c59ac309
Commit
c59ac309
authored
May 21, 2010
by
Martín Ferrari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more test; change in API for tunnels
parent
eb1a7279
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
sample-api.py
sample-api.py
+2
-1
t/interfaces.py
t/interfaces.py
+18
-1
No files found.
sample-api.py
View file @
c59ac309
...
...
@@ -21,7 +21,8 @@ print "Nodes started with pids: %d and %d" % (a.pid, b.pid)
# interface object maps to a veth pair with one end in a netns
if0
=
a
.
add_if
(
mac_address
=
'42:71:e0:90:ca:42'
)
if1
=
b
.
add_if
(
mtu
=
1492
)
if2
=
b
.
add_tunnel_if
()
# tun device, for connecting to the outside world
# for using with a tun device, to connect to the outside world
if2
=
b
.
import_if
(
'tun0'
)
# each Link is a linux bridge, all the parameters are applied to the associated
# interfaces as tc qdiscs.
...
...
t/interfaces.py
View file @
c59ac309
...
...
@@ -9,7 +9,24 @@ class TestInterfaces(unittest.TestCase):
# def setUp(self):
# pass
def
test_interfaces
(
self
):
pass
node0
=
netns
.
Node
()
if0
=
a
.
add_if
(
mac_address
=
'42:71:e0:90:ca:42'
,
mtu
=
1492
)
self
.
assertEquals
(
if0
.
mac_address
,
'42:71:e0:90:ca:42'
)
if0
.
mac_address
=
'4271E090CA42'
self
.
assertEquals
(
if0
.
mac_address
,
'42:71:e0:90:ca:42'
)
self
.
assertRaises
(
BaseException
,
setattr
,
if0
,
'mac_address'
,
'foo'
)
self
.
assertRaises
(
BaseException
,
setattr
,
if0
,
'mac_address'
,
'12345678901'
)
self
.
assertEquals
(
if0
.
mtu
,
1492
)
self
.
assertRaises
(
BaseException
,
setattr
,
if0
,
'mtu'
,
0
)
self
.
assertRaises
(
BaseException
,
setattr
,
if0
,
'mtu'
,
65537
)
# FIXME: run-time tests
dummyname
=
"dummy%d"
%
os
.
getpid
()
self
.
assertEquals
(
os
.
system
(
"ip link add name %s type dummy"
%
dummyname
),
0
)
if1
=
a
.
import_if
(
dummyname
)
if
__name__
==
'__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