Commit 40b30562 authored by oftutorial's avatar oftutorial

meter and flow associating with that configured: datapath to be tested -...

meter and flow associating with that configured: datapath to be tested - safety checkpoint commit :)
parent 30b0d6a7
#!/bin/bash
NUM=$1
for (( i=1; i<=$NUM; i++ ))
do
dpctl unix:/tmp/s$i meter-features
dpctl unix:/tmp/s$i stats-flow
dpctl unix:/tmp/s$i stats-meter
dpctl unix:/tmp/s$i meter-config
done
......@@ -2,3 +2,4 @@ tapDataBase
tags
build/*
cscope*
*.pyc
......@@ -164,8 +164,13 @@ class TapPolicyController(ControllerBase):
action = oDbFlowEntry.get('origAction')
print "Install orig flow"
print "match:"+str(match)
inst = [ofp.OFPInstructionActions(of.OFPIT_APPLY_ACTIONS,
action)] #working
if not isinstance(action,
ofp.OFPInstructionActions):
inst = [ofp.OFPInstructionActions(of.OFPIT_APPLY_ACTIONS,
action)] #working
else:
inst = action;
print "inst:"+str(inst)
self.mod_flow(dp, table_id=table, command=of.OFPFC_ADD,
match=match, inst=inst);
......@@ -213,11 +218,12 @@ class TapPolicyController(ControllerBase):
tap_id = tapDB.insertTapDBDict(tapDbEntry);
if tap_id == -1:
if (tap_id == -1) or (tap_id is None):
print "end2endTunnel creation failed"
return Response(status=404)
print "inserting at DB row : %d" % tap_id
print "inserting at DB row : tapid"
print tap_id
print optPath
index = 0
......@@ -388,7 +394,7 @@ class TapPolicyController(ControllerBase):
burst_size = 0
bands.append(ofp.OFPMeterBandDrop(rate, burst_size))
meter_mod = ofp.OFPMeterMod(
dp, of.OFPMC_ADD, of.OFPMF_KBPS, tap_id, bands)
dp, of.OFPMC_ADD, of.OFPMF_KBPS, int(tap_id), bands)
dp.send_msg(meter_mod)
for i in flows[str(dpid)]:
......@@ -482,14 +488,18 @@ class TapPolicyController(ControllerBase):
of = dp.ofproto
ofp = dp.ofproto_parser
ids_action = action
#add metering instruction for the flow
meter_inst = ofp.OFPInstructionMeter(flowDbEntry.get('tapID'))
print "ids act:" + str(action)
f = ofp.OFPMatchField.make(of.OXM_OF_VLAN_VID, vlan_id)
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
#add metering instruction for the flow
#ids_action.append(ofp.OFPInstructionMeter(flowDbEntry.get('tapID')))
inst = [ofp.OFPInstructionActions(of.OFPIT_APPLY_ACTIONS, ids_action)] #working
inst.append(meter_inst)
print "inst:" + str(inst)
print "match:" +str(match)
flowDbEntry['modf2Table']= self.IDS_TABLE
......@@ -499,7 +509,6 @@ class TapPolicyController(ControllerBase):
print flowDbEntry['modf2Action']
flowDbEntry['pipelineDepth'] = 2
#install the flow associated with the meter_id
self.DBEntry['mod'].append({'table': self.IDS_TABLE, 'match': match, 'inst': inst})
self.mod_flow(dp,table_id=self.IDS_TABLE,command=of.OFPFC_ADD,match=match, inst=inst);
return flowDbEntry;
......
......@@ -390,6 +390,6 @@ def main():
flowDbEntry['tapID']=tapID
rc = insertFlowDBDict(flowDbEntry);
print rc;
'''
if __name__ == "__main__":
main()
'''
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