Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
925be39a
Commit
925be39a
authored
Jul 7, 2015
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
python benchmark: add ipv6, ip forwarding
parent
a10ba600
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
tools/python/tests/benchmark.py
+3
-3
3 additions, 3 deletions
tools/python/tests/benchmark.py
tools/python/tests/dhtnetwork.py
+7
-4
7 additions, 4 deletions
tools/python/tests/dhtnetwork.py
tools/python/tests/dummy_if.py
+8
-3
8 additions, 3 deletions
tools/python/tests/dummy_if.py
with
18 additions
and
10 deletions
tools/python/tests/benchmark.py
+
3
−
3
View file @
925be39a
...
@@ -37,7 +37,7 @@ procs = [None for _ in range(clusters)]
...
@@ -37,7 +37,7 @@ procs = [None for _ in range(clusters)]
try
:
try
:
for
i
in
range
(
clusters
):
for
i
in
range
(
clusters
):
procs
[
i
]
=
NSPopen
(
'
node
'
+
str
(
i
),
[
"
python3
"
,
"
dhtnetwork.py
"
,
"
-n
"
,
str
(
node_per_loc
),
"
-b
"
,
bootstrap
.
ip4
+
'
:4000
'
,
'
-I
'
,
args
.
ifname
+
str
(
i
)
+
'
.1
'
])
procs
[
i
]
=
NSPopen
(
'
node
'
+
str
(
i
),
[
"
python3
"
,
"
dhtnetwork.py
"
,
"
-n
"
,
str
(
node_per_loc
),
"
-b
"
,
bootstrap
.
ip4
,
"
-b6
"
,
bootstrap
.
ip6
,
'
-I
'
,
args
.
ifname
+
str
(
i
)
+
'
.1
'
])
plt
.
pause
(
2
)
plt
.
pause
(
2
)
plt
.
ion
()
plt
.
ion
()
...
@@ -86,7 +86,7 @@ try:
...
@@ -86,7 +86,7 @@ try:
procs
[
n
].
release
()
procs
[
n
].
release
()
except
:
except
:
pass
pass
procs
[
n
]
=
NSPopen
(
'
node
'
+
str
(
n
),
[
"
python3
"
,
"
dhtnetwork.py
"
,
"
-n
"
,
str
(
node_per_loc
),
"
-b
"
,
bootstrap
.
ip4
+
'
:4000
'
,
'
-I
'
,
args
.
ifname
+
str
(
n
)
+
'
.1
'
])
procs
[
n
]
=
NSPopen
(
'
node
'
+
str
(
n
),
[
"
python3
"
,
"
dhtnetwork.py
"
,
"
-n
"
,
str
(
node_per_loc
),
"
-b
"
,
bootstrap
.
ip4
,
"
-b6
"
,
bootstrap
.
ip6
,
'
-I
'
,
args
.
ifname
+
str
(
n
)
+
'
.1
'
])
plt
.
pause
(
5
)
plt
.
pause
(
5
)
...
@@ -98,7 +98,7 @@ try:
...
@@ -98,7 +98,7 @@ try:
#nnodes = (n+1)*args.node_num
#nnodes = (n+1)*args.node_num
#net.resize(nnodes)
#net.resize(nnodes)
#time.sleep(2.5)
#time.sleep(2.5)
#
replace_cluster()
replace_cluster
()
print
(
"
Getting 10 random hashes succesively.
"
)
print
(
"
Getting 10 random hashes succesively.
"
)
for
i
in
range
(
50
):
for
i
in
range
(
50
):
#net.replace_node()
#net.replace_node()
...
...
This diff is collapsed.
Click to expand it.
tools/python/tests/dhtnetwork.py
+
7
−
4
View file @
925be39a
...
@@ -49,8 +49,6 @@ class DhtNetwork(object):
...
@@ -49,8 +49,6 @@ class DhtNetwork(object):
self
.
ip6
=
ip6
if
ip6
else
ips
[
1
]
self
.
ip6
=
ip6
if
ip6
else
ips
[
1
]
self
.
bootstrap
=
bootstrap
self
.
bootstrap
=
bootstrap
#print(self.ip4, self.ip6, self.port)
#print(self.ip4, self.ip6, self.port)
#self.bootstrap_node = DhtNetwork.run_node(self.ip4, self.ip6, self.port+1, [(self.ip4, str(self.port))])[1]
#self.port += 1
def
front
(
self
):
def
front
(
self
):
if
len
(
self
.
nodes
)
==
0
:
if
len
(
self
.
nodes
)
==
0
:
...
@@ -111,11 +109,16 @@ if __name__ == '__main__':
...
@@ -111,11 +109,16 @@ if __name__ == '__main__':
parser
.
add_argument
(
'
-I
'
,
'
--iface
'
,
help
=
'
local interface to bind
'
,
default
=
'
any
'
)
parser
.
add_argument
(
'
-I
'
,
'
--iface
'
,
help
=
'
local interface to bind
'
,
default
=
'
any
'
)
parser
.
add_argument
(
'
-p
'
,
'
--port
'
,
help
=
'
start of port range (port, port+node_num)
'
,
type
=
int
,
default
=
4000
)
parser
.
add_argument
(
'
-p
'
,
'
--port
'
,
help
=
'
start of port range (port, port+node_num)
'
,
type
=
int
,
default
=
4000
)
parser
.
add_argument
(
'
-b
'
,
'
--bootstrap
'
,
help
=
'
bootstrap address
'
)
parser
.
add_argument
(
'
-b
'
,
'
--bootstrap
'
,
help
=
'
bootstrap address
'
)
parser
.
add_argument
(
'
-b6
'
,
'
--bootstrap6
'
,
help
=
'
bootstrap address (IPv6)
'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
#ips = find_ip(args.iface)
bs
=
[]
if
args
.
bootstrap
:
bs
.
append
((
args
.
bootstrap
,
str
(
4000
)))
if
args
.
bootstrap6
:
bs
.
append
((
args
.
bootstrap6
,
str
(
4000
)))
net
=
DhtNetwork
(
iface
=
args
.
iface
,
port
=
args
.
port
,
bootstrap
=
[
args
.
bootstrap
.
split
(
'
:
'
)]
if
args
.
bootstrap
else
[])
net
=
DhtNetwork
(
iface
=
args
.
iface
,
port
=
args
.
port
,
bootstrap
=
bs
if
args
.
bootstrap
else
[])
net
.
resize
(
args
.
node_num
)
net
.
resize
(
args
.
node_num
)
with
lock
:
with
lock
:
...
...
This diff is collapsed.
Click to expand it.
tools/python/tests/dummy_if.py
+
8
−
3
View file @
925be39a
#!/usr/bin/env python3
#!/usr/bin/env python3
import
argparse
,
subprocess
from
pyroute2
import
IPDB
,
NetNS
from
pyroute2
import
IPDB
,
NetNS
from
pyroute2.netns.process.proxy
import
NSPopen
from
pyroute2.netns.process.proxy
import
NSPopen
import
argparse
,
subprocess
parser
=
argparse
.
ArgumentParser
(
description
=
'
Create a dummy network interface for testing
'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'
Create a dummy network interface for testing
'
)
parser
.
add_argument
(
'
-i
'
,
'
--ifname
'
,
help
=
'
interface name
'
,
default
=
'
ethdht
'
)
parser
.
add_argument
(
'
-i
'
,
'
--ifname
'
,
help
=
'
interface name
'
,
default
=
'
ethdht
'
)
...
@@ -49,7 +50,8 @@ try:
...
@@ -49,7 +50,8 @@ try:
iface
=
args
.
ifname
+
str
(
ifn
)
iface
=
args
.
ifname
+
str
(
ifn
)
i
.
add_port
(
ip
.
interfaces
[
iface
])
i
.
add_port
(
ip
.
interfaces
[
iface
])
i
.
add_port
(
ip
.
interfaces
[
'
tap
'
+
args
.
ifname
])
i
.
add_port
(
ip
.
interfaces
[
'
tap
'
+
args
.
ifname
])
i
.
add_ip
(
'
10.0.42.1/24
'
)
# the same as i.add_ip('10.0.0.1', 24)
i
.
add_ip
(
local_addr4
+
'
1/24
'
)
# the same as i.add_ip('10.0.0.1', 24)
i
.
add_ip
(
local_addr6
+
'
1/24
'
)
i
.
up
()
i
.
up
()
with
ip
.
interfaces
[
'
tap
'
+
args
.
ifname
]
as
tap
:
with
ip
.
interfaces
[
'
tap
'
+
args
.
ifname
]
as
tap
:
...
@@ -72,7 +74,7 @@ try:
...
@@ -72,7 +74,7 @@ try:
lo
.
up
()
lo
.
up
()
with
ip_ns
.
interfaces
[
iface1
]
as
i
:
with
ip_ns
.
interfaces
[
iface1
]
as
i
:
i
.
add_ip
(
local_addr4
+
str
(
ifn
+
8
)
+
'
/24
'
)
i
.
add_ip
(
local_addr4
+
str
(
ifn
+
8
)
+
'
/24
'
)
#
i.add_ip(local_addr6+str(ifn+8)+'/
8
')
i
.
add_ip
(
local_addr6
+
str
(
ifn
+
8
)
+
'
/
64
'
)
i
.
up
()
i
.
up
()
finally
:
finally
:
ip_ns
.
release
()
ip_ns
.
release
()
...
@@ -83,6 +85,9 @@ try:
...
@@ -83,6 +85,9 @@ try:
nsp
.
wait
()
nsp
.
wait
()
nsp
.
release
()
nsp
.
release
()
subprocess
.
call
([
"
sysctl
"
,
"
-w
"
,
"
net.ipv4.conf.
"
+
brige_name
+
"
.forwarding=1
"
])
subprocess
.
call
([
"
sysctl
"
,
"
-w
"
,
"
net.ipv6.conf.
"
+
brige_name
+
"
.forwarding=1
"
])
except
Exception
as
e
:
except
Exception
as
e
:
print
(
'
Error
'
,
e
)
print
(
'
Error
'
,
e
)
finally
:
finally
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment