Skip to content

Commit

Permalink
distributed_bridge: check ip address before validating traffic
Browse files Browse the repository at this point in the history
Signed-off-by: Wei-Chun Chao <[email protected]>
  • Loading branch information
weichunc committed Aug 13, 2015
1 parent a0e58e0 commit 780ce48
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions examples/distributed_bridge/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from builtins import input
from pyroute2 import IPRoute, NetNS, IPDB, NSPopen
from simulation import Simulation
from subprocess import PIPE, call
from subprocess import PIPE, call, Popen

if len(argv) > 1 and argv[1] == "mesh":
multicast = 0
Expand Down Expand Up @@ -43,10 +43,13 @@ def start(self):
print("Validating connectivity")
for i in range(1, num_hosts):
for j in range(0, 2):
out = 1
while out:
out = call(["ip", "netns", "exec", "host%d" % i,
"ip", "addr", "show", "br%d" % j], stdout=null, stderr=null)
retry = -1
while retry < 0:
check = Popen(["ip", "netns", "exec", "host%d" % i,
"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))
call(["ip", "netns", "exec", "host%d" % i,
"ping", "99.1.%d.1" % j, "-c", "3", "-i", "0.2", "-q"])
Expand Down

0 comments on commit 780ce48

Please sign in to comment.