Commit 0110b328 authored by Praveen Kumar Shanmugam's avatar Praveen Kumar Shanmugam

scale down changes; forgot to push early :(

parent facee8ff
......@@ -69,7 +69,22 @@ class dynamicRateLimiter(simple_switch_13.SimpleSwitch13):
increment = (bandwidth / 20 ) # 5% increment
if (pktError > 0):
print "Reduce the rate limiting "
print "Reduce the rate limiting in multiples of increment"
  • changes are made to scale down when I see packet drops. But change it to scale down comparing the BW usage of the port and the tap flows in the port.

Please register or sign in to reply
no_of_increments = (pktError/increment) + 1; #always have higher allocation
new_limit = increment * no_of_increments;
of = datapath.ofproto
ofp = datapath.ofproto_parser
burst_size = 0
bands = []
bands.append(ofp.OFPMeterBandDrop(new_limit, burst_size))
meter_mod = ofp.OFPMeterMod(
datapath, of.OFPMC_MODIFY, of.OFPMF_KBPS, int(tapid), bands)
datapath.send_msg(meter_mod)
rateEntry = {
'ratelimit' : new_limit,
'tapID' : tapid
}
tapDB.udpateRateLimit(rateEntry)
return ;
if limit == max_rate_limit:
......@@ -77,6 +92,7 @@ class dynamicRateLimiter(simple_switch_13.SimpleSwitch13):
return ;
if (usedbw < 50): #less than 50%
print "Increase the rate for tunnel traffic"
new_limit = limit + increment;
if new_limit > max_rate_limit:
new_limit = max_rate_limit;
......
......@@ -23,6 +23,7 @@ def createBWDBConnection():
usedbw UNSIGNED INTEGER DEFAULT 0,
rxBytes UNSIGNED BIGINT DEFAULT 0,
txBytes UNSIGNED BIGINT DEFAULT 0,
txDrops UNSIGNED BIGINT DEFAULT 0,
pktError UNSIGNED BIGINT DEFAULT 0,
timeStamp UNSIGNED BIG INT
);
......@@ -77,7 +78,7 @@ def getBWEntry(bwDBEntry):
cursor = conn.cursor()
cursor.execute("""select uniqID,bandwidth, usedbw, rxBytes, txBytes,
pktError, timeStamp from bwTable where dpid=:dpid and
txDrops, pktError, timeStamp from bwTable where dpid=:dpid and
port=:port """,bwDBEntry);
bwList = []
......@@ -89,8 +90,9 @@ def getBWEntry(bwDBEntry):
'usedbw':row[2],
'rxBytes':row[3],
'txBytes':row[4],
'pktError':row[5],
'timeStamp':row[6]
'txDrops':row[5],
'pktError':row[6],
'timeStamp':row[7]
}
#print rowDict
bwList.append(rowDict)
......@@ -135,9 +137,9 @@ def insertBWDBDict(bwDBEntry):
try:
cursor.execute("""
insert into bwTable( dpid, port, bandwidth, usedbw,
rxBytes, txBytes, pktError, timeStamp)
rxBytes, txBytes, txDrops, pktError, timeStamp)
values (:dpid, :port, :bandwidth, :usedbw, :rxBytes,
:txBytes, :pktError, :timeStamp)
:txBytes, :txDrops, :pktError, :timeStamp)
""", bwDBEntry);
conn.commit();
rc = cursor.lastrowid
......@@ -170,7 +172,7 @@ def updateBWDict(bwDBEntry):
try:
cursor.execute("""
select txBytes, pktError, timeStamp, bandwidth
select txBytes, txDrops, timeStamp, bandwidth
from bwTable
where dpid=:dpid and port=:port
""",bwDBEntry)
......@@ -178,7 +180,8 @@ def updateBWDict(bwDBEntry):
if (row is not None) and (row[2] != 0): #update the entry and recalculate bw used.
#used bw is for txBytes as we focus on tunnel
prevTxBytes = row[0];
pktError = row[1];
txDrops = row[1];
pktError = bwDBEntry.get('txDrops') - txDrops
prevTimeStamp = row[2];
bandwidth = row[3];
txByte = bwDBEntry.get('txBytes');
......@@ -206,7 +209,7 @@ def updateBWDict(bwDBEntry):
cursor.execute("""
update bwTable set usedbw=:usedbw, rxBytes=:rxBytes,
txBytes=:txBytes, pktError=:pktError, timeStamp=:timeStamp
txBytes=:txBytes, txDrops=:txDrops, pktError=:pktError, timeStamp=:timeStamp
where dpid=:dpid and port=:port""", bwDBEntry);
conn.commit();
#print "update done"
......@@ -222,7 +225,7 @@ def main():
bwDbEntry= {
'dpid': '000000001', 'port':3, 'bandwidth':10,
'usedbw':10, 'rxBytes':204034, 'txBytes':432432,
'pktError':5, 'timeStamp':12.4
'txDrops':5, 'pktError':0, 'timeStamp':12.4
}
#print bwDbEntry
......
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