示例#1
0
文件: altq.py 项目: kpsubedi/pfGUI
 def _str_sc(self, m1, d, m2):
     """Return the string representation of the service curve."""
     s = ""
     if m2:
         s = " {}".format(rate2str(m2))
     if d:
         s = "({} {}{})".format(rate2str(m1), d, s)
     return s
示例#2
0
 def _str_sc(self, m1, d, m2):
     """ """
     s = ""
     if m2:
         s = " {}".format(rate2str(m2))
     if d:
         s = "({} {}{})".format(rate2str(m1), d, s)
     return s
示例#3
0
文件: altq.py 项目: kpsubedi/pfGUI
    def _str_altq(self):
        """Convert a root ALTQ discipline to a string."""
        altqs = {ALTQT_CBQ: "cbq", ALTQT_PRIQ: "priq", ALTQT_HFSC: "hfsc"}

        s  = "altq on {.ifname} ".format(self)
        s += "{} {}".format(altqs[self.scheduler], self._str_opts())

        if (0 < self.ifbandwidth < 100):
            s += "bandwidth {.ifbandwidth}% ".format(self)
        elif (self.ifbandwidth >= 100):
            s += "bandwidth {} ".format(rate2str(self.ifbandwidth))
        if self.qlimit != DEFAULT_QLIMIT:
            s += "qlimit {.qlimit} ".format(self)
        s += "tbrsize {.tbrsize}".format(self)

        return s
示例#4
0
文件: altq.py 项目: kpsubedi/pfGUI
    def _str_queue(self):
        """Convert a child ALTQ discipline to a string."""
        altqs = {ALTQT_CBQ: "cbq", ALTQT_PRIQ: "priq", ALTQT_HFSC: "hfsc"}
        opts = self._str_opts()

        s = "queue {0.qname} on {0.ifname} ".format(self)

        if self.scheduler in (ALTQT_CBQ, ALTQT_HFSC):
            if (0 < self.bandwidth < 100):
                s += "bandwidth {.bandwidth}% ".format(self)
            elif (self.bandwidth >= 100):
                s += "bandwidth {} ".format(rate2str(self.bandwidth))
        if self.priority != DEFAULT_PRIORITY:
            s += "priority {.priority} ".format(self)
        if self.qlimit != DEFAULT_QLIMIT:
            s += "qlimit {.qlimit} ".format(self)
        if opts:
            s += "{}{}".format(altqs[self.scheduler], opts)

        return s
示例#5
0
 def _str_bandwidth(self, bw):
     """ """
     return bw if isinstance(bw, basestring) else rate2str(bw)
示例#6
0
文件: queue.py 项目: chrisvel/py-pf
 def _str_bandwidth(self, bw):
     """ """
     return bw if isinstance(bw, basestring) else rate2str(bw)