Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
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
Kirill Smelkov
bcc
Commits
ab4ca4cb
Commit
ab4ca4cb
authored
Aug 27, 2015
by
Brenden Blanco
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #168 from iovisor/weichunc_dev
Add gretap support for full mesh tunnel
parents
ef3b5d9d
3fe56c3c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
12 deletions
+29
-12
examples/distributed_bridge/main.py
examples/distributed_bridge/main.py
+15
-5
examples/distributed_bridge/tunnel_mesh.py
examples/distributed_bridge/tunnel_mesh.py
+14
-7
No files found.
examples/distributed_bridge/main.py
View file @
ab4ca4cb
...
@@ -9,12 +9,22 @@ from simulation import Simulation
...
@@ -9,12 +9,22 @@ from simulation import Simulation
from
subprocess
import
PIPE
,
call
,
Popen
from
subprocess
import
PIPE
,
call
,
Popen
import
re
import
re
dhcp
=
0
multicast
=
1
multicast
=
1
if
len
(
argv
)
>
1
and
argv
[
1
]
==
"mesh"
:
dhcp
=
0
gretap
=
0
if
"mesh"
in
argv
:
multicast
=
0
multicast
=
0
if
len
(
argv
)
>
2
and
argv
[
2
]
==
"dhcp"
:
if
"dhcp"
in
argv
:
dhcp
=
1
dhcp
=
1
multicast
=
0
if
"gretap"
in
argv
:
gretap
=
1
multicast
=
0
print
(
"multicast %d dhcp %d gretap %d"
%
(
multicast
,
dhcp
,
gretap
))
ipr
=
IPRoute
()
ipr
=
IPRoute
()
ipdb
=
IPDB
(
nl
=
ipr
)
ipdb
=
IPDB
(
nl
=
ipr
)
...
@@ -37,7 +47,7 @@ class TunnelSimulation(Simulation):
...
@@ -37,7 +47,7 @@ class TunnelSimulation(Simulation):
if
multicast
:
if
multicast
:
cmd
=
[
"python"
,
"tunnel.py"
,
str
(
i
)]
cmd
=
[
"python"
,
"tunnel.py"
,
str
(
i
)]
else
:
else
:
cmd
=
[
"python"
,
"tunnel_mesh.py"
,
str
(
num_hosts
),
str
(
i
),
str
(
dhcp
)]
cmd
=
[
"python"
,
"tunnel_mesh.py"
,
str
(
num_hosts
),
str
(
i
),
str
(
dhcp
)
,
str
(
gretap
)
]
p
=
NSPopen
(
host_info
[
i
][
0
].
nl
.
netns
,
cmd
,
stdin
=
PIPE
)
p
=
NSPopen
(
host_info
[
i
][
0
].
nl
.
netns
,
cmd
,
stdin
=
PIPE
)
self
.
processes
.
append
(
p
)
self
.
processes
.
append
(
p
)
with
self
.
ipdb
.
create
(
ifname
=
"br-fabric"
,
kind
=
"bridge"
)
as
br
:
with
self
.
ipdb
.
create
(
ifname
=
"br-fabric"
,
kind
=
"bridge"
)
as
br
:
...
...
examples/distributed_bridge/tunnel_mesh.py
View file @
ab4ca4cb
...
@@ -17,6 +17,7 @@ from subprocess import call, Popen, PIPE
...
@@ -17,6 +17,7 @@ from subprocess import call, Popen, PIPE
num_hosts
=
int
(
argv
[
1
])
num_hosts
=
int
(
argv
[
1
])
host_id
=
int
(
argv
[
2
])
host_id
=
int
(
argv
[
2
])
dhcp
=
int
(
argv
[
3
])
dhcp
=
int
(
argv
[
3
])
gretap
=
int
(
argv
[
4
])
b
=
BPF
(
src_file
=
"tunnel_mesh.c"
)
b
=
BPF
(
src_file
=
"tunnel_mesh.c"
)
ingress_fn
=
b
.
load_func
(
"handle_ingress"
,
BPF
.
SCHED_CLS
)
ingress_fn
=
b
.
load_func
(
"handle_ingress"
,
BPF
.
SCHED_CLS
)
...
@@ -38,9 +39,15 @@ d_serv = []
...
@@ -38,9 +39,15 @@ d_serv = []
d_client
=
[]
d_client
=
[]
def
run
():
def
run
():
if
gretap
:
with
ipdb
.
create
(
ifname
=
"gretap1"
,
kind
=
"gretap"
,
gre_ikey
=
0
,
gre_okey
=
0
,
gre_local
=
'172.16.1.%d'
%
(
100
+
host_id
),
gre_ttl
=
16
,
gre_collect_metadata
=
1
)
as
vx
:
vx
.
up
()
ifc_gc
.
append
(
vx
.
ifname
)
else
:
with
ipdb
.
create
(
ifname
=
"vxlan0"
,
kind
=
"vxlan"
,
vxlan_id
=
0
,
with
ipdb
.
create
(
ifname
=
"vxlan0"
,
kind
=
"vxlan"
,
vxlan_id
=
0
,
vxlan_link
=
ifc
,
vxlan_port
=
htons
(
4789
),
vxlan_link
=
ifc
,
vxlan_port
=
htons
(
4789
),
vxlan_flowbased
=
True
,
vxlan_collect_metadata
=
True
,
vxlan_collect_metadata
=
True
,
vxlan_learning
=
False
)
as
vx
:
vxlan_learning
=
False
)
as
vx
:
vx
.
up
()
vx
.
up
()
...
...
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