示例#1
0
    def __init__(self,
                 host,
                 user,
                 password,
                 port=22,
                 commands=None,
                 enable_bgp=True,
                 asn='My ASN',
                 name=None,
                 acl=None):
        ulgmodel.RemoteRouter.__init__(self, acl=acl)

        self.setHost(host)
        self.setPort(port)
        self.setUser(user)
        self.setPassword(password)
        self.bgp_ipv4_peers = []
        self.bgp_ipv6_peers = []
        if (name):
            self.setName(name)
        else:
            self.setName(host)
        self.setASN(asn)

        if enable_bgp:
            if (defaults.rescan_on_display):
                self.rescanHook()
            else:
                self.loadBGPPeers()

            rid = hashlib.md5(self.getName()).hexdigest()

            self.bgp4select = ulgmodel.CommonSelectionParameter(
                rid + "bgp4",
                [tuple((
                    p,
                    p,
                )) for p in self.getBGPIPv4Peers()],
                name=defaults.STRING_IPADDRESS)
            self.bgp6select = ulgmodel.CommonSelectionParameter(
                rid + "bgp6",
                [tuple((
                    p,
                    p,
                )) for p in self.getBGPIPv6Peers()],
                name=defaults.STRING_IPADDRESS)

        if (commands):
            self.setCommands(commands)
        else:
            self.setCommands(self._getDefaultCommands())
示例#2
0
 def initRoutingTableSelect(self, rt):
     rid = hashlib.md5(self.getName()).hexdigest()
     self.rt_select = ulgmodel.CommonSelectionParameter(
         rid + "rt", [tuple((
             p,
             p,
         )) for p in rt],
         name=defaults.STRING_RTABLE)
示例#3
0
 def initBGPPeerSelect(self, peers):
     rid = hashlib.md5(self.getName()).hexdigest()
     self.bgp_peer_select = ulgmodel.CommonSelectionParameter(
         rid + "bgp", [tuple((
             p,
             p,
         )) for p in peers],
         name=defaults.STRING_PEERID)