From 539a5d77ff86663cc5862d5ba20227d0d1ff6998 Mon Sep 17 00:00:00 2001 From: David Barroso Date: Sun, 27 Nov 2016 12:32:15 +0100 Subject: [PATCH 01/18] Adapting travis and setup.cfg --- .travis.yml | 23 ++++++++++++----------- setup.cfg | 9 +++++++++ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 06cedb1..3012dc3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,22 @@ language: python + python: - 2.7 + install: - pip install -r requirements.txt - pip install . - pip install coveralls + +script: +- py.test +- coverage combine test/unit/.coverage +- pylama . + +after_success: + - coveralls + - if [ $TRAVIS_TAG ]; then curl -X POST https://readthedocs.org/build/napalm; fi + deploy: provider: pypi user: dbarroso @@ -13,14 +25,3 @@ deploy: on: tags: true branch: master -script: -- cd test/unit -- nosetests --with-coverage --cover-package napalm_fortios -v TestFortiOSDriver:TestGetterFortiOSDriver.test_get_bgp_neighbors -- nosetests --with-coverage --cover-package napalm_fortios -v TestFortiOSDriver:TestGetterFortiOSDriver.test_get_environment -- nosetests --with-coverage --cover-package napalm_fortios -v TestFortiOSDriver:TestGetterFortiOSDriver.test_get_facts -- nosetests --with-coverage --cover-package napalm_fortios -v TestFortiOSDriver:TestGetterFortiOSDriver.test_get_interfaces -- nosetests --with-coverage --cover-package napalm_fortios -v TestFortiOSDriver:TestGetterFortiOSDriver.test_get_interfaces_counters -- nosetests --with-coverage --cover-package napalm_fortios -v TestFortiOSDriver:TestGetterFortiOSDriver.test_get_config -- cd ../.. -- coverage combine test/unit/.coverage -after_success: coveralls diff --git a/setup.cfg b/setup.cfg index ffae4a5..b70b914 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,3 +4,12 @@ ignore = D203,C901 [pylama:pep8] max_line_length = 100 + +[pytest] +addopts = --cov=./ -vs +json_report = report.json +jsonapi = true + +[coverage:run] +include = + napalm_fortios/* From 3f7f7cb83a9d10efdf1317e6a97bc0aa73aadfea Mon Sep 17 00:00:00 2001 From: David Barroso Date: Sun, 27 Nov 2016 14:10:59 +0100 Subject: [PATCH 02/18] Minor administrative fixes --- .travis.yml | 3 +-- report.json | 1 + requirements-dev.txt | 1 + setup.cfg | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 report.json diff --git a/.travis.yml b/.travis.yml index 3012dc3..5bf5aa7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,9 +4,8 @@ python: - 2.7 install: -- pip install -r requirements.txt +- pip install -r requirements-dev.txt - pip install . -- pip install coveralls script: - py.test diff --git a/report.json b/report.json new file mode 100644 index 0000000..7cb2b0d --- /dev/null +++ b/report.json @@ -0,0 +1 @@ +{"included": [], "data": [{"relationships": {"tests": {"data": []}}, "attributes": {"environment": {}, "created_at": "2016-11-27 13:04:26.138259", "summary": {"duration": 0.046421051025390625, "num_tests": 0}}, "type": "report", "id": 1}]} \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt index 491f338..0f1c9d3 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -4,4 +4,5 @@ pytest-json pytest-pythonpath pylama flake8-import-order +coveralls -r requirements.txt diff --git a/setup.cfg b/setup.cfg index b70b914..c338e58 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,7 +5,7 @@ ignore = D203,C901 [pylama:pep8] max_line_length = 100 -[pytest] +[tool:pytest] addopts = --cov=./ -vs json_report = report.json jsonapi = true From f5edd34d8b9306965123bcdbee0055632682aa27 Mon Sep 17 00:00:00 2001 From: David Barroso Date: Sun, 27 Nov 2016 14:11:18 +0100 Subject: [PATCH 03/18] Bump version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1af1d89..ef85d26 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name="napalm-fortios", - version="0.2.1", + version="0.2.2", packages=find_packages(), author="David Barroso", author_email="dbarrosop@dravetech.com", From 4d0325eb97d137aaab30318dc8575e1d03b36bcb Mon Sep 17 00:00:00 2001 From: David Barroso Date: Sun, 27 Nov 2016 14:19:12 +0100 Subject: [PATCH 04/18] Make pylama happy --- napalm_fortios/fortios.py | 58 +++++++++++++++++++++++----------- report.json | 2 +- test/unit/TestFortiOSDriver.py | 8 +++-- 3 files changed, 45 insertions(+), 23 deletions(-) diff --git a/napalm_fortios/fortios.py b/napalm_fortios/fortios.py index e0a2fcc..45711e9 100644 --- a/napalm_fortios/fortios.py +++ b/napalm_fortios/fortios.py @@ -16,7 +16,8 @@ from pyFG.exceptions import FailedCommit, CommandExecutionException from napalm_base.base import NetworkDriver from napalm_base.exceptions import ReplaceConfigException, MergeConfigException -from napalm_base.utils.string_parsers import colon_separated_string_to_dict, convert_uptime_string_seconds +from napalm_base.utils.string_parsers import colon_separated_string_to_dict,\ + convert_uptime_string_seconds class FortiOSDriver(NetworkDriver): @@ -30,7 +31,8 @@ def __init__(self, hostname, username, password, timeout=60, optional_args=None) else: self.vdom = None - self.device = FortiOS(hostname, username=username, password=password, timeout=timeout, vdom=self.vdom) + self.device = FortiOS(hostname, username=username, password=password, + timeout=timeout, vdom=self.vdom) self.config_replace = False def open(self): @@ -44,14 +46,16 @@ def execute_command_with_vdom(self, command, vdom=None): vdom = vdom or self.vdom if vdom == 'global' and self.vdom is not None: - # If vdom is global we go to the global vdom, execute the commands and then back to the root. - # There is a catch, if the device doesn't have vdoms enabled we have to execute the command in the root + # If vdom is global we go to the global vdom, execute the commands + # and then back to the root. There is a catch, if the device doesn't + # have vdoms enabled we have to execute the command in the root command = 'conf global\n{command}\nend'.format(command=command) # We skip the lines telling us that we changed vdom return self.device.execute_command(command)[1:-2] elif vdom not in ['global', None]: - # If we have a vdom we change to the vdom, execute the commands and then exit back to the root + # If we have a vdom we change to the vdom, execute + # the commands and then exit back to the root command = 'conf vdom\nedit {vdom}\n{command}\nend'.format(vdom=vdom, command=command) # We skip the lines telling us that we changed vdom @@ -132,10 +136,14 @@ def rollback(self): self.device.load_config(empty_candidate=True) self.load_replace_candidate(config=rollback_config) - self.device.candidate_config['vpn certificate local']['Fortinet_CA_SSLProxy'].del_param('private-key') - self.device.candidate_config['vpn certificate local']['Fortinet_CA_SSLProxy'].del_param('certificate') - self.device.candidate_config['vpn certificate local']['Fortinet_SSLProxy'].del_param('private-key') - self.device.candidate_config['vpn certificate local']['Fortinet_SSLProxy'].del_param('certificate') + self.device.candidate_config['vpn certificate local']['Fortinet_CA_SSLProxy'].\ + del_param('private-key') + self.device.candidate_config['vpn certificate local']['Fortinet_CA_SSLProxy'].\ + del_param('certificate') + self.device.candidate_config['vpn certificate local']['Fortinet_SSLProxy'].\ + del_param('private-key') + self.device.candidate_config['vpn certificate local']['Fortinet_SSLProxy'].\ + del_param('certificate') self.device.commit() def get_config(self, retrieve="all"): @@ -163,7 +171,8 @@ def get_config(self, retrieve="all"): def get_facts(self): system_status = self.get_command_with_vdom('get system status', vdom='global') - performance_status = self.get_command_with_vdom('get system performance status', vdom='global') + performance_status = self.get_command_with_vdom('get system performance status', + 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 ''] @@ -279,7 +288,8 @@ def get_bgp_neighbors(self): neighbor_dict['address_family']['ipv4'] = dict() neighbor_dict['address_family']['ipv6'] = dict() - detail_output = [x.lower() for x in self.execute_command_with_vdom(command_detail.format(neighbor))] + detail_output = [x.lower() for x in + self.execute_command_with_vdom(command_detail.format(neighbor))] m = re.search('remote router id (.+?)\n', '\n'.join(detail_output)) if m: neighbor_dict['remote_id'] = unicode(m.group(1)) @@ -326,7 +336,8 @@ def get_interfaces_counters(self): elif (data[1].startswith('RX packets') or data[1].startswith('TX packets')) and if_name: if_data = data[1].split(' ') direction = if_data[0].lower() - interface_counters[if_name][direction + '_unicast_packets'] = int(if_data[1].split(':')[1]) + interface_counters[if_name][direction + '_unicast_packets'] = \ + int(if_data[1].split(':')[1]) interface_counters[if_name][direction + '_errors'] = int(if_data[2].split(':')[1]) interface_counters[if_name][direction + '_discards'] = int(if_data[2].split(':')[1]) interface_counters[if_name][direction + '_multicast_packets'] = -1 @@ -380,7 +391,7 @@ def get_cpu(cpu_lines): return output def get_memory(memory_line): - total, used = int(memory_line[1]) >> 20, int(memory_line[2]) >> 20 # convert from 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) def get_temperature(temperature_lines, detail_block): @@ -388,7 +399,8 @@ def get_temperature(temperature_lines, detail_block): 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} + output[sensor_name] = {'is_alert': False, 'is_critical': False, + 'temperature': 0.0} continue m = search_normal(temp_line) @@ -400,7 +412,8 @@ def get_temperature(temperature_lines, 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]) + 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) @@ -409,10 +422,13 @@ def get_temperature(temperature_lines, detail_block): out = dict() - sensors_block = [parse_string(x) for x in self.execute_command_with_vdom('execute sensor detail', vdom='global') if x] + sensors_block = [parse_string(x) for x in + self.execute_command_with_vdom('execute sensor detail', vdom='global') + if x] # temp - temp_lines = [x for x in sensors_block if any([True for y in ['dts', 'temp', 'adt7490'] if y in x])] + temp_lines = [x for x in sensors_block + if any([True for y in ['dts', 'temp', 'adt7490'] if y in x])] out['temperature'] = get_temperature(temp_lines, sensors_block) # fans @@ -420,11 +436,15 @@ def get_temperature(temperature_lines, detail_block): # cpu out['cpu'] = get_cpu( - [x for x in self.execute_command_with_vdom('get system performance status | grep CPU', vdom='global')[1:] if x]) + [x for x in + self.execute_command_with_vdom('get system performance status | grep CPU', + vdom='global')[1:] if x]) # memory memory_command = 'diag hard sys mem | grep Mem:' - t = [x for x in re.split('\s+', self.execute_command_with_vdom(memory_command, vdom='global')[0]) if x] + t = [x for x in + re.split('\s+', self.execute_command_with_vdom(memory_command, + vdom='global')[0]) if x] out['memory'] = get_memory(t) # power, not implemented diff --git a/report.json b/report.json index 7cb2b0d..e365e0b 100644 --- a/report.json +++ b/report.json @@ -1 +1 @@ -{"included": [], "data": [{"relationships": {"tests": {"data": []}}, "attributes": {"environment": {}, "created_at": "2016-11-27 13:04:26.138259", "summary": {"duration": 0.046421051025390625, "num_tests": 0}}, "type": "report", "id": 1}]} \ No newline at end of file +{"included": [], "data": [{"relationships": {"tests": {"data": []}}, "attributes": {"environment": {}, "created_at": "2016-11-27 14:11:34.760826", "summary": {"duration": 0.0366358757019043, "num_tests": 0}}, "type": "report", "id": 1}]} \ No newline at end of file diff --git a/test/unit/TestFortiOSDriver.py b/test/unit/TestFortiOSDriver.py index a0f55df..542c1fd 100644 --- a/test/unit/TestFortiOSDriver.py +++ b/test/unit/TestFortiOSDriver.py @@ -60,9 +60,11 @@ def read_txt_file(filename): def execute_command(self, command): return self.read_txt_file( - 'fortios/mock_data/{}.txt'.format(command.replace(' ', '_').replace('|', '').replace(':', ''))) + 'fortios/mock_data/{}.txt'.format( + command.replace(' ', '_').replace('|', '').replace(':', ''))) def load_config(self, config_block): self.running_config = FortiConfig('running') - self.running_config.parse_config_output(self.read_txt_file('fortios/mock_data/{}.txt'.format( - config_block.replace(' ', '_')))) + self.running_config.parse_config_output( + self.read_txt_file('fortios/mock_data/{}.txt'.format( + config_block.replace(' ', '_')))) From 8183a4e151d61f43cf303550571f31bb1e83cd1d Mon Sep 17 00:00:00 2001 From: David Barroso Date: Sun, 27 Nov 2016 14:59:03 +0100 Subject: [PATCH 05/18] All test migrated --- napalm_fortios/fortios.py | 3 - report.json | 2 +- test/unit/TestFortiOSDriver.py | 38 -- .../mock_data/diag_hard_sys_mem__grep_mem.txt | 1 - .../diagnose_hardware_deviceinfo_nic.txt | 3 - ...diagnose_hardware_deviceinfo_nic_mgmt2.txt | 42 -- ...diagnose_hardware_deviceinfo_nic_port1.txt | 93 ---- .../mock_data/execute_sensor_detail.txt | 255 --------- .../fortios/mock_data/fnsysctl_ifconfig.txt | 509 ------------------ ...t_router_info_bgp_neighbor_10.15.2.101.txt | 45 -- ...t_router_info_bgp_neighbor_10.15.2.105.txt | 42 -- ...et_router_info_bgp_neighbor_10.15.2.99.txt | 33 -- ....2.101_received-routes__grep_prefixes_.txt | 1 - ....2.105_received-routes__grep_prefixes_.txt | 1 - ...5.2.99_received-routes__grep_prefixes_.txt | 1 - .../mock_data/get_router_info_bgp_sum.txt | 11 - .../mock_data/get_system_dns__grep_domain.txt | 1 - .../get_system_interface__grep_==.txt | 15 - .../get_system_performance_status.txt | 12 - ...et_system_performance_status__grep_cpu.txt | 5 - .../fortios/mock_data/get_system_status.txt | 24 - test/unit/fortios/mock_data/router_bgp.txt | 60 --- test/unit/fortios/mock_data/show.txt | 402 -------------- .../fortios/mock_data/system_interface.txt | 121 ----- 24 files changed, 1 insertion(+), 1719 deletions(-) delete mode 100644 test/unit/fortios/mock_data/diag_hard_sys_mem__grep_mem.txt delete mode 100644 test/unit/fortios/mock_data/diagnose_hardware_deviceinfo_nic.txt delete mode 100644 test/unit/fortios/mock_data/diagnose_hardware_deviceinfo_nic_mgmt2.txt delete mode 100644 test/unit/fortios/mock_data/diagnose_hardware_deviceinfo_nic_port1.txt delete mode 100644 test/unit/fortios/mock_data/execute_sensor_detail.txt delete mode 100644 test/unit/fortios/mock_data/fnsysctl_ifconfig.txt delete mode 100644 test/unit/fortios/mock_data/get_router_info_bgp_neighbor_10.15.2.101.txt delete mode 100644 test/unit/fortios/mock_data/get_router_info_bgp_neighbor_10.15.2.105.txt delete mode 100644 test/unit/fortios/mock_data/get_router_info_bgp_neighbor_10.15.2.99.txt delete mode 100644 test/unit/fortios/mock_data/get_router_info_bgp_neighbors_10.15.2.101_received-routes__grep_prefixes_.txt delete mode 100644 test/unit/fortios/mock_data/get_router_info_bgp_neighbors_10.15.2.105_received-routes__grep_prefixes_.txt delete mode 100644 test/unit/fortios/mock_data/get_router_info_bgp_neighbors_10.15.2.99_received-routes__grep_prefixes_.txt delete mode 100644 test/unit/fortios/mock_data/get_router_info_bgp_sum.txt delete mode 100644 test/unit/fortios/mock_data/get_system_dns__grep_domain.txt delete mode 100644 test/unit/fortios/mock_data/get_system_interface__grep_==.txt delete mode 100644 test/unit/fortios/mock_data/get_system_performance_status.txt delete mode 100644 test/unit/fortios/mock_data/get_system_performance_status__grep_cpu.txt delete mode 100644 test/unit/fortios/mock_data/get_system_status.txt delete mode 100644 test/unit/fortios/mock_data/router_bgp.txt delete mode 100644 test/unit/fortios/mock_data/show.txt delete mode 100644 test/unit/fortios/mock_data/system_interface.txt diff --git a/napalm_fortios/fortios.py b/napalm_fortios/fortios.py index 45711e9..b986f3b 100644 --- a/napalm_fortios/fortios.py +++ b/napalm_fortios/fortios.py @@ -351,9 +351,6 @@ def get_interfaces_counters(self): interface_counters[if_name]['tx_octets'] = int(if_data[7].split(':')[1]) return interface_counters - def get_lldp_neighbors(self): - return {} - def get_environment(self): def parse_string(line): diff --git a/report.json b/report.json index e365e0b..f372b0e 100644 --- a/report.json +++ b/report.json @@ -1 +1 @@ -{"included": [], "data": [{"relationships": {"tests": {"data": []}}, "attributes": {"environment": {}, "created_at": "2016-11-27 14:11:34.760826", "summary": {"duration": 0.0366358757019043, "num_tests": 0}}, "type": "report", "id": 1}]} \ No newline at end of file +{"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": "call"}, "duration": 0.0014026165008544922, "outcome": "passed"}, "type": "test", "id": 9}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_is_alive[no_test_case_found]", "teardown": {"duration": 6.29425048828125e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.00033211708068847656, "outcome": "passed", "name": "setup"}, "run_index": 19, "call": {"duration": 0.00011897087097167969, "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.0008461475372314453, "outcome": "skipped"}, "type": "test", "id": 10}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_probes_results[no_test_case_found]", "teardown": {"duration": 8.487701416015625e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003800392150878906, "outcome": "passed", "name": "setup"}, "run_index": 21, "call": {"duration": 0.00023889541625976562, "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.0010838508605957031, "outcome": "skipped"}, "type": "test", "id": 11}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_mac_address_table[no_test_case_found]", "teardown": {"duration": 6.604194641113281e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003840923309326172, "outcome": "passed", "name": "setup"}, "run_index": 12, "call": {"duration": 0.00012803077697753906, "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.0009622573852539062, "outcome": "skipped"}, "type": "test", "id": 12}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_ping[no_test_case_found]", "teardown": {"duration": 7.700920104980469e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0004589557647705078, "outcome": "passed", "name": "setup"}, "run_index": 23, "call": {"duration": 0.0001399517059326172, "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.0011348724365234375, "outcome": "skipped"}, "type": "test", "id": 13}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_lldp_neighbors_detail[no_test_case_found]", "teardown": {"duration": 6.508827209472656e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003249645233154297, "outcome": "passed", "name": "setup"}, "run_index": 4, "call": {"duration": 0.00012993812561035156, "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.0008449554443359375, "outcome": "skipped"}, "type": "test", "id": 14}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_environment[normal]", "teardown": {"duration": 8.0108642578125e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003638267517089844, "outcome": "passed", "name": "setup"}, "run_index": 24, "call": {"duration": 0.00433802604675293, "outcome": "passed", "name": "call"}, "duration": 0.0051457881927490234, "outcome": "passed"}, "type": "test", "id": 15}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_bgp_config[no_test_case_found]", "teardown": {"duration": 6.699562072753906e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.00036406517028808594, "outcome": "passed", "name": "setup"}, "run_index": 16, "call": {"duration": 0.0001239776611328125, "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.0009191036224365234, "outcome": "skipped"}, "type": "test", "id": 16}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_config_filtered[normal]", "teardown": {"duration": 8.392333984375e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003631114959716797, "outcome": "passed", "name": "setup"}, "run_index": 22, "call": {"duration": 0.0003178119659423828, "outcome": "passed", "name": "call"}, "duration": 0.0011279582977294922, "outcome": "passed"}, "type": "test", "id": 17}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_ntp_peers[no_test_case_found]", "teardown": {"duration": 6.4849853515625e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003151893615722656, "outcome": "passed", "name": "setup"}, "run_index": 5, "call": {"duration": 0.00012111663818359375, "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.00081634521484375, "outcome": "skipped"}, "type": "test", "id": 18}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_traceroute[no_test_case_found]", "teardown": {"duration": 6.604194641113281e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.00033593177795410156, "outcome": "passed", "name": "setup"}, "run_index": 20, "call": {"duration": 0.00011491775512695312, "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.0008528232574462891, "outcome": "skipped"}, "type": "test", "id": 19}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_interfaces[normal]", "teardown": {"duration": 6.604194641113281e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.00034809112548828125, "outcome": "passed", "name": "setup"}, "run_index": 2, "call": {"duration": 0.0009751319885253906, "outcome": "passed", "name": "call"}, "duration": 0.001737356185913086, "outcome": "passed"}, "type": "test", "id": 20}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_optics[no_test_case_found]", "teardown": {"duration": 6.4849853515625e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003120899200439453, "outcome": "passed", "name": "setup"}, "run_index": 9, "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.0008149147033691406, "outcome": "skipped"}, "type": "test", "id": 21}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_interfaces_ip[no_test_case_found]", "teardown": {"duration": 6.413459777832031e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003459453582763672, "outcome": "passed", "name": "setup"}, "run_index": 17, "call": {"duration": 0.00013113021850585938, "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.0008871555328369141, "outcome": "skipped"}, "type": "test", "id": 22}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_ntp_stats[no_test_case_found]", "teardown": {"duration": 6.794929504394531e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.00041604042053222656, "outcome": "passed", "name": "setup"}, "run_index": 7, "call": {"duration": 0.0003948211669921875, "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.001294851303100586, "outcome": "skipped"}, "type": "test", "id": 23}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_bgp_neighbors_detail[no_test_case_found]", "teardown": {"duration": 6.29425048828125e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.00033593177795410156, "outcome": "passed", "name": "setup"}, "run_index": 15, "call": {"duration": 0.0001270771026611328, "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.0008618831634521484, "outcome": "skipped"}, "type": "test", "id": 24}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_lldp_neighbors[no_test_case_found]", "teardown": {"duration": 0.00010085105895996094, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003330707550048828, "outcome": "passed", "name": "setup"}, "run_index": 6, "call": {"duration": 0.00015687942504882812, "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.0009238719940185547, "outcome": "skipped"}, "type": "test", "id": 25}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_snmp_information[no_test_case_found]", "teardown": {"duration": 0.0005891323089599609, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.000331878662109375, "outcome": "passed", "name": "setup"}, "run_index": 26, "call": {"duration": 0.0010008811950683594, "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.0022537708282470703, "outcome": "skipped"}, "type": "test", "id": 26}, {"attributes": {"name": "test/unit/test_getters.py::TestGetter::()::test_get_facts[normal]", "teardown": {"duration": 6.389617919921875e-05, "outcome": "passed", "name": "teardown"}, "setup": {"duration": 0.0003380775451660156, "outcome": "passed", "name": "setup"}, "run_index": 14, "call": {"duration": 0.0005338191986083984, "outcome": "passed", "name": "call"}, "duration": 0.0012738704681396484, "outcome": "passed"}, "type": "test", "id": 27}], "data": [{"relationships": {"tests": {"data": [{"type": "test", "id": 1}, {"type": "test", "id": 2}, {"type": "test", "id": 3}, {"type": "test", "id": 4}, {"type": "test", "id": 5}, {"type": "test", "id": 6}, {"type": "test", "id": 7}, {"type": "test", "id": 8}, {"type": "test", "id": 9}, {"type": "test", "id": 10}, {"type": "test", "id": 11}, {"type": "test", "id": 12}, {"type": "test", "id": 13}, {"type": "test", "id": 14}, {"type": "test", "id": 15}, {"type": "test", "id": 16}, {"type": "test", "id": 17}, {"type": "test", "id": 18}, {"type": "test", "id": 19}, {"type": "test", "id": 20}, {"type": "test", "id": 21}, {"type": "test", "id": 22}, {"type": "test", "id": 23}, {"type": "test", "id": 24}, {"type": "test", "id": 25}, {"type": "test", "id": 26}, {"type": "test", "id": 27}]}}, "attributes": {"environment": {"Python": "2.7.12", "Platform": "Darwin-16.1.0-x86_64-i386-64bit"}, "created_at": "2016-11-27 14:58:56.238830", "summary": {"duration": 0.33277392387390137, "skipped": 20, "passed": 7, "num_tests": 27}}, "type": "report", "id": 1}]} \ No newline at end of file diff --git a/test/unit/TestFortiOSDriver.py b/test/unit/TestFortiOSDriver.py index 542c1fd..6e519e4 100644 --- a/test/unit/TestFortiOSDriver.py +++ b/test/unit/TestFortiOSDriver.py @@ -30,41 +30,3 @@ def setUpClass(cls): cls.device = FortiOSDriver(hostname, username, password, timeout=60) cls.device.open() - - -class TestGetterFortiOSDriver(unittest.TestCase, TestGettersNetworkDriver): - - @classmethod - def setUpClass(cls): - cls.mock = True - - hostname = '192.168.56.201' - username = 'vagrant' - password = 'vagrant' - cls.vendor = 'eos' - - cls.device = FortiOSDriver(hostname, username, password, timeout=60) - - if cls.mock: - cls.device.device = FakeFortiOSDevice() - else: - cls.device.open() - - -class FakeFortiOSDevice: - - @staticmethod - def read_txt_file(filename): - with open(filename.lower()) as data_file: - return data_file.read().splitlines() - - def execute_command(self, command): - return self.read_txt_file( - 'fortios/mock_data/{}.txt'.format( - command.replace(' ', '_').replace('|', '').replace(':', ''))) - - def load_config(self, config_block): - self.running_config = FortiConfig('running') - self.running_config.parse_config_output( - self.read_txt_file('fortios/mock_data/{}.txt'.format( - config_block.replace(' ', '_')))) diff --git a/test/unit/fortios/mock_data/diag_hard_sys_mem__grep_mem.txt b/test/unit/fortios/mock_data/diag_hard_sys_mem__grep_mem.txt deleted file mode 100644 index 894f1f6..0000000 --- a/test/unit/fortios/mock_data/diag_hard_sys_mem__grep_mem.txt +++ /dev/null @@ -1 +0,0 @@ -Mem: 8349081600 1204281344 7144800256 0 137478144 329146368 102465536 diff --git a/test/unit/fortios/mock_data/diagnose_hardware_deviceinfo_nic.txt b/test/unit/fortios/mock_data/diagnose_hardware_deviceinfo_nic.txt deleted file mode 100644 index abc4969..0000000 --- a/test/unit/fortios/mock_data/diagnose_hardware_deviceinfo_nic.txt +++ /dev/null @@ -1,3 +0,0 @@ -The following NICs are available: - mgmt2 - port1 diff --git a/test/unit/fortios/mock_data/diagnose_hardware_deviceinfo_nic_mgmt2.txt b/test/unit/fortios/mock_data/diagnose_hardware_deviceinfo_nic_mgmt2.txt deleted file mode 100644 index 30d63c6..0000000 --- a/test/unit/fortios/mock_data/diagnose_hardware_deviceinfo_nic_mgmt2.txt +++ /dev/null @@ -1,42 +0,0 @@ -Description Broadcom 570x Tigon3 Ethernet Adapter -Part_Number BCM95718 -PHY_Device_ID 5718C -Driver_Name tg3 -Driver_Version 3.85l -PCI_Vendor 0x14e4 -PCI_Device_ID 0x1656 -PCI_Subsystem_Vendor 0x14e4 -PCI_Subsystem_ID 0x1656 -PCI_Revision_ID 0x5717100 -PCI_Address 5:0.1 -Memory 0xefe30000 -IRQ 17 -System_Device_Name mgmt2 -Current_HWaddr 00:09:0f:09:00:01 -Permanent_HWaddr 08:5b:0e:7a:66:83 -Link down -Speed N/A -FlowControl N/A -Rx_Packets 0 -Rx_Packets_Dropped 0 -Tx_Packets 0 -Rx_Bytes 0 -Tx_Bytes 0 -Rx_Errors 0 -Tx_errors 0 -Multicast 0 -Collisions 0 -Rx_Length_Errors 0 -Rx_Over_Errors 0 -Rx_Frame_Errors 0 -Tx_aborted_Errors 0 -Tx_carrier_errors 0 -Rx_CRC_Errors 0 -rx_pending 200 -tx_pending 511 -tg3_flags a648e425 -tg3_flags2 180c9600 -tg3_flags3 00603003 -rx_rcb_ptr 00000000 -rx_producer 00000000 -num_reset 0 diff --git a/test/unit/fortios/mock_data/diagnose_hardware_deviceinfo_nic_port1.txt b/test/unit/fortios/mock_data/diagnose_hardware_deviceinfo_nic_port1.txt deleted file mode 100644 index 0ae5a3b..0000000 --- a/test/unit/fortios/mock_data/diagnose_hardware_deviceinfo_nic_port1.txt +++ /dev/null @@ -1,93 +0,0 @@ -Description :FortiASIC NP4 Adapter -Driver Name :FortiASIC Unified NPU Driver -Version :1.0 -PCI Slot :01:00.0 -PCI_Revision_ID :1 -Board :fgt800c -SN :FG800C3914800949 -Major ID :19 -Minor ID :0 -LIF ID :1 -NPU OID :1 -NPU OID_VID :3 -netdev flags :0x00001303 -Current_HWaddr 00:09:0f:09:00:02 -Permanent_HWaddr 08:5b:0e:7a:66:69 -Queue :On -rx_buffer_len :2048 -max_frame_size :1522 -min_frame_size :278 -MTU :1500 -Hidden :No -dyn_lif :0 -npu_cap :0000601f -ses_mask :40027dcb -cmd_in_queue :0 -half_id :1 -phy_addr :0x01 -phy_flags :0x4002 -medium_type :Copper -sw_port :3 -sw_np_port :29 -sw_stats_port :0 -phy_oid :0x01 -slot_id :0x00 -vid_phy[6] :[0003][0000][0000][0000][0000][0000] -vid_fwd[6] :[0000][0000][0000][0000][0000][0000] -oid_fwd[6] :[0000][0000][0000][0000][0000][0000] -========== Link Status ========== -Admin :up -PHY Status :up -PHY Speed :1000 -Duplex :Full -link_status :1 -rx_link_status :1 -remote_fault :0 -local_fault :0 -local_warning :0 -int_phy_link :0 -int_phy_reinit_cnt:0 -link_andone :0 -serdes_mode :SerDes -============ Counters =========== -clst_tx_orig :0 -clst_tx_o_free :0 -clst_tx_redir :0 -clst_tx_rd_free :0 -clst_tx_reply :0 -clst_tx_rp_free :0 -dd_wo_eop :0 -tcp_udp_csum_err:0 -rx_error :0 -rx_crc_error :0 -rx_len_error :0 -rx_carrier :0 -rx_oversize :0 -rx_undersize :0 -tx_collision :0 -ip_sum_offload :0 -ipsec_dec :0 -ipsec_dec_drop :0 -ipsec_antireplay_f:0 -ipsec_antireplay_p:0 -aps_log :0 -Rx Pkts :188895694 -Rx Bytes :82538535564 -Tx Pkts :297621641 -Tx Bytes :236894931491 -Host Rx Pkts :188895680 -Host Rx Bytes :79138411812 -Host Tx Pkts :297622192 -Host Tx Bytes :238680266080 -sw_rx_pkts :188895695 -sw_rx_bytes :934157048 -sw_tx_pkts :297621645 -sw_tx_bytes :671734297 -sw_rx_mc_pkts :166 -sw_rx_bc_pkts :110805703 -sw_np_rx_pkts :416031055 -sw_np_rx_bytes :251347608749 -sw_np_tx_pkts :299701544 -sw_np_tx_bytes :95704383998 -sw_np_rx_mc_pkts:78 -sw_np_rx_bc_pkts:236817338 diff --git a/test/unit/fortios/mock_data/execute_sensor_detail.txt b/test/unit/fortios/mock_data/execute_sensor_detail.txt deleted file mode 100644 index f5b1554..0000000 --- a/test/unit/fortios/mock_data/execute_sensor_detail.txt +++ /dev/null @@ -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 diff --git a/test/unit/fortios/mock_data/fnsysctl_ifconfig.txt b/test/unit/fortios/mock_data/fnsysctl_ifconfig.txt deleted file mode 100644 index 273f7ae..0000000 --- a/test/unit/fortios/mock_data/fnsysctl_ifconfig.txt +++ /dev/null @@ -1,509 +0,0 @@ -mgmt1 Link encap:Ethernet HWaddr 08:5B:0E:1C:02:2C - inet addr:10.225.0.101 Bcast:10.225.15.255 Mask:255.255.240.0 - UP BROADCAST RUNNING ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:779899549 errors:0 dropped:0 overruns:0 frame:0 - TX packets:9523098 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:100706484996 (93.8 GB) TX bytes:2343371965 (2.2 GB) - Interrupt:16 - -mgmt2 Link encap:Ethernet HWaddr 00:09:0F:09:00:01 - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - Interrupt:17 - -wan1 Link encap:Ethernet HWaddr 00:09:0F:09:00:1A - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port1 Link encap:Ethernet HWaddr 00:09:0F:09:00:02 - UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:63129134 errors:0 dropped:0 overruns:0 frame:0 - TX packets:64114385 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:6998023850 (6.5 GB) TX bytes:8021760304 (7.5 GB) - -wan2 Link encap:Ethernet HWaddr 00:09:0F:09:00:1B - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port2 Link encap:Ethernet HWaddr 00:09:0F:09:00:0D - UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:56564667 errors:0 dropped:0 overruns:0 frame:0 - TX packets:56562812 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:6108984036 (5.7 GB) TX bytes:6108783696 (5.7 GB) - -port3 Link encap:Ethernet HWaddr 00:09:0F:09:00:13 - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port4 Link encap:Ethernet HWaddr 00:09:0F:09:00:14 - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port5 Link encap:Ethernet HWaddr 00:09:0F:09:00:15 - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port6 Link encap:Ethernet HWaddr 00:09:0F:09:00:16 - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port7 Link encap:Ethernet HWaddr 00:09:0F:09:00:17 - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port8 Link encap:Ethernet HWaddr 00:09:0F:09:00:18 - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port9 Link encap:Ethernet HWaddr 00:09:0F:09:00:19 - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port10 Link encap:Ethernet HWaddr 00:09:0F:09:00:03 - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port11 Link encap:Ethernet HWaddr 00:09:0F:09:00:04 - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port12 Link encap:Ethernet HWaddr 00:09:0F:09:00:05 - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port13 Link encap:Ethernet HWaddr 00:09:0F:09:00:06 - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port14 Link encap:Ethernet HWaddr 00:09:0F:09:00:07 - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port15 Link encap:Ethernet HWaddr 00:09:0F:09:00:08 - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port16 Link encap:Ethernet HWaddr 00:09:0F:09:00:09 - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port17 Link encap:Ethernet HWaddr 00:09:0F:09:00:0A - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port18 Link encap:Ethernet HWaddr 00:09:0F:09:00:0B - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port19 Link encap:Ethernet HWaddr 00:09:0F:09:00:0C - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port20 Link encap:Ethernet HWaddr 00:09:0F:09:00:0E - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port21 Link encap:Ethernet HWaddr 00:09:0F:09:00:0F - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port22 Link encap:Ethernet HWaddr 00:09:0F:09:00:10 - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -port23 Link encap:Ethernet HWaddr 00:09:0F:09:00:11 - UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:86746961835 errors:0 dropped:0 overruns:0 frame:0 - TX packets:99786157719 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:27883734996518 (25968.8 GB) TX bytes:35320005597799 (32894.3 GB) - -port24 Link encap:Ethernet HWaddr 00:09:0F:09:00:12 - UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -root Link encap:Local Loopback - inet addr:127.0.0.1 Mask:255.0.0.0 - UP LOOPBACK RUNNING MTU:16436 Metric:1 - RX packets:352233 errors:0 dropped:0 overruns:0 frame:0 - TX packets:352233 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:1077259718 (1.0 GB) TX bytes:1077259718 (1.0 GB) - -ssl.root Link encap:Point-Point Protocol - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -pub0 Link encap:Ethernet HWaddr 00:09:0F:09:00:11 - inet addr:191.168.32.243 Bcast:193.235.32.255 Mask:255.255.255.240 - UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1 - RX packets:45948704676 errors:0 dropped:0 overruns:0 frame:0 - TX packets:41279349776 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:11620407995936 (10822.3 GB) TX bytes:18790279964525 (17499.8 GB) - -svc0 Link encap:Ethernet HWaddr 00:09:0F:09:00:11 - inet addr:172.20.96.131 Bcast:23.92.96.143 Mask:255.255.255.240 - UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1 - RX packets:40792225191 errors:0 dropped:0 overruns:0 frame:0 - TX packets:58506810107 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:15915591848230 (14822.5 GB) TX bytes:16130582366133 (15022.8 GB) - -vsys_hamgmt Link encap:Local Loopback - inet addr:127.0.0.1 Mask:255.0.0.0 - UP LOOPBACK RUNNING MTU:16436 Metric:1 - RX packets:45 errors:0 dropped:0 overruns:0 frame:0 - TX packets:45 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:11717 (11.4 KB) TX bytes:11717 (11.4 KB) - -MY_VPN Link encap:Unknown - inet addr:10.15.2.100 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 - RX packets:3802963042 errors:19403 dropped:0 overruns:0 frame:0 - TX packets:4405184959 errors:18 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:1401932944256 (1305.7 GB) TX bytes:3390894856257 (3158.0 GB) - -vsys_ha Link encap:Local Loopback - inet addr:127.0.0.1 Mask:255.0.0.0 - UP LOOPBACK RUNNING MTU:16436 Metric:1 - RX packets:525955 errors:0 dropped:0 overruns:0 frame:0 - TX packets:525955 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:40507822 (38.6 MB) TX bytes:40507822 (38.6 MB) - -port_ha Link encap:Ethernet HWaddr 08:5B:0E:1C:02:13 - inet addr:169.254.0.1 Bcast:169.254.0.63 Mask:255.255.255.192 - UP BROADCAST RUNNING MULTICAST MTU:1496 Metric:1 - RX packets:6564405 errors:0 dropped:0 overruns:0 frame:0 - TX packets:7551508 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:770850098 (735.1 MB) TX bytes:1882738875 (1.8 GB) - -vsys_fgfm Link encap:Local Loopback - inet addr:127.0.0.1 Mask:255.0.0.0 - UP LOOPBACK RUNNING MTU:16436 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) - -havdlink0 Link encap:Point-Point Protocol - inet addr:169.254.0.65 Mask:255.255.255.192 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 - RX packets:15886 errors:0 dropped:0 overruns:0 frame:0 - TX packets:9211 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:22847822 (21.8 MB) TX bytes:505250 (493.4 KB) - -havdlink1 Link encap:Point-Point Protocol - inet addr:169.254.0.66 Mask:255.255.255.192 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 - RX packets:9211 errors:0 dropped:0 overruns:0 frame:0 - TX packets:15886 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:100 - RX bytes:505250 (493.4 KB) TX bytes:22847822 (21.8 MB) - -forticlient_3 Link encap:Unknown - inet addr:10.226.0.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 - RX packets:15534 errors:0 dropped:0 overruns:0 frame:0 - TX packets:13524 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:2247112 (2.1 MB) TX bytes:71795 (70.1 KB) - -native_2 Link encap:Unknown - inet addr:10.226.1.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 - RX packets:91542 errors:0 dropped:0 overruns:0 frame:0 - TX packets:80053 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:12083568 (11.5 MB) TX bytes:15028967 (14.3 MB) - -forticlient_2 Link encap:Unknown - inet addr:10.226.0.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 - RX packets:3079 errors:0 dropped:0 overruns:0 frame:0 - TX packets:2042 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:197672 (193.0 KB) TX bytes:132023 (128.9 KB) - -forticlient_0 Link encap:Unknown - inet addr:10.226.0.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 - RX packets:13702 errors:0 dropped:0 overruns:0 frame:0 - TX packets:13820 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:2884770 (2.8 MB) TX bytes:10488565 (10.0 MB) - -forticlient_1 Link encap:Unknown - inet addr:10.226.0.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 - RX packets:1797 errors:0 dropped:0 overruns:0 frame:0 - TX packets:1788 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:262802 (256.6 KB) TX bytes:524834 (512.5 KB) - -native_0 Link encap:Unknown - inet addr:10.226.1.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 - RX packets:44431 errors:0 dropped:0 overruns:0 frame:0 - TX packets:48129 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:12257836 (11.7 MB) TX bytes:39259957 (37.4 MB) - -native_12 Link encap:Unknown - inet addr:10.226.1.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 - RX packets:4748 errors:0 dropped:0 overruns:0 frame:0 - TX packets:4486 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:789430 (770.9 KB) TX bytes:1377722 (1.3 MB) - -native_13 Link encap:Unknown - inet addr:10.226.1.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 - RX packets:20234 errors:0 dropped:0 overruns:0 frame:0 - TX packets:25601 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:4327094 (4.1 MB) TX bytes:28183480 (26.9 MB) - -forticlient_6 Link encap:Unknown - inet addr:10.226.0.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 - RX packets:3077 errors:0 dropped:0 overruns:0 frame:0 - TX packets:2688 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:722376 (705.4 KB) TX bytes:1050853 (1.0 MB) - -native_8 Link encap:Unknown - inet addr:10.226.1.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 - RX packets:25861 errors:0 dropped:0 overruns:0 frame:0 - TX packets:30206 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:7341560 (7.0 MB) TX bytes:13828520 (13.2 MB) - -forticlient_7 Link encap:Unknown - inet addr:10.226.0.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 - RX packets:3972 errors:0 dropped:0 overruns:0 frame:0 - TX packets:3454 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:1245858 (1.2 MB) TX bytes:2163625 (2.1 MB) - -native_15 Link encap:Unknown - inet addr:10.226.1.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 - RX packets:3214 errors:0 dropped:0 overruns:0 frame:0 - TX packets:1413 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:526560 (514.2 KB) TX bytes:918582 (897.1 KB) - -native_3 Link encap:Unknown - inet addr:10.226.1.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 - RX packets:8330 errors:0 dropped:0 overruns:0 frame:0 - TX packets:10370 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:1312384 (1.3 MB) TX bytes:9178427 (8.8 MB) - -forticlient_8 Link encap:Unknown - inet addr:10.226.0.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 - RX packets:8578 errors:0 dropped:0 overruns:0 frame:0 - TX packets:6398 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:1507782 (1.4 MB) TX bytes:6228587 (5.9 MB) - -forticlient_11 Link encap:Unknown - inet addr:10.226.0.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 - RX packets:643 errors:0 dropped:0 overruns:0 frame:0 - TX packets:639 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:132682 (129.6 KB) TX bytes:131218 (128.1 KB) - -forticlient_9 Link encap:Unknown - inet addr:10.226.0.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 - RX packets:5923 errors:0 dropped:0 overruns:0 frame:0 - TX packets:3455 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:1228870 (1.2 MB) TX bytes:917637 (896.1 KB) - -native_10 Link encap:Unknown - inet addr:10.226.1.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 - RX packets:136 errors:0 dropped:0 overruns:0 frame:0 - TX packets:257 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:1152 (1.1 KB) TX bytes:328002 (320.3 KB) - -forticlient_12 Link encap:Unknown - inet addr:10.226.0.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 - RX packets:8193 errors:0 dropped:0 overruns:0 frame:0 - TX packets:13439 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:1376446 (1.3 MB) TX bytes:13829166 (13.2 MB) - -forticlient_4 Link encap:Unknown - inet addr:10.226.0.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 - RX packets:2561 errors:0 dropped:0 overruns:0 frame:0 - TX packets:2047 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:1179812 (1.1 MB) TX bytes:1311111 (1.3 MB) - -native_16 Link encap:Unknown - inet addr:10.226.1.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 - RX packets:4 errors:0 dropped:0 overruns:0 frame:0 - TX packets:2 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:576 (576 Bytes) TX bytes:234 (234 Bytes) - -forticlient_13 Link encap:Unknown - inet addr:10.226.0.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 - RX packets:22658 errors:0 dropped:0 overruns:0 frame:0 - TX packets:33151 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:3277076 (3.1 MB) TX bytes:40895077 (39.0 MB) - -native_17 Link encap:Unknown - inet addr:10.226.1.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 - RX packets:1668 errors:0 dropped:0 overruns:0 frame:0 - TX packets:1534 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:394172 (384.9 KB) TX bytes:853214 (833.2 KB) - -forticlient_10 Link encap:Unknown - inet addr:10.226.0.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 - RX packets:1537 errors:0 dropped:0 overruns:0 frame:0 - TX packets:1407 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:327842 (320.2 KB) TX bytes:721528 (704.6 KB) - -native_1 Link encap:Unknown - inet addr:10.226.1.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 - RX packets:261 errors:0 dropped:0 overruns:0 frame:0 - TX packets:130 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:67266 (65.7 KB) TX bytes:66750 (65.2 KB) - -native_5 Link encap:Unknown - inet addr:10.226.1.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 - RX packets:65157 errors:0 dropped:0 overruns:0 frame:0 - TX packets:45441 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:78447844 (74.8 MB) TX bytes:3080693 (2.9 MB) - -native_6 Link encap:Unknown - inet addr:10.226.1.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 - RX packets:263 errors:0 dropped:0 overruns:0 frame:0 - TX packets:131 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:66870 (65.3 KB) TX bytes:66274 (64.7 KB) - -native_4 Link encap:Unknown - inet addr:10.226.1.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 - RX packets:1 errors:0 dropped:0 overruns:0 frame:0 - TX packets:1 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:144 (144 Bytes) TX bytes:100 (100 Bytes) - -forticlient_14 Link encap:Unknown - inet addr:10.226.0.1 Mask:255.255.255.255 - UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 - RX packets:1 errors:0 dropped:0 overruns:0 frame:0 - TX packets:2 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:144 (144 Bytes) TX bytes:262 (262 Bytes) diff --git a/test/unit/fortios/mock_data/get_router_info_bgp_neighbor_10.15.2.101.txt b/test/unit/fortios/mock_data/get_router_info_bgp_neighbor_10.15.2.101.txt deleted file mode 100644 index bb032f4..0000000 --- a/test/unit/fortios/mock_data/get_router_info_bgp_neighbor_10.15.2.101.txt +++ /dev/null @@ -1,45 +0,0 @@ -BGP neighbor is 10.15.2.101, remote AS 65208, local AS 65432, external link - BGP version 4, remote router ID 74.201.254.126 - BGP state = Established, up for 14:03:33 - Last read 00:00:35, hold time is 180, keepalive interval is 60 seconds - Configured hold time is 180, keepalive interval is 60 seconds - Neighbor capabilities: - Route refresh: advertised and received (old and new) - Address family IPv4 Unicast: advertised and received - Address family IPv6 Unicast: advertised and received - Received 178916 messages, 76 notifications, 0 in queue - Sent 227304 messages, 94 notifications, 0 in queue - Route refresh request: received 0, sent 0 - Minimum time between advertisement runs is 30 seconds - - For address family: IPv4 Unicast - BGP table version 20239, neighbor version 20238 - Index 6, Offset 0, Mask 0x40 - Community attribute sent to this neighbor (both) - Inbound path policy configured - Outbound path policy configured - Route map for incoming advertisements is *allow-officeroot - Route map for outgoing advertisements is *allow-taggedroot - 1 accepted prefixes - 666 announced prefixes - - For address family: IPv6 Unicast - BGP table version 580, neighbor version 580 - Index 7, Offset 0, Mask 0x80 - Community attribute sent to this neighbor (both) - Inbound path policy configured - Outbound path policy configured - Route map for incoming advertisements is *allow-officeroot - Route map for outgoing advertisements is *deny-allroot - 0 accepted prefixes - 0 announced prefixes - - Connections established 38; dropped 37 -Local host: 10.15.2.100, Local port: 21921 -Foreign host: 10.15.2.101, Foreign port: 179 -Nexthop: 10.15.2.100 -Nexthop global: :: -Nexthop local: :: -BGP connection: non shared network -Last Reset: 14:03:47, due to BGP Notification sent -Notification Error Message: (CeaseUnspecified Error Subcode) diff --git a/test/unit/fortios/mock_data/get_router_info_bgp_neighbor_10.15.2.105.txt b/test/unit/fortios/mock_data/get_router_info_bgp_neighbor_10.15.2.105.txt deleted file mode 100644 index bd7c2f5..0000000 --- a/test/unit/fortios/mock_data/get_router_info_bgp_neighbor_10.15.2.105.txt +++ /dev/null @@ -1,42 +0,0 @@ -BGP neighbor is 10.15.2.105, remote AS 65209, local AS 65432, external link - BGP version 4, remote router ID 209.92.66.34 - BGP state = Established, up for 01w3d19h - Last read 00:00:31, hold time is 180, keepalive interval is 60 seconds - Configured hold time is 180, keepalive interval is 60 seconds - Neighbor capabilities: - Route refresh: advertised and received (old and new) - Address family IPv4 Unicast: advertised and received - Address family IPv6 Unicast: advertised and received - Received 164115 messages, 207 notifications, 0 in queue - Sent 222373 messages, 223 notifications, 0 in queue - Route refresh request: received 0, sent 0 - Minimum time between advertisement runs is 30 seconds - - For address family: IPv4 Unicast - BGP table version 20294, neighbor version 20293 - Index 0, Offset 0, Mask 0x1 - Community attribute sent to this neighbor (both) - Inbound path policy configured - Outbound path policy configured - Route map for incoming advertisements is *allow-officeroot - Route map for outgoing advertisements is *allow-taggedroot - 1 accepted prefixes - 668 announced prefixes - - For address family: IPv6 Unicast - BGP table version 583, neighbor version 583 - Index 11, Offset 1, Mask 0x8 - Community attribute sent to this neighbor (both) - 0 accepted prefixes - 3 announced prefixes - - Connections established 111; dropped 111 -Local host: 10.15.2.104, Local port: 18347 -Foreign host: 10.15.2.105, Foreign port: 179 -Nexthop: 10.15.2.104 -Nexthop global: :: -Nexthop local: :: -BGP connection: non shared network -Last Reset: 01w3d19h, due to BGP Notification sent -Notification Error Message: (CeaseUnspecified Error Subcode) - diff --git a/test/unit/fortios/mock_data/get_router_info_bgp_neighbor_10.15.2.99.txt b/test/unit/fortios/mock_data/get_router_info_bgp_neighbor_10.15.2.99.txt deleted file mode 100644 index ef864c2..0000000 --- a/test/unit/fortios/mock_data/get_router_info_bgp_neighbor_10.15.2.99.txt +++ /dev/null @@ -1,33 +0,0 @@ -BGP neighbor is 10.15.2.99, remote AS 65307, local AS 65432, external link - Administratively shut down - BGP version 4, remote router ID 0.0.0.0 - BGP state = Idle - Not directly connected EBGP - Last read 11w0d23h, hold time is 180, keepalive interval is 60 seconds - Configured hold time is 180, keepalive interval is 60 seconds - Received 81901 messages, 0 notifications, 0 in queue - Sent 90330 messages, 6 notifications, 0 in queue - Route refresh request: received 3, sent 0 - Minimum time between advertisement runs is 30 seconds - - For address family: IPv4 Unicast - BGP table version 20294, neighbor version 0 - Index 5, Offset 0, Mask 0x20 - Community attribute sent to this neighbor (both) - Inbound path policy configured - Outbound path policy configured - Route map for incoming advertisements is *allow-taggedroot - Route map for outgoing advertisements is *allow-taggedroot - 0 accepted prefixes - 0 announced prefixes - - For address family: IPv6 Unicast - BGP table version 583, neighbor version 0 - Index 6, Offset 0, Mask 0x40 - Community attribute sent to this neighbor (both) - 0 accepted prefixes - 0 announced prefixes - - Connections established 6; dropped 6 -Last Reset: 11w0d23h, due to BGP Notification sent -Notification Error Message: (Cease/Administratively Shutdown.) diff --git a/test/unit/fortios/mock_data/get_router_info_bgp_neighbors_10.15.2.101_received-routes__grep_prefixes_.txt b/test/unit/fortios/mock_data/get_router_info_bgp_neighbors_10.15.2.101_received-routes__grep_prefixes_.txt deleted file mode 100644 index 8b13789..0000000 --- a/test/unit/fortios/mock_data/get_router_info_bgp_neighbors_10.15.2.101_received-routes__grep_prefixes_.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/unit/fortios/mock_data/get_router_info_bgp_neighbors_10.15.2.105_received-routes__grep_prefixes_.txt b/test/unit/fortios/mock_data/get_router_info_bgp_neighbors_10.15.2.105_received-routes__grep_prefixes_.txt deleted file mode 100644 index 8b13789..0000000 --- a/test/unit/fortios/mock_data/get_router_info_bgp_neighbors_10.15.2.105_received-routes__grep_prefixes_.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/unit/fortios/mock_data/get_router_info_bgp_neighbors_10.15.2.99_received-routes__grep_prefixes_.txt b/test/unit/fortios/mock_data/get_router_info_bgp_neighbors_10.15.2.99_received-routes__grep_prefixes_.txt deleted file mode 100644 index 8b13789..0000000 --- a/test/unit/fortios/mock_data/get_router_info_bgp_neighbors_10.15.2.99_received-routes__grep_prefixes_.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/unit/fortios/mock_data/get_router_info_bgp_sum.txt b/test/unit/fortios/mock_data/get_router_info_bgp_sum.txt deleted file mode 100644 index 5cbd1da..0000000 --- a/test/unit/fortios/mock_data/get_router_info_bgp_sum.txt +++ /dev/null @@ -1,11 +0,0 @@ -BGP router identifier 193.235.32.243, local AS number 65432 -BGP table version is 20239 -454 BGP AS-PATH entries -54 BGP community entries - -Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd -10.15.2.99 4 65307 81901 90336 0 0 0 never Idle (Admin) -10.15.2.101 4 65208 178986 227392 20238 0 0 13:58:12 1 -10.15.2.105 4 65209 163073 221322 20238 0 0 01w3d00h 1 - -Total number of neighbors 3 \ No newline at end of file diff --git a/test/unit/fortios/mock_data/get_system_dns__grep_domain.txt b/test/unit/fortios/mock_data/get_system_dns__grep_domain.txt deleted file mode 100644 index d09b8f5..0000000 --- a/test/unit/fortios/mock_data/get_system_dns__grep_domain.txt +++ /dev/null @@ -1 +0,0 @@ -domain : spotify.net diff --git a/test/unit/fortios/mock_data/get_system_interface__grep_==.txt b/test/unit/fortios/mock_data/get_system_interface__grep_==.txt deleted file mode 100644 index b8f6b87..0000000 --- a/test/unit/fortios/mock_data/get_system_interface__grep_==.txt +++ /dev/null @@ -1,15 +0,0 @@ -== [ mgmt1 ] -== [ mgmt2 ] -== [ wan1 ] -== [ wan2 ] -== [ port1 ] -== [ port2 ] -== [ modem ] -== [ ssl.root ] -== [ npu0-vlink0 ] -== [ npu0-vlink1 ] -== [ pub0 ] -== [ svc0 ] -== [ forticlient ] -== [ native ] -== [ MY_VPN ] diff --git a/test/unit/fortios/mock_data/get_system_performance_status.txt b/test/unit/fortios/mock_data/get_system_performance_status.txt deleted file mode 100644 index c6d3dd4..0000000 --- a/test/unit/fortios/mock_data/get_system_performance_status.txt +++ /dev/null @@ -1,12 +0,0 @@ -CPU states: 0% user 18% system 0% nice 82% idle -CPU0 states: 0% user 22% system 0% nice 78% idle -CPU1 states: 0% user 15% system 0% nice 85% idle -CPU2 states: 0% user 17% system 0% nice 83% idle -CPU3 states: 0% user 19% system 0% nice 81% idle -Memory states: 49% used -Average network usage: 141989 kbps in 1 minute, 125760 kbps in 10 minutes, 146591 kbps in 30 minutes -Average sessions: 14482 sessions in 1 minute, 14837 sessions in 10 minutes, 14965 sessions in 30 minutes -Average session setup rate: 259 sessions per second in last 1 minute, 154 sessions per second in last 10 minutes, 193 sessions per second in last 30 minutes -Virus caught: 0 total in 1 minute -IPS attacks blocked: 0 total in 1 minute -Uptime: 274 days, 1 hours, 41 minutes diff --git a/test/unit/fortios/mock_data/get_system_performance_status__grep_cpu.txt b/test/unit/fortios/mock_data/get_system_performance_status__grep_cpu.txt deleted file mode 100644 index 2bf96c7..0000000 --- a/test/unit/fortios/mock_data/get_system_performance_status__grep_cpu.txt +++ /dev/null @@ -1,5 +0,0 @@ -CPU states: 0% user 5% system 0% nice 95% idle -CPU0 states: 0% user 8% system 0% nice 92% idle -CPU1 states: 0% user 4% system 0% nice 96% idle -CPU2 states: 0% user 4% system 0% nice 96% idle -CPU3 states: 0% user 4% system 0% nice 96% idle diff --git a/test/unit/fortios/mock_data/get_system_status.txt b/test/unit/fortios/mock_data/get_system_status.txt deleted file mode 100644 index 965d768..0000000 --- a/test/unit/fortios/mock_data/get_system_status.txt +++ /dev/null @@ -1,24 +0,0 @@ -vpn-sto3-z8r307-2 # get system status -Version: FortiGate-800C v5.2.2,build0642,141118 (GA) -Virus-DB: 16.00560(2012-10-19 08:31) -Extended DB: 1.00000(2012-10-17 15:46) -Extreme DB: 1.00000(2012-10-17 15:47) -IPS-DB: 5.00555(2014-10-07 01:21) -IPS-ETDB: 0.00000(2001-01-01 00:00) -Serial-Number: FG800C3914800949 -Botnet DB: 1.00000(2012-05-28 22:51) -BIOS version: 04000038 -System Part-Number: P11496-05 -Log hard disk: Available -Hostname: vpn-sto3-z8r307-2 -Operation Mode: NAT -Current virtual domain: root -Max number of virtual domains: 10 -Virtual domains status: 1 in NAT mode, 0 in TP mode -Virtual domain configuration: disable -FIPS-CC mode: disable -Current HA mode: a-p, master -Branch point: 642 -Release Version Information: GA -FortiOS x86-64: Yes -System time: Thu Nov 26 06:46:57 2015 diff --git a/test/unit/fortios/mock_data/router_bgp.txt b/test/unit/fortios/mock_data/router_bgp.txt deleted file mode 100644 index 682f9b9..0000000 --- a/test/unit/fortios/mock_data/router_bgp.txt +++ /dev/null @@ -1,60 +0,0 @@ -config router bgp - set as 65432 - set router-id 10.235.32.243 - config aggregate-address - edit 1 - set prefix 192.168.53.0 255.255.255.0 - next - edit 2 - set prefix 192.168.4.0 255.255.252.0 - next - end - config neighbor - edit "10.15.2.99" - set bfd enable - set shutdown enable - set description "LOMGW-ASH2-1 PRIMARY TUNNEL" - set remote-as 65307 - set route-map-in "allow-tagged" - set route-map-out "allow-tagged" - next - edit "10.15.2.101" - set bfd enable - set description "OFFICE NYC620 PRIMARY TUNNEL" - set remote-as 65208 - set route-map-in "allow-office" - set route-map-in6 "allow-office" - set route-map-out "allow-tagged" - set route-map-out6 "deny-all" - next - edit "10.15.2.105" - set bfd enable - set description "OFFICE SFO988 SECONDARY TUNNEL" - set remote-as 65209 - set route-map-in "allow-office" - set route-map-out "allow-tagged" - next - end - config redistribute "connected" - end - config redistribute "rip" - end - config redistribute "ospf" - end - config redistribute "static" - set status enable - set route-map "tag-static-with-community" - end - config redistribute "isis" - end - config redistribute6 "connected" - end - config redistribute6 "rip" - end - config redistribute6 "ospf" - end - config redistribute6 "static" - end - config redistribute6 "isis" - end -end \ No newline at end of file diff --git a/test/unit/fortios/mock_data/show.txt b/test/unit/fortios/mock_data/show.txt deleted file mode 100644 index 9102184..0000000 --- a/test/unit/fortios/mock_data/show.txt +++ /dev/null @@ -1,402 +0,0 @@ -#config-version=FWF60D-5.00-FW-build271-140124:opmode=1:vdom=0:user=admin -#conf_file_ver=9284291339995375843 -#buildno=0271 -#global_vdom=1 -config system global - set admintimeout 15 - set fgd-alert-subscription advisory latest-threat - set gui-certificates enable - set gui-dynamic-routing enable - set gui-ipv6 enable - set gui-local-in-policy enable - set gui-nat46-64 enable - set gui-policy-based-ipsec enable - set hostname "FORTINET" - set service-expire-notification disable - set timezone 08 -end -config system accprofile - edit "prof_admin" - set admingrp read-write - set authgrp read-write - set endpoint-control-grp read-write - set fwgrp read-write - set loggrp read-write - set mntgrp read-write - set netgrp read-write - set routegrp read-write - set sysgrp read-write - set updategrp read-write - set utmgrp read-write - set vpngrp read-write - set wanoptgrp read-write - set wifi read-write - next -end -config system interface - edit "dmz" - set vdom "root" - set ip 10.10.10.1 255.255.255.0 - set allowaccess ping https fgfm capwap - set type physical - set snmp-index 5 - next - edit "wan1" - set vdom "root" - set mode dhcp - set allowaccess ping https ssh snmp - set type physical - set snmp-index 3 - config ipv6 - set ip6-allowaccess ping https ssh - end - set defaultgw enable - next - edit "wan2" - set vdom "root" - set ip 192.168.101.99 255.255.255.0 - set allowaccess ping fgfm auto-ipsec - set type physical - set snmp-index 4 - next - edit "modem" - set vdom "root" - set mode pppoe - set type physical - set snmp-index 6 - set defaultgw enable - next - edit "ssl.root" - set vdom "root" - set type tunnel - set alias "sslvpn tunnel interface" - set snmp-index 7 - next - edit "mesh.root" - set vdom "root" - set type vap-switch - set snmp-index 9 - next - edit "internal" - set vdom "root" - set ip 10.10.90.1 255.255.255.0 - set allowaccess ping https ssh snmp http fgfm capwap - set status down - set type physical - set snmp-index 2 - next - edit "wifi" - set vdom "root" - set ip 10.10.80.1 255.255.255.0 - set allowaccess ping https ssh fgfm - set status down - set type vap-switch - set snmp-index 1 - next -end -config system admin - edit "admin" - set accprofile "super_admin" - set vdom "root" - config dashboard-tabs - edit 1 - set name "Status" - next - edit 2 - set columns 1 - set name "Top Sources" - next - edit 3 - set columns 1 - set name "Top Destinations" - next - edit 4 - set columns 1 - set name "Top Applications" - next - end - config dashboard - edit 1 - set tab-id 1 - set column 1 - next - edit 2 - set widget-type licinfo - set tab-id 1 - set column 1 - next - edit 3 - set widget-type jsconsole - set tab-id 1 - set column 1 - next - edit 4 - set widget-type sysres - set tab-id 1 - set column 2 - next - edit 5 - set widget-type gui-features - set tab-id 1 - set column 2 - next - edit 6 - set widget-type alert - set tab-id 1 - set column 2 - set top-n 10 - next - edit 21 - set widget-type sessions - set tab-id 2 - set column 1 - set top-n 25 - set sort-by msg-counts - next - edit 31 - set widget-type sessions - set tab-id 3 - set column 1 - set top-n 25 - set sort-by msg-counts - set report-by destination - next - edit 41 - set widget-type sessions - set tab-id 4 - set column 1 - set top-n 25 - set sort-by msg-counts - set report-by application - next - end - config login-time - edit "admin" - set last-login 2014-03-05 20:18:42 - next - end - set password ENC AK1mbPadQmYqP8Q4f7ClXXWGrgEMVWbGGwf6IgRwHQduoc= - next -end -config system ha - set override disable -end -config system storage - edit "FLASH1" - set media-type "scsi" - set partition "4E6CD8C90723C14B" - next -end -config system replacemsg-image - edit "logo_fnet" - set image-base64 '' - set image-type gif - next - edit "logo_fguard_wf" - set image-base64 '' - set image-type gif - next - edit "logo_fw_auth" - set image-base64 '' - set image-type png - next - edit "logo_v2_fnet" - set image-base64 '' - set image-type png - next - edit "logo_v2_fguard_wf" - set image-base64 '' - set image-type png - next -end -config system snmp sysinfo - set status enable -end -config vpn certificate ca -end -config vpn certificate local -end -config wanopt storage - edit "FLASH1" - set size 4563 - next -end -config system session-sync -end -config ips global - set default-app-cat-mask 18446744073474670591 -end -config ips dbinfo - set version 1 -end -config gui console - unset preferences -end -config system auto-install - set auto-install-config enable - set auto-install-image enable -end -config system console - set output standard -end -config system ntp - set ntpsync enable - set syncinterval 60 -end -config system settings - set sip-tcp-port 5060 - set sip-udp-port 5060 -end -config firewall service group - edit "Email Access" - set member "DNS" "IMAP" "IMAPS" "POP3" "POP3S" "SMTP" "SMTPS" - next - edit "Web Access" - set member "DNS" "HTTP" "HTTPS" - next - edit "Windows AD" - set member "DCE-RPC" "DNS" "KERBEROS" "LDAP" "LDAP_UDP" "SAMBA" "SMB" - next - edit "Exchange Server" - set member "DCE-RPC" "DNS" "HTTPS" - next -end -config webfilter ftgd-local-cat - edit "custom1" - set id 140 - next - edit "custom2" - set id 141 - next -end -config user fortitoken - edit "FTKMOB4302463E0E" - set license "FTMTRIAL00138836" - next - edit "FTKMOB433B7004CF" - set license "FTMTRIAL00138836" - next -end -config user local - edit "guest" - set type password - set passwd ENC SWv0LitZXJWqXLGveoEXgcboipAFM2wg7Np0oxyQpRubIce9royFr2/bxJ2nzvoPR0CN3p1/2+VWuPJlLTDGuYX0ojfBAbWkgLXI2AxwB3jpUp7PMWMyyfn4aT2Y35HnSP5mP87q2d1lMYJkBttbceEmZsDgkmeRyLPDNdtSCFvZ7pKm0gNDILk7sLPyJT7k5ZXxtw== - next -end -config user group - edit "FSSO_Guest_Users" - set group-type fsso-service - next - edit "Guest-group" - set member "guest" - next -end -config spamfilter profile - edit "default" - set comment "malware and phishing URL filtering" - next -end -config wanopt settings - set host-id "default-id" -end -config wanopt profile - edit "default" - set comments "default WANopt profile" - next -end -config web-proxy global - set proxy-fqdn "default.fqdn" -end -config firewall schedule recurring - edit "always" - set day sunday monday tuesday wednesday thursday friday saturday - next -end -config firewall profile-protocol-options - edit "default" - set comment "all default services" - config http - set ports 80 - set options clientcomfort no-content-summary - unset post-lang - end - config ftp - set ports 21 - set options clientcomfort no-content-summary splice - end - config imap - set ports 143 - set options fragmail no-content-summary - end - config mapi - set ports 135 - set options fragmail no-content-summary - end - config pop3 - set ports 110 - set options fragmail no-content-summary - end - config smtp - set ports 25 - set options fragmail no-content-summary splice - end - config nntp - set ports 119 - set options no-content-summary splice - end - config im - unset options - end - config dns - set ports 53 - end - next -end -config firewall deep-inspection-options - edit "default" - set comment "all default services" - config https - set ports 443 - end - config ftps - set ports 990 - end - config imaps - set ports 993 - end - config pop3s - set ports 995 - end - config smtps - set ports 465 - end - next -end -config firewall identity-based-route -end -config firewall policy - edit 5 - set srcintf "internal" - set dstintf "wifi" - set srcaddr "all" - set dstaddr "all" - set action accept - set schedule "always" - set service "ALL" - next -end -config wireless-controller wtp - edit "FWF60D-WIFI0" - next -end -config log disk setting - set status enable - set storage "FLASH1" -end -config log eventfilter - set user disable - set wan-opt disable -end -config log setting - set gui-location disk -end \ No newline at end of file diff --git a/test/unit/fortios/mock_data/system_interface.txt b/test/unit/fortios/mock_data/system_interface.txt deleted file mode 100644 index 01d77c5..0000000 --- a/test/unit/fortios/mock_data/system_interface.txt +++ /dev/null @@ -1,121 +0,0 @@ -config system interface - edit "mgmt1" - set ip 10.209.32.126 255.255.240.0 - set allowaccess ping https ssh snmp - set vlanforward enable - set type physical - set dedicated-to management - set snmp-index 2 - set defaultgw disable - next - edit "mgmt2" - set vdom "root" - set vlanforward enable - set type physical - set snmp-index 4 - next - edit "wan1" - set vdom "root" - set vlanforward enable - set type physical - set snmp-index 5 - next - edit "wan2" - set vdom "root" - set vlanforward enable - set type physical - set snmp-index 6 - next - edit "port1" - set vdom "root" - set allowaccess ping https - set vlanforward enable - set type physical - set snmp-index 1 - next - edit "port2" - set vdom "root" - set vlanforward enable - set type physical - set snmp-index 7 - next - edit "modem" - set vdom "root" - set mode pppoe - set vlanforward enable - set type physical - set snmp-index 3 - next - edit "ssl.root" - set vdom "root" - set vlanforward enable - set status down - set type tunnel - set alias "sslvpn tunnel interface" - set snmp-index 30 - next - edit "npu0-vlink0" - set vdom "root" - set vlanforward enable - set status down - set type physical - set snmp-index 32 - next - edit "npu0-vlink1" - set vdom "root" - set vlanforward enable - set status down - set type physical - set snmp-index 33 - next - edit "pub0" - set vdom "root" - set ip 192.168.181.235 255.255.255.248 - set allowaccess ping - set vlanforward enable - set snmp-index 31 - set interface "port1" - set vlanid 22 - next - edit "svc0" - set vdom "root" - set ip 192.168.169.235 255.255.255.248 - set allowaccess ping - set vlanforward enable - set snmp-index 34 - set interface "port11" - set vlanid 32 - next - edit "forticlient" - set vdom "root" - set ip 10.210.0.1 255.255.255.255 - set allowaccess ping ssh - set vlanforward enable - set type tunnel - set remote-ip 10.210.0.1 - set listen-forticlient-connection enable - set snmp-index 39 - set interface "pub0" - next - edit "native" - set vdom "root" - set ip 10.210.1.1 255.255.255.255 - set allowaccess ping ssh - set vlanforward enable - set type tunnel - set remote-ip 10.210.1.1 - set snmp-index 40 - set interface "pub0" - next - edit "MY_VPN" - set vdom "root" - set ip 10.15.2.160 255.255.255.255 - set allowaccess ping ssh - set vlanforward enable - set type tunnel - set remote-ip 10.15.2.161 - set snmp-index 41 - set interface "pub0" - next - -end \ No newline at end of file From ddd45df13cf6ed20dad18c1ed8a0074694bc58e3 Mon Sep 17 00:00:00 2001 From: David Barroso Date: Sun, 27 Nov 2016 15:00:33 +0100 Subject: [PATCH 06/18] Added new code for testing framework --- test/unit/conftest.py | 63 +++ .../normal/expected_result.json | 1 + ...t_router_info_bgp_neighbor_10_15_2_101.txt | 45 ++ ...t_router_info_bgp_neighbor_10_15_2_105.txt | 42 ++ ...et_router_info_bgp_neighbor_10_15_2_99.txt | 33 ++ ...2_101_received_routes___grep_prefixes_.txt | 1 + ...2_105_received_routes___grep_prefixes_.txt | 1 + ..._2_99_received_routes___grep_prefixes_.txt | 1 + .../normal/get_router_info_bgp_sum.txt | 11 + .../normal/router_bgp.txt | 60 +++ .../normal/expected_result.json | 1 + .../test_get_config/normal/show.txt | 402 ++++++++++++++ .../normal/expected_result.json | 1 + .../test_get_config_filtered/normal/show.txt | 402 ++++++++++++++ .../normal/diag_hard_sys_mem___grep_Mem_.txt | 1 + .../normal/execute_sensor_detail.txt | 255 +++++++++ .../normal/expected_result.json | 1 + ...t_system_performance_status___grep_CPU.txt | 5 + .../normal/expected_result.json | 1 + .../normal/get_system_dns___grep_domain.txt | 1 + .../normal/get_system_interface___grep___.txt | 15 + .../normal/get_system_performance_status.txt | 12 + .../normal/get_system_status.txt | 24 + .../diagnose_hardware_deviceinfo_nic.txt | 3 + ...diagnose_hardware_deviceinfo_nic_mgmt2.txt | 42 ++ ...diagnose_hardware_deviceinfo_nic_port1.txt | 93 ++++ .../normal/expected_result.json | 1 + .../normal/expected_result.json | 1 + .../normal/fnsysctl_ifconfig.txt | 509 ++++++++++++++++++ test/unit/test_getters.py | 11 + 30 files changed, 2039 insertions(+) create mode 100644 test/unit/conftest.py create mode 100644 test/unit/mocked_data/test_get_bgp_neighbors/normal/expected_result.json create mode 100644 test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbor_10_15_2_101.txt create mode 100644 test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbor_10_15_2_105.txt create mode 100644 test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbor_10_15_2_99.txt create mode 100644 test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbors_10_15_2_101_received_routes___grep_prefixes_.txt create mode 100644 test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbors_10_15_2_105_received_routes___grep_prefixes_.txt create mode 100644 test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbors_10_15_2_99_received_routes___grep_prefixes_.txt create mode 100644 test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_sum.txt create mode 100644 test/unit/mocked_data/test_get_bgp_neighbors/normal/router_bgp.txt create mode 100644 test/unit/mocked_data/test_get_config/normal/expected_result.json create mode 100644 test/unit/mocked_data/test_get_config/normal/show.txt create mode 100644 test/unit/mocked_data/test_get_config_filtered/normal/expected_result.json create mode 100644 test/unit/mocked_data/test_get_config_filtered/normal/show.txt create mode 100644 test/unit/mocked_data/test_get_environment/normal/diag_hard_sys_mem___grep_Mem_.txt create mode 100644 test/unit/mocked_data/test_get_environment/normal/execute_sensor_detail.txt create mode 100644 test/unit/mocked_data/test_get_environment/normal/expected_result.json create mode 100644 test/unit/mocked_data/test_get_environment/normal/get_system_performance_status___grep_CPU.txt create mode 100644 test/unit/mocked_data/test_get_facts/normal/expected_result.json create mode 100644 test/unit/mocked_data/test_get_facts/normal/get_system_dns___grep_domain.txt create mode 100644 test/unit/mocked_data/test_get_facts/normal/get_system_interface___grep___.txt create mode 100644 test/unit/mocked_data/test_get_facts/normal/get_system_performance_status.txt create mode 100644 test/unit/mocked_data/test_get_facts/normal/get_system_status.txt create mode 100644 test/unit/mocked_data/test_get_interfaces/normal/diagnose_hardware_deviceinfo_nic.txt create mode 100644 test/unit/mocked_data/test_get_interfaces/normal/diagnose_hardware_deviceinfo_nic_mgmt2.txt create mode 100644 test/unit/mocked_data/test_get_interfaces/normal/diagnose_hardware_deviceinfo_nic_port1.txt create mode 100644 test/unit/mocked_data/test_get_interfaces/normal/expected_result.json create mode 100644 test/unit/mocked_data/test_get_interfaces_counters/normal/expected_result.json create mode 100644 test/unit/mocked_data/test_get_interfaces_counters/normal/fnsysctl_ifconfig.txt create mode 100644 test/unit/test_getters.py diff --git a/test/unit/conftest.py b/test/unit/conftest.py new file mode 100644 index 0000000..8a8ee31 --- /dev/null +++ b/test/unit/conftest.py @@ -0,0 +1,63 @@ +"""Test fixtures.""" +from builtins import super + +import pytest +from napalm_base.test import conftest as parent_conftest +from napalm_base.test.double import BaseTestDouble + +from napalm_fortios import FortiOSDriver as OriginalDriver +from pyFG.fortios import FortiConfig + + +@pytest.fixture(scope='class') +def set_device_parameters(request): + """Set up the class.""" + def fin(): + request.cls.device.close() + request.addfinalizer(fin) + + request.cls.driver = OriginalDriver + request.cls.patched_driver = PatchedDriver + request.cls.vendor = 'fortios' + parent_conftest.set_device_parameters(request) + + +def pytest_generate_tests(metafunc): + """Generate test cases dynamically.""" + parent_conftest.pytest_generate_tests(metafunc, __file__) + + +class PatchedDriver(OriginalDriver): + """Patched Driver.""" + def __init__(self, hostname, username, password, timeout=60, optional_args=None): + super().__init__(hostname, username, password, timeout, optional_args) + self.patched_attrs = ['device'] + self.device = FakeDevice() + + def open(self): + pass + + def close(self): + pass + + +class FakeDevice(BaseTestDouble): + """Device test double.""" + + def open(self): + pass + + def close(self): + pass + + def execute_command(self, command): + filename = '{}.txt'.format(self.sanitize_text(command)) + full_path = self.find_file(filename) + return self.read_txt_file(full_path).splitlines() + + def load_config(self, config_block): + filename = '{}.txt'.format(self.sanitize_text(config_block)) + full_path = self.find_file(filename) + + self.running_config = FortiConfig('running') + self.running_config.parse_config_output(self.read_txt_file(full_path)) diff --git a/test/unit/mocked_data/test_get_bgp_neighbors/normal/expected_result.json b/test/unit/mocked_data/test_get_bgp_neighbors/normal/expected_result.json new file mode 100644 index 0000000..65b2daa --- /dev/null +++ b/test/unit/mocked_data/test_get_bgp_neighbors/normal/expected_result.json @@ -0,0 +1 @@ +{"global": {"router_id": "193.235.32.243,", "peers": {"10.15.2.101": {"is_enabled": true, "uptime": 50292, "remote_as": 65208, "description": "", "remote_id": "74.201.254.126", "local_as": 65432, "is_up": true, "address_family": {"ipv4": {"sent_prefixes": 666, "accepted_prefixes": 1, "received_prefixes": 0}, "ipv6": {"sent_prefixes": 0, "accepted_prefixes": 0, "received_prefixes": 0}}}, "10.15.2.105": {"is_enabled": true, "uptime": 0, "remote_as": 65209, "description": "", "remote_id": "209.92.66.34", "local_as": 65432, "is_up": true, "address_family": {"ipv4": {"sent_prefixes": 668, "accepted_prefixes": 1, "received_prefixes": 0}, "ipv6": {"sent_prefixes": 3, "accepted_prefixes": 0, "received_prefixes": 0}}}, "10.15.2.99": {"is_enabled": false, "uptime": 0, "remote_as": 65307, "description": "", "remote_id": "0.0.0.0", "local_as": 65432, "is_up": false, "address_family": {"ipv4": {"sent_prefixes": 0, "accepted_prefixes": 0, "received_prefixes": 0}, "ipv6": {"sent_prefixes": 0, "accepted_prefixes": 0, "received_prefixes": 0}}}}}} diff --git a/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbor_10_15_2_101.txt b/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbor_10_15_2_101.txt new file mode 100644 index 0000000..bb032f4 --- /dev/null +++ b/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbor_10_15_2_101.txt @@ -0,0 +1,45 @@ +BGP neighbor is 10.15.2.101, remote AS 65208, local AS 65432, external link + BGP version 4, remote router ID 74.201.254.126 + BGP state = Established, up for 14:03:33 + Last read 00:00:35, hold time is 180, keepalive interval is 60 seconds + Configured hold time is 180, keepalive interval is 60 seconds + Neighbor capabilities: + Route refresh: advertised and received (old and new) + Address family IPv4 Unicast: advertised and received + Address family IPv6 Unicast: advertised and received + Received 178916 messages, 76 notifications, 0 in queue + Sent 227304 messages, 94 notifications, 0 in queue + Route refresh request: received 0, sent 0 + Minimum time between advertisement runs is 30 seconds + + For address family: IPv4 Unicast + BGP table version 20239, neighbor version 20238 + Index 6, Offset 0, Mask 0x40 + Community attribute sent to this neighbor (both) + Inbound path policy configured + Outbound path policy configured + Route map for incoming advertisements is *allow-officeroot + Route map for outgoing advertisements is *allow-taggedroot + 1 accepted prefixes + 666 announced prefixes + + For address family: IPv6 Unicast + BGP table version 580, neighbor version 580 + Index 7, Offset 0, Mask 0x80 + Community attribute sent to this neighbor (both) + Inbound path policy configured + Outbound path policy configured + Route map for incoming advertisements is *allow-officeroot + Route map for outgoing advertisements is *deny-allroot + 0 accepted prefixes + 0 announced prefixes + + Connections established 38; dropped 37 +Local host: 10.15.2.100, Local port: 21921 +Foreign host: 10.15.2.101, Foreign port: 179 +Nexthop: 10.15.2.100 +Nexthop global: :: +Nexthop local: :: +BGP connection: non shared network +Last Reset: 14:03:47, due to BGP Notification sent +Notification Error Message: (CeaseUnspecified Error Subcode) diff --git a/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbor_10_15_2_105.txt b/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbor_10_15_2_105.txt new file mode 100644 index 0000000..bd7c2f5 --- /dev/null +++ b/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbor_10_15_2_105.txt @@ -0,0 +1,42 @@ +BGP neighbor is 10.15.2.105, remote AS 65209, local AS 65432, external link + BGP version 4, remote router ID 209.92.66.34 + BGP state = Established, up for 01w3d19h + Last read 00:00:31, hold time is 180, keepalive interval is 60 seconds + Configured hold time is 180, keepalive interval is 60 seconds + Neighbor capabilities: + Route refresh: advertised and received (old and new) + Address family IPv4 Unicast: advertised and received + Address family IPv6 Unicast: advertised and received + Received 164115 messages, 207 notifications, 0 in queue + Sent 222373 messages, 223 notifications, 0 in queue + Route refresh request: received 0, sent 0 + Minimum time between advertisement runs is 30 seconds + + For address family: IPv4 Unicast + BGP table version 20294, neighbor version 20293 + Index 0, Offset 0, Mask 0x1 + Community attribute sent to this neighbor (both) + Inbound path policy configured + Outbound path policy configured + Route map for incoming advertisements is *allow-officeroot + Route map for outgoing advertisements is *allow-taggedroot + 1 accepted prefixes + 668 announced prefixes + + For address family: IPv6 Unicast + BGP table version 583, neighbor version 583 + Index 11, Offset 1, Mask 0x8 + Community attribute sent to this neighbor (both) + 0 accepted prefixes + 3 announced prefixes + + Connections established 111; dropped 111 +Local host: 10.15.2.104, Local port: 18347 +Foreign host: 10.15.2.105, Foreign port: 179 +Nexthop: 10.15.2.104 +Nexthop global: :: +Nexthop local: :: +BGP connection: non shared network +Last Reset: 01w3d19h, due to BGP Notification sent +Notification Error Message: (CeaseUnspecified Error Subcode) + diff --git a/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbor_10_15_2_99.txt b/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbor_10_15_2_99.txt new file mode 100644 index 0000000..ef864c2 --- /dev/null +++ b/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbor_10_15_2_99.txt @@ -0,0 +1,33 @@ +BGP neighbor is 10.15.2.99, remote AS 65307, local AS 65432, external link + Administratively shut down + BGP version 4, remote router ID 0.0.0.0 + BGP state = Idle + Not directly connected EBGP + Last read 11w0d23h, hold time is 180, keepalive interval is 60 seconds + Configured hold time is 180, keepalive interval is 60 seconds + Received 81901 messages, 0 notifications, 0 in queue + Sent 90330 messages, 6 notifications, 0 in queue + Route refresh request: received 3, sent 0 + Minimum time between advertisement runs is 30 seconds + + For address family: IPv4 Unicast + BGP table version 20294, neighbor version 0 + Index 5, Offset 0, Mask 0x20 + Community attribute sent to this neighbor (both) + Inbound path policy configured + Outbound path policy configured + Route map for incoming advertisements is *allow-taggedroot + Route map for outgoing advertisements is *allow-taggedroot + 0 accepted prefixes + 0 announced prefixes + + For address family: IPv6 Unicast + BGP table version 583, neighbor version 0 + Index 6, Offset 0, Mask 0x40 + Community attribute sent to this neighbor (both) + 0 accepted prefixes + 0 announced prefixes + + Connections established 6; dropped 6 +Last Reset: 11w0d23h, due to BGP Notification sent +Notification Error Message: (Cease/Administratively Shutdown.) diff --git a/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbors_10_15_2_101_received_routes___grep_prefixes_.txt b/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbors_10_15_2_101_received_routes___grep_prefixes_.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbors_10_15_2_101_received_routes___grep_prefixes_.txt @@ -0,0 +1 @@ + diff --git a/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbors_10_15_2_105_received_routes___grep_prefixes_.txt b/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbors_10_15_2_105_received_routes___grep_prefixes_.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbors_10_15_2_105_received_routes___grep_prefixes_.txt @@ -0,0 +1 @@ + diff --git a/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbors_10_15_2_99_received_routes___grep_prefixes_.txt b/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbors_10_15_2_99_received_routes___grep_prefixes_.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_neighbors_10_15_2_99_received_routes___grep_prefixes_.txt @@ -0,0 +1 @@ + diff --git a/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_sum.txt b/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_sum.txt new file mode 100644 index 0000000..5cbd1da --- /dev/null +++ b/test/unit/mocked_data/test_get_bgp_neighbors/normal/get_router_info_bgp_sum.txt @@ -0,0 +1,11 @@ +BGP router identifier 193.235.32.243, local AS number 65432 +BGP table version is 20239 +454 BGP AS-PATH entries +54 BGP community entries + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +10.15.2.99 4 65307 81901 90336 0 0 0 never Idle (Admin) +10.15.2.101 4 65208 178986 227392 20238 0 0 13:58:12 1 +10.15.2.105 4 65209 163073 221322 20238 0 0 01w3d00h 1 + +Total number of neighbors 3 \ No newline at end of file diff --git a/test/unit/mocked_data/test_get_bgp_neighbors/normal/router_bgp.txt b/test/unit/mocked_data/test_get_bgp_neighbors/normal/router_bgp.txt new file mode 100644 index 0000000..682f9b9 --- /dev/null +++ b/test/unit/mocked_data/test_get_bgp_neighbors/normal/router_bgp.txt @@ -0,0 +1,60 @@ +config router bgp + set as 65432 + set router-id 10.235.32.243 + config aggregate-address + edit 1 + set prefix 192.168.53.0 255.255.255.0 + next + edit 2 + set prefix 192.168.4.0 255.255.252.0 + next + end + config neighbor + edit "10.15.2.99" + set bfd enable + set shutdown enable + set description "LOMGW-ASH2-1 PRIMARY TUNNEL" + set remote-as 65307 + set route-map-in "allow-tagged" + set route-map-out "allow-tagged" + next + edit "10.15.2.101" + set bfd enable + set description "OFFICE NYC620 PRIMARY TUNNEL" + set remote-as 65208 + set route-map-in "allow-office" + set route-map-in6 "allow-office" + set route-map-out "allow-tagged" + set route-map-out6 "deny-all" + next + edit "10.15.2.105" + set bfd enable + set description "OFFICE SFO988 SECONDARY TUNNEL" + set remote-as 65209 + set route-map-in "allow-office" + set route-map-out "allow-tagged" + next + end + config redistribute "connected" + end + config redistribute "rip" + end + config redistribute "ospf" + end + config redistribute "static" + set status enable + set route-map "tag-static-with-community" + end + config redistribute "isis" + end + config redistribute6 "connected" + end + config redistribute6 "rip" + end + config redistribute6 "ospf" + end + config redistribute6 "static" + end + config redistribute6 "isis" + end +end \ No newline at end of file diff --git a/test/unit/mocked_data/test_get_config/normal/expected_result.json b/test/unit/mocked_data/test_get_config/normal/expected_result.json new file mode 100644 index 0000000..8d901e5 --- /dev/null +++ b/test/unit/mocked_data/test_get_config/normal/expected_result.json @@ -0,0 +1 @@ +{"running": "#config-version=FWF60D-5.00-FW-build271-140124:opmode=1:vdom=0:user=admin\n#conf_file_ver=9284291339995375843\n#buildno=0271\n#global_vdom=1\nconfig system global\n set admintimeout 15\n set fgd-alert-subscription advisory latest-threat\n set gui-certificates enable\n set gui-dynamic-routing enable\n set gui-ipv6 enable\n set gui-local-in-policy enable\n set gui-nat46-64 enable\n set gui-policy-based-ipsec enable\n set hostname \"FORTINET\"\n set service-expire-notification disable\n set timezone 08\nend\nconfig system accprofile\n edit \"prof_admin\"\n set admingrp read-write\n set authgrp read-write\n set endpoint-control-grp read-write\n set fwgrp read-write\n set loggrp read-write\n set mntgrp read-write\n set netgrp read-write\n set routegrp read-write\n set sysgrp read-write\n set updategrp read-write\n set utmgrp read-write\n set vpngrp read-write\n set wanoptgrp read-write\n set wifi read-write\n next\nend\nconfig system interface\n edit \"dmz\"\n set vdom \"root\"\n set ip 10.10.10.1 255.255.255.0\n set allowaccess ping https fgfm capwap\n set type physical\n set snmp-index 5\n next\n edit \"wan1\"\n set vdom \"root\"\n set mode dhcp\n set allowaccess ping https ssh snmp\n set type physical\n set snmp-index 3\n config ipv6\n set ip6-allowaccess ping https ssh\n end\n set defaultgw enable\n next\n edit \"wan2\"\n set vdom \"root\"\n set ip 192.168.101.99 255.255.255.0\n set allowaccess ping fgfm auto-ipsec\n set type physical\n set snmp-index 4\n next\n edit \"modem\"\n set vdom \"root\"\n set mode pppoe\n set type physical\n set snmp-index 6\n set defaultgw enable\n next\n edit \"ssl.root\"\n set vdom \"root\"\n set type tunnel\n set alias \"sslvpn tunnel interface\"\n set snmp-index 7\n next\n edit \"mesh.root\"\n set vdom \"root\"\n set type vap-switch\n set snmp-index 9\n next\n edit \"internal\"\n set vdom \"root\"\n set ip 10.10.90.1 255.255.255.0\n set allowaccess ping https ssh snmp http fgfm capwap\n set status down\n set type physical\n set snmp-index 2\n next\n edit \"wifi\"\n set vdom \"root\"\n set ip 10.10.80.1 255.255.255.0\n set allowaccess ping https ssh fgfm\n set status down\n set type vap-switch\n set snmp-index 1\n next\nend\nconfig system admin\n edit \"admin\"\n set accprofile \"super_admin\"\n set vdom \"root\"\n config dashboard-tabs\n edit 1\n set name \"Status\"\n next\n edit 2\n set columns 1\n set name \"Top Sources\"\n next\n edit 3\n set columns 1\n set name \"Top Destinations\"\n next\n edit 4\n set columns 1\n set name \"Top Applications\"\n next\n end\n config dashboard\n edit 1\n set tab-id 1\n set column 1\n next\n edit 2\n set widget-type licinfo\n set tab-id 1\n set column 1\n next\n edit 3\n set widget-type jsconsole\n set tab-id 1\n set column 1\n next\n edit 4\n set widget-type sysres\n set tab-id 1\n set column 2\n next\n edit 5\n set widget-type gui-features\n set tab-id 1\n set column 2\n next\n edit 6\n set widget-type alert\n set tab-id 1\n set column 2\n set top-n 10\n next\n edit 21\n set widget-type sessions\n set tab-id 2\n set column 1\n set top-n 25\n set sort-by msg-counts\n next\n edit 31\n set widget-type sessions\n set tab-id 3\n set column 1\n set top-n 25\n set sort-by msg-counts\n set report-by destination\n next\n edit 41\n set widget-type sessions\n set tab-id 4\n set column 1\n set top-n 25\n set sort-by msg-counts\n set report-by application\n next\n end\n config login-time\n edit \"admin\"\n set last-login 2014-03-05 20:18:42\n next\n end\n set password ENC AK1mbPadQmYqP8Q4f7ClXXWGrgEMVWbGGwf6IgRwHQduoc=\n next\nend\nconfig system ha\n set override disable\nend\nconfig system storage\n edit \"FLASH1\"\n set media-type \"scsi\"\n set partition \"4E6CD8C90723C14B\"\n next\nend\nconfig system replacemsg-image\n edit \"logo_fnet\"\n set image-base64 ''\n set image-type gif\n next\n edit \"logo_fguard_wf\"\n set image-base64 ''\n set image-type gif\n next\n edit \"logo_fw_auth\"\n set image-base64 ''\n set image-type png\n next\n edit \"logo_v2_fnet\"\n set image-base64 ''\n set image-type png\n next\n edit \"logo_v2_fguard_wf\"\n set image-base64 ''\n set image-type png\n next\nend\nconfig system snmp sysinfo\n set status enable\nend\nconfig vpn certificate ca\nend\nconfig vpn certificate local\nend\nconfig wanopt storage\n edit \"FLASH1\"\n set size 4563\n next\nend\nconfig system session-sync\nend\nconfig ips global\n set default-app-cat-mask 18446744073474670591\nend\nconfig ips dbinfo\n set version 1\nend\nconfig gui console\n unset preferences\nend\nconfig system auto-install\n set auto-install-config enable\n set auto-install-image enable\nend\nconfig system console\n set output standard\nend\nconfig system ntp\n set ntpsync enable\n set syncinterval 60\nend\nconfig system settings\n set sip-tcp-port 5060\n set sip-udp-port 5060\nend\nconfig firewall service group\n edit \"Email Access\"\n set member \"DNS\" \"IMAP\" \"IMAPS\" \"POP3\" \"POP3S\" \"SMTP\" \"SMTPS\"\n next\n edit \"Web Access\"\n set member \"DNS\" \"HTTP\" \"HTTPS\"\n next\n edit \"Windows AD\"\n set member \"DCE-RPC\" \"DNS\" \"KERBEROS\" \"LDAP\" \"LDAP_UDP\" \"SAMBA\" \"SMB\"\n next\n edit \"Exchange Server\"\n set member \"DCE-RPC\" \"DNS\" \"HTTPS\"\n next\nend\nconfig webfilter ftgd-local-cat\n edit \"custom1\"\n set id 140\n next\n edit \"custom2\"\n set id 141\n next\nend\nconfig user fortitoken\n edit \"FTKMOB4302463E0E\"\n set license \"FTMTRIAL00138836\"\n next\n edit \"FTKMOB433B7004CF\"\n set license \"FTMTRIAL00138836\"\n next\nend\nconfig user local\n edit \"guest\"\n set type password\n set passwd ENC SWv0LitZXJWqXLGveoEXgcboipAFM2wg7Np0oxyQpRubIce9royFr2/bxJ2nzvoPR0CN3p1/2+VWuPJlLTDGuYX0ojfBAbWkgLXI2AxwB3jpUp7PMWMyyfn4aT2Y35HnSP5mP87q2d1lMYJkBttbceEmZsDgkmeRyLPDNdtSCFvZ7pKm0gNDILk7sLPyJT7k5ZXxtw==\n next\nend\nconfig user group\n edit \"FSSO_Guest_Users\"\n set group-type fsso-service\n next\n edit \"Guest-group\"\n set member \"guest\"\n next\nend\nconfig spamfilter profile\n edit \"default\"\n set comment \"malware and phishing URL filtering\"\n next\nend\nconfig wanopt settings\n set host-id \"default-id\"\nend\nconfig wanopt profile\n edit \"default\"\n set comments \"default WANopt profile\"\n next\nend\nconfig web-proxy global\n set proxy-fqdn \"default.fqdn\"\nend\nconfig firewall schedule recurring\n edit \"always\"\n set day sunday monday tuesday wednesday thursday friday saturday\n next\nend\nconfig firewall profile-protocol-options\n edit \"default\"\n set comment \"all default services\"\n config http\n set ports 80\n set options clientcomfort no-content-summary\n unset post-lang\n end\n config ftp\n set ports 21\n set options clientcomfort no-content-summary splice\n end\n config imap\n set ports 143\n set options fragmail no-content-summary\n end\n config mapi\n set ports 135\n set options fragmail no-content-summary\n end\n config pop3\n set ports 110\n set options fragmail no-content-summary\n end\n config smtp\n set ports 25\n set options fragmail no-content-summary splice\n end\n config nntp\n set ports 119\n set options no-content-summary splice\n end\n config im\n unset options\n end\n config dns\n set ports 53\n end\n next\nend\nconfig firewall deep-inspection-options\n edit \"default\"\n set comment \"all default services\"\n config https\n set ports 443\n end\n config ftps\n set ports 990\n end\n config imaps\n set ports 993\n end\n config pop3s\n set ports 995\n end\n config smtps\n set ports 465\n end\n next\nend\nconfig firewall identity-based-route\nend\nconfig firewall policy\n edit 5\n set srcintf \"internal\"\n set dstintf \"wifi\"\n set srcaddr \"all\"\n set dstaddr \"all\"\n set action accept\n set schedule \"always\"\n set service \"ALL\"\n next\nend\nconfig wireless-controller wtp\n edit \"FWF60D-WIFI0\"\n next\nend\nconfig log disk setting\n set status enable\n set storage \"FLASH1\"\nend\nconfig log eventfilter\n set user disable\n set wan-opt disable\nend\nconfig log setting\n set gui-location disk\nend", "startup": "", "candidate": ""} diff --git a/test/unit/mocked_data/test_get_config/normal/show.txt b/test/unit/mocked_data/test_get_config/normal/show.txt new file mode 100644 index 0000000..9102184 --- /dev/null +++ b/test/unit/mocked_data/test_get_config/normal/show.txt @@ -0,0 +1,402 @@ +#config-version=FWF60D-5.00-FW-build271-140124:opmode=1:vdom=0:user=admin +#conf_file_ver=9284291339995375843 +#buildno=0271 +#global_vdom=1 +config system global + set admintimeout 15 + set fgd-alert-subscription advisory latest-threat + set gui-certificates enable + set gui-dynamic-routing enable + set gui-ipv6 enable + set gui-local-in-policy enable + set gui-nat46-64 enable + set gui-policy-based-ipsec enable + set hostname "FORTINET" + set service-expire-notification disable + set timezone 08 +end +config system accprofile + edit "prof_admin" + set admingrp read-write + set authgrp read-write + set endpoint-control-grp read-write + set fwgrp read-write + set loggrp read-write + set mntgrp read-write + set netgrp read-write + set routegrp read-write + set sysgrp read-write + set updategrp read-write + set utmgrp read-write + set vpngrp read-write + set wanoptgrp read-write + set wifi read-write + next +end +config system interface + edit "dmz" + set vdom "root" + set ip 10.10.10.1 255.255.255.0 + set allowaccess ping https fgfm capwap + set type physical + set snmp-index 5 + next + edit "wan1" + set vdom "root" + set mode dhcp + set allowaccess ping https ssh snmp + set type physical + set snmp-index 3 + config ipv6 + set ip6-allowaccess ping https ssh + end + set defaultgw enable + next + edit "wan2" + set vdom "root" + set ip 192.168.101.99 255.255.255.0 + set allowaccess ping fgfm auto-ipsec + set type physical + set snmp-index 4 + next + edit "modem" + set vdom "root" + set mode pppoe + set type physical + set snmp-index 6 + set defaultgw enable + next + edit "ssl.root" + set vdom "root" + set type tunnel + set alias "sslvpn tunnel interface" + set snmp-index 7 + next + edit "mesh.root" + set vdom "root" + set type vap-switch + set snmp-index 9 + next + edit "internal" + set vdom "root" + set ip 10.10.90.1 255.255.255.0 + set allowaccess ping https ssh snmp http fgfm capwap + set status down + set type physical + set snmp-index 2 + next + edit "wifi" + set vdom "root" + set ip 10.10.80.1 255.255.255.0 + set allowaccess ping https ssh fgfm + set status down + set type vap-switch + set snmp-index 1 + next +end +config system admin + edit "admin" + set accprofile "super_admin" + set vdom "root" + config dashboard-tabs + edit 1 + set name "Status" + next + edit 2 + set columns 1 + set name "Top Sources" + next + edit 3 + set columns 1 + set name "Top Destinations" + next + edit 4 + set columns 1 + set name "Top Applications" + next + end + config dashboard + edit 1 + set tab-id 1 + set column 1 + next + edit 2 + set widget-type licinfo + set tab-id 1 + set column 1 + next + edit 3 + set widget-type jsconsole + set tab-id 1 + set column 1 + next + edit 4 + set widget-type sysres + set tab-id 1 + set column 2 + next + edit 5 + set widget-type gui-features + set tab-id 1 + set column 2 + next + edit 6 + set widget-type alert + set tab-id 1 + set column 2 + set top-n 10 + next + edit 21 + set widget-type sessions + set tab-id 2 + set column 1 + set top-n 25 + set sort-by msg-counts + next + edit 31 + set widget-type sessions + set tab-id 3 + set column 1 + set top-n 25 + set sort-by msg-counts + set report-by destination + next + edit 41 + set widget-type sessions + set tab-id 4 + set column 1 + set top-n 25 + set sort-by msg-counts + set report-by application + next + end + config login-time + edit "admin" + set last-login 2014-03-05 20:18:42 + next + end + set password ENC AK1mbPadQmYqP8Q4f7ClXXWGrgEMVWbGGwf6IgRwHQduoc= + next +end +config system ha + set override disable +end +config system storage + edit "FLASH1" + set media-type "scsi" + set partition "4E6CD8C90723C14B" + next +end +config system replacemsg-image + edit "logo_fnet" + set image-base64 '' + set image-type gif + next + edit "logo_fguard_wf" + set image-base64 '' + set image-type gif + next + edit "logo_fw_auth" + set image-base64 '' + set image-type png + next + edit "logo_v2_fnet" + set image-base64 '' + set image-type png + next + edit "logo_v2_fguard_wf" + set image-base64 '' + set image-type png + next +end +config system snmp sysinfo + set status enable +end +config vpn certificate ca +end +config vpn certificate local +end +config wanopt storage + edit "FLASH1" + set size 4563 + next +end +config system session-sync +end +config ips global + set default-app-cat-mask 18446744073474670591 +end +config ips dbinfo + set version 1 +end +config gui console + unset preferences +end +config system auto-install + set auto-install-config enable + set auto-install-image enable +end +config system console + set output standard +end +config system ntp + set ntpsync enable + set syncinterval 60 +end +config system settings + set sip-tcp-port 5060 + set sip-udp-port 5060 +end +config firewall service group + edit "Email Access" + set member "DNS" "IMAP" "IMAPS" "POP3" "POP3S" "SMTP" "SMTPS" + next + edit "Web Access" + set member "DNS" "HTTP" "HTTPS" + next + edit "Windows AD" + set member "DCE-RPC" "DNS" "KERBEROS" "LDAP" "LDAP_UDP" "SAMBA" "SMB" + next + edit "Exchange Server" + set member "DCE-RPC" "DNS" "HTTPS" + next +end +config webfilter ftgd-local-cat + edit "custom1" + set id 140 + next + edit "custom2" + set id 141 + next +end +config user fortitoken + edit "FTKMOB4302463E0E" + set license "FTMTRIAL00138836" + next + edit "FTKMOB433B7004CF" + set license "FTMTRIAL00138836" + next +end +config user local + edit "guest" + set type password + set passwd ENC SWv0LitZXJWqXLGveoEXgcboipAFM2wg7Np0oxyQpRubIce9royFr2/bxJ2nzvoPR0CN3p1/2+VWuPJlLTDGuYX0ojfBAbWkgLXI2AxwB3jpUp7PMWMyyfn4aT2Y35HnSP5mP87q2d1lMYJkBttbceEmZsDgkmeRyLPDNdtSCFvZ7pKm0gNDILk7sLPyJT7k5ZXxtw== + next +end +config user group + edit "FSSO_Guest_Users" + set group-type fsso-service + next + edit "Guest-group" + set member "guest" + next +end +config spamfilter profile + edit "default" + set comment "malware and phishing URL filtering" + next +end +config wanopt settings + set host-id "default-id" +end +config wanopt profile + edit "default" + set comments "default WANopt profile" + next +end +config web-proxy global + set proxy-fqdn "default.fqdn" +end +config firewall schedule recurring + edit "always" + set day sunday monday tuesday wednesday thursday friday saturday + next +end +config firewall profile-protocol-options + edit "default" + set comment "all default services" + config http + set ports 80 + set options clientcomfort no-content-summary + unset post-lang + end + config ftp + set ports 21 + set options clientcomfort no-content-summary splice + end + config imap + set ports 143 + set options fragmail no-content-summary + end + config mapi + set ports 135 + set options fragmail no-content-summary + end + config pop3 + set ports 110 + set options fragmail no-content-summary + end + config smtp + set ports 25 + set options fragmail no-content-summary splice + end + config nntp + set ports 119 + set options no-content-summary splice + end + config im + unset options + end + config dns + set ports 53 + end + next +end +config firewall deep-inspection-options + edit "default" + set comment "all default services" + config https + set ports 443 + end + config ftps + set ports 990 + end + config imaps + set ports 993 + end + config pop3s + set ports 995 + end + config smtps + set ports 465 + end + next +end +config firewall identity-based-route +end +config firewall policy + edit 5 + set srcintf "internal" + set dstintf "wifi" + set srcaddr "all" + set dstaddr "all" + set action accept + set schedule "always" + set service "ALL" + next +end +config wireless-controller wtp + edit "FWF60D-WIFI0" + next +end +config log disk setting + set status enable + set storage "FLASH1" +end +config log eventfilter + set user disable + set wan-opt disable +end +config log setting + set gui-location disk +end \ No newline at end of file diff --git a/test/unit/mocked_data/test_get_config_filtered/normal/expected_result.json b/test/unit/mocked_data/test_get_config_filtered/normal/expected_result.json new file mode 100644 index 0000000..c162bbc --- /dev/null +++ b/test/unit/mocked_data/test_get_config_filtered/normal/expected_result.json @@ -0,0 +1 @@ +{"running": "", "startup": "", "candidate": ""} diff --git a/test/unit/mocked_data/test_get_config_filtered/normal/show.txt b/test/unit/mocked_data/test_get_config_filtered/normal/show.txt new file mode 100644 index 0000000..9102184 --- /dev/null +++ b/test/unit/mocked_data/test_get_config_filtered/normal/show.txt @@ -0,0 +1,402 @@ +#config-version=FWF60D-5.00-FW-build271-140124:opmode=1:vdom=0:user=admin +#conf_file_ver=9284291339995375843 +#buildno=0271 +#global_vdom=1 +config system global + set admintimeout 15 + set fgd-alert-subscription advisory latest-threat + set gui-certificates enable + set gui-dynamic-routing enable + set gui-ipv6 enable + set gui-local-in-policy enable + set gui-nat46-64 enable + set gui-policy-based-ipsec enable + set hostname "FORTINET" + set service-expire-notification disable + set timezone 08 +end +config system accprofile + edit "prof_admin" + set admingrp read-write + set authgrp read-write + set endpoint-control-grp read-write + set fwgrp read-write + set loggrp read-write + set mntgrp read-write + set netgrp read-write + set routegrp read-write + set sysgrp read-write + set updategrp read-write + set utmgrp read-write + set vpngrp read-write + set wanoptgrp read-write + set wifi read-write + next +end +config system interface + edit "dmz" + set vdom "root" + set ip 10.10.10.1 255.255.255.0 + set allowaccess ping https fgfm capwap + set type physical + set snmp-index 5 + next + edit "wan1" + set vdom "root" + set mode dhcp + set allowaccess ping https ssh snmp + set type physical + set snmp-index 3 + config ipv6 + set ip6-allowaccess ping https ssh + end + set defaultgw enable + next + edit "wan2" + set vdom "root" + set ip 192.168.101.99 255.255.255.0 + set allowaccess ping fgfm auto-ipsec + set type physical + set snmp-index 4 + next + edit "modem" + set vdom "root" + set mode pppoe + set type physical + set snmp-index 6 + set defaultgw enable + next + edit "ssl.root" + set vdom "root" + set type tunnel + set alias "sslvpn tunnel interface" + set snmp-index 7 + next + edit "mesh.root" + set vdom "root" + set type vap-switch + set snmp-index 9 + next + edit "internal" + set vdom "root" + set ip 10.10.90.1 255.255.255.0 + set allowaccess ping https ssh snmp http fgfm capwap + set status down + set type physical + set snmp-index 2 + next + edit "wifi" + set vdom "root" + set ip 10.10.80.1 255.255.255.0 + set allowaccess ping https ssh fgfm + set status down + set type vap-switch + set snmp-index 1 + next +end +config system admin + edit "admin" + set accprofile "super_admin" + set vdom "root" + config dashboard-tabs + edit 1 + set name "Status" + next + edit 2 + set columns 1 + set name "Top Sources" + next + edit 3 + set columns 1 + set name "Top Destinations" + next + edit 4 + set columns 1 + set name "Top Applications" + next + end + config dashboard + edit 1 + set tab-id 1 + set column 1 + next + edit 2 + set widget-type licinfo + set tab-id 1 + set column 1 + next + edit 3 + set widget-type jsconsole + set tab-id 1 + set column 1 + next + edit 4 + set widget-type sysres + set tab-id 1 + set column 2 + next + edit 5 + set widget-type gui-features + set tab-id 1 + set column 2 + next + edit 6 + set widget-type alert + set tab-id 1 + set column 2 + set top-n 10 + next + edit 21 + set widget-type sessions + set tab-id 2 + set column 1 + set top-n 25 + set sort-by msg-counts + next + edit 31 + set widget-type sessions + set tab-id 3 + set column 1 + set top-n 25 + set sort-by msg-counts + set report-by destination + next + edit 41 + set widget-type sessions + set tab-id 4 + set column 1 + set top-n 25 + set sort-by msg-counts + set report-by application + next + end + config login-time + edit "admin" + set last-login 2014-03-05 20:18:42 + next + end + set password ENC AK1mbPadQmYqP8Q4f7ClXXWGrgEMVWbGGwf6IgRwHQduoc= + next +end +config system ha + set override disable +end +config system storage + edit "FLASH1" + set media-type "scsi" + set partition "4E6CD8C90723C14B" + next +end +config system replacemsg-image + edit "logo_fnet" + set image-base64 '' + set image-type gif + next + edit "logo_fguard_wf" + set image-base64 '' + set image-type gif + next + edit "logo_fw_auth" + set image-base64 '' + set image-type png + next + edit "logo_v2_fnet" + set image-base64 '' + set image-type png + next + edit "logo_v2_fguard_wf" + set image-base64 '' + set image-type png + next +end +config system snmp sysinfo + set status enable +end +config vpn certificate ca +end +config vpn certificate local +end +config wanopt storage + edit "FLASH1" + set size 4563 + next +end +config system session-sync +end +config ips global + set default-app-cat-mask 18446744073474670591 +end +config ips dbinfo + set version 1 +end +config gui console + unset preferences +end +config system auto-install + set auto-install-config enable + set auto-install-image enable +end +config system console + set output standard +end +config system ntp + set ntpsync enable + set syncinterval 60 +end +config system settings + set sip-tcp-port 5060 + set sip-udp-port 5060 +end +config firewall service group + edit "Email Access" + set member "DNS" "IMAP" "IMAPS" "POP3" "POP3S" "SMTP" "SMTPS" + next + edit "Web Access" + set member "DNS" "HTTP" "HTTPS" + next + edit "Windows AD" + set member "DCE-RPC" "DNS" "KERBEROS" "LDAP" "LDAP_UDP" "SAMBA" "SMB" + next + edit "Exchange Server" + set member "DCE-RPC" "DNS" "HTTPS" + next +end +config webfilter ftgd-local-cat + edit "custom1" + set id 140 + next + edit "custom2" + set id 141 + next +end +config user fortitoken + edit "FTKMOB4302463E0E" + set license "FTMTRIAL00138836" + next + edit "FTKMOB433B7004CF" + set license "FTMTRIAL00138836" + next +end +config user local + edit "guest" + set type password + set passwd ENC SWv0LitZXJWqXLGveoEXgcboipAFM2wg7Np0oxyQpRubIce9royFr2/bxJ2nzvoPR0CN3p1/2+VWuPJlLTDGuYX0ojfBAbWkgLXI2AxwB3jpUp7PMWMyyfn4aT2Y35HnSP5mP87q2d1lMYJkBttbceEmZsDgkmeRyLPDNdtSCFvZ7pKm0gNDILk7sLPyJT7k5ZXxtw== + next +end +config user group + edit "FSSO_Guest_Users" + set group-type fsso-service + next + edit "Guest-group" + set member "guest" + next +end +config spamfilter profile + edit "default" + set comment "malware and phishing URL filtering" + next +end +config wanopt settings + set host-id "default-id" +end +config wanopt profile + edit "default" + set comments "default WANopt profile" + next +end +config web-proxy global + set proxy-fqdn "default.fqdn" +end +config firewall schedule recurring + edit "always" + set day sunday monday tuesday wednesday thursday friday saturday + next +end +config firewall profile-protocol-options + edit "default" + set comment "all default services" + config http + set ports 80 + set options clientcomfort no-content-summary + unset post-lang + end + config ftp + set ports 21 + set options clientcomfort no-content-summary splice + end + config imap + set ports 143 + set options fragmail no-content-summary + end + config mapi + set ports 135 + set options fragmail no-content-summary + end + config pop3 + set ports 110 + set options fragmail no-content-summary + end + config smtp + set ports 25 + set options fragmail no-content-summary splice + end + config nntp + set ports 119 + set options no-content-summary splice + end + config im + unset options + end + config dns + set ports 53 + end + next +end +config firewall deep-inspection-options + edit "default" + set comment "all default services" + config https + set ports 443 + end + config ftps + set ports 990 + end + config imaps + set ports 993 + end + config pop3s + set ports 995 + end + config smtps + set ports 465 + end + next +end +config firewall identity-based-route +end +config firewall policy + edit 5 + set srcintf "internal" + set dstintf "wifi" + set srcaddr "all" + set dstaddr "all" + set action accept + set schedule "always" + set service "ALL" + next +end +config wireless-controller wtp + edit "FWF60D-WIFI0" + next +end +config log disk setting + set status enable + set storage "FLASH1" +end +config log eventfilter + set user disable + set wan-opt disable +end +config log setting + set gui-location disk +end \ No newline at end of file diff --git a/test/unit/mocked_data/test_get_environment/normal/diag_hard_sys_mem___grep_Mem_.txt b/test/unit/mocked_data/test_get_environment/normal/diag_hard_sys_mem___grep_Mem_.txt new file mode 100644 index 0000000..894f1f6 --- /dev/null +++ b/test/unit/mocked_data/test_get_environment/normal/diag_hard_sys_mem___grep_Mem_.txt @@ -0,0 +1 @@ +Mem: 8349081600 1204281344 7144800256 0 137478144 329146368 102465536 diff --git a/test/unit/mocked_data/test_get_environment/normal/execute_sensor_detail.txt b/test/unit/mocked_data/test_get_environment/normal/execute_sensor_detail.txt new file mode 100644 index 0000000..f5b1554 --- /dev/null +++ b/test/unit/mocked_data/test_get_environment/normal/execute_sensor_detail.txt @@ -0,0 +1,255 @@ + 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 diff --git a/test/unit/mocked_data/test_get_environment/normal/expected_result.json b/test/unit/mocked_data/test_get_environment/normal/expected_result.json new file mode 100644 index 0000000..ac06b26 --- /dev/null +++ b/test/unit/mocked_data/test_get_environment/normal/expected_result.json @@ -0,0 +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}} diff --git a/test/unit/mocked_data/test_get_environment/normal/get_system_performance_status___grep_CPU.txt b/test/unit/mocked_data/test_get_environment/normal/get_system_performance_status___grep_CPU.txt new file mode 100644 index 0000000..2bf96c7 --- /dev/null +++ b/test/unit/mocked_data/test_get_environment/normal/get_system_performance_status___grep_CPU.txt @@ -0,0 +1,5 @@ +CPU states: 0% user 5% system 0% nice 95% idle +CPU0 states: 0% user 8% system 0% nice 92% idle +CPU1 states: 0% user 4% system 0% nice 96% idle +CPU2 states: 0% user 4% system 0% nice 96% idle +CPU3 states: 0% user 4% system 0% nice 96% idle diff --git a/test/unit/mocked_data/test_get_facts/normal/expected_result.json b/test/unit/mocked_data/test_get_facts/normal/expected_result.json new file mode 100644 index 0000000..f418714 --- /dev/null +++ b/test/unit/mocked_data/test_get_facts/normal/expected_result.json @@ -0,0 +1 @@ +{"uptime": 23679660, "vendor": "Fortigate", "hostname": "vpn-sto3-z8r307-2", "fqdn": "vpn-sto3-z8r307-2.spotify.net", "os_version": "v5.2.2", "serial_number": "FG800C3914800949", "model": "FortiGate-800C", "interface_list": ["mgmt1", "mgmt2", "wan1", "wan2", "port1", "port2", "modem", "ssl.root", "npu0-vlink0", "npu0-vlink1", "pub0", "svc0", "forticlient", "native", "MY_VPN"]} diff --git a/test/unit/mocked_data/test_get_facts/normal/get_system_dns___grep_domain.txt b/test/unit/mocked_data/test_get_facts/normal/get_system_dns___grep_domain.txt new file mode 100644 index 0000000..d09b8f5 --- /dev/null +++ b/test/unit/mocked_data/test_get_facts/normal/get_system_dns___grep_domain.txt @@ -0,0 +1 @@ +domain : spotify.net diff --git a/test/unit/mocked_data/test_get_facts/normal/get_system_interface___grep___.txt b/test/unit/mocked_data/test_get_facts/normal/get_system_interface___grep___.txt new file mode 100644 index 0000000..b8f6b87 --- /dev/null +++ b/test/unit/mocked_data/test_get_facts/normal/get_system_interface___grep___.txt @@ -0,0 +1,15 @@ +== [ mgmt1 ] +== [ mgmt2 ] +== [ wan1 ] +== [ wan2 ] +== [ port1 ] +== [ port2 ] +== [ modem ] +== [ ssl.root ] +== [ npu0-vlink0 ] +== [ npu0-vlink1 ] +== [ pub0 ] +== [ svc0 ] +== [ forticlient ] +== [ native ] +== [ MY_VPN ] diff --git a/test/unit/mocked_data/test_get_facts/normal/get_system_performance_status.txt b/test/unit/mocked_data/test_get_facts/normal/get_system_performance_status.txt new file mode 100644 index 0000000..c6d3dd4 --- /dev/null +++ b/test/unit/mocked_data/test_get_facts/normal/get_system_performance_status.txt @@ -0,0 +1,12 @@ +CPU states: 0% user 18% system 0% nice 82% idle +CPU0 states: 0% user 22% system 0% nice 78% idle +CPU1 states: 0% user 15% system 0% nice 85% idle +CPU2 states: 0% user 17% system 0% nice 83% idle +CPU3 states: 0% user 19% system 0% nice 81% idle +Memory states: 49% used +Average network usage: 141989 kbps in 1 minute, 125760 kbps in 10 minutes, 146591 kbps in 30 minutes +Average sessions: 14482 sessions in 1 minute, 14837 sessions in 10 minutes, 14965 sessions in 30 minutes +Average session setup rate: 259 sessions per second in last 1 minute, 154 sessions per second in last 10 minutes, 193 sessions per second in last 30 minutes +Virus caught: 0 total in 1 minute +IPS attacks blocked: 0 total in 1 minute +Uptime: 274 days, 1 hours, 41 minutes diff --git a/test/unit/mocked_data/test_get_facts/normal/get_system_status.txt b/test/unit/mocked_data/test_get_facts/normal/get_system_status.txt new file mode 100644 index 0000000..965d768 --- /dev/null +++ b/test/unit/mocked_data/test_get_facts/normal/get_system_status.txt @@ -0,0 +1,24 @@ +vpn-sto3-z8r307-2 # get system status +Version: FortiGate-800C v5.2.2,build0642,141118 (GA) +Virus-DB: 16.00560(2012-10-19 08:31) +Extended DB: 1.00000(2012-10-17 15:46) +Extreme DB: 1.00000(2012-10-17 15:47) +IPS-DB: 5.00555(2014-10-07 01:21) +IPS-ETDB: 0.00000(2001-01-01 00:00) +Serial-Number: FG800C3914800949 +Botnet DB: 1.00000(2012-05-28 22:51) +BIOS version: 04000038 +System Part-Number: P11496-05 +Log hard disk: Available +Hostname: vpn-sto3-z8r307-2 +Operation Mode: NAT +Current virtual domain: root +Max number of virtual domains: 10 +Virtual domains status: 1 in NAT mode, 0 in TP mode +Virtual domain configuration: disable +FIPS-CC mode: disable +Current HA mode: a-p, master +Branch point: 642 +Release Version Information: GA +FortiOS x86-64: Yes +System time: Thu Nov 26 06:46:57 2015 diff --git a/test/unit/mocked_data/test_get_interfaces/normal/diagnose_hardware_deviceinfo_nic.txt b/test/unit/mocked_data/test_get_interfaces/normal/diagnose_hardware_deviceinfo_nic.txt new file mode 100644 index 0000000..abc4969 --- /dev/null +++ b/test/unit/mocked_data/test_get_interfaces/normal/diagnose_hardware_deviceinfo_nic.txt @@ -0,0 +1,3 @@ +The following NICs are available: + mgmt2 + port1 diff --git a/test/unit/mocked_data/test_get_interfaces/normal/diagnose_hardware_deviceinfo_nic_mgmt2.txt b/test/unit/mocked_data/test_get_interfaces/normal/diagnose_hardware_deviceinfo_nic_mgmt2.txt new file mode 100644 index 0000000..30d63c6 --- /dev/null +++ b/test/unit/mocked_data/test_get_interfaces/normal/diagnose_hardware_deviceinfo_nic_mgmt2.txt @@ -0,0 +1,42 @@ +Description Broadcom 570x Tigon3 Ethernet Adapter +Part_Number BCM95718 +PHY_Device_ID 5718C +Driver_Name tg3 +Driver_Version 3.85l +PCI_Vendor 0x14e4 +PCI_Device_ID 0x1656 +PCI_Subsystem_Vendor 0x14e4 +PCI_Subsystem_ID 0x1656 +PCI_Revision_ID 0x5717100 +PCI_Address 5:0.1 +Memory 0xefe30000 +IRQ 17 +System_Device_Name mgmt2 +Current_HWaddr 00:09:0f:09:00:01 +Permanent_HWaddr 08:5b:0e:7a:66:83 +Link down +Speed N/A +FlowControl N/A +Rx_Packets 0 +Rx_Packets_Dropped 0 +Tx_Packets 0 +Rx_Bytes 0 +Tx_Bytes 0 +Rx_Errors 0 +Tx_errors 0 +Multicast 0 +Collisions 0 +Rx_Length_Errors 0 +Rx_Over_Errors 0 +Rx_Frame_Errors 0 +Tx_aborted_Errors 0 +Tx_carrier_errors 0 +Rx_CRC_Errors 0 +rx_pending 200 +tx_pending 511 +tg3_flags a648e425 +tg3_flags2 180c9600 +tg3_flags3 00603003 +rx_rcb_ptr 00000000 +rx_producer 00000000 +num_reset 0 diff --git a/test/unit/mocked_data/test_get_interfaces/normal/diagnose_hardware_deviceinfo_nic_port1.txt b/test/unit/mocked_data/test_get_interfaces/normal/diagnose_hardware_deviceinfo_nic_port1.txt new file mode 100644 index 0000000..0ae5a3b --- /dev/null +++ b/test/unit/mocked_data/test_get_interfaces/normal/diagnose_hardware_deviceinfo_nic_port1.txt @@ -0,0 +1,93 @@ +Description :FortiASIC NP4 Adapter +Driver Name :FortiASIC Unified NPU Driver +Version :1.0 +PCI Slot :01:00.0 +PCI_Revision_ID :1 +Board :fgt800c +SN :FG800C3914800949 +Major ID :19 +Minor ID :0 +LIF ID :1 +NPU OID :1 +NPU OID_VID :3 +netdev flags :0x00001303 +Current_HWaddr 00:09:0f:09:00:02 +Permanent_HWaddr 08:5b:0e:7a:66:69 +Queue :On +rx_buffer_len :2048 +max_frame_size :1522 +min_frame_size :278 +MTU :1500 +Hidden :No +dyn_lif :0 +npu_cap :0000601f +ses_mask :40027dcb +cmd_in_queue :0 +half_id :1 +phy_addr :0x01 +phy_flags :0x4002 +medium_type :Copper +sw_port :3 +sw_np_port :29 +sw_stats_port :0 +phy_oid :0x01 +slot_id :0x00 +vid_phy[6] :[0003][0000][0000][0000][0000][0000] +vid_fwd[6] :[0000][0000][0000][0000][0000][0000] +oid_fwd[6] :[0000][0000][0000][0000][0000][0000] +========== Link Status ========== +Admin :up +PHY Status :up +PHY Speed :1000 +Duplex :Full +link_status :1 +rx_link_status :1 +remote_fault :0 +local_fault :0 +local_warning :0 +int_phy_link :0 +int_phy_reinit_cnt:0 +link_andone :0 +serdes_mode :SerDes +============ Counters =========== +clst_tx_orig :0 +clst_tx_o_free :0 +clst_tx_redir :0 +clst_tx_rd_free :0 +clst_tx_reply :0 +clst_tx_rp_free :0 +dd_wo_eop :0 +tcp_udp_csum_err:0 +rx_error :0 +rx_crc_error :0 +rx_len_error :0 +rx_carrier :0 +rx_oversize :0 +rx_undersize :0 +tx_collision :0 +ip_sum_offload :0 +ipsec_dec :0 +ipsec_dec_drop :0 +ipsec_antireplay_f:0 +ipsec_antireplay_p:0 +aps_log :0 +Rx Pkts :188895694 +Rx Bytes :82538535564 +Tx Pkts :297621641 +Tx Bytes :236894931491 +Host Rx Pkts :188895680 +Host Rx Bytes :79138411812 +Host Tx Pkts :297622192 +Host Tx Bytes :238680266080 +sw_rx_pkts :188895695 +sw_rx_bytes :934157048 +sw_tx_pkts :297621645 +sw_tx_bytes :671734297 +sw_rx_mc_pkts :166 +sw_rx_bc_pkts :110805703 +sw_np_rx_pkts :416031055 +sw_np_rx_bytes :251347608749 +sw_np_tx_pkts :299701544 +sw_np_tx_bytes :95704383998 +sw_np_rx_mc_pkts:78 +sw_np_rx_bc_pkts:236817338 diff --git a/test/unit/mocked_data/test_get_interfaces/normal/expected_result.json b/test/unit/mocked_data/test_get_interfaces/normal/expected_result.json new file mode 100644 index 0000000..ce33538 --- /dev/null +++ b/test/unit/mocked_data/test_get_interfaces/normal/expected_result.json @@ -0,0 +1 @@ +{"mgmt2": {"is_enabled": true, "description": "", "last_flapped": -1.0, "is_up": false, "mac_address": "00:09:0f:09:00:01", "speed": -1}, "port1": {"is_enabled": false, "description": "", "last_flapped": -1.0, "is_up": false, "mac_address": "00:09:0f:09:00:02", "speed": 1000}} diff --git a/test/unit/mocked_data/test_get_interfaces_counters/normal/expected_result.json b/test/unit/mocked_data/test_get_interfaces_counters/normal/expected_result.json new file mode 100644 index 0000000..84a534b --- /dev/null +++ b/test/unit/mocked_data/test_get_interfaces_counters/normal/expected_result.json @@ -0,0 +1 @@ +{"forticlient_0": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 10488565, "tx_errors": 0, "rx_octets": 2884770, "tx_unicast_packets": 13820, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 13702}, "vsys_hamgmt": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 11717, "tx_errors": 0, "rx_octets": 11717, "tx_unicast_packets": 45, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 45}, "port21": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "forticlient_4": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 1311111, "tx_errors": 0, "rx_octets": 1179812, "tx_unicast_packets": 2047, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 2561}, "mgmt1": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 2343371965, "tx_errors": 0, "rx_octets": 100706484996, "tx_unicast_packets": 9523098, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 779899549}, "mgmt2": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "port18": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "port19": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "pub0": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 18790279964525, "tx_errors": 0, "rx_octets": 11620407995936, "tx_unicast_packets": 41279349776, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 45948704676}, "native_17": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 853214, "tx_errors": 0, "rx_octets": 394172, "tx_unicast_packets": 1534, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 1668}, "port10": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "port11": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "port12": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "native_15": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 918582, "tx_errors": 0, "rx_octets": 526560, "tx_unicast_packets": 1413, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 3214}, "port14": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "port15": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "port16": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "port17": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "forticlient_14": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 262, "tx_errors": 0, "rx_octets": 144, "tx_unicast_packets": 2, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 1}, "vsys_fgfm": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "port13": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "forticlient_11": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 131218, "tx_errors": 0, "rx_octets": 132682, "tx_unicast_packets": 639, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 643}, "forticlient_3": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 71795, "tx_errors": 0, "rx_octets": 2247112, "tx_unicast_packets": 13524, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 15534}, "forticlient_13": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 40895077, "tx_errors": 0, "rx_octets": 3277076, "tx_unicast_packets": 33151, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 22658}, "forticlient_12": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 13829166, "tx_errors": 0, "rx_octets": 1376446, "tx_unicast_packets": 13439, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 8193}, "native_12": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 1377722, "tx_errors": 0, "rx_octets": 789430, "tx_unicast_packets": 4486, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 4748}, "native_3": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 9178427, "tx_errors": 0, "rx_octets": 1312384, "tx_unicast_packets": 10370, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 8330}, "native_13": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 28183480, "tx_errors": 0, "rx_octets": 4327094, "tx_unicast_packets": 25601, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 20234}, "vsys_ha": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 40507822, "tx_errors": 0, "rx_octets": 40507822, "tx_unicast_packets": 525955, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 525955}, "havdlink0": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 505250, "tx_errors": 0, "rx_octets": 22847822, "tx_unicast_packets": 9211, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 15886}, "native_10": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 328002, "tx_errors": 0, "rx_octets": 1152, "tx_unicast_packets": 257, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 136}, "port8": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "port9": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "port6": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "port7": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "port4": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "port5": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "port2": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 6108783696, "tx_errors": 0, "rx_octets": 6108984036, "tx_unicast_packets": 56562812, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 56564667}, "port3": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "havdlink1": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 22847822, "tx_errors": 0, "rx_octets": 505250, "tx_unicast_packets": 15886, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 9211}, "native_4": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 100, "tx_errors": 0, "rx_octets": 144, "tx_unicast_packets": 1, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 1}, "native_5": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 3080693, "tx_errors": 0, "rx_octets": 78447844, "tx_unicast_packets": 45441, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 65157}, "native_6": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 66274, "tx_errors": 0, "rx_octets": 66870, "tx_unicast_packets": 131, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 263}, "forticlient_6": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 1050853, "tx_errors": 0, "rx_octets": 722376, "tx_unicast_packets": 2688, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 3077}, "forticlient_1": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 524834, "tx_errors": 0, "rx_octets": 262802, "tx_unicast_packets": 1788, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 1797}, "native_1": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 66750, "tx_errors": 0, "rx_octets": 67266, "tx_unicast_packets": 130, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 261}, "native_2": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 15028967, "tx_errors": 0, "rx_octets": 12083568, "tx_unicast_packets": 80053, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 91542}, "forticlient_2": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 132023, "tx_errors": 0, "rx_octets": 197672, "tx_unicast_packets": 2042, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 3079}, "native_8": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 13828520, "tx_errors": 0, "rx_octets": 7341560, "tx_unicast_packets": 30206, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 25861}, "forticlient_9": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 917637, "tx_errors": 0, "rx_octets": 1228870, "tx_unicast_packets": 3455, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 5923}, "forticlient_8": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 6228587, "tx_errors": 0, "rx_octets": 1507782, "tx_unicast_packets": 6398, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 8578}, "wan2": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "wan1": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "port24": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "port_ha": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 1882738875, "tx_errors": 0, "rx_octets": 770850098, "tx_unicast_packets": 7551508, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 6564405}, "forticlient_7": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 2163625, "tx_errors": 0, "rx_octets": 1245858, "tx_unicast_packets": 3454, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 3972}, "port20": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "port23": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 35320005597799, "tx_errors": 0, "rx_octets": 27883734996518, "tx_unicast_packets": 99786157719, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 86746961835}, "port22": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "forticlient_10": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 721528, "tx_errors": 0, "rx_octets": 327842, "tx_unicast_packets": 1407, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 1537}, "native_0": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 39259957, "tx_errors": 0, "rx_octets": 12257836, "tx_unicast_packets": 48129, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 44431}, "native_16": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 234, "tx_errors": 0, "rx_octets": 576, "tx_unicast_packets": 2, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 4}, "ssl.root": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 0, "tx_errors": 0, "rx_octets": 0, "tx_unicast_packets": 0, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 0}, "MY_VPN": {"tx_multicast_packets": -1, "tx_discards": 18, "tx_octets": 3390894856257, "tx_errors": 18, "rx_octets": 1401932944256, "tx_unicast_packets": 4405184959, "rx_errors": 19403, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 19403, "rx_unicast_packets": 3802963042}, "port1": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 8021760304, "tx_errors": 0, "rx_octets": 6998023850, "tx_unicast_packets": 64114385, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 63129134}, "root": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 1077259718, "tx_errors": 0, "rx_octets": 1077259718, "tx_unicast_packets": 352233, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 352233}, "svc0": {"tx_multicast_packets": -1, "tx_discards": 0, "tx_octets": 16130582366133, "tx_errors": 0, "rx_octets": 15915591848230, "tx_unicast_packets": 58506810107, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": -1, "rx_broadcast_packets": -1, "rx_discards": 0, "rx_unicast_packets": 40792225191}} diff --git a/test/unit/mocked_data/test_get_interfaces_counters/normal/fnsysctl_ifconfig.txt b/test/unit/mocked_data/test_get_interfaces_counters/normal/fnsysctl_ifconfig.txt new file mode 100644 index 0000000..273f7ae --- /dev/null +++ b/test/unit/mocked_data/test_get_interfaces_counters/normal/fnsysctl_ifconfig.txt @@ -0,0 +1,509 @@ +mgmt1 Link encap:Ethernet HWaddr 08:5B:0E:1C:02:2C + inet addr:10.225.0.101 Bcast:10.225.15.255 Mask:255.255.240.0 + UP BROADCAST RUNNING ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:779899549 errors:0 dropped:0 overruns:0 frame:0 + TX packets:9523098 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:100706484996 (93.8 GB) TX bytes:2343371965 (2.2 GB) + Interrupt:16 + +mgmt2 Link encap:Ethernet HWaddr 00:09:0F:09:00:01 + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + Interrupt:17 + +wan1 Link encap:Ethernet HWaddr 00:09:0F:09:00:1A + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port1 Link encap:Ethernet HWaddr 00:09:0F:09:00:02 + UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:63129134 errors:0 dropped:0 overruns:0 frame:0 + TX packets:64114385 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:6998023850 (6.5 GB) TX bytes:8021760304 (7.5 GB) + +wan2 Link encap:Ethernet HWaddr 00:09:0F:09:00:1B + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port2 Link encap:Ethernet HWaddr 00:09:0F:09:00:0D + UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:56564667 errors:0 dropped:0 overruns:0 frame:0 + TX packets:56562812 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:6108984036 (5.7 GB) TX bytes:6108783696 (5.7 GB) + +port3 Link encap:Ethernet HWaddr 00:09:0F:09:00:13 + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port4 Link encap:Ethernet HWaddr 00:09:0F:09:00:14 + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port5 Link encap:Ethernet HWaddr 00:09:0F:09:00:15 + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port6 Link encap:Ethernet HWaddr 00:09:0F:09:00:16 + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port7 Link encap:Ethernet HWaddr 00:09:0F:09:00:17 + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port8 Link encap:Ethernet HWaddr 00:09:0F:09:00:18 + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port9 Link encap:Ethernet HWaddr 00:09:0F:09:00:19 + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port10 Link encap:Ethernet HWaddr 00:09:0F:09:00:03 + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port11 Link encap:Ethernet HWaddr 00:09:0F:09:00:04 + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port12 Link encap:Ethernet HWaddr 00:09:0F:09:00:05 + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port13 Link encap:Ethernet HWaddr 00:09:0F:09:00:06 + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port14 Link encap:Ethernet HWaddr 00:09:0F:09:00:07 + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port15 Link encap:Ethernet HWaddr 00:09:0F:09:00:08 + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port16 Link encap:Ethernet HWaddr 00:09:0F:09:00:09 + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port17 Link encap:Ethernet HWaddr 00:09:0F:09:00:0A + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port18 Link encap:Ethernet HWaddr 00:09:0F:09:00:0B + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port19 Link encap:Ethernet HWaddr 00:09:0F:09:00:0C + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port20 Link encap:Ethernet HWaddr 00:09:0F:09:00:0E + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port21 Link encap:Ethernet HWaddr 00:09:0F:09:00:0F + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port22 Link encap:Ethernet HWaddr 00:09:0F:09:00:10 + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +port23 Link encap:Ethernet HWaddr 00:09:0F:09:00:11 + UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:86746961835 errors:0 dropped:0 overruns:0 frame:0 + TX packets:99786157719 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:27883734996518 (25968.8 GB) TX bytes:35320005597799 (32894.3 GB) + +port24 Link encap:Ethernet HWaddr 00:09:0F:09:00:12 + UP BROADCAST PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +root Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:352233 errors:0 dropped:0 overruns:0 frame:0 + TX packets:352233 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:1077259718 (1.0 GB) TX bytes:1077259718 (1.0 GB) + +ssl.root Link encap:Point-Point Protocol + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +pub0 Link encap:Ethernet HWaddr 00:09:0F:09:00:11 + inet addr:191.168.32.243 Bcast:193.235.32.255 Mask:255.255.255.240 + UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1 + RX packets:45948704676 errors:0 dropped:0 overruns:0 frame:0 + TX packets:41279349776 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:11620407995936 (10822.3 GB) TX bytes:18790279964525 (17499.8 GB) + +svc0 Link encap:Ethernet HWaddr 00:09:0F:09:00:11 + inet addr:172.20.96.131 Bcast:23.92.96.143 Mask:255.255.255.240 + UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1 + RX packets:40792225191 errors:0 dropped:0 overruns:0 frame:0 + TX packets:58506810107 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:15915591848230 (14822.5 GB) TX bytes:16130582366133 (15022.8 GB) + +vsys_hamgmt Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:45 errors:0 dropped:0 overruns:0 frame:0 + TX packets:45 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:11717 (11.4 KB) TX bytes:11717 (11.4 KB) + +MY_VPN Link encap:Unknown + inet addr:10.15.2.100 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 + RX packets:3802963042 errors:19403 dropped:0 overruns:0 frame:0 + TX packets:4405184959 errors:18 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:1401932944256 (1305.7 GB) TX bytes:3390894856257 (3158.0 GB) + +vsys_ha Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:525955 errors:0 dropped:0 overruns:0 frame:0 + TX packets:525955 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:40507822 (38.6 MB) TX bytes:40507822 (38.6 MB) + +port_ha Link encap:Ethernet HWaddr 08:5B:0E:1C:02:13 + inet addr:169.254.0.1 Bcast:169.254.0.63 Mask:255.255.255.192 + UP BROADCAST RUNNING MULTICAST MTU:1496 Metric:1 + RX packets:6564405 errors:0 dropped:0 overruns:0 frame:0 + TX packets:7551508 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:770850098 (735.1 MB) TX bytes:1882738875 (1.8 GB) + +vsys_fgfm Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0 Bytes) TX bytes:0 (0 Bytes) + +havdlink0 Link encap:Point-Point Protocol + inet addr:169.254.0.65 Mask:255.255.255.192 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 + RX packets:15886 errors:0 dropped:0 overruns:0 frame:0 + TX packets:9211 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:22847822 (21.8 MB) TX bytes:505250 (493.4 KB) + +havdlink1 Link encap:Point-Point Protocol + inet addr:169.254.0.66 Mask:255.255.255.192 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 + RX packets:9211 errors:0 dropped:0 overruns:0 frame:0 + TX packets:15886 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:505250 (493.4 KB) TX bytes:22847822 (21.8 MB) + +forticlient_3 Link encap:Unknown + inet addr:10.226.0.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 + RX packets:15534 errors:0 dropped:0 overruns:0 frame:0 + TX packets:13524 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:2247112 (2.1 MB) TX bytes:71795 (70.1 KB) + +native_2 Link encap:Unknown + inet addr:10.226.1.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 + RX packets:91542 errors:0 dropped:0 overruns:0 frame:0 + TX packets:80053 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:12083568 (11.5 MB) TX bytes:15028967 (14.3 MB) + +forticlient_2 Link encap:Unknown + inet addr:10.226.0.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 + RX packets:3079 errors:0 dropped:0 overruns:0 frame:0 + TX packets:2042 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:197672 (193.0 KB) TX bytes:132023 (128.9 KB) + +forticlient_0 Link encap:Unknown + inet addr:10.226.0.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 + RX packets:13702 errors:0 dropped:0 overruns:0 frame:0 + TX packets:13820 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:2884770 (2.8 MB) TX bytes:10488565 (10.0 MB) + +forticlient_1 Link encap:Unknown + inet addr:10.226.0.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 + RX packets:1797 errors:0 dropped:0 overruns:0 frame:0 + TX packets:1788 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:262802 (256.6 KB) TX bytes:524834 (512.5 KB) + +native_0 Link encap:Unknown + inet addr:10.226.1.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 + RX packets:44431 errors:0 dropped:0 overruns:0 frame:0 + TX packets:48129 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:12257836 (11.7 MB) TX bytes:39259957 (37.4 MB) + +native_12 Link encap:Unknown + inet addr:10.226.1.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 + RX packets:4748 errors:0 dropped:0 overruns:0 frame:0 + TX packets:4486 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:789430 (770.9 KB) TX bytes:1377722 (1.3 MB) + +native_13 Link encap:Unknown + inet addr:10.226.1.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 + RX packets:20234 errors:0 dropped:0 overruns:0 frame:0 + TX packets:25601 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:4327094 (4.1 MB) TX bytes:28183480 (26.9 MB) + +forticlient_6 Link encap:Unknown + inet addr:10.226.0.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 + RX packets:3077 errors:0 dropped:0 overruns:0 frame:0 + TX packets:2688 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:722376 (705.4 KB) TX bytes:1050853 (1.0 MB) + +native_8 Link encap:Unknown + inet addr:10.226.1.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 + RX packets:25861 errors:0 dropped:0 overruns:0 frame:0 + TX packets:30206 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:7341560 (7.0 MB) TX bytes:13828520 (13.2 MB) + +forticlient_7 Link encap:Unknown + inet addr:10.226.0.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 + RX packets:3972 errors:0 dropped:0 overruns:0 frame:0 + TX packets:3454 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:1245858 (1.2 MB) TX bytes:2163625 (2.1 MB) + +native_15 Link encap:Unknown + inet addr:10.226.1.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 + RX packets:3214 errors:0 dropped:0 overruns:0 frame:0 + TX packets:1413 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:526560 (514.2 KB) TX bytes:918582 (897.1 KB) + +native_3 Link encap:Unknown + inet addr:10.226.1.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 + RX packets:8330 errors:0 dropped:0 overruns:0 frame:0 + TX packets:10370 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:1312384 (1.3 MB) TX bytes:9178427 (8.8 MB) + +forticlient_8 Link encap:Unknown + inet addr:10.226.0.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 + RX packets:8578 errors:0 dropped:0 overruns:0 frame:0 + TX packets:6398 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:1507782 (1.4 MB) TX bytes:6228587 (5.9 MB) + +forticlient_11 Link encap:Unknown + inet addr:10.226.0.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 + RX packets:643 errors:0 dropped:0 overruns:0 frame:0 + TX packets:639 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:132682 (129.6 KB) TX bytes:131218 (128.1 KB) + +forticlient_9 Link encap:Unknown + inet addr:10.226.0.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 + RX packets:5923 errors:0 dropped:0 overruns:0 frame:0 + TX packets:3455 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:1228870 (1.2 MB) TX bytes:917637 (896.1 KB) + +native_10 Link encap:Unknown + inet addr:10.226.1.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 + RX packets:136 errors:0 dropped:0 overruns:0 frame:0 + TX packets:257 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:1152 (1.1 KB) TX bytes:328002 (320.3 KB) + +forticlient_12 Link encap:Unknown + inet addr:10.226.0.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 + RX packets:8193 errors:0 dropped:0 overruns:0 frame:0 + TX packets:13439 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:1376446 (1.3 MB) TX bytes:13829166 (13.2 MB) + +forticlient_4 Link encap:Unknown + inet addr:10.226.0.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 + RX packets:2561 errors:0 dropped:0 overruns:0 frame:0 + TX packets:2047 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:1179812 (1.1 MB) TX bytes:1311111 (1.3 MB) + +native_16 Link encap:Unknown + inet addr:10.226.1.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 + RX packets:4 errors:0 dropped:0 overruns:0 frame:0 + TX packets:2 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:576 (576 Bytes) TX bytes:234 (234 Bytes) + +forticlient_13 Link encap:Unknown + inet addr:10.226.0.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 + RX packets:22658 errors:0 dropped:0 overruns:0 frame:0 + TX packets:33151 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:3277076 (3.1 MB) TX bytes:40895077 (39.0 MB) + +native_17 Link encap:Unknown + inet addr:10.226.1.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 + RX packets:1668 errors:0 dropped:0 overruns:0 frame:0 + TX packets:1534 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:394172 (384.9 KB) TX bytes:853214 (833.2 KB) + +forticlient_10 Link encap:Unknown + inet addr:10.226.0.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 + RX packets:1537 errors:0 dropped:0 overruns:0 frame:0 + TX packets:1407 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:327842 (320.2 KB) TX bytes:721528 (704.6 KB) + +native_1 Link encap:Unknown + inet addr:10.226.1.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 + RX packets:261 errors:0 dropped:0 overruns:0 frame:0 + TX packets:130 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:67266 (65.7 KB) TX bytes:66750 (65.2 KB) + +native_5 Link encap:Unknown + inet addr:10.226.1.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 + RX packets:65157 errors:0 dropped:0 overruns:0 frame:0 + TX packets:45441 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:78447844 (74.8 MB) TX bytes:3080693 (2.9 MB) + +native_6 Link encap:Unknown + inet addr:10.226.1.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 + RX packets:263 errors:0 dropped:0 overruns:0 frame:0 + TX packets:131 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:66870 (65.3 KB) TX bytes:66274 (64.7 KB) + +native_4 Link encap:Unknown + inet addr:10.226.1.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1422 Metric:1 + RX packets:1 errors:0 dropped:0 overruns:0 frame:0 + TX packets:1 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:144 (144 Bytes) TX bytes:100 (100 Bytes) + +forticlient_14 Link encap:Unknown + inet addr:10.226.0.1 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1438 Metric:1 + RX packets:1 errors:0 dropped:0 overruns:0 frame:0 + TX packets:2 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:144 (144 Bytes) TX bytes:262 (262 Bytes) diff --git a/test/unit/test_getters.py b/test/unit/test_getters.py new file mode 100644 index 0000000..6509001 --- /dev/null +++ b/test/unit/test_getters.py @@ -0,0 +1,11 @@ +"""Tests for getters.""" + +from napalm_base.test.getters import BaseTestGetters + + +import pytest + + +@pytest.mark.usefixtures("set_device_parameters") +class TestGetter(BaseTestGetters): + """Test get_* methods.""" From bda95eb6685c2e0f60d76ff4f6b9d235342ec459 Mon Sep 17 00:00:00 2001 From: David Barroso Date: Sun, 27 Nov 2016 15:11:44 +0100 Subject: [PATCH 07/18] Added future to requirements --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 1454b58..0554366 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ napalm-base>=0.18.0 pyFG +future From 34eaef53e0ef61ef0f9b2fd7708ae806d1b69bb8 Mon Sep 17 00:00:00 2001 From: David Barroso Date: Sun, 27 Nov 2016 15:14:23 +0100 Subject: [PATCH 08/18] Fixing travis --- .travis.yml | 1 - test/unit/TestFortiOSDriver.py | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5bf5aa7..5c99348 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,6 @@ install: script: - py.test -- coverage combine test/unit/.coverage - pylama . after_success: diff --git a/test/unit/TestFortiOSDriver.py b/test/unit/TestFortiOSDriver.py index 6e519e4..7f03aa6 100644 --- a/test/unit/TestFortiOSDriver.py +++ b/test/unit/TestFortiOSDriver.py @@ -15,8 +15,7 @@ import unittest from napalm_fortios.fortios import FortiOSDriver -from napalm_base.test.base import TestConfigNetworkDriver, TestGettersNetworkDriver -from pyFG.fortios import FortiConfig +from napalm_base.test.base import TestConfigNetworkDriver class TestConfigFortiOSDriver(unittest.TestCase, TestConfigNetworkDriver): From fa29ff1e3af49c7b42113e092ea9a71d28b4ac32 Mon Sep 17 00:00:00 2001 From: awlx Date: Mon, 28 Nov 2016 11:52:53 +0100 Subject: [PATCH 09/18] Added method is_alive() --- napalm_fortios/fortios.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/napalm_fortios/fortios.py b/napalm_fortios/fortios.py index e0a2fcc..5267431 100644 --- a/napalm_fortios/fortios.py +++ b/napalm_fortios/fortios.py @@ -39,6 +39,12 @@ def open(self): def close(self): self.device.close() + def is_alive(self): + """Returns a flag with the state of the SSH connection.""" + return { + 'is_alive': self.device.ssh.get_transport().is_active() + } + 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. vdom = vdom or self.vdom From ac461281684432c04c37b312d5d61aefd1532143 Mon Sep 17 00:00:00 2001 From: awlx Date: Tue, 29 Nov 2016 09:56:23 +0100 Subject: [PATCH 10/18] Initial commit --- napalm_fortios/fortios.py | 45 +++++++++++++++++++ .../normal/expected_result.json | 1 + .../normal/show_firewall_policy.txt | 23 ++++++++++ 3 files changed, 69 insertions(+) create mode 100644 test/unit/mocked_data/test_get_firewall_policies/normal/expected_result.json create mode 100644 test/unit/mocked_data/test_get_firewall_policies/normal/show_firewall_policy.txt diff --git a/napalm_fortios/fortios.py b/napalm_fortios/fortios.py index 365e6f5..5663533 100644 --- a/napalm_fortios/fortios.py +++ b/napalm_fortios/fortios.py @@ -261,6 +261,51 @@ def _search_line_in_lines(search, lines): if search in l: return l + def get_firewall_policies(self): + cmd = self.execute_command_with_vdom('show firewall policy') + policy = dict() + policy_id = None + default_policy = dict() + position = 1 + + for line in cmd: + policy_data = line.strip() + if policy_data.find("edit") == 0: + policy_id = policy_data.split()[1] + policy[policy_id] = dict() + if policy_id is not None: + if len(policy_data.split()) > 2: + policy_setting = policy_data.split()[1] + policy[policy_id][policy_setting] = policy_data.split()[2].replace("\"", "") + + for key in policy: + + enabled = 'status' in policy[key] + + logtraffic = policy[key]['logtraffic'] if 'logtraffic' in policy[key] else False + + action = 'permit' if 'action' in policy[key] else 'reject' + + policy_item = dict() + default_policy[key] = list() + policy_item['position'] = position + policy_item['packet_hits'] = -1 + policy_item['byte_hits'] = -1 + policy_item['id'] = unicode(key) + policy_item['enabled'] = enabled + policy_item['schedule'] = unicode(policy[key]['schedule']) + policy_item['log'] = unicode(logtraffic) + policy_item['l3_src'] = unicode(policy[key]['srcaddr']) + policy_item['l3_dst'] = unicode(policy[key]['dstaddr']) + policy_item['service'] = unicode(policy[key]['service']) + policy_item['src_zone'] = unicode(policy[key]['srcintf']) + policy_item['dst_zone'] = unicode(policy[key]['dstintf']) + policy_item['action'] = unicode(action) + default_policy[key].append(policy_item) + + position = position + 1 + return default_policy + def get_bgp_neighbors(self): families = ['ipv4', 'ipv6'] diff --git a/test/unit/mocked_data/test_get_firewall_policies/normal/expected_result.json b/test/unit/mocked_data/test_get_firewall_policies/normal/expected_result.json new file mode 100644 index 0000000..07f8e47 --- /dev/null +++ b/test/unit/mocked_data/test_get_firewall_policies/normal/expected_result.json @@ -0,0 +1 @@ +{'1': [{'src_zone': u'any', 'log': u'False', 'service': u'ALL', 'schedule': u'always', 'l3_src': u'all', 'enabled': False, 'packet_hits': -1, 'l3_dst': u'all', 'dst_zone': u'any', 'action': u'permit', 'position': 1, 'byte_hits': -1, 'id': u'1'}], '2': [{'src_zone': u'port3', 'log': u'all', 'service': u'ALL', 'schedule': u'always', 'l3_src': u'all', 'enabled': False, 'packet_hits': -1, 'l3_dst': u'all', 'dst_zone': u'port2', 'action': u'reject', 'position': 2, 'byte_hits': -1, 'id': u'2'}]} diff --git a/test/unit/mocked_data/test_get_firewall_policies/normal/show_firewall_policy.txt b/test/unit/mocked_data/test_get_firewall_policies/normal/show_firewall_policy.txt new file mode 100644 index 0000000..996a5d7 --- /dev/null +++ b/test/unit/mocked_data/test_get_firewall_policies/normal/show_firewall_policy.txt @@ -0,0 +1,23 @@ +config firewall policy + edit 1 + set uuid 9d747de8-dad4-51e5-7a7e-d078aa77140a + set srcintf "any" + set dstintf "any" + set srcaddr "all" + set dstaddr "all" + set action accept + set schedule "always" + set service "ALL" + 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 From 91e179c6593eb8ab0c55bd10f05cf3a9542a6459 Mon Sep 17 00:00:00 2001 From: awlx Date: Tue, 29 Nov 2016 10:07:50 +0100 Subject: [PATCH 11/18] Patched is_alive test failing --- test/unit/conftest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/unit/conftest.py b/test/unit/conftest.py index 8a8ee31..b9f7825 100644 --- a/test/unit/conftest.py +++ b/test/unit/conftest.py @@ -40,6 +40,8 @@ def open(self): def close(self): pass + def is_alive(self): + pass class FakeDevice(BaseTestDouble): """Device test double.""" From e2eeda8b9f167b57c7381f5413eb0fcc247930dd Mon Sep 17 00:00:00 2001 From: awlx Date: Tue, 29 Nov 2016 10:20:09 +0100 Subject: [PATCH 12/18] is_alive return {'is_alive': True} --- test/unit/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/conftest.py b/test/unit/conftest.py index b9f7825..f7d99fb 100644 --- a/test/unit/conftest.py +++ b/test/unit/conftest.py @@ -41,7 +41,7 @@ def close(self): pass def is_alive(self): - pass + return({'is_alive': True}) class FakeDevice(BaseTestDouble): """Device test double.""" From fc7579f1b4a0368e41ac7c4b990480bc9a401f27 Mon Sep 17 00:00:00 2001 From: awlx Date: Tue, 29 Nov 2016 10:24:29 +0100 Subject: [PATCH 13/18] Added mockdata --- test/unit/conftest.py | 1 + test/unit/mocked_data/test_is_alive/normal/expected_result.json | 1 + 2 files changed, 2 insertions(+) create mode 100644 test/unit/mocked_data/test_is_alive/normal/expected_result.json diff --git a/test/unit/conftest.py b/test/unit/conftest.py index f7d99fb..5ff70d2 100644 --- a/test/unit/conftest.py +++ b/test/unit/conftest.py @@ -43,6 +43,7 @@ def close(self): def is_alive(self): return({'is_alive': True}) + class FakeDevice(BaseTestDouble): """Device test double.""" diff --git a/test/unit/mocked_data/test_is_alive/normal/expected_result.json b/test/unit/mocked_data/test_is_alive/normal/expected_result.json new file mode 100644 index 0000000..43b92ac --- /dev/null +++ b/test/unit/mocked_data/test_is_alive/normal/expected_result.json @@ -0,0 +1 @@ +{"is_alive": true} From ee28aa880736703d5b5f0401825388c592c67f0d Mon Sep 17 00:00:00 2001 From: awlx Date: Tue, 29 Nov 2016 10:26:51 +0100 Subject: [PATCH 14/18] Whitespace fix on line 285 in fortios.py --- napalm_fortios/fortios.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/napalm_fortios/fortios.py b/napalm_fortios/fortios.py index 5663533..46d5efe 100644 --- a/napalm_fortios/fortios.py +++ b/napalm_fortios/fortios.py @@ -282,7 +282,7 @@ def get_firewall_policies(self): enabled = 'status' in policy[key] - logtraffic = policy[key]['logtraffic'] if 'logtraffic' in policy[key] else False + logtraffic = policy[key]['logtraffic'] if 'logtraffic' in policy[key] else False action = 'permit' if 'action' in policy[key] else 'reject' From 788c7b46efd0122a6239695bb04f34c64c2f7bdf Mon Sep 17 00:00:00 2001 From: Mircea Ulinic Date: Thu, 1 Dec 2016 10:42:34 +0000 Subject: [PATCH 15/18] Version bump to 0.3.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ef85d26..2537ad6 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name="napalm-fortios", - version="0.2.2", + version="0.3.0", packages=find_packages(), author="David Barroso", author_email="dbarrosop@dravetech.com", From 1a463476100fd71ae5450c874d55b4e9dd6e8861 Mon Sep 17 00:00:00 2001 From: awlx Date: Thu, 1 Dec 2016 12:51:08 +0100 Subject: [PATCH 16/18] Fixed expected results according to PR #26 --- .../test_get_bgp_neighbors/normal/expected_result.json | 2 +- .../test_get_firewall_policies/normal/expected_result.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/mocked_data/test_get_bgp_neighbors/normal/expected_result.json b/test/unit/mocked_data/test_get_bgp_neighbors/normal/expected_result.json index 65b2daa..7148fdc 100644 --- a/test/unit/mocked_data/test_get_bgp_neighbors/normal/expected_result.json +++ b/test/unit/mocked_data/test_get_bgp_neighbors/normal/expected_result.json @@ -1 +1 @@ -{"global": {"router_id": "193.235.32.243,", "peers": {"10.15.2.101": {"is_enabled": true, "uptime": 50292, "remote_as": 65208, "description": "", "remote_id": "74.201.254.126", "local_as": 65432, "is_up": true, "address_family": {"ipv4": {"sent_prefixes": 666, "accepted_prefixes": 1, "received_prefixes": 0}, "ipv6": {"sent_prefixes": 0, "accepted_prefixes": 0, "received_prefixes": 0}}}, "10.15.2.105": {"is_enabled": true, "uptime": 0, "remote_as": 65209, "description": "", "remote_id": "209.92.66.34", "local_as": 65432, "is_up": true, "address_family": {"ipv4": {"sent_prefixes": 668, "accepted_prefixes": 1, "received_prefixes": 0}, "ipv6": {"sent_prefixes": 3, "accepted_prefixes": 0, "received_prefixes": 0}}}, "10.15.2.99": {"is_enabled": false, "uptime": 0, "remote_as": 65307, "description": "", "remote_id": "0.0.0.0", "local_as": 65432, "is_up": false, "address_family": {"ipv4": {"sent_prefixes": 0, "accepted_prefixes": 0, "received_prefixes": 0}, "ipv6": {"sent_prefixes": 0, "accepted_prefixes": 0, "received_prefixes": 0}}}}}} +{"global": {"router_id": "193.235.32.243,", "peers": {"10.15.2.101": {"is_enabled": true, "uptime": 50292, "remote_as": 65208, "description": "", "remote_id": "74.201.254.126", "local_as": 65432, "is_up": true, "address_family": {"ipv4": {"sent_prefixes": 666, "accepted_prefixes": 1, "received_prefixes": 0}, "ipv6": {"sent_prefixes": 0, "accepted_prefixes": 0, "received_prefixes": 0}}}, "10.15.2.105": {"is_enabled": true, "uptime": 864000, "remote_as": 65209, "description": "", "remote_id": "209.92.66.34", "local_as": 65432, "is_up": true, "address_family": {"ipv4": {"sent_prefixes": 668, "accepted_prefixes": 1, "received_prefixes": 0}, "ipv6": {"sent_prefixes": 3, "accepted_prefixes": 0, "received_prefixes": 0}}}, "10.15.2.99": {"is_enabled": false, "uptime": 0, "remote_as": 65307, "description": "", "remote_id": "0.0.0.0", "local_as": 65432, "is_up": false, "address_family": {"ipv4": {"sent_prefixes": 0, "accepted_prefixes": 0, "received_prefixes": 0}, "ipv6": {"sent_prefixes": 0, "accepted_prefixes": 0, "received_prefixes": 0}}}}}} diff --git a/test/unit/mocked_data/test_get_firewall_policies/normal/expected_result.json b/test/unit/mocked_data/test_get_firewall_policies/normal/expected_result.json index 07f8e47..ccfa872 100644 --- a/test/unit/mocked_data/test_get_firewall_policies/normal/expected_result.json +++ b/test/unit/mocked_data/test_get_firewall_policies/normal/expected_result.json @@ -1 +1 @@ -{'1': [{'src_zone': u'any', 'log': u'False', 'service': u'ALL', 'schedule': u'always', 'l3_src': u'all', 'enabled': False, 'packet_hits': -1, 'l3_dst': u'all', 'dst_zone': u'any', 'action': u'permit', 'position': 1, 'byte_hits': -1, 'id': u'1'}], '2': [{'src_zone': u'port3', 'log': u'all', 'service': u'ALL', 'schedule': u'always', 'l3_src': u'all', 'enabled': False, 'packet_hits': -1, 'l3_dst': u'all', 'dst_zone': u'port2', 'action': u'reject', 'position': 2, 'byte_hits': -1, 'id': u'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"}], "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"}]} From e68a906578bca69a33d1d73751ada43e924a6981 Mon Sep 17 00:00:00 2001 From: awlx Date: Thu, 1 Dec 2016 12:53:31 +0100 Subject: [PATCH 17/18] Fixed typo --- .../test_get_firewall_policies/normal/expected_result.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/mocked_data/test_get_firewall_policies/normal/expected_result.json b/test/unit/mocked_data/test_get_firewall_policies/normal/expected_result.json index ccfa872..f68f0cc 100644 --- a/test/unit/mocked_data/test_get_firewall_policies/normal/expected_result.json +++ b/test/unit/mocked_data/test_get_firewall_policies/normal/expected_result.json @@ -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"}], "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"}]} From f4b4df9ac976e53af6aa6350087ff1ef13a3b755 Mon Sep 17 00:00:00 2001 From: awlx Date: Thu, 1 Dec 2016 12:57:17 +0100 Subject: [PATCH 18/18] Fixed problem with "log" attribute --- .../test_get_firewall_policies/normal/expected_result.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/mocked_data/test_get_firewall_policies/normal/expected_result.json b/test/unit/mocked_data/test_get_firewall_policies/normal/expected_result.json index f68f0cc..89f9399 100644 --- a/test/unit/mocked_data/test_get_firewall_policies/normal/expected_result.json +++ b/test/unit/mocked_data/test_get_firewall_policies/normal/expected_result.json @@ -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"}], "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"}]}