예제 #1
0
 def discard(self, scope, name, command, tokens):
     # README: We are setting the ASN as zero as that what Juniper (and Arbor) did when we created a local flow route
     try:
         scope[-1]['announce'][-1].attributes[
             Attribute.CODE.EXTENDED_COMMUNITY].add(TrafficRate(ASN(0), 0))
         return True
     except ValueError:
         return self.error.set(self.syntax)
예제 #2
0
파일: parser.py 프로젝트: pierky/exabgp
def rate_limit(tokeniser):
    # README: We are setting the ASN as zero as that what Juniper (and Arbor) did when we created a local flow route
    speed = int(tokeniser())
    if speed < 9600 and speed != 0:
        log.warning("rate-limiting flow under 9600 bytes per seconds may not work", 'configuration')
    if speed > 1000000000000:
        speed = 1000000000000
        log.warning("rate-limiting changed for 1 000 000 000 000 bytes from %s" % speed, 'configuration')
    return ExtendedCommunities().add(TrafficRate(ASN(0), speed))
예제 #3
0
 def rate_limit(self, scope, name, command, tokens):
     # README: We are setting the ASN as zero as that what Juniper (and Arbor) did when we created a local flow route
     try:
         speed = int(tokens[0])
         if speed < 9600 and speed != 0:
             self.logger.configuration(
                 "rate-limiting flow under 9600 bytes per seconds may not work",
                 'warning')
         if speed > 1000000000000:
             speed = 1000000000000
             self.logger.configuration(
                 "rate-limiting changed for 1 000 000 000 000 bytes from %s"
                 % tokens[0], 'warning')
         scope[-1]['announce'][-1].attributes[
             Attribute.CODE.EXTENDED_COMMUNITY].add(
                 TrafficRate(ASN(0), speed))
         return True
     except ValueError:
         return self.error.set(self.syntax)
예제 #4
0
파일: parser.py 프로젝트: pierky/exabgp
def discard(tokeniser):
    # README: We are setting the ASN as zero as that what Juniper (and Arbor) did when we created a local flow route
    return ExtendedCommunities().add(TrafficRate(ASN(0), 0))