Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
re6stnet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
zhifan huang
re6stnet
Commits
fb7ee67d
Commit
fb7ee67d
authored
Jul 12, 2022
by
zhifan huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: move connect test function, and typo
parent
bc2fafa1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
22 deletions
+18
-22
re6st/tests/test_network/network_build.py
re6st/tests/test_network/network_build.py
+18
-22
No files found.
re6st/tests/test_network/network_build.py
View file @
fb7ee67d
...
...
@@ -8,7 +8,8 @@ from pathlib2 import Path
DEMO_PATH
=
Path
(
__file__
).
resolve
().
parent
.
parent
.
parent
.
parent
/
"demo"
fix_file
=
DEMO_PATH
/
"fixnemu.py"
execfile
(
str
(
fix_file
))
# execfile(str(fix_file)) Removed in python3
exec
(
open
(
str
(
fix_file
)).
read
())
IPTABLES
=
'iptables-nft'
class
Node
(
nemu
.
Node
):
...
...
@@ -50,19 +51,13 @@ class NetManager(object):
def
__init__
(
self
):
self
.
object
=
[]
self
.
registries
=
{}
def
connectible_test
(
nm
):
def
connectable_test
(
self
):
"""test each node can ping to their registry
Args:
nm: NetManger
Raise:
AssertionError
"""
for
reg
in
nm
.
registries
:
for
node
in
nm
.
registries
[
reg
]
:
for
reg
,
nodes
in
self
.
registries
.
items
()
:
for
node
in
nodes
:
app0
=
node
.
Popen
([
"ping"
,
"-c"
,
"1"
,
reg
.
ip
],
stdout
=
PIPE
)
ret
=
app0
.
wait
()
if
ret
:
...
...
@@ -71,6 +66,7 @@ def connectible_test(nm):
logging
.
debug
(
"each node can ping to their registry"
)
def
net_route
():
"""build a network connect by a route(bridge)
...
...
@@ -93,7 +89,7 @@ def net_route():
nm
.
object
.
append
(
switch1
)
nm
.
registries
[
registry
]
=
[
machine1
,
machine2
]
connectible_test
(
nm
)
nm
.
connectable_test
(
)
return
nm
def
net_demo
():
...
...
@@ -177,7 +173,7 @@ def net_demo():
stdout
=
PIPE
,
stderr
=
PIPE
)
switch1
.
up
=
switch2
.
up
=
switch3
.
up
=
True
connectible_test
(
nm
)
nm
.
connectable_test
(
)
return
nm
def
network_direct
():
...
...
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