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
780ce481
Commit
780ce481
authored
Aug 12, 2015
by
Wei-Chun Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
distributed_bridge: check ip address before validating traffic
Signed-off-by:
Wei-Chun Chao
<
weichunc@plumgrid.com
>
parent
a0e58e06
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
examples/distributed_bridge/main.py
examples/distributed_bridge/main.py
+8
-5
No files found.
examples/distributed_bridge/main.py
View file @
780ce481
...
@@ -6,7 +6,7 @@ from sys import argv
...
@@ -6,7 +6,7 @@ from sys import argv
from
builtins
import
input
from
builtins
import
input
from
pyroute2
import
IPRoute
,
NetNS
,
IPDB
,
NSPopen
from
pyroute2
import
IPRoute
,
NetNS
,
IPDB
,
NSPopen
from
simulation
import
Simulation
from
simulation
import
Simulation
from
subprocess
import
PIPE
,
call
from
subprocess
import
PIPE
,
call
,
Popen
if
len
(
argv
)
>
1
and
argv
[
1
]
==
"mesh"
:
if
len
(
argv
)
>
1
and
argv
[
1
]
==
"mesh"
:
multicast
=
0
multicast
=
0
...
@@ -43,10 +43,13 @@ class TunnelSimulation(Simulation):
...
@@ -43,10 +43,13 @@ class TunnelSimulation(Simulation):
print
(
"Validating connectivity"
)
print
(
"Validating connectivity"
)
for
i
in
range
(
1
,
num_hosts
):
for
i
in
range
(
1
,
num_hosts
):
for
j
in
range
(
0
,
2
):
for
j
in
range
(
0
,
2
):
out
=
1
retry
=
-
1
while
out
:
while
retry
<
0
:
out
=
call
([
"ip"
,
"netns"
,
"exec"
,
"host%d"
%
i
,
check
=
Popen
([
"ip"
,
"netns"
,
"exec"
,
"host%d"
%
i
,
"ip"
,
"addr"
,
"show"
,
"br%d"
%
j
],
stdout
=
null
,
stderr
=
null
)
"ip"
,
"addr"
,
"show"
,
"br%d"
%
j
],
stdout
=
PIPE
,
stderr
=
PIPE
)
out
=
check
.
stdout
.
read
()
checkip
=
"99.1.%d.%d"
%
(
j
,
i
+
1
)
retry
=
out
.
find
(
checkip
)
print
(
"VNI%d between host0 and host%d"
%
(
10000
+
j
,
i
))
print
(
"VNI%d between host0 and host%d"
%
(
10000
+
j
,
i
))
call
([
"ip"
,
"netns"
,
"exec"
,
"host%d"
%
i
,
call
([
"ip"
,
"netns"
,
"exec"
,
"host%d"
%
i
,
"ping"
,
"99.1.%d.1"
%
j
,
"-c"
,
"3"
,
"-i"
,
"0.2"
,
"-q"
])
"ping"
,
"99.1.%d.1"
%
j
,
"-c"
,
"3"
,
"-i"
,
"0.2"
,
"-q"
])
...
...
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