Skip to content

Commit

Permalink
Enh: New test mode (licenses)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfarouq-ext committed Jan 21, 2025
1 parent 087c6da commit 9ffc7db
Show file tree
Hide file tree
Showing 2 changed files with 322 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/network/fortinet/fortigate/restapi/licenses.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
*** Settings ***
Documentation Check licenses.
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource

Suite Setup Start Mockoon ${MOCKOON_JSON}
Suite Teardown Stop Mockoon
Test Timeout 120s

** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}output-api.json

${CMD} ${CENTREON_PLUGINS}
... --plugin=network::fortinet::fortigate::restapi::plugin
... --hostname=${HOSTNAME}
... --proto='http'
... --access-token=mokoon-token
... --port=${APIPORT}

*** Test Cases ***
licenses ${tc}
[Documentation] Check
[Tags] network fortinet fortigate restapi
${command} Catenate
... ${CMD}
... --mode=licenses
... ${extra_options}
Ctn Verify Command Output ${command} ${expected_result}

Examples: tc extra_options expected_result --
... 1 --warning-status='\\\%{name} eq /web_filtering/i' CRITICAL: License 'ai_malware_detection' status: expired - License 'antispam' status: expired - License 'antivirus' status: expired - License 'blacklisted_certificates' status: expired - License 'botnet_domain' status: expired - License 'ips' status: expired - License 'malicious_urls' status: expired - License 'mobile_malware' status: expired - License 'web_filtering' status: expired | 'ai_malware_detection#license.expires.seconds'=0s;;;0; 'antispam#license.expires.seconds'=0s;;;0; 'antivirus#license.expires.seconds'=0s;;;0; 'appctrl#license.expires.seconds'=0s;;;0; 'blacklisted_certificates#license.expires.seconds'=0s;;;0; 'botnet_domain#license.expires.seconds'=0s;;;0; 'device_os_id#license.expires.seconds'=0s;;;0; 'forticare:support:enhanced#license.expires.seconds'=0s;;;0; 'forticare:support:hardware#license.expires.seconds'=0s;;;0; 'forticloud_sandbox#license.expires.seconds'=0s;;;0; 'fortiems_cloud#license.expires.seconds'=0s;;;0; 'ips#license.expires.seconds'=0s;;;0;
... 2 --critical-status='\\\%{status} =~ /unavailable/i' CRITICAL: License 'sms' status: unavailable | 'ai_malware_detection#license.expires.seconds'=0s;;;0; 'antispam#license.expires.seconds'=0s;;;0; 'antivirus#license.expires.seconds'=0s;;;0; 'appctrl#license.expires.seconds'=0s;;;0; 'blacklisted_certificates#license.expires.seconds'=0s;;;0; 'botnet_domain#license.expires.seconds'=0s;;;0; 'device_os_id#license.expires.seconds'=0s;;;0; 'forticare:support:enhanced#license.expires.seconds'=0s;;;0; 'forticare:support:hardware#license.expires.seconds'=0s;;;0; 'forticloud_sandbox#license.expires.seconds'=0s;;;0; 'fortiems_cloud#license.expires.seconds'=0s;;;0; 'ips#license.expires.seconds'=0s;;;0; 'malicious_urls#license.expires.seconds'=0s;;;0; 'mobile_malware#license.expires.seconds'=0s;;;0; 'web_filtering#license.expires.seconds'=0s;;;0;
... 3 --filter-name='sms' OK: License 'sms' status: unavailable
... 4 --unit='w' CRITICAL: License 'ai_malware_detection' status: expired - License 'antispam' status: expired - License 'antivirus' status: expired - License 'blacklisted_certificates' status: expired - License 'botnet_domain' status: expired - License 'ips' status: expired - License 'malicious_urls' status: expired - License 'mobile_malware' status: expired - License 'web_filtering' status: expired | 'ai_malware_detection#license.expires.weeks'=0w;;;0; 'antispam#license.expires.weeks'=0w;;;0; 'antivirus#license.expires.weeks'=0w;;;0; 'appctrl#license.expires.weeks'=0w;;;0; 'blacklisted_certificates#license.expires.weeks'=0w;;;0; 'botnet_domain#license.expires.weeks'=0w;;;0; 'device_os_id#license.expires.weeks'=0w;;;0; 'forticare:support:enhanced#license.expires.weeks'=0w;;;0; 'forticare:support:hardware#license.expires.weeks'=0w;;;0; 'forticloud_sandbox#license.expires.weeks'=0w;;;0; 'fortiems_cloud#license.expires.weeks'=0w;;;0; 'ips#license.expires.weeks'=0w;;;0; 'malicious_urls#license.expires.weeks'=0w;;;0; 'mobile_malware#license.expires.weeks'=0w;;;0; 'web_filtering#license.expires.weeks'=0w;;;0;
... 5 --critical-status='' --warning-expires=0 --critical-expires=20 OK: All licenses are ok | 'ai_malware_detection#license.expires.seconds'=0s;0:0;0:20;0; 'antispam#license.expires.seconds'=0s;0:0;0:20;0; 'antivirus#license.expires.seconds'=0s;0:0;0:20;0; 'appctrl#license.expires.seconds'=0s;0:0;0:20;0; 'blacklisted_certificates#license.expires.seconds'=0s;0:0;0:20;0; 'botnet_domain#license.expires.seconds'=0s;0:0;0:20;0; 'device_os_id#license.expires.seconds'=0s;0:0;0:20;0; 'forticare:support:enhanced#license.expires.seconds'=0s;0:0;0:20;0; 'forticare:support:hardware#license.expires.seconds'=0s;0:0;0:20;0; 'forticloud_sandbox#license.expires.seconds'=0s;0:0;0:20;0; 'fortiems_cloud#license.expires.seconds'=0s;0:0;0:20;0; 'ips#license.expires.seconds'=0s;0:0;0:20;0; 'malicious_urls#license.expires.seconds'=0s;0:0;0:20;0; 'mobile_malware#license.expires.seconds'=0s;0:0;0:20;0; 'web_filtering#license.expires.seconds'=0s;0:0;0:20;0;
... 6 --warning-status='' --warning-last-update=0 --critical-last-update=100 --filter-name='forticloud_sandbox' OK: License 'forticloud_sandbox' status: free_license, expires in 0 | 'forticloud_sandbox#license.expires.seconds'=0s;;;0;
286 changes: 286 additions & 0 deletions tests/network/fortinet/fortigate/restapi/output-api.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,286 @@
{
"http_method":"GET",
"results":{
"fortiguard":{
"type":"cloud_service_status",
"supported":true,
"connected":true,
"has_updated":true,
"update_server_usa":false,
"next_scheduled_update":1731938460,
"scheduled_updates_enabled":true,
"server_address":"xx.xx.xx.xx:443",
"fortigate_wan_ip":"xx.xx.xx.xx"
},
"forticare":{
"type":"cloud_service_status",
"status":"registered",
"registration_supported":true,
"account":"[email protected]",
"support":{
"hardware":{
"status":"licensed",
"support_level":"Advanced HW",
"expires":1737244800
},
"enhanced":{
"status":"licensed",
"support_level":"Premium",
"expires":1737244800
}
},
"company":"xxxxxxxxx",
"industry":""
},
"forticloud":{
"type":"cloud_service_status",
"status":"cloud_logged_out"
},
"security_rating":{
"type":"downloaded_fds_object",
"status":"no_license",
"version":"0.00000",
"entitlement":"FGSA",
"last_update":978303600
},
"antivirus":{
"type":"downloaded_fds_object",
"status":"expired",
"version":"1.00000",
"expires":1515888000,
"entitlement":"AVDB",
"last_update":1523293620,
"last_update_attempt":1672054760,
"last_update_result_status":"update_result_not_authorized",
"last_update_method_status":"update_method_manual",
"db_status":"db_type_extended",
"engine":{
"version":"6.00298",
"last_update":1709239320,
"last_update_attempt":1567573458,
"last_update_result_status":"update_result_not_authorized",
"last_update_method_status":"update_method_manual"
}
},
"mobile_malware":{
"type":"downloaded_fds_object",
"status":"expired",
"version":"0.00000",
"expires":1515888000,
"entitlement":"AVDB",
"last_update":978303600,
"last_update_attempt":1672054760,
"last_update_result_status":"update_result_not_authorized",
"last_update_method_status":"update_method_manual"
},
"ai_malware_detection":{
"type":"downloaded_fds_object",
"status":"expired",
"version":"0.00000",
"expires":1515888000,
"entitlement":"AVDB",
"last_update":978303600
},
"ips":{
"type":"downloaded_fds_object",
"status":"expired",
"version":"6.00741",
"expires":1515888000,
"entitlement":"NIDS",
"last_update":1448933400,
"last_update_attempt":1567573458,
"last_update_result_status":"update_result_not_authorized",
"last_update_method_status":"update_method_manual",
"db_status":"db_type_normal",
"engine":{
"version":"7.00181",
"last_update":1709587380,
"last_update_attempt":1567573458,
"last_update_result_status":"update_result_not_authorized",
"last_update_method_status":"update_method_manual"
}
},
"industrial_db":{
"type":"downloaded_fds_object",
"status":"no_license",
"version":"6.00741",
"entitlement":"ISSS",
"last_update":1448933400
},
"appctrl":{
"type":"downloaded_fds_object",
"status":"licensed",
"version":"25.00592",
"expires":1737244800,
"entitlement":"FMWR",
"last_update":1620125365,
"last_update_attempt":1620125372,
"last_update_result_status":"update_result_no_updates",
"last_update_method_status":"update_method_sched"
},
"internet_service_db":{
"type":"downloaded_fds_object",
"status":"licensed",
"version":"7.03943",
"last_update":1731726154,
"last_update_attempt":1731934873,
"last_update_result_status":"update_result_no_updates",
"last_update_method_status":"update_method_sched"
},
"device_os_id":{
"type":"downloaded_fds_object",
"status":"licensed",
"version":"1.00177",
"expires":1737244800,
"entitlement":"FMWR",
"last_update":1726887673,
"last_update_attempt":1731934873,
"last_update_result_status":"update_result_no_updates",
"last_update_method_status":"update_method_sched"
},
"botnet_ip":{
"type":"downloaded_fds_object",
"status":"licensed",
"version":"7.03943",
"last_update":1731726154,
"last_update_attempt":1731934873,
"last_update_result_status":"update_result_no_updates",
"last_update_method_status":"update_method_sched"
},
"botnet_domain":{
"type":"downloaded_fds_object",
"status":"expired",
"version":"0.00000",
"expires":1515888000,
"entitlement":"AVDB",
"last_update":978303600,
"last_update_attempt":1672054760,
"last_update_result_status":"update_result_not_authorized",
"last_update_method_status":"update_method_manual"
},
"malicious_urls":{
"type":"downloaded_fds_object",
"status":"expired",
"version":"1.00001",
"expires":1515888000,
"entitlement":"NIDS",
"last_update":1672054760,
"last_update_attempt":1672054760,
"last_update_result_status":"update_result_success",
"last_update_method_status":"update_method_sched"
},
"blacklisted_certificates":{
"type":"downloaded_fds_object",
"status":"expired",
"version":"0.00000",
"expires":1516147200,
"entitlement":"FURL",
"last_update":978303600
},
"web_filtering":{
"type":"live_fortiguard_service",
"status":"expired",
"expires":1516147200,
"entitlement":"FURL",
"category_list_version":9,
"running":false
},
"outbreak_prevention":{
"type":"live_fortiguard_service",
"status":"no_license",
"entitlement":"ZHVO"
},
"antispam":{
"type":"live_fortiguard_service",
"status":"expired",
"expires":1516147200,
"entitlement":"SPAM"
},
"sdwan_network_monitor":{
"type":"live_fortiguard_service",
"status":"no_license",
"entitlement":"SWNM"
},
"iot_detection":{
"type":"live_fortiguard_service",
"status":"no_license",
"entitlement":"IOTH"
},
"forticloud_logging":{
"type":"live_cloud_service",
"status":"free_license",
"used_bytes":0,
"max_bytes":0,
"log_retention_days":7
},
"forticloud_sandbox":{
"type":"live_cloud_service",
"status":"free_license",
"expires":1515888000,
"entitlement":"AVDB",
"files_uploaded_daily":0,
"max_files_daily":100
},
"fortianalyzer_cloud":{
"type":"live_cloud_service",
"status":"no_license",
"entitlement":"FAZC"
},
"fortianalyzer_cloud_premium":{
"type":"live_cloud_service",
"status":"no_license",
"entitlement":"AFAC"
},
"fortimanager_cloud":{
"type":"live_cloud_service",
"status":"no_license",
"entitlement":"FMGC"
},
"fortiipam_cloud":{
"type":"live_cloud_service",
"status":"no_license",
"entitlement":"IPMC"
},
"fortisandbox_cloud":{
"type":"live_cloud_service",
"status":"no_license",
"entitlement":"FSAC"
},
"fortiems_cloud":{
"type":"account_level_live_cloud_service",
"status":"expires_soon",
"expires":1732838400,
"entitlement":"FCEM"
},
"fortimanager_cloud_alci":{
"type":"account_level_live_cloud_service",
"status":"no_license",
"entitlement":"FMGC"
},
"fortisandbox_cloud_alci":{
"type":"account_level_live_cloud_service",
"status":"no_license",
"entitlement":"FSAP"
},
"vdom":{
"type":"platform",
"can_upgrade":false,
"used":2,
"max":10
},
"sms":{
"type":"other",
"status":"unavailable",
"used":0,
"max":100
}
},
"vdom":"root",
"path":"license",
"name":"status",
"action":"select",
"status":"success",
"serial":"FG100E4Q17017027",
"version":"v7.0.15",
"build":632
}

0 comments on commit 9ffc7db

Please sign in to comment.