This commit is contained in:
David Barroso committed 2015-12-02 10:50:06 +01:00
1 parent 74144cca32
commit b5319aee52
10 files changed
+12 -9

No files matched your search

+10 -9
View File
@@ -205,15 +205,16 @@ class FortiOSDriver(NetworkDriver):
neighbor_dict['remote_as'] = int(neigh_conf.get_param('remote-as')) neighbor_dict['remote_as'] = int(neigh_conf.get_param('remote-as'))
neighbor_dict['is_up'] = 'never' != parameters[7] or False neighbor_dict['is_up'] = 'never' != parameters[7] or False
neighbor_dict['is_enabled'] = neigh_conf.get_param('shutdown') != 'enable' or False neighbor_dict['is_enabled'] = neigh_conf.get_param('shutdown') != 'enable' or False
neighbor_dict['description'] = '' neighbor_dict['description'] = u''
neighbor_dict['uptime'] = convert_uptime_string_seconds(parameters[7]) neighbor_dict['uptime'] = convert_uptime_string_seconds(parameters[7])
neighbor_dict['ipv4'] = dict() neighbor_dict['address_family'] = dict()
neighbor_dict['ipv6'] = dict() neighbor_dict['address_family']['ipv4'] = dict()
neighbor_dict['address_family']['ipv6'] = dict()
detail_output = [x.lower() for x in self.device.execute_command(command_detail.format(neighbor))] detail_output = [x.lower() for x in self.device.execute_command(command_detail.format(neighbor))]
m = re.search('remote router id (.+?)\n', '\n'.join(detail_output)) m = re.search('remote router id (.+?)\n', '\n'.join(detail_output))
if m: if m:
neighbor_dict['remote_id'] = m.group(1) neighbor_dict['remote_id'] = unicode(m.group(1))
else: else:
raise Exception('cannot find remote router id for %s' % neighbor) raise Exception('cannot find remote router id for %s' % neighbor)
@@ -225,20 +226,20 @@ class FortiOSDriver(NetworkDriver):
for term, fortiname in terms.iteritems(): for term, fortiname in terms.iteritems():
text = search_line_in_lines('%s prefixes' % fortiname, block) text = search_line_in_lines('%s prefixes' % fortiname, block)
t = [int(s) for s in text.split() if s.isdigit()][0] t = [int(s) for s in text.split() if s.isdigit()][0]
neighbor_dict[family][term] = t neighbor_dict['address_family'][family][term] = t
received = self.device.execute_command( received = self.device.execute_command(
command_received.format(neighbor))[0].split() command_received.format(neighbor))[0].split()
if len(received) > 0: if len(received) > 0:
neighbor_dict[family]['received_prefixes'] = received[-1] neighbor_dict['address_family'][family]['received_prefixes'] = received[-1]
else: else:
# Soft-reconfig is not enabled # Soft-reconfig is not enabled
neighbor_dict[family]['received_prefixes'] = 0 neighbor_dict['address_family'][family]['received_prefixes'] = 0
peers[neighbor] = neighbor_dict peers[neighbor] = neighbor_dict
return { return {
'default': { 'global': {
'router_id': bgp_sum[0].split()[3], 'router_id': unicode(bgp_sum[0].split()[3]),
'peers': peers 'peers': peers
} }
} }
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.