Commit dad3a5e6 authored by Praveen Kumar Shanmugam's avatar Praveen Kumar Shanmugam

update the installation script to for cqpd and mininet clean and updated

install for image creation
parent 395a9676
......@@ -2,7 +2,7 @@
csv_input=$1
declare -a arr=("s1-eth1" "s1-eth2" "s2-eth1" "s2-eth2" "s2-eth3" "s3-eth2")
declare -a arr=("s1-eth1" "s1-eth3" "s2-eth1" "s2-eth2" "s2-eth3" "s3-eth2")
start_timestamp=`head -1 $csv_input | cut -d',' -f1`
export start_timestamp
......
#!/bin/sh
sudo apt-get install -y cmake libpcap-dev libxerces-c2-dev libpcre3-dev flex bison pkg-config autoconf libtool libboost-dev
#!/bin/bash
OFSWITCHDIR=~/downloads/ofsoftswitch13
NBEESRCDIR=~/downloads/nbeesrc-jan-10-2013
RYUDIR=~/download/deditect/Code/ryu
sudo apt-get -y remove python2.7
sudo apt-get -y install python2.7
sudo apt-get update
sudo apt-get install -y git python-simplejson python-qt4 python-twisted-conch automake autoconf gcc uml-utilities libtool build-essential git pkg-config linux-headers-`uname -r`;
sudo apt-get install -y cmake libpcap-dev libxerces-c2-dev libpcre3-dev flex bison pkg-config autoconf libtool libboost-dev;
sudo apt-get install -y bwm-ng sqlite curl mz
sudo apt-get install -y xorg xauth openbox
sudo apt-get install -y python-matplotlib python-networkx python-tk python-setuptools
sudo apt-get install -y python-dev python-pip python-eventlet python-routes python-webob python-paramiko libxml2-dev libxslt1-dev bwm-ng sqlite curl mz
sudo apt-get install -y libxml2-dev libxslt-dev gnuplot screen vim
cd $NBEESRCDIR/src;
cmake .
make
sudo cp ../bin/libn*.so /usr/local/lib
sudo ldconfig
sudo cp -R ../include/* /usr/include/
cd ~
sudo rm -rf ~/openflow
sudo rm -rf ~/mininet
git clone git://github.com/mininet/mininet
cd ~
sudo mininet/util/install.sh -nfv
cd $OFSWITCHDIR;
sudo git pull
./boot.sh;
./configure;
make;
sudo make install;
cd -;
cd $RYUDIR
sudo python ./setup.py install
......@@ -236,7 +236,7 @@ class TapPolicyController(ControllerBase):
LOG.debug("tap_port: %d", tap_port)
LOG.debug("vlan_id : %d", vlan_id)
rate = 10
rate = 1000 * 1 #KBps -> 1Mbps
  • Has the new changes for the cpqd user switch from main repo and associated changes for the metering to work!!

Please register or sign in to reply
tapDbEntry= {
'dpid': dpid_pd, 'monitorPort':tap_port, 'bandwidth':10,
......@@ -551,11 +551,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, int(tap_id), bands)
dp.send_msg(meter_mod)
rate = 2 * rate ;
meter_mod = ofp.OFPMeterMod(
dp, of.OFPMC_MODIFY, of.OFPMF_KBPS, int(tap_id), bands)
dp, of.OFPMC_ADD, (of.OFPMF_KBPS), int(tap_id), bands)
dp.send_msg(meter_mod)
meterdbEntry={
'dpid': dpid_to_str(dp.id),
......@@ -565,7 +561,7 @@ class TapPolicyController(ControllerBase):
'timeStamp':0,
'rxRate':0
};
meterDB.insertmeterdbDict(meterdbEntry);
#meterDB.insertmeterdbDict(meterdbEntry);
for i in flows[str(dpid)]:
for j in i['actions']:
......@@ -1047,7 +1043,7 @@ class RestCnacApi(app_manager.RyuApp):
super(RestCnacApi, self).__init__(*args, **kwargs)
self.dpset = kwargs['dpset']
tapDB.createTapDBConnection()
meterDB.createmeterdbConnection()
#meterDB.createmeterdbConnection()
wsgi = kwargs['wsgi']
self.waiters = {}
self.data = {}
......
......@@ -41,7 +41,10 @@ class DebugPkt(app_manager.RyuApp):
in_port = msg.match['in_port']
pkt = packet.Packet(msg.data)
print pkt
eth = pkt.get_protocol(ethernet.ethernet)
print eth
return ;
dst = eth.dst
src = eth.src
......
......@@ -67,7 +67,7 @@ class dynamicRateLimiter(simple_switch_13.SimpleSwitch13):
self.logger.info('usedbw: %d', usedbw)
max_rate_limit = (bandwidth / 2) #max limit = 50%
increment = (bandwidth / (20)) # 5% increment [bandwidth is in Kbps]
increment = (bandwidth *(0.1)) # 5% increment [bandwidth is in Kbps]
meterdbEntry= {
'dpid':tap.get('dpid'),
......@@ -87,7 +87,7 @@ class dynamicRateLimiter(simple_switch_13.SimpleSwitch13):
bands = []
bands.append(ofp.OFPMeterBandDrop(new_limit, burst_size))
meter_mod = ofp.OFPMeterMod(datapath, of.OFPMC_MODIFY,
of.OFPMF_KBPS, meterid, bands)
(of.OFPMF_KBPS), meterid, bands)
datapath.send_msg(meter_mod)
rateEntry = {
......@@ -95,17 +95,21 @@ class dynamicRateLimiter(simple_switch_13.SimpleSwitch13):
'tapID' : tapid
}
tapDB.udpateRateLimit(rateEntry)
meterDB.resetMeterEntry(meterdbEntry);
#meterDB.resetMeterEntry(meterdbEntry);
return ;
if ratelimit == max_rate_limit:
self.logger.info("Already at maximum time ratelimit")
return ;
if (usedbw < 50): #less than 50%
if (usedbw < 100): #less than 50%
if (usedbw > ratelimit):
self.logger.info("Higher service traffic .. don't grow")
return ;
new_limit = ratelimit + increment;
if new_limit > max_rate_limit:
new_limit = max_rate_limit;
new_limit = new_limit * 8 #KBps -> kbps
self.logger.info("meterid[%d] Increase the rate[%d] for tunnel traffic",
meterid, new_limit)
of = datapath.ofproto
......@@ -122,4 +126,4 @@ class dynamicRateLimiter(simple_switch_13.SimpleSwitch13):
'tapID' : tapid
}
tapDB.udpateRateLimit(rateEntry)
meterDB.resetMeterEntry(meterdbEntry);
#meterDB.resetMeterEntry(meterdbEntry);
......@@ -61,12 +61,12 @@ class SimpleMonitor(simple_switch_13.SimpleSwitch13):
portList = tapDB.getTapPortsForSwitch({'dpid':dpid_to_str(dp.id)})
for port in portList:
self._request_stats(dp, port)
'''
meterList = tapDB.getMeterIDs({'dpid':dpid_to_str(dp.id)})
self.logger.debug('meter: %s', str(meterList))
for meterID in meterList:
self.logger.debug('meterID: %d', int(meterID))
self._request_mstats(dp, meterID);
'''
self._request_stats(dp, dp.ofproto.OFPP_ANY)
'''
hub.sleep(10)
......@@ -76,7 +76,7 @@ class SimpleMonitor(simple_switch_13.SimpleSwitch13):
datapath.id, meterID)
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
req = parser.OFPMeterStatsRequest(datapath, 0, meterID)
req = parser.OFPMeterConfigStatsRequest(datapath, 0, meterID)
datapath.send_msg(req)
def _request_stats(self, datapath, port):
......@@ -88,44 +88,43 @@ class SimpleMonitor(simple_switch_13.SimpleSwitch13):
#ofproto.OFPP_ANY)
datapath.send_msg(req)
@set_ev_cls(ofp_event.EventOFPMeterStatsReply, MAIN_DISPATCHER)
@set_ev_cls(ofp_event.EventOFPMeterConfigStatsReply, MAIN_DISPATCHER)
def _meter_stats_reply_handler(self, ev):
self.logger.debug("_meter_stats_reply_handler : %s", str(ev.msg.body))
dp_str = dpid_to_str(ev.msg.datapath.id)
for stat in ev.msg.body:
self.logger.debug('meter_id=0x%08x len=%d flow_count=%d '
'packet_in_count=%d byte_in_count=%d '
'duration_sec=%d duration_nsec=%d '
'band_stats=%s' %
(stat.meter_id, stat.len, stat.flow_count,
stat.packet_in_count, stat.byte_in_count,
stat.duration_sec, stat.duration_nsec,
(stat.meter_id, stat.length, stat.flow_count,
stat.band_stats))
meterdbEntry= {
'dpid': dp_str,
'meterID':stat.meter_id,
'rxBytes':stat.byte_in_count,
'timeStamp':stat.duration_sec
'bands':stat.bands
};
meterDB.updateMeterDict(meterdbEntry);
#meterDB.updateMeterDict(meterdbEntry);
@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,
......
......@@ -4,7 +4,7 @@ from os.path import isfile, getsize
import sqlite3 as sql
import logging
from ryu.lib import meterDB
from ryu.lib import tapDB
#single write and single read so no locks are implemented.
global bwdb
......@@ -177,7 +177,8 @@ def updateBWDict(bwDBEntry):
cursor = conn.cursor()
rc = True;
meterRxRate = meterDB.getRateBySwitchPort(bwDBEntry);
meterlimit = (tapDB.getTapRateLimit(bwDBEntry)).get('limit')
try:
cursor.execute("""
select txBytes, txDrops, timeStamp, bandwidth, pktError
......@@ -204,7 +205,7 @@ def updateBWDict(bwDBEntry):
try:
KB = ((float(newBytes))/(1024)); #bytes -> KB
rate = (KB/sec); #KBps
serviceTrafficRate = rate - meterRxRate ;
serviceTrafficRate = rate - meterlimit;
utilization = ((float((serviceTrafficRate) * 100 )/bandwidth))
#in percentage
except ZeroDivisionError:
......@@ -220,7 +221,7 @@ def updateBWDict(bwDBEntry):
log.info("switch:%s port:%d bw[%d]: newBytes[%d], sec[%d], KB[%f], rate[%f], "
"meterRate[%d], service[%d], utilization:[%d]", bwDBEntry.get('dpid'),
int(bwDBEntry.get('port')), bandwidth, newBytes,
sec, KB, rate, meterRxRate, serviceTrafficRate, utilization)
sec, KB, rate, meterlimit, serviceTrafficRate, utilization)
bwDBEntry['usedbw']= int(utilization) * errMultiplier
......
......@@ -289,6 +289,33 @@ def udpateRateLimit(rateEntry):
conn.close();
return rc;
def getTapRateLimit(rateEntry):
print "udpateRateLimit: update rate entry query"
print rateEntry
conn = sql.connect(db)
cursor = conn.cursor()
rc = True;
try:
cursor.execute("""
select ratelimit,tapID from tapTable
where dpid=:dpid and monitorPort=:port""",
rateEntry);
row = cursor.fetchone();
if row is not None:
rateEntry['limit'] = (row[0]/8); #kbps -> KBps
rateEntry['tapID'] = row[1];
else:
rateEntry['limit'] = 0;
rateEntry['tapID'] = 0;
except sql.Error as e:
print "An error occured ",e.args[0];
cursor.close();
conn.close();
return rateEntry;
def insertFlowDBDict(flowEntry):
print "insertFlowDBDict: print entry for flowtable insert query"
print flowEntry
......@@ -426,7 +453,7 @@ def getAllTapMeters():
'tapID':row[0],
'dpid':row[1],
'port':row[2],
'limit':row[3]
'limit':(row[3]/8) #kbps -> KBps
}
print rowDict;
tapList.append(rowDict);
......
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