예제 #1
0
    def __applyBwLimit(self, user_obj, instance, action):
        """
            apply bandwidth limit on user, this is seperate from simple bandwidth limit

            user_obj (User.User instance): object of user that we want to apply limit on
            instance (integer): instance number of user 
            action (integer): can be "apply" and "remove"
            
        """
        if self.bw_tx_leaf_id == None and self.bw_rx_leaf_id == None:
            return

        try:
            ip_addr = user_obj.getTypeObj().getClientAddr(instance)
        except GeneralException:
            logException(LOG_ERROR, "Can't apply bandwidth limit on user")
            return

        try:
            if action == "apply":
                bw_main.getManager().applyBwLimit(ip_addr, self.bw_tx_leaf_id,
                                                  self.bw_rx_leaf_id)
            else:
                bw_main.getManager().removeBwLimit(ip_addr)
        except:
            logException(LOG_ERROR, "Apply Bw Limit")
예제 #2
0
    def __applyBwLimit(self,user_obj,instance,action):
	"""
	    apply bandwidth limit on user, this is seperate from simple bandwidth limit

	    user_obj (User.User instance): object of user that we want to apply limit on
	    instance (integer): instance number of user 
	    action (integer): can be "apply" and "remove"
	    
	"""
	if self.bw_tx_leaf_id==None and self.bw_rx_leaf_id==None:
	    return
	try:
	    ip_addr=user_obj.getTypeObj().getClientAddr(instance)
	except GeneralException:
	    logException(LOG_ERROR,"Can't apply bandwidth limit on user")

	if action=="apply":
	    bw_main.getManager().applyBwLimit(ip_addr,self.bw_tx_leaf_id,self.bw_rx_leaf_id)
	else:
	    bw_main.getManager().removeBwLimit(ip_addr)
예제 #3
0
 def run(self):
     bw_main.getManager().updateCounters()
예제 #4
0
 def remove(self):
     bw_main.getManager().removeBwLimit(self.getIP())
예제 #5
0
 def run(self):
     bw_main.getManager().updateCounters()
예제 #6
0
 def apply(self):
     bw_main.getManager().applyBwLimit(self.getIP(), self.getTxLeafID(), self.getRxLeafID())
예제 #7
0
 def getActiveLeaves(self, request):
     request.needAuthType(request.ADMIN)
     request.getAuthNameObj().canDo("CHANGE BANDWIDTH MANGER")
     return bw_main.getManager().getAllUserLeavesInfo()
예제 #8
0
from core.bandwidth_limit import bw_main

tc = bw_main.getTCRunner()
print tc.getCounters("eth0")
print bw_main.getManager().user_leaves["192.168.1.11/32"][1].getDefaultMinorTC_ID()
print bw_main.getManager().user_leaves["192.168.1.11/32"][0].getTotalMinorTC_ID()
print bw_main.getManager().getAllUserLeavesInfo()["192.168.1.11/32"]
예제 #9
0
 def __getCountersForID(self, _id):
     return bw_main.getManager().getCounters(self.getInterfaceName(), _id)
예제 #10
0
    def __getCountersForID(self,_id):
	return bw_main.getManager().getCounters(self.getInterfaceName(),_id)
예제 #11
0
파일: static_ip.py 프로젝트: sankopay/IBSng
 def remove(self):
     bw_main.getManager().removeBwLimit(self.getIP())
예제 #12
0
파일: static_ip.py 프로젝트: sankopay/IBSng
 def apply(self):
     bw_main.getManager().applyBwLimit(self.getIP(), self.getTxLeafID(),
                                       self.getRxLeafID())
예제 #13
0
    def getActiveLeaves(self,request):
	request.needAuthType(request.ADMIN)
	request.getAuthNameObj().canDo("CHANGE BANDWIDTH MANGER")
	return bw_main.getManager().getAllUserLeavesInfo()