Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6407c0dfc2 | ||
|
|
c66e0c483a | ||
|
|
e5b45cffe0 | ||
|
|
529c78fb34 | ||
|
|
bdcb3dc338 | ||
|
|
7b53176371 | ||
|
|
b453a640dd | ||
|
|
c544c59f2c | ||
|
|
b8ac2c49c6 | ||
|
|
3f8a79459e | ||
|
|
e79fa6f501 | ||
|
|
ec445bc44b | ||
|
|
05573195db | ||
|
|
85612c49fc | ||
|
|
7888ad9e0b | ||
|
|
7cb0723b07 | ||
|
|
77f0c5e42f | ||
|
|
88fdbffa44 | ||
|
|
2fa9c589f6 | ||
|
|
5616a1f7ae | ||
|
|
0a0b87d4f4 | ||
|
|
4b78a4d731 | ||
|
|
60a5cc5764 | ||
|
|
fbe3c04cbb | ||
|
|
73afe433cc | ||
|
|
2ccad9982f | ||
|
|
b0308075f4 | ||
|
|
13a82b7e81 | ||
|
|
62299ccf28 | ||
|
|
f9d7bd0aa9 | ||
|
|
8a1779b10a | ||
|
|
60ccca9441 | ||
|
|
3af1c05fb2 | ||
|
|
67a2d4c97e | ||
|
|
b6026ad12c | ||
|
|
3055c79c02 | ||
|
|
b9a7d3e992 | ||
|
|
f0ac70d2af | ||
|
|
8456b5271a |
No files matched your search
@@ -60,3 +60,4 @@ env
|
|||||||
|
|
||||||
test/unit/test_devices.py
|
test/unit/test_devices.py
|
||||||
|
|
||||||
|
report.json
|
||||||
+10
-14
@@ -1,20 +1,11 @@
|
|||||||
language: python
|
language: python
|
||||||
|
|
||||||
python:
|
python:
|
||||||
- 2.7
|
- 2.7
|
||||||
|
- 3.4
|
||||||
|
- 3.5
|
||||||
install:
|
install:
|
||||||
- pip install -r requirements-dev.txt
|
- pip install tox-travis
|
||||||
- pip install .
|
- pip install coveralls
|
||||||
|
|
||||||
script:
|
|
||||||
- py.test
|
|
||||||
- pylama .
|
|
||||||
|
|
||||||
after_success:
|
|
||||||
- coveralls
|
|
||||||
- if [ $TRAVIS_TAG ]; then curl -X POST https://readthedocs.org/build/napalm; fi
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: pypi
|
provider: pypi
|
||||||
user: dbarroso
|
user: dbarroso
|
||||||
@@ -23,3 +14,8 @@ deploy:
|
|||||||
on:
|
on:
|
||||||
tags: true
|
tags: true
|
||||||
branch: master
|
branch: master
|
||||||
|
script:
|
||||||
|
- tox
|
||||||
|
after_success:
|
||||||
|
- coveralls
|
||||||
|
- if [ $TRAVIS_TAG ]; then curl -X POST https://readthedocs.org/build/napalm; fi
|
||||||
+132
-113
@@ -11,13 +11,16 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations under
|
# License for the specific language governing permissions and limitations under
|
||||||
# the License.
|
# the License.
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from pyFG.fortios import FortiOS, FortiConfig, logger
|
from pyFG.fortios import FortiOS, FortiConfig, logger
|
||||||
from pyFG.exceptions import FailedCommit, CommandExecutionException
|
from pyFG.exceptions import FailedCommit, CommandExecutionException
|
||||||
from napalm_base.base import NetworkDriver
|
from napalm.base.exceptions import ReplaceConfigException, MergeConfigException
|
||||||
from napalm_base.exceptions import ReplaceConfigException, MergeConfigException
|
from napalm.base.utils.string_parsers import colon_separated_string_to_dict,\
|
||||||
from napalm_base.utils.string_parsers import colon_separated_string_to_dict,\
|
|
||||||
convert_uptime_string_seconds
|
convert_uptime_string_seconds
|
||||||
|
import napalm.base.helpers
|
||||||
|
from napalm.base.base import NetworkDriver
|
||||||
|
|
||||||
|
|
||||||
class FortiOSDriver(NetworkDriver):
|
class FortiOSDriver(NetworkDriver):
|
||||||
@@ -47,7 +50,7 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
'is_alive': self.device.ssh.get_transport().is_active()
|
'is_alive': self.device.ssh.get_transport().is_active()
|
||||||
}
|
}
|
||||||
|
|
||||||
def execute_command_with_vdom(self, command, vdom=None):
|
def _execute_command_with_vdom(self, command, vdom=None):
|
||||||
# If the user doesn't specify a particular vdom we use the default vdom for the object.
|
# If the user doesn't specify a particular vdom we use the default vdom for the object.
|
||||||
vdom = vdom or self.vdom
|
vdom = vdom or self.vdom
|
||||||
|
|
||||||
@@ -70,8 +73,8 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
# If there is no vdom we just execute the command
|
# If there is no vdom we just execute the command
|
||||||
return self.device.execute_command(command)
|
return self.device.execute_command(command)
|
||||||
|
|
||||||
def get_command_with_vdom(self, cmd, separator=':', auto=False, vdom=None):
|
def _get_command_with_vdom(self, cmd, separator=':', auto=False, vdom=None):
|
||||||
output = self.execute_command_with_vdom(cmd, vdom)
|
output = self._execute_command_with_vdom(cmd, vdom)
|
||||||
|
|
||||||
if auto:
|
if auto:
|
||||||
if ':' in output[0]:
|
if ':' in output[0]:
|
||||||
@@ -121,7 +124,7 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
|
|
||||||
def commit_config(self):
|
def commit_config(self):
|
||||||
try:
|
try:
|
||||||
self.execute_command_with_vdom('execute backup config flash commit_with_napalm')
|
self._execute_command_with_vdom('execute backup config flash commit_with_napalm')
|
||||||
self.device.commit()
|
self.device.commit()
|
||||||
self.discard_config()
|
self.discard_config()
|
||||||
except FailedCommit as e:
|
except FailedCommit as e:
|
||||||
@@ -135,9 +138,9 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
self.device.load_config(in_candidate=True)
|
self.device.load_config(in_candidate=True)
|
||||||
|
|
||||||
def rollback(self):
|
def rollback(self):
|
||||||
output = self.execute_command_with_vdom('fnsysctl ls -l data2/config', vdom=None)
|
output = self._execute_command_with_vdom('fnsysctl ls -l data2/config', vdom=None)
|
||||||
rollback_file = output[-2].split()[-1]
|
rollback_file = output[-2].split()[-1]
|
||||||
rollback_config = self.execute_command_with_vdom(
|
rollback_config = self._execute_command_with_vdom(
|
||||||
'fnsysctl cat data2/config/{rollback_file}'.format(rollback_file))
|
'fnsysctl cat data2/config/{rollback_file}'.format(rollback_file))
|
||||||
|
|
||||||
self.device.load_config(empty_candidate=True)
|
self.device.load_config(empty_candidate=True)
|
||||||
@@ -159,12 +162,12 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
get_candidate = retrieve == "all" or retrieve == "candidate"
|
get_candidate = retrieve == "all" or retrieve == "candidate"
|
||||||
|
|
||||||
if retrieve == "all" or get_running:
|
if retrieve == "all" or get_running:
|
||||||
result = self.execute_command_with_vdom('show')
|
result = self._execute_command_with_vdom('show')
|
||||||
text_result = '\n'.join(result)
|
text_result = '\n'.join(result)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'startup': u"",
|
'startup': u"",
|
||||||
'running': unicode(text_result),
|
'running': str(text_result),
|
||||||
'candidate': u"",
|
'candidate': u"",
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,22 +179,24 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def get_facts(self):
|
def get_facts(self):
|
||||||
system_status = self.get_command_with_vdom('get system status', vdom='global')
|
system_status = self._get_command_with_vdom('get system status', vdom='global')
|
||||||
performance_status = self.get_command_with_vdom('get system performance status',
|
performance_status = self._get_command_with_vdom('get system performance status',
|
||||||
vdom='global')
|
vdom='global')
|
||||||
|
|
||||||
interfaces = self.execute_command_with_vdom('get system interface | grep ==', vdom='global')
|
interfaces = self._execute_command_with_vdom('get system interface | grep ==',
|
||||||
|
vdom='global')
|
||||||
interface_list = [x.split()[2] for x in interfaces if x.strip() is not '']
|
interface_list = [x.split()[2] for x in interfaces if x.strip() is not '']
|
||||||
|
|
||||||
domain = self.get_command_with_vdom('get system dns | grep domain', vdom='global')['domain']
|
domain = self._get_command_with_vdom('get system dns | grep domain',
|
||||||
|
vdom='global')['domain']
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'vendor': unicode('Fortigate'),
|
'vendor': str('Fortigate'),
|
||||||
'os_version': unicode(system_status['Version'].split(',')[0].split()[1]),
|
'os_version': str(system_status['Version'].split(',')[0].split()[1]),
|
||||||
'uptime': convert_uptime_string_seconds(performance_status['Uptime']),
|
'uptime': convert_uptime_string_seconds(performance_status['Uptime']),
|
||||||
'serial_number': unicode(system_status['Serial-Number']),
|
'serial_number': str(system_status['Serial-Number']),
|
||||||
'model': unicode(system_status['Version'].split(',')[0].split()[0]),
|
'model': str(system_status['Version'].split(',')[0].split()[0]),
|
||||||
'hostname': unicode(system_status['Hostname']),
|
'hostname': str(system_status['Hostname']),
|
||||||
'fqdn': u'{}.{}'.format(system_status['Hostname'], domain),
|
'fqdn': u'{}.{}'.format(system_status['Hostname'], domain),
|
||||||
'interface_list': interface_list
|
'interface_list': interface_list
|
||||||
}
|
}
|
||||||
@@ -218,12 +223,13 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def get_interfaces(self):
|
def get_interfaces(self):
|
||||||
cmd_data = self.execute_command_with_vdom('diagnose hardware deviceinfo nic', vdom='global')
|
cmd_data = self._execute_command_with_vdom('diagnose hardware deviceinfo nic',
|
||||||
|
vdom='global')
|
||||||
|
|
||||||
interface_list = [x.replace('\t', '') for x in cmd_data if x.startswith('\t')]
|
interface_list = [x.replace('\t', '') for x in cmd_data if x.startswith('\t')]
|
||||||
interface_statistics = {}
|
interface_statistics = {}
|
||||||
for interface in interface_list:
|
for interface in interface_list:
|
||||||
if_data = self.execute_command_with_vdom(
|
if_data = self._execute_command_with_vdom(
|
||||||
'diagnose hardware deviceinfo nic {}'.format(interface), vdom='global')
|
'diagnose hardware deviceinfo nic {}'.format(interface), vdom='global')
|
||||||
parsed_data = {}
|
parsed_data = {}
|
||||||
if interface.startswith('mgmt'):
|
if interface.startswith('mgmt'):
|
||||||
@@ -236,7 +242,7 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
elif line.startswith('Link'):
|
elif line.startswith('Link'):
|
||||||
parsed_data['is_up'] = line.split('\t')[-1] is 'up'
|
parsed_data['is_up'] = line.split('\t')[-1] is 'up'
|
||||||
elif line.startswith('Current_HWaddr'):
|
elif line.startswith('Current_HWaddr'):
|
||||||
parsed_data['mac_address'] = unicode(line.split('\t')[-1])
|
parsed_data['mac_address'] = str(line.split('\t')[-1])
|
||||||
parsed_data['is_enabled'] = True
|
parsed_data['is_enabled'] = True
|
||||||
parsed_data['description'] = u''
|
parsed_data['description'] = u''
|
||||||
parsed_data['last_flapped'] = -1.0
|
parsed_data['last_flapped'] = -1.0
|
||||||
@@ -249,12 +255,33 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
elif line.startswith('PHY Speed'):
|
elif line.startswith('PHY Speed'):
|
||||||
parsed_data['speed'] = int(line.split(':')[-1])
|
parsed_data['speed'] = int(line.split(':')[-1])
|
||||||
elif line.startswith('Current_HWaddr'):
|
elif line.startswith('Current_HWaddr'):
|
||||||
parsed_data['mac_address'] = unicode(line.split(' ')[-1])
|
parsed_data['mac_address'] = str(line.split(' ')[-1])
|
||||||
parsed_data['description'] = u''
|
parsed_data['description'] = u''
|
||||||
parsed_data['last_flapped'] = -1.0
|
parsed_data['last_flapped'] = -1.0
|
||||||
interface_statistics[interface] = parsed_data
|
interface_statistics[interface] = parsed_data
|
||||||
return interface_statistics
|
return interface_statistics
|
||||||
|
|
||||||
|
def get_interfaces_ip(self):
|
||||||
|
cmd = self._execute_command_with_vdom('get system interface physical', vdom='global')
|
||||||
|
interface_ip_dictionary = {}
|
||||||
|
if_name = None
|
||||||
|
for line in cmd:
|
||||||
|
interface_data = line.strip().split()
|
||||||
|
if len(interface_data)==0:
|
||||||
|
continue
|
||||||
|
if interface_data[0].startswith('==['):
|
||||||
|
m = re.search("==\[(.+)\]", interface_data[0])
|
||||||
|
if_name = m.group(1)
|
||||||
|
if if_name and interface_data[0]=="ip:" and interface_data[1][0]!='0':
|
||||||
|
interface_ip_dictionary[if_name]={}
|
||||||
|
interface_ip_dictionary[if_name]["ipv4"]={interface_data[1]: {'prefix_length': sum(bin(int(x)).count('1') for x in interface_data[2].split('.'))}}
|
||||||
|
if if_name and interface_data[0]=="ipv6:" and interface_data[1][0]!=':':
|
||||||
|
try:
|
||||||
|
interface_ip_dictionary[if_name]["ipv6"]={interface_data[1].split('/')[0]: {'prefix_length': interface_data[1].split('/')[1]}}
|
||||||
|
except:
|
||||||
|
interface_ip_dictionary[if_name]={"ipv6": {interface_data[1].split('/')[0]: {'prefix_length': interface_data[1].split('/')[1]}}}
|
||||||
|
return interface_ip_dictionary
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _search_line_in_lines(search, lines):
|
def _search_line_in_lines(search, lines):
|
||||||
for l in lines:
|
for l in lines:
|
||||||
@@ -262,7 +289,7 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
return l
|
return l
|
||||||
|
|
||||||
def get_firewall_policies(self):
|
def get_firewall_policies(self):
|
||||||
cmd = self.execute_command_with_vdom('show firewall policy')
|
cmd = self._execute_command_with_vdom('show firewall policy')
|
||||||
policy = dict()
|
policy = dict()
|
||||||
policy_id = None
|
policy_id = None
|
||||||
default_policy = dict()
|
default_policy = dict()
|
||||||
@@ -291,16 +318,16 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
policy_item['position'] = position
|
policy_item['position'] = position
|
||||||
policy_item['packet_hits'] = -1
|
policy_item['packet_hits'] = -1
|
||||||
policy_item['byte_hits'] = -1
|
policy_item['byte_hits'] = -1
|
||||||
policy_item['id'] = unicode(key)
|
policy_item['id'] = str(key)
|
||||||
policy_item['enabled'] = enabled
|
policy_item['enabled'] = enabled
|
||||||
policy_item['schedule'] = unicode(policy[key]['schedule'])
|
policy_item['schedule'] = str(policy[key]['schedule'])
|
||||||
policy_item['log'] = unicode(logtraffic)
|
policy_item['log'] = str(logtraffic)
|
||||||
policy_item['l3_src'] = unicode(policy[key]['srcaddr'])
|
policy_item['l3_src'] = str(policy[key]['srcaddr'])
|
||||||
policy_item['l3_dst'] = unicode(policy[key]['dstaddr'])
|
policy_item['l3_dst'] = str(policy[key]['dstaddr'])
|
||||||
policy_item['service'] = unicode(policy[key]['service'])
|
policy_item['service'] = str(policy[key]['service'])
|
||||||
policy_item['src_zone'] = unicode(policy[key]['srcintf'])
|
policy_item['src_zone'] = str(policy[key]['srcintf'])
|
||||||
policy_item['dst_zone'] = unicode(policy[key]['dstintf'])
|
policy_item['dst_zone'] = str(policy[key]['dstintf'])
|
||||||
policy_item['action'] = unicode(action)
|
policy_item['action'] = str(action)
|
||||||
default_policy[key].append(policy_item)
|
default_policy[key].append(policy_item)
|
||||||
|
|
||||||
position = position + 1
|
position = position + 1
|
||||||
@@ -315,14 +342,14 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
command_received = 'get router info bgp neighbors {} received-routes | grep prefixes '
|
command_received = 'get router info bgp neighbors {} received-routes | grep prefixes '
|
||||||
peers = dict()
|
peers = dict()
|
||||||
|
|
||||||
bgp_sum = self.execute_command_with_vdom(command_sum)
|
bgp_sum = self._execute_command_with_vdom(command_sum)
|
||||||
|
|
||||||
re_neigh = re.compile("^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+")
|
re_neigh = re.compile("^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+")
|
||||||
neighbors = {n.split()[0]: n.split()[1:] for n in bgp_sum if re.match(re_neigh, n)}
|
neighbors = {n.split()[0]: n.split()[1:] for n in bgp_sum if re.match(re_neigh, n)}
|
||||||
|
|
||||||
self.device.load_config('router bgp')
|
self.device.load_config('router bgp')
|
||||||
|
|
||||||
for neighbor, parameters in neighbors.iteritems():
|
for neighbor, parameters in neighbors.items():
|
||||||
logger.debug('NEW PEER')
|
logger.debug('NEW PEER')
|
||||||
neigh_conf = self.device.running_config['router bgp']['neighbor']['{}'.format(neighbor)]
|
neigh_conf = self.device.running_config['router bgp']['neighbor']['{}'.format(neighbor)]
|
||||||
|
|
||||||
@@ -340,10 +367,10 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
neighbor_dict['address_family']['ipv6'] = dict()
|
neighbor_dict['address_family']['ipv6'] = dict()
|
||||||
|
|
||||||
detail_output = [x.lower() for x in
|
detail_output = [x.lower() for x in
|
||||||
self.execute_command_with_vdom(command_detail.format(neighbor))]
|
self._execute_command_with_vdom(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'] = unicode(m.group(1))
|
neighbor_dict['remote_id'] = str(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)
|
||||||
|
|
||||||
@@ -352,12 +379,12 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
x = detail_output.index(' for address family: {} unicast'.format(family))
|
x = detail_output.index(' for address family: {} unicast'.format(family))
|
||||||
block = detail_output[x:]
|
block = detail_output[x:]
|
||||||
|
|
||||||
for term, fortiname in terms.iteritems():
|
for term, fortiname in terms.items():
|
||||||
text = self._search_line_in_lines('%s prefixes' % fortiname, block)
|
text = self._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['address_family'][family][term] = t
|
neighbor_dict['address_family'][family][term] = t
|
||||||
|
|
||||||
received = self.execute_command_with_vdom(
|
received = self._execute_command_with_vdom(
|
||||||
command_received.format(neighbor))[0].split()
|
command_received.format(neighbor))[0].split()
|
||||||
if len(received) > 0:
|
if len(received) > 0:
|
||||||
neighbor_dict['address_family'][family]['received_prefixes'] = received[-1]
|
neighbor_dict['address_family'][family]['received_prefixes'] = received[-1]
|
||||||
@@ -368,13 +395,13 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'global': {
|
'global': {
|
||||||
'router_id': unicode(bgp_sum[0].split()[3]),
|
'router_id': str(bgp_sum[0].split()[3]),
|
||||||
'peers': peers
|
'peers': peers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_interfaces_counters(self):
|
def get_interfaces_counters(self):
|
||||||
cmd = self.execute_command_with_vdom('fnsysctl ifconfig', vdom=None)
|
cmd = self._execute_command_with_vdom('fnsysctl ifconfig', vdom=None)
|
||||||
if_name = None
|
if_name = None
|
||||||
interface_counters = dict()
|
interface_counters = dict()
|
||||||
for line in cmd:
|
for line in cmd:
|
||||||
@@ -404,29 +431,6 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
|
|
||||||
def get_environment(self):
|
def get_environment(self):
|
||||||
|
|
||||||
def parse_string(line):
|
|
||||||
return re.sub(' +', ' ', line.lower())
|
|
||||||
|
|
||||||
def search_disabled(line):
|
|
||||||
m = re.search("(.+?) (.+?) alarm=(.+?) \(scanning disabled\)", line)
|
|
||||||
return m.group(2)
|
|
||||||
|
|
||||||
def search_normal(line):
|
|
||||||
m = re.search("(.+?) (.+?) alarm=(.+?) value=(.+?) threshold_status=(.+?)", line)
|
|
||||||
return m
|
|
||||||
|
|
||||||
def get_fans(fan_lines):
|
|
||||||
output = dict()
|
|
||||||
for fan_line in fan_lines:
|
|
||||||
if 'disabled' in fan_line:
|
|
||||||
name = search_disabled(fan_line)
|
|
||||||
output[name] = dict(status=False)
|
|
||||||
continue
|
|
||||||
|
|
||||||
m = search_normal(fan_line)
|
|
||||||
output[m.group(2)] = dict(status=True)
|
|
||||||
return output
|
|
||||||
|
|
||||||
def get_cpu(cpu_lines):
|
def get_cpu(cpu_lines):
|
||||||
output = dict()
|
output = dict()
|
||||||
for l in cpu_lines:
|
for l in cpu_lines:
|
||||||
@@ -442,62 +446,77 @@ class FortiOSDriver(NetworkDriver):
|
|||||||
total, used = int(memory_line[1]) >> 20, int(memory_line[2]) >> 20 # byte to MB
|
total, used = int(memory_line[1]) >> 20, int(memory_line[2]) >> 20 # byte to MB
|
||||||
return dict(available_ram=total, used_ram=used)
|
return dict(available_ram=total, used_ram=used)
|
||||||
|
|
||||||
def get_temperature(temperature_lines, detail_block):
|
|
||||||
output = dict()
|
|
||||||
for temp_line in temperature_lines:
|
|
||||||
if 'disabled' in temp_line:
|
|
||||||
sensor_name = search_disabled(temp_line)
|
|
||||||
output[sensor_name] = {'is_alert': False, 'is_critical': False,
|
|
||||||
'temperature': 0.0}
|
|
||||||
continue
|
|
||||||
|
|
||||||
m = search_normal(temp_line)
|
|
||||||
sensor_name, temp_value, status = m.group(2), m.group(4), int(m.group(5))
|
|
||||||
is_alert = True if status == 1 else False
|
|
||||||
|
|
||||||
# find block
|
|
||||||
fullline = self._search_line_in_lines(sensor_name, detail_block)
|
|
||||||
index_line = detail_block.index(fullline)
|
|
||||||
sensor_block = detail_block[index_line:]
|
|
||||||
|
|
||||||
v = int(self._search_line_in_lines('upper_non_recoverable',
|
|
||||||
sensor_block).split('=')[1])
|
|
||||||
|
|
||||||
output[sensor_name] = dict(temperature=float(temp_value), is_alert=is_alert,
|
|
||||||
is_critical=True if v > temp_value else False)
|
|
||||||
|
|
||||||
return output
|
|
||||||
|
|
||||||
out = dict()
|
out = dict()
|
||||||
|
|
||||||
sensors_block = [parse_string(x) for x in
|
#execute sensor detail is not available
|
||||||
self.execute_command_with_vdom('execute sensor detail', vdom='global')
|
sensors_block = self._execute_command_with_vdom('execute sensor list', vdom='global')
|
||||||
if x]
|
|
||||||
|
|
||||||
# temp
|
temperatures=dict()
|
||||||
temp_lines = [x for x in sensors_block
|
fans=dict()
|
||||||
if any([True for y in ['dts', 'temp', 'adt7490'] if y in x])]
|
powers = dict()
|
||||||
out['temperature'] = get_temperature(temp_lines, sensors_block)
|
|
||||||
|
|
||||||
# fans
|
for line in sensors_block:
|
||||||
out['fans'] = get_fans([x for x in sensors_block if 'fan' in x and 'temp' not in x])
|
m = re.search("([0-9]+?) (.+\s[0-9]+?) (.+?) value=([0-9\.]+)", line)
|
||||||
|
if m:
|
||||||
|
if "TMP" in m.group(2).strip():
|
||||||
|
sensor_name, temp_value=m.group(3).strip(), m.group(4)
|
||||||
|
temp_value=float(temp_value)
|
||||||
|
temperatures[sensor_name] = dict(temperature=temp_value, is_alert=False, is_critical=False)
|
||||||
|
elif "FAN" in m.group(2):
|
||||||
|
fans[m.group(2)+" - "+m.group(3).strip()] = dict(status=True)
|
||||||
|
else:
|
||||||
|
m = re.search("([0-9]+?)\s(.+?)\s+alarm=([0-9]+)\s+value=([0-9\.]+)\s+threshold_status=([0-9]+)", line)
|
||||||
|
if m:
|
||||||
|
if "TMP" in m.group(2) or "Temp" in m.group(2):
|
||||||
|
sensor_name, temp_value=m.group(2).strip(), m.group(4)
|
||||||
|
temp_value=float(temp_value)
|
||||||
|
temperatures[sensor_name] = dict(temperature=temp_value, is_alert=int(m.group(5)), is_critical=int(m.group(3)))
|
||||||
|
elif "FAN" in m.group(2).upper():
|
||||||
|
fans[m.group(2).strip()] = dict(status=(not bool(int(m.group(3)))))
|
||||||
|
elif m.group(2)[0]=="+":
|
||||||
|
powers[ m.group(2).strip()] = dict(status=(not bool(int(m.group(3)))), capacity=-1.0, output=-1.0)
|
||||||
|
|
||||||
|
out['fans'] = fans
|
||||||
|
out['temperature'] = temperatures
|
||||||
|
out['power'] = powers
|
||||||
|
|
||||||
# cpu
|
# cpu
|
||||||
out['cpu'] = get_cpu(
|
out['cpu'] = get_cpu(
|
||||||
[x for x in
|
[x for x in
|
||||||
self.execute_command_with_vdom('get system performance status | grep CPU',
|
self._execute_command_with_vdom('get system performance status | grep CPU',
|
||||||
vdom='global')[1:] if x])
|
vdom='global')[1:] if x])
|
||||||
|
|
||||||
# memory
|
# memory
|
||||||
memory_command = 'diag hard sys mem | grep Mem:'
|
memory_block = self._execute_command_with_vdom('diag hard sys mem | grep Mem', vdom='global')
|
||||||
t = [x for x in
|
out['memory'] = dict(available_ram=-1, used_ram=-1)
|
||||||
re.split('\s+', self.execute_command_with_vdom(memory_command,
|
for line in memory_block:
|
||||||
vdom='global')[0]) if x]
|
if line.strip().startswith("MemTotal:"):
|
||||||
out['memory'] = get_memory(t)
|
out['memory']["available_ram"]=(int(line.split()[1])>>10)
|
||||||
|
if line.strip().startswith("MemFree:"):
|
||||||
# power, not implemented
|
out['memory']["used_ram"]=(int(line.split()[1])>>10)
|
||||||
sensors = [x.split()[1] for x in sensors_block if x.split()[0].isdigit()]
|
if line.strip().startswith("Mem:"):
|
||||||
psus = {x for x in sensors if x.startswith('ps')}
|
out['memory']=get_memory(line.split())
|
||||||
out['power'] = {t: {'status': True, 'capacity': -1.0, 'output': -1.0} for t in psus}
|
|
||||||
|
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
def get_arp_table(self):
|
||||||
|
|
||||||
|
arp_table = []
|
||||||
|
command = "get sys arp"
|
||||||
|
output = self._execute_command_with_vdom(command)
|
||||||
|
|
||||||
|
# Skip the first line which is a header
|
||||||
|
output = output[1:]
|
||||||
|
|
||||||
|
for line in output:
|
||||||
|
if len(line) > 0:
|
||||||
|
address, age, mac, interface = line.split()
|
||||||
|
entry = {
|
||||||
|
"interface": interface,
|
||||||
|
"mac": napalm.base.helpers.mac(mac).rstrip(),
|
||||||
|
"ip": address,
|
||||||
|
"age": age.replace("-", "-1"),
|
||||||
|
}
|
||||||
|
arp_table.append(entry)
|
||||||
|
return arp_table
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{"included": [{"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_bgp_neighbors[normal]", "teardown": {"duration": 7.700920104980469e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003800392150878906, "outcome": "passed", "name": "setup"}, "run_index": 11, "call": {"duration": 0.004490852355957031, "outcome": "passed", "name": "call"}, "duration": 0.005327939987182617, "outcome": "passed"}, "type": "test", "id": 1}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_route_to[no_test_case_found]", "teardown": {"duration": 6.389617919921875e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003459453582763672, "outcome": "passed", "name": "setup"}, "run_index": 13, "call": {"duration": 0.00012302398681640625, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0008788108825683594, "outcome": "skipped"}, "type": "test", "id": 2}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_arp_table[no_test_case_found]", "teardown": {"duration": 6.914138793945312e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.000370025634765625, "outcome": "passed", "name": "setup"}, "run_index": 1, "call": {"duration": 0.00012612342834472656, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0009353160858154297, "outcome": "skipped"}, "type": "test", "id": 3}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_network_instances[no_test_case_found]", "teardown": {"duration": 7.104873657226562e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0004589557647705078, "outcome": "passed", "name": "setup"}, "run_index": 8, "call": {"duration": 0.000125885009765625, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0011148452758789062, "outcome": "skipped"}, "type": "test", "id": 4}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_probes_config[no_test_case_found]", "teardown": {"duration": 7.009506225585938e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003409385681152344, "outcome": "passed", "name": "setup"}, "run_index": 3, "call": {"duration": 0.00026488304138183594, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.001016855239868164, "outcome": "skipped"}, "type": "test", "id": 5}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_ntp_servers[no_test_case_found]", "teardown": {"duration": 0.00011706352233886719, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.007989168167114258, "outcome": "passed", "name": "setup"}, "run_index": 0, "call": {"duration": 0.00020694732666015625, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.01630234718322754, "outcome": "skipped"}, "type": "test", "id": 6}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_users[no_test_case_found]", "teardown": {"duration": 6.29425048828125e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.00034308433532714844, "outcome": "passed", "name": "setup"}, "run_index": 18, "call": {"duration": 0.00011801719665527344, "outcome": "skipped", "name": "call", "longrepr": "('/Users/dbarroso/.virtualenvs/napalm/lib/python2.7/site-packages/napalm_base/test/getters.py', 78, u'Skipped: Method not implemented')"}, "duration": 0.0008671283721923828, "outcome": "skipped"}, "type": "test", "id": 7}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_interfaces_counters[normal]", "teardown": {"duration": 7.891654968261719e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003077983856201172, "outcome": "passed", "name": "setup"}, "run_index": 10, "call": {"duration": 0.007678031921386719, "outcome": "passed", "name": "call"}, "duration": 0.00837254524230957, "outcome": "passed"}, "type": "test", "id": 8}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_config[normal]", "teardown": {"duration": 6.29425048828125e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.00037789344787597656, "outcome": "passed", "name": "setup"}, "run_index": 25, "call": {"duration": 0.0005838871002197266, "outcome": "passed", "name":Line truncated
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
|
coveralls
|
||||||
pytest
|
pytest
|
||||||
pytest-cov
|
pytest-cov
|
||||||
pytest-json
|
pytest-json
|
||||||
pytest-pythonpath
|
pytest-pythonpath
|
||||||
pylama
|
pylama
|
||||||
flake8-import-order
|
flake8-import-order
|
||||||
coveralls
|
|
||||||
-r requirements.txt
|
-r requirements.txt
|
||||||
+3
-2
@@ -1,3 +1,4 @@
|
|||||||
napalm-base>=0.18.0
|
napalm
|
||||||
pyFG
|
pyFG>=0.49_1
|
||||||
future
|
future
|
||||||
|
ncclient==0.6.9
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
[pylama]
|
[pylama]
|
||||||
linters = mccabe,pep8,pyflakes
|
linters = mccabe,pep8,pyflakes
|
||||||
ignore = D203,C901
|
ignore = D203,C901
|
||||||
|
skip = build/*,.tox/*
|
||||||
|
|
||||||
[pylama:pep8]
|
[pylama:pep8]
|
||||||
max_line_length = 100
|
max_line_length = 100
|
||||||
|
|
||||||
[tool:pytest]
|
[pytest]
|
||||||
addopts = --cov=./ -vs
|
addopts = --cov=napalm_fortios --cov-report term-missing -vs --pylama
|
||||||
json_report = report.json
|
json_report = report.json
|
||||||
jsonapi = true
|
jsonapi = true
|
||||||
|
|
||||||
[coverage:run]
|
[coverage:run]
|
||||||
include =
|
source = napalm_fortios
|
||||||
napalm_fortios/*
|
|
||||||
@@ -3,16 +3,21 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
from pip.req import parse_requirements
|
try:
|
||||||
|
from pip._internal.req import parse_requirements
|
||||||
|
except ImportError:
|
||||||
|
from pip.req import parse_requirements
|
||||||
__author__ = 'David Barroso <dbarrosop@dravetech.com>'
|
__author__ = 'David Barroso <dbarrosop@dravetech.com>'
|
||||||
|
|
||||||
install_reqs = parse_requirements('requirements.txt', session=uuid.uuid1())
|
install_reqs = parse_requirements('requirements.txt', session=uuid.uuid1())
|
||||||
reqs = [str(ir.req) for ir in install_reqs]
|
try:
|
||||||
|
reqs = [str(ir.req) for ir in install_reqs]
|
||||||
|
except:
|
||||||
|
reqs = [str(ir.requirement) for ir in install_reqs]
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="napalm-fortios",
|
name="napalm-fortios",
|
||||||
version="0.3.0",
|
version="0.4.1",
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
author="David Barroso",
|
author="David Barroso",
|
||||||
author_email="dbarrosop@dravetech.com",
|
author_email="dbarrosop@dravetech.com",
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"interface": "vlan99",
|
||||||
|
"ip": "192.168.199.43",
|
||||||
|
"mac": "EC:F4:BB:D6:4B:C8",
|
||||||
|
"age": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "vlan99",
|
||||||
|
"ip": "192.168.199.90",
|
||||||
|
"mac": "00:50:56:88:95:25",
|
||||||
|
"age": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "vlan99",
|
||||||
|
"ip": "192.168.199.75",
|
||||||
|
"mac": "00:0C:29:F0:B6:54",
|
||||||
|
"age": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "vlan99",
|
||||||
|
"ip": "192.168.199.44",
|
||||||
|
"mac": "00:10:18:E6:8F:A7",
|
||||||
|
"age": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "port4",
|
||||||
|
"ip": "169.254.0.1",
|
||||||
|
"mac": "00:50:56:88:B9:98",
|
||||||
|
"age": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"interface": "vlan99",
|
||||||
|
"ip": "192.168.199.60",
|
||||||
|
"mac": "00:50:CC:7E:26:40",
|
||||||
|
"age": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
Address Age(min) Hardware Addr Interface
|
||||||
|
192.168.199.43 0 ec:f4:bb:d6:4b:c8 vlan99
|
||||||
|
192.168.199.90 0 00:50:56:88:95:25 vlan99
|
||||||
|
192.168.199.75 0 00:0c:29:f0:b6:54 vlan99
|
||||||
|
192.168.199.44 0 00:10:18:e6:8f:a7 vlan99
|
||||||
|
169.254.0.1 - 00:50:56:88:b9:98 port4
|
||||||
|
192.168.199.60 0 00:50:cc:7e:26:40 vlan99
|
||||||
|
|
||||||
@@ -1,255 +0,0 @@
|
|||||||
1 P1V8_SFR_V alarm=0 value=1.8135 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=1.9801
|
|
||||||
upper_critical=1.9507
|
|
||||||
upper_non_critical=1.8919
|
|
||||||
lower_non_critical=1.7155
|
|
||||||
lower_critical=1.6567
|
|
||||||
lower_non_recoverable=1.6273
|
|
||||||
2 AD_1.2VA alarm=0 value=1.2059 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=1.3235
|
|
||||||
upper_critical=1.3039
|
|
||||||
upper_non_critical=1.2647
|
|
||||||
lower_non_critical=1.1373
|
|
||||||
lower_critical=1.1079
|
|
||||||
lower_non_recoverable=1.0883
|
|
||||||
3 AD_+12V alarm=0 value=12.1065 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=13.7585
|
|
||||||
upper_critical=13.1685
|
|
||||||
upper_non_critical=12.6375
|
|
||||||
lower_non_critical=11.3985
|
|
||||||
lower_critical=10.8085
|
|
||||||
lower_non_recoverable=10.2185
|
|
||||||
4 AD_1V_10G alarm=0 value=1.0099 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=1.1079
|
|
||||||
upper_critical=1.0883
|
|
||||||
upper_non_critical=1.0589
|
|
||||||
lower_non_critical=0.9511
|
|
||||||
lower_critical=0.9217
|
|
||||||
lower_non_recoverable=0.9021
|
|
||||||
5 AD_1.5VA alarm=0 value=1.4999 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=1.6567
|
|
||||||
upper_critical=1.6273
|
|
||||||
upper_non_critical=1.5783
|
|
||||||
lower_non_critical=1.4313
|
|
||||||
lower_critical=1.3823
|
|
||||||
lower_non_recoverable=1.3529
|
|
||||||
6 AD_1P05_PCH alarm=0 value=1.0491 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=1.1569
|
|
||||||
upper_critical=1.1373
|
|
||||||
upper_non_critical=1.1079
|
|
||||||
lower_non_critical=0.9903
|
|
||||||
lower_critical=0.9707
|
|
||||||
lower_non_recoverable=0.9511
|
|
||||||
7 AD_1.2VSW alarm=0 value=1.2157 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=1.3235
|
|
||||||
upper_critical=1.3039
|
|
||||||
upper_non_critical=1.2843
|
|
||||||
lower_non_critical=1.1373
|
|
||||||
lower_critical=1.1079
|
|
||||||
lower_non_recoverable=1.0883
|
|
||||||
8 VCCP alarm=0 value=1.0788 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=1.5117
|
|
||||||
upper_critical=1.4649
|
|
||||||
upper_non_critical=1.4064
|
|
||||||
lower_non_critical=0.6459
|
|
||||||
lower_critical=0.6225
|
|
||||||
lower_non_recoverable=0.5991
|
|
||||||
9 P1V1_VTT alarm=0 value=1.1118 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=1.2086
|
|
||||||
upper_critical=1.1822
|
|
||||||
upper_non_critical=1.1558
|
|
||||||
lower_non_critical=1.0502
|
|
||||||
lower_critical=1.015
|
|
||||||
lower_non_recoverable=0.9886
|
|
||||||
10 +12V alarm=0 value=12.089762 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=13.825762
|
|
||||||
upper_critical=13.205762
|
|
||||||
upper_non_critical=12.647762
|
|
||||||
lower_non_critical=11.469762
|
|
||||||
lower_critical=10.911762
|
|
||||||
lower_non_recoverable=10.291762
|
|
||||||
11 +5V alarm=0 value=5.05405 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=5.52565
|
|
||||||
upper_critical=5.44705
|
|
||||||
upper_non_critical=5.42085
|
|
||||||
lower_non_critical=4.79205
|
|
||||||
lower_critical=4.63485
|
|
||||||
lower_non_recoverable=4.53005
|
|
||||||
12 P3V3_STBY alarm=0 value=3.33765 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=3.63005
|
|
||||||
upper_critical=3.56125
|
|
||||||
upper_non_critical=3.47525
|
|
||||||
lower_non_critical=3.13125
|
|
||||||
lower_critical=3.02805
|
|
||||||
lower_non_recoverable=2.95925
|
|
||||||
13 DTS CPU alarm=0 value=54 threshold_status=0
|
|
||||||
type=1/1
|
|
||||||
upper_non_recoverable=85
|
|
||||||
upper_critical=80
|
|
||||||
upper_non_critical=75
|
|
||||||
14 ADT7490 Local alarm=0 value=48 threshold_status=0
|
|
||||||
type=1/1
|
|
||||||
upper_non_recoverable=80
|
|
||||||
upper_critical=75
|
|
||||||
upper_non_critical=70
|
|
||||||
15 ADT7490 Rem1 alarm=0 value=58 threshold_status=0
|
|
||||||
type=1/1
|
|
||||||
upper_non_recoverable=85
|
|
||||||
upper_critical=80
|
|
||||||
upper_non_critical=75
|
|
||||||
16 ADT7490 Rem2 alarm=0 value=56 threshold_status=0
|
|
||||||
type=1/1
|
|
||||||
upper_non_recoverable=82
|
|
||||||
upper_critical=77
|
|
||||||
upper_non_critical=72
|
|
||||||
17 LM75 alarm=0 value=47 threshold_status=0
|
|
||||||
type=1/1
|
|
||||||
upper_non_recoverable=83
|
|
||||||
upper_critical=78
|
|
||||||
upper_non_critical=73
|
|
||||||
18 Fan 1 alarm=0 value=6700 threshold_status=0
|
|
||||||
type=4/1
|
|
||||||
upper_non_recoverable=25000
|
|
||||||
upper_critical=24000
|
|
||||||
upper_non_critical=22000
|
|
||||||
lower_non_critical=4000
|
|
||||||
lower_critical=3000
|
|
||||||
lower_non_recoverable=2000
|
|
||||||
19 Fan 2 alarm=0 value=6700 threshold_status=0
|
|
||||||
type=4/1
|
|
||||||
upper_non_recoverable=25000
|
|
||||||
upper_critical=24000
|
|
||||||
upper_non_critical=22000
|
|
||||||
lower_non_critical=4000
|
|
||||||
lower_critical=3000
|
|
||||||
lower_non_recoverable=2000
|
|
||||||
20 Fan 3 alarm=0 value=6900 threshold_status=0
|
|
||||||
type=4/1
|
|
||||||
upper_non_recoverable=25000
|
|
||||||
upper_critical=24000
|
|
||||||
upper_non_critical=22000
|
|
||||||
lower_non_critical=4000
|
|
||||||
lower_critical=3000
|
|
||||||
lower_non_recoverable=2000
|
|
||||||
21 Fan 4 alarm=0 value=6900 threshold_status=0
|
|
||||||
type=4/1
|
|
||||||
upper_non_recoverable=25000
|
|
||||||
upper_critical=24000
|
|
||||||
upper_non_critical=22000
|
|
||||||
lower_non_critical=4000
|
|
||||||
lower_critical=3000
|
|
||||||
lower_non_recoverable=2000
|
|
||||||
22 Fan 5 alarm=0 value=6200 threshold_status=0
|
|
||||||
type=4/1
|
|
||||||
upper_non_recoverable=25000
|
|
||||||
upper_critical=24000
|
|
||||||
upper_non_critical=22000
|
|
||||||
lower_non_critical=4000
|
|
||||||
lower_critical=3000
|
|
||||||
lower_non_recoverable=2000
|
|
||||||
23 PS1 Temp alarm=0 value=41 threshold_status=0
|
|
||||||
type=1/1
|
|
||||||
upper_non_recoverable=78
|
|
||||||
upper_critical=73
|
|
||||||
upper_non_critical=68
|
|
||||||
24 PS1 Fan 1 alarm=0 value=6784 threshold_status=0
|
|
||||||
type=4/1
|
|
||||||
upper_non_recoverable=32000
|
|
||||||
upper_critical=29056
|
|
||||||
upper_non_critical=26112
|
|
||||||
lower_non_critical=1024
|
|
||||||
lower_critical=768
|
|
||||||
lower_non_recoverable=512
|
|
||||||
25 PS1 VIN alarm=0 value=230 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=255
|
|
||||||
upper_critical=254
|
|
||||||
upper_non_critical=250
|
|
||||||
lower_non_critical=38
|
|
||||||
lower_critical=36
|
|
||||||
lower_non_recoverable=34
|
|
||||||
26 PS1 VOUT alarm=0 value=12.032 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=13.229
|
|
||||||
upper_critical=12.977
|
|
||||||
upper_non_critical=12.662
|
|
||||||
lower_non_critical=11.528
|
|
||||||
lower_critical=11.15
|
|
||||||
lower_non_recoverable=10.898
|
|
||||||
27 PS1 Status alarm=0
|
|
||||||
type=8/111
|
|
||||||
upper_non_recoverable=0
|
|
||||||
upper_critical=0
|
|
||||||
upper_non_critical=0
|
|
||||||
28 PS2 Temp alarm=0 (scanning disabled)
|
|
||||||
type=1/1
|
|
||||||
upper_non_recoverable=78
|
|
||||||
upper_critical=73
|
|
||||||
upper_non_critical=68
|
|
||||||
29 PS2 Fan 1 alarm=0 (scanning disabled)
|
|
||||||
type=4/1
|
|
||||||
upper_non_recoverable=32000
|
|
||||||
upper_critical=29056
|
|
||||||
upper_non_critical=26112
|
|
||||||
lower_non_critical=1024
|
|
||||||
lower_critical=768
|
|
||||||
lower_non_recoverable=512
|
|
||||||
30 PS2 VIN alarm=0 (scanning disabled)
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=255
|
|
||||||
upper_critical=254
|
|
||||||
upper_non_critical=250
|
|
||||||
lower_non_critical=38
|
|
||||||
lower_critical=36
|
|
||||||
lower_non_recoverable=34
|
|
||||||
31 PS2 VOUT alarm=0 (scanning disabled)
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=13.229
|
|
||||||
upper_critical=12.977
|
|
||||||
upper_non_critical=12.662
|
|
||||||
lower_non_critical=11.528
|
|
||||||
lower_critical=11.15
|
|
||||||
lower_non_recoverable=10.898
|
|
||||||
32 PS2 Status alarm=0 (not detected)
|
|
||||||
type=8/111
|
|
||||||
upper_non_recoverable=0
|
|
||||||
upper_critical=0
|
|
||||||
upper_non_critical=0
|
|
||||||
33 INA219 PS1 Vsht alarm=0 value=0.00832 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=0.03232
|
|
||||||
upper_critical=0.03104
|
|
||||||
upper_non_critical=0.03008
|
|
||||||
34 INA219 PS1 Vbus alarm=0 value=12.032 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=13.312
|
|
||||||
upper_critical=13.056
|
|
||||||
upper_non_critical=12.672
|
|
||||||
lower_non_critical=11.392
|
|
||||||
lower_critical=11.136
|
|
||||||
lower_non_recoverable=10.88
|
|
||||||
35 INA219 PS2 Vsht alarm=0 value=0.00032 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=0.03232
|
|
||||||
upper_critical=0.03104
|
|
||||||
upper_non_critical=0.03008
|
|
||||||
36 INA219 PS2 Vbus alarm=0 value=12.032 threshold_status=0
|
|
||||||
type=2/1
|
|
||||||
upper_non_recoverable=13.312
|
|
||||||
upper_critical=13.056
|
|
||||||
upper_non_critical=12.672
|
|
||||||
lower_non_critical=11.392
|
|
||||||
lower_critical=11.136
|
|
||||||
lower_non_recoverable=10.88
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
1 +3.3V alarm=0 value=3.2856 threshold_status=0
|
||||||
|
2 +5V alarm=0 value=5.0235 threshold_status=0
|
||||||
|
3 +12V alarm=0 value=12.136 threshold_status=0
|
||||||
|
4 CPU VCCP alarm=0 value=0.9609 threshold_status=0
|
||||||
|
5 CPU VTT alarm=0 value=1.0589 threshold_status=0
|
||||||
|
6 CPU PVSA alarm=0 value=0.9315 threshold_status=0
|
||||||
|
7 P1V8 alarm=0 value=1.7841 threshold_status=0
|
||||||
|
8 P1V5 alarm=0 value=1.4999 threshold_status=0
|
||||||
|
9 PCH +1.05V alarm=0 value=1.04 threshold_status=0
|
||||||
|
10 VCC 2V5 alarm=0 value=2.432 threshold_status=0
|
||||||
|
11 MAIN 12V alarm=0 value=11.904 threshold_status=0
|
||||||
|
12 VCC 1V15 alarm=0 value=1.136 threshold_status=0
|
||||||
|
13 DDR3 VTT alarm=0 value=0.736 threshold_status=0
|
||||||
|
14 RPS 12V alarm=1 value=0 threshold_status=0x7
|
||||||
|
15 NCT +3.3V alarm=0 value=3.216 threshold_status=0
|
||||||
|
16 NCT VBAT alarm=0 value=3.264 threshold_status=0
|
||||||
|
17 NCT +3.3VSB alarm=0 value=3.216 threshold_status=0
|
||||||
|
18 NCT VTT alarm=0 value=1.04 threshold_status=0
|
||||||
|
19 DTS CPU alarm=0 value=50 threshold_status=0
|
||||||
|
20 CPU Core 0 alarm=0 value=49 threshold_status=0
|
||||||
|
21 CPU Core 1 alarm=0 value=50 threshold_status=0
|
||||||
|
22 TD1 alarm=0 value=37 threshold_status=0
|
||||||
|
23 TD2 alarm=0 value=25 threshold_status=0
|
||||||
|
24 FAN_TMP_3 alarm=0 value=35 threshold_status=0
|
||||||
|
25 LM75 U72 alarm=0 value=28 threshold_status=0
|
||||||
|
26 LM75 U65 alarm=0 value=31 threshold_status=0
|
||||||
|
27 LM75 U62 alarm=0 value=32 threshold_status=0
|
||||||
|
28 FAN1 alarm=0 value=4900 threshold_status=0
|
||||||
|
29 FAN2 alarm=0 value=5000 threshold_status=0
|
||||||
|
30 FAN3 alarm=0 value=4700 threshold_status=0
|
||||||
@@ -1 +1 @@
|
|||||||
{"fans": {"ps2 fan 1": {"status": false}, "ps1 fan 1": {"status": true}, "fan 2": {"status": true}, "fan 3": {"status": true}, "fan 1": {"status": true}, "fan 4": {"status": true}, "fan 5": {"status": true}}, "cpu": {"CPU2": {"%usage": 4.0}, "CPU3": {"%usage": 4.0}, "CPU0": {"%usage": 8.0}, "CPU1": {"%usage": 4.0}}, "temperature": {"adt7490 rem1": {"is_critical": false, "temperature": 58.0, "is_alert": false}, "adt7490 rem2": {"is_critical": false, "temperature": 56.0, "is_alert": false}, "dts cpu": {"is_critical": false, "temperature": 54.0, "is_alert": false}, "ps2 temp": {"is_alert": false, "temperature": 0.0, "is_critical": false}, "ps1 temp": {"is_critical": false, "temperature": 41.0, "is_alert": false}, "adt7490 local": {"is_critical": false, "temperature": 48.0, "is_alert": false}}, "power": {"ps2": {"status": true, "output": -1.0, "capacity": -1.0}, "ps1": {"status": true, "output": -1.0, "capacity": -1.0}}, "memory": {"available_ram": 7962, "used_ram": 1148}}
|
{'fans': {'FAN1': {'status': true}, 'FAN2': {'status': true}, 'FAN3': {'status': true}}, 'temperature': {'FAN_TMP_3': {'temperature': 35.0, 'is_alert': 0, 'is_critical': 0}}, 'power': {'+3.3V': {'status': true, 'capacity': -1.0, 'output': -1.0}, '+5V': {'status': true, 'capacity': -1.0, 'output': -1.0}, '+12V': {'status': true, 'capacity': -1.0, 'output': -1.0}}, 'cpu': {'CPU0': {'%usage': 5.0}, 'CPU1': {'%usage': 2.0}, 'CPU2': {'%usage': 11.0}, 'CPU3': {'%usage': 2.0}}, 'memory': {'available_ram': 3039, 'used_ram': 1661}}
|
||||||
@@ -1 +1 @@
|
|||||||
{"1": [{"src_zone": "any", "log": "False", "service": "ALL", "schedule": "always", "l3_src": "all", "enabled": false, "packet_hits": -1, "l3_dst": "all", "dst_zone": "any", "action": "permit", "position": 1, "byte_hits": -1, "id": "1"}], "2": [{"src_zone": "port3", "log": "all", "service": "ALL", "schedule": "always", "l3_src": "all", "enabled": false, "packet_hits": -1, "l3_dst": "all", "dst_zone": "port2", "action": "reject", "position": 2, "byte_hits": -1, "id": "2"}]}
|
{"1": [{"src_zone": "any", "log": "False", "service": "ALL", "schedule": "always", "l3_src": "all", "enabled": false, "packet_hits": -1, "l3_dst": "all", "dst_zone": "any", "action": "permit", "position": 1, "byte_hits": -1, "id": "1"}] }
|
||||||
@@ -9,15 +9,4 @@ config firewall policy
|
|||||||
set schedule "always"
|
set schedule "always"
|
||||||
set service "ALL"
|
set service "ALL"
|
||||||
next
|
next
|
||||||
edit 2
|
|
||||||
set name "bla"
|
|
||||||
set uuid de597b64-aca8-51e6-5d00-b7874e6b72b8
|
|
||||||
set srcintf "port3"
|
|
||||||
set dstintf "port2"
|
|
||||||
set srcaddr "all"
|
|
||||||
set dstaddr "all"
|
|
||||||
set schedule "always"
|
|
||||||
set service "ALL"
|
|
||||||
set logtraffic all
|
|
||||||
next
|
|
||||||
end
|
end
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{'mgmt': {'ipv4': {'192.168.1.99': {'prefix_length': 24}}}, 'port1': {'ipv4': {'10.0.96.152': {'prefix_length': 19}}, 'ipv6': {'fd00:d051::10:0:96:152': {'prefix_length': '64'}}}}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
== [onboard]
|
||||||
|
==[mgmt]
|
||||||
|
mode: static
|
||||||
|
ip: 192.168.1.99 255.255.255.0
|
||||||
|
ipv6: ::/0
|
||||||
|
status: down
|
||||||
|
speed: n/a
|
||||||
|
==[port1]
|
||||||
|
mode: static
|
||||||
|
ip: 10.0.96.152 255.255.224.0
|
||||||
|
ipv6: fd00:d051::10:0:96:152/64
|
||||||
|
status: up
|
||||||
|
speed: 1000Mbps (Duplex: full)
|
||||||
|
==[port2]
|
||||||
|
mode: static
|
||||||
|
ip: 0.0.0.0 0.0.0.0
|
||||||
|
ipv6: ::/0
|
||||||
|
status: up
|
||||||
|
speed: 1000Mbps (Duplex: full)
|
||||||
|
|
||||||
Reference in new issue
Block a user