Exemplo n.º 1
0
 def family(self, tokeniser):
     data = self.get_section(SectionFamily.name, tokeniser)
     if data:
         self.content[Capability.ID(
             Capability.ID.MULTIPROTOCOL)] = MultiProtocol(
                 (afi, safi) for afi in sorted(data)
                 for safi in sorted(data[afi]))
     else:
         return False
Exemplo n.º 2
0
    def enter(self, tokeniser):
        Section.enter(self, tokeniser)

        self.content[Capability.ID(Capability.ID.FOUR_BYTES_ASN)] = True
        self.content[Capability.ID(Capability.ID.AIGP)] = False
        self.content[Capability.ID(Capability.ID.ADD_PATH)] = 0
        self.content[Capability.ID(Capability.ID.OPERATIONAL)] = False
        self.content[Capability.ID(Capability.ID.ROUTE_REFRESH)] = False
        self.content[Capability.ID(Capability.ID.MULTISESSION)] = False
        self.content[Capability.ID(Capability.ID.GRACEFUL_RESTART)] = 0
Exemplo n.º 3
0
    def addpath(self, tokeniser):
        self._check_duplicate(tokeniser, RaisedCapability)
        valid_options = ('receive', 'send', 'send/receive', 'disable',
                         'disabled')
        ap = tokeniser()
        if ap not in valid_options:
            raise RaisedCapability(
                tokeniser,
                "%s is not a invalid add-path paramerter, options are %s" %
                (ap, ', '.join(valid_options)))

        self.content[Capability.ID(Capability.ID.ADD_PATH)] = 0
        if ap.endswith('receive'): self.content[Capability.ID.ADD_PATH] += 1
        if ap.startswith('send'): self.content[Capability.ID.ADD_PATH] += 2
Exemplo n.º 4
0
    def graceful(self, tokeniser):
        self._check_duplicate(tokeniser, RaisedCapability)
        token = tokeniser()
        if not token.isdigit():
            raise RaisedCapability(
                tokeniser,
                "%s is not a valid option for graceful-restart, it must be a positive number smaller than 2^16"
                % token)

        duration = int(token)
        if duration < 0:
            raise RaisedCapability(
                tokeniser,
                "%s is not a valid option for graceful-restart, it must be a positive number smaller than 2^16"
                % token)
        if duration > pow(2, 16):
            raise RaisedCapability(
                tokeniser,
                "%s is not a valid option for graceful-restart, it must be a positive number smaller than 2^16"
                % token)

        self.content[Capability.ID(Capability.ID.GRACEFUL_RESTART)] = duration
Exemplo n.º 5
0
 def operational(self, tokeniser):
     self._check_duplicate(tokeniser, RaisedCapability)
     self.content[Capability.ID(Capability.ID.OPERATIONAL)] = boolean(
         tokeniser, False)
Exemplo n.º 6
0
 def aigp(self, tokeniser):
     self._check_duplicate(tokeniser, RaisedCapability)
     self.content[Capability.ID(Capability.ID.AIGP)] = boolean(
         tokeniser, False)
Exemplo n.º 7
0
 def asn4(self, tokeniser):
     self._check_duplicate(tokeniser, RaisedCapability)
     self.content[Capability.ID(Capability.ID.FOUR_BYTES_ASN)] = boolean(
         tokeniser, True)
Exemplo n.º 8
0
 def exit(self, tokeniser):
     if Capability.ID(Capability.ID.MULTIPROTOCOL) not in self.content:
         self.content[Capability.ID(
             Capability.ID.MULTIPROTOCOL)] = MultiProtocol(known_families())
Exemplo n.º 9
0
 def multisession(self, tokeniser):
     self._check_duplicate(tokeniser, RaisedCapability)
     self.content[Capability.ID(
         Capability.ID.MULTISESSION_CISCO)] = boolean(tokeniser, False)
Exemplo n.º 10
0
 def refresh(self, tokeniser):
     self._check_duplicate(tokeniser, RaisedCapability)
     self.content[Capability.ID(Capability.ID.ROUTE_REFRESH)] = boolean(
         tokeniser, False)