示例#1
0
 def __addDefaultClassAndFilter(self, mark_id, parent_id):
     """
         add default service limit class
         mark_id(int): mark number to user with iptables
         parent_id(int): parent minor id of default class
     """
     minor_id = self.__getNewMinorTC_ID()
     self.default_minor_id = minor_id
     bw_main.getTCRunner().addClass(
         self.getLeafObj().getInterfaceName(), "parent 1:%s" % parent_id,
         "classid 1:%s" % minor_id, "htb",
         "rate %skbit" % self.getLeafObj().getDefaultRate(),
         "ceil %skbit" % self.getLeafObj().getDefaultCeil(), "quantum 3000")
     bw_main.getIPTablesRunner().addMark(mark_id, self.ip_addr,
                                         self.direction, None)
     bw_main.getTCRunner().addFilter(self.getLeafObj().getInterfaceName(),
                                     "protocol ip", "prio 1",
                                     "handle %s fw" % mark_id,
                                     "flowid 1:%s" % minor_id)
示例#2
0
 def __addService(self, leaf_service, mark_id, parent_id):
     """
         add service limit in "leaf_service"
         mark_id(int): mark number to user with iptables
         parent_id(int): parent minor id of class
     """
     minor_id = self.__getNewMinorTC_ID()
     self.service_minor_ids.append(minor_id)
     bw_main.getTCRunner().addClass(self.getLeafObj().getInterfaceName(),
                                    "parent 1:%s" % parent_id,
                                    "classid 1:%s" % minor_id, "htb",
                                    "rate %skbit" % leaf_service.getRate(),
                                    "ceil %skbit" % leaf_service.getCeil(),
                                    "quantum 3000")
     bw_main.getIPTablesRunner().addMark(mark_id, self.ip_addr,
                                         self.direction, leaf_service)
     bw_main.getTCRunner().addFilter(self.getLeafObj().getInterfaceName(),
                                     "protocol ip", "prio 1",
                                     "handle %s fw" % mark_id,
                                     "flowid 1:%s" % minor_id)
示例#3
0
    def __addDefaultClassAndFilter(self,mark_id,parent_id):
	"""
	    add default service limit class
	    mark_id(int): mark number to user with iptables
	    parent_id(int): parent minor id of default class
	"""
	minor_id=self.__getNewMinorTC_ID()
	self.default_minor_id=minor_id
	bw_main.getTCRunner().addClass(self.getLeafObj().getInterfaceName(),
				       "parent 1:%s"%parent_id,
				       "classid 1:%s"%minor_id,
				       "htb",
				       "rate %skbit"%self.getLeafObj().getDefaultRate(),
				       "ceil %skbit"%self.getLeafObj().getDefaultCeil(),
				       "quantum 3000")
	bw_main.getIPTablesRunner().addMark(mark_id,self.ip_addr,self.direction,None)
	bw_main.getTCRunner().addFilter(self.getLeafObj().getInterfaceName(),
					"protocol ip",
					"prio 1",
					"handle %s fw"%mark_id,
					"flowid 1:%s"%minor_id)
示例#4
0
    def __addService(self,leaf_service,mark_id,parent_id):
    	"""
	    add service limit in "leaf_service"
	    mark_id(int): mark number to user with iptables
	    parent_id(int): parent minor id of class
	"""
	minor_id=self.__getNewMinorTC_ID()
	self.service_minor_ids.append(minor_id)
	bw_main.getTCRunner().addClass(self.getLeafObj().getInterfaceName(),
				       "parent 1:%s"%parent_id,
				       "classid 1:%s"%minor_id,
				       "htb",
				       "rate %skbit"%leaf_service.getRate(),
				       "ceil %skbit"%leaf_service.getCeil(),
				       "quantum 3000")
	bw_main.getIPTablesRunner().addMark(mark_id,self.ip_addr,self.direction,leaf_service)
	bw_main.getTCRunner().addFilter(self.getLeafObj().getInterfaceName(),
					"protocol ip",
					"prio 1",
					"handle %s fw"%mark_id,
					"flowid 1:%s"%minor_id)
示例#5
0
 def __delMark(self, mark_id, leaf_service):
     bw_main.getIPTablesRunner().delMark(mark_id, self.ip_addr,
                                         self.direction, leaf_service)
示例#6
0
    def __delMark(self,mark_id,leaf_service):
	bw_main.getIPTablesRunner().delMark(mark_id,self.ip_addr,self.direction,leaf_service)