本文整理匯總了Python中model.Node.add_ip方法的典型用法代碼示例。如果您正苦於以下問題:Python Node.add_ip方法的具體用法?Python Node.add_ip怎麽用?Python Node.add_ip使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類model.Node
的用法示例。
在下文中一共展示了Node.add_ip方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _parse
# 需要導入模塊: from model import Node [as 別名]
# 或者: from model.Node import add_ip [as 別名]
def _parse(self, entries, skip_self):
nodes = entries['Node']
if not skip_self:
nodes += entries['Self']
for node in nodes:
n = Node(node.hostname, node.latlon)
n.add_ip(node.ip)
self._nodes[node.hostname] = n
self._ips[node.ip] = n
mids_unknown = []
for mid in entries['Mid']:
try:
node = self._ips[mid.ip]
node.add_ip(mid.alias)
self._ips[mid.alias] = node
except KeyError:
mids_unknown.append(mid)
links = entries['Link'] + entries['PLink']
links_unknown = []
for link in links:
try:
if skip_self:
link_ips = [link.src_ip, link.dst_ip]
if any(s.ip in link_ips for s in entries['Self']):
continue
node = self._ips[link.src_ip]
l = Link(self._ips[link.dst_ip], link.lq)
node.add_link(l)
except KeyError:
links_unknown.append(link)