modified scripts to enable tap flow automatically with traffic generations,...

modified scripts to enable tap flow automatically with traffic generations, but the traffic is not being hit when using mz, debugging that
parent 55080508
......@@ -126,21 +126,14 @@ def monitor_devs_ng(fname="txrate.csv" , interval_sec=0.01):
(interval_sec * 1000, fname))
Popen(cmd, shell=True).wait()
def monitorInterfaces(net):
def monitorInterfacesInit(net):
monitors = []
#monitors.append(multiprocessing.Process(target=monitor_devs_ifstat,
# args=("rate.csv",)))
monitors.append(multiprocessing.Process(target=monitor_devs_ng,
args=('txrate.csv', 1,)))
for m in monitors:
m.start();
CLI(net)
for m in monitors:
m.terminate();
return monitors
def bandwidthTest(bw=5, controllerip="localhost"):
print bw
......@@ -160,23 +153,39 @@ def bandwidthTest(bw=5, controllerip="localhost"):
h3 = net.getNodeByName('h3')
monitoringHosts.append(h3)
print h3.name
#start ifstat in h1 and h3
#ifstat -i eth0 -t 1> test.log &
'''
for h in monitoringHosts:
if_cmd = 'ifstat -i %s-eth0 -t delay 2 > %s-eth0.log &' %(h.name, h.name)
print if_cmd
h.cmd(if_cmd)
'''
#populate l3 routes
net.pingAll();
monitorInterfaces(net);
'''
for h in monitoringHosts:
h.cmd('killall ifstat')
'''
monitors = monitorInterfacesInit(net);
for m in monitors:
m.start();
#CLI(net)
#start the traffic generation wait for 5 seconds (H1->H3)
tg_cmd = 'mz h1-eth0 -c 0 -t ip -A 10.0.0.1 -B 10.0.0.3 -P \"Hello World\" &'
print "Traffic generation from H1 started"
h1.cmd(tg_cmd)
sleep_time = 20
print "Sleeping for %d seconds before TAP is applied" % sleep_time
sleep(sleep_time)
#create the tap for s2-port(3)
#wait for 2 minutes for the rate-limiter to grow
p = Popen("./bwTestTapFlow.sh", shell=True)
CLI(net)
#stop the traffic generation
h1.cmd('killall mz')
print "Stopped traffic generation"
#generate the graph
for m in monitors:
m.terminate();
net.stop();
return
......
#!/bin/sh -x
HOST="localhost"
CMD="add"
TAPID=3
curl -d "{\
'dpid':'0000000000000002',\
'output':3,\
'vlan_id':100,\
'tapID': $TAPID \
}" http://$HOST:8080/policy/tap/e2etunnel/{$CMD}
......@@ -334,7 +334,7 @@ class TapPolicyController(ControllerBase):
match = ofp.OFPMatch(vlan_vid=tun_id)
ids_action = []
ids_action.append(ofp.OFPActionOutput(out_port)) #working
ids_action.append(ofp.OFPActionOutput(of.OFPP_CONTROLLER)) #working
#ids_action.append(ofp.OFPActionOutput(of.OFPP_CONTROLLER)) #working
inst = [ofp.OFPInstructionActions(of.OFPIT_APPLY_ACTIONS,
ids_action)] #working
self.mod_flow(dp, command=of.OFPFC_ADD, match=match, inst=inst)
......@@ -515,10 +515,12 @@ class TapPolicyController(ControllerBase):
#match.set_dl_type(ether.ETH_TYPE_IP)
match.set_vlan_vid(vlanid)
f = ofp.OFPMatchField.make(of.OXM_OF_VLAN_VID, out_vlanid)
action = []
action.append(ofp.OFPActionSetField(f)) #working
action.append(ofp.OFPActionOutput(outport))
action.append(ofp.OFPActionOutput(of.OFPP_CONTROLLER)) #working
#action = []
#action.append(ofp.OFPActionSetField(f)) #working
#action.append(ofp.OFPActionOutput(outport))
#action.append(ofp.OFPActionOutput(of.OFPP_CONTROLLER)) #working
action = [ofp.OFPActionPopVlan(),
ofp.OFPActionOutput(outport)]
inst = [ofp.OFPInstructionActions(of.OFPIT_APPLY_ACTIONS,
action)] #working
self.mod_flow(dp, command=of.OFPFC_ADD, match=match, inst=inst)
......@@ -661,7 +663,7 @@ class TapPolicyController(ControllerBase):
ids_action.append(ofp.OFPActionPushVlan(ethertype=ether.ETH_TYPE_8021Q))
ids_action.append(ofp.OFPActionSetField(f)) #working
ids_action.append(ofp.OFPActionOutput(ids_port)) #working
ids_action.append(ofp.OFPActionOutput(of.OFPP_CONTROLLER)) #working
#ids_action.append(ofp.OFPActionOutput(of.OFPP_CONTROLLER)) #working
inst = [ofp.OFPInstructionActions(of.OFPIT_APPLY_ACTIONS, ids_action)] #working
inst.append(meter_inst)
......
......@@ -45,7 +45,7 @@ class dynamicRateLimiter(simple_switch_13.SimpleSwitch13):
def _reconfigure_metering(self, tap):
bwList = bwDB.getBWEntry(tap)
for bw in bwList:
print bw
#print bw
dpid = str_to_dpid(tap.get('dpid'))
datapath = self.datapaths[dpid]
......
......@@ -66,20 +66,20 @@ class SimpleMonitor(simple_switch_13.SimpleSwitch13):
@set_ev_cls(ofp_event.EventOFPPortStatsReply,[MAIN_DISPATCHER])
def _port_stats_reply_handler(self, ev):
body = ev.msg.body
self.logger.info('datapath port timestamp '
'rx-pkts rx-bytes rx-error '
'tx-pkts tx-bytes tx-error '
'rx-drop tx-drop')
self.logger.info('---------------- -------- '
'-------- -------- -------- '
'-------- -------- -------- '
'-------- -------- --------')
#self.logger.info('datapath port timestamp '
# 'rx-pkts rx-bytes rx-error '
# 'tx-pkts tx-bytes tx-error '
# 'rx-drop tx-drop')
#self.logger.info('---------------- -------- '
# '-------- -------- -------- '
# '-------- -------- -------- '
# '-------- -------- --------')
for stat in sorted(body, key=attrgetter('port_no')):
self.logger.info('%016x %8x %8d %8d %8d %8d %8d %8d %8d %8d %8d',
ev.msg.datapath.id, stat.port_no, stat.duration_sec,
stat.rx_packets, stat.rx_bytes, stat.rx_errors,
stat.tx_packets, stat.tx_bytes, stat.tx_errors,
stat.rx_dropped, stat.tx_dropped)
#self.logger.info('%016x %8x %8d %8d %8d %8d %8d %8d %8d %8d %8d',
# ev.msg.datapath.id, stat.port_no, stat.duration_sec,
# stat.rx_packets, stat.rx_bytes, stat.rx_errors,
# stat.tx_packets, stat.tx_bytes, stat.tx_errors,
# stat.rx_dropped, stat.tx_dropped)
dp_str = dpid_to_str(ev.msg.datapath.id)
bwDbEntry= {
'dpid': dp_str,
......
......@@ -5,7 +5,7 @@ SWITCH_COUNT=$2
#./bin/ryu-manager --verbose --app-lists ryu/app/rest,ryu/app/rest_topology,ryu/topology/dumper,ryu/app/ofctl_rest,ryu/app/cnac_rest
#./bin/ryu-manager --verbose --observe-links --wsapi-host=$WSAPI_HOST --app-lists ryu.topology.switches,ryu.app.rest,ryu.app.rest_topology,ryu.app.ofctl_rest,ryu/app/cnac_rest,ryu/app/rest_net_topology,ryu.app.simple_switch_lacp
./bin/ryu-manager --wsapi-host=$WSAPI_HOST --app-lists ryu/app/rest,ryu/app/rest_topology,ryu/topology/dumper,ryu/app/ofctl_rest,ryu/app/cnac_rest,ryu/app/rest_net_topology,ryu/app/simple_switch_13,ryu/app/simple_monitor
./bin/ryu-manager --wsapi-host=$WSAPI_HOST --app-lists ryu/app/rest,ryu/app/rest_topology,ryu/topology/dumper,ryu/app/ofctl_rest,ryu/app/cnac_rest,ryu/app/rest_net_topology,ryu/app/simple_switch_13,ryu/app/simple_monitor,ryu/app/dump_pkt
#./bin/ryu-manager --verbose --wsapi-host=$WSAPI_HOST --app-lists ryu.topology.switches,ryu.app.rest,ryu.app.rest_topology,ryu.app.ofctl_rest,ryu/app/cnac_rest,ryu/app/rest_net_topology,ryu/app/dump_pkt
#./bin/ryu-manager --verbose --wsapi-host=$WSAPI_HOST --app-lists ryu.topology.switches,ryu.app.rest,ryu.app.rest_topology,ryu.app.ofctl_rest,ryu/app/cnac_rest,ryu/app/rest_net_topology,ryu/app/simple_switch_13,ryu/app/simple_monitor,ryu/app/dynamic_rate_limiter,ryu/app/dump_pkt
#./bin/ryu-manager --verbose --observe-links --app-lists ryu.topology.switches,ryu.app.rest,ryu.app.rest_topology,ryu.app.ofctl_rest,ryu/app/cnac_rest,ryu/app/rest_net_topology
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment