mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-20 10:48:59 +00:00
Move modules and module_utils unit tests to correct place (#81)
* Move modules and module_utils unit tests to correct place. * Update ignore.txt * Fix imports. * Fix typos. * Fix more typos.
This commit is contained in:
parent
ab3c2120fb
commit
be191cce6c
1170 changed files with 732 additions and 751 deletions
|
|
@ -0,0 +1,934 @@
|
|||
{
|
||||
"add_device": [
|
||||
{
|
||||
"url": "/dvm/cmd/add/device/",
|
||||
"raw_response": {
|
||||
"device": {
|
||||
"adm_pass": "fortinet",
|
||||
"os_ver": 6,
|
||||
"ip": "10.7.220.151",
|
||||
"mgmt.__data[6]": 1,
|
||||
"vm_mem": 1003,
|
||||
"maxvdom": 10,
|
||||
"conn_mode": 1,
|
||||
"platform_id": 112,
|
||||
"branch_pt": 231,
|
||||
"hostname": "ansible-fgt01",
|
||||
"source": 1,
|
||||
"mgmt_id": 1014939351,
|
||||
"version": 600,
|
||||
"build": 231,
|
||||
"mgmt_mode": 3,
|
||||
"adm_usr": "admin",
|
||||
"av_ver": "1.00000(2018-04-09 18:07)",
|
||||
"mgmt.__data[4]": 1052262400,
|
||||
"oid": 403,
|
||||
"conn_status": 1,
|
||||
"beta": -1,
|
||||
"dev_status": 1,
|
||||
"platform_str": "FortiGate-VM64",
|
||||
"last_checked": 1550698141,
|
||||
"vm_mem_limit": 6144,
|
||||
"mgmt.__data[0]": 3870643,
|
||||
"name": "FGT1",
|
||||
"tab_status": "<unknown>",
|
||||
"patch": 4,
|
||||
"vm_cpu_limit": 4,
|
||||
"vm_status": 3,
|
||||
"ips_ver": "6.00741(2015-12-01 02:30)",
|
||||
"flags": 2097169,
|
||||
"sn": "FGVM04TM18000391",
|
||||
"mr": 0,
|
||||
"os_type": 0,
|
||||
"vm_cpu": 1
|
||||
}
|
||||
},
|
||||
"datagram_sent": {
|
||||
"device": {
|
||||
"adm_pass": "fortinet",
|
||||
"name": "FGT1",
|
||||
"ip": "10.7.220.151",
|
||||
"flags": 24,
|
||||
"sn": null,
|
||||
"mgmt_mode": "fmgfaz",
|
||||
"adm_usr": "admin"
|
||||
},
|
||||
"flags": [
|
||||
"create_task",
|
||||
"nonblocking"
|
||||
],
|
||||
"odd_request_form": "True",
|
||||
"adom": "ansible"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"device_username": "admin",
|
||||
"adom": "ansible",
|
||||
"device_ip": "10.7.220.151",
|
||||
"device_unique_name": "FGT1",
|
||||
"mode": "add",
|
||||
"device_serial": null,
|
||||
"device_password": "fortinet"
|
||||
},
|
||||
"post_method": "exec"
|
||||
},
|
||||
{
|
||||
"url": "/dvm/cmd/add/device/",
|
||||
"paramgram_used": {
|
||||
"device_username": "admin",
|
||||
"adom": "ansible",
|
||||
"device_ip": "10.7.220.152",
|
||||
"device_unique_name": "FGT2",
|
||||
"mode": "add",
|
||||
"device_serial": null,
|
||||
"device_password": "fortinet"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"device": {
|
||||
"adm_pass": "fortinet",
|
||||
"name": "FGT2",
|
||||
"ip": "10.7.220.152",
|
||||
"flags": 24,
|
||||
"sn": null,
|
||||
"mgmt_mode": "fmgfaz",
|
||||
"adm_usr": "admin"
|
||||
},
|
||||
"flags": [
|
||||
"create_task",
|
||||
"nonblocking"
|
||||
],
|
||||
"odd_request_form": "True",
|
||||
"adom": "ansible"
|
||||
},
|
||||
"raw_response": {
|
||||
"device": {
|
||||
"adm_pass": "fortinet",
|
||||
"ip": "10.7.220.152",
|
||||
"mgmt.__data[6]": 1,
|
||||
"vm_mem": 1003,
|
||||
"maxvdom": 10,
|
||||
"conn_mode": 1,
|
||||
"vm_cpu_limit": 4,
|
||||
"vm_cpu": 1,
|
||||
"branch_pt": 231,
|
||||
"hostname": "ansible-fgt02",
|
||||
"source": 1,
|
||||
"mgmt_id": 1879100317,
|
||||
"version": 600,
|
||||
"build": 231,
|
||||
"mgmt_mode": 3,
|
||||
"adm_usr": "admin",
|
||||
"av_ver": "1.00000(2018-04-09 18:07)",
|
||||
"oid": 415,
|
||||
"conn_status": 1,
|
||||
"beta": -1,
|
||||
"dev_status": 1,
|
||||
"platform_str": "FortiGate-VM64",
|
||||
"last_checked": 1550698177,
|
||||
"patch": 4,
|
||||
"vm_mem_limit": 6144,
|
||||
"mgmt.__data[0]": 3870643,
|
||||
"name": "FGT2",
|
||||
"tab_status": "<unknown>",
|
||||
"mgmt.__data[4]": 1052262400,
|
||||
"platform_id": 112,
|
||||
"vm_status": 3,
|
||||
"ips_ver": "6.00741(2015-12-01 02:30)",
|
||||
"flags": 2097169,
|
||||
"sn": "FGVM04TM18000392",
|
||||
"mr": 0,
|
||||
"os_type": 0,
|
||||
"os_ver": 6
|
||||
}
|
||||
},
|
||||
"post_method": "exec"
|
||||
},
|
||||
{
|
||||
"url": "/dvm/cmd/add/device/",
|
||||
"raw_response": {
|
||||
"device": {
|
||||
"adm_pass": "fortinet",
|
||||
"os_ver": 6,
|
||||
"ip": "10.7.220.153",
|
||||
"mgmt.__data[6]": 1,
|
||||
"vm_mem": 1003,
|
||||
"maxvdom": 10,
|
||||
"conn_mode": 1,
|
||||
"platform_id": 112,
|
||||
"branch_pt": 231,
|
||||
"hostname": "ansible-fgt03",
|
||||
"source": 1,
|
||||
"mgmt_id": 104863251,
|
||||
"version": 600,
|
||||
"build": 231,
|
||||
"mgmt_mode": 3,
|
||||
"adm_usr": "admin",
|
||||
"av_ver": "1.00000(2018-04-09 18:07)",
|
||||
"mgmt.__data[4]": 1052262400,
|
||||
"oid": 427,
|
||||
"conn_status": 1,
|
||||
"beta": -1,
|
||||
"dev_status": 1,
|
||||
"platform_str": "FortiGate-VM64",
|
||||
"last_checked": 1550698204,
|
||||
"vm_mem_limit": 6144,
|
||||
"mgmt.__data[0]": 3870643,
|
||||
"name": "FGT3",
|
||||
"tab_status": "<unknown>",
|
||||
"patch": 4,
|
||||
"vm_cpu_limit": 4,
|
||||
"vm_status": 3,
|
||||
"ips_ver": "6.00741(2015-12-01 02:30)",
|
||||
"flags": 2097169,
|
||||
"sn": "FGVM04TM18000393",
|
||||
"mr": 0,
|
||||
"os_type": 0,
|
||||
"vm_cpu": 1
|
||||
}
|
||||
},
|
||||
"datagram_sent": {
|
||||
"device": {
|
||||
"adm_pass": "fortinet",
|
||||
"name": "FGT3",
|
||||
"ip": "10.7.220.153",
|
||||
"flags": 24,
|
||||
"sn": null,
|
||||
"mgmt_mode": "fmgfaz",
|
||||
"adm_usr": "admin"
|
||||
},
|
||||
"flags": [
|
||||
"create_task",
|
||||
"nonblocking"
|
||||
],
|
||||
"odd_request_form": "True",
|
||||
"adom": "ansible"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"device_username": "admin",
|
||||
"adom": "ansible",
|
||||
"device_ip": "10.7.220.153",
|
||||
"device_unique_name": "FGT3",
|
||||
"mode": "add",
|
||||
"device_serial": null,
|
||||
"device_password": "fortinet"
|
||||
},
|
||||
"post_method": "exec"
|
||||
}
|
||||
],
|
||||
"discover_device": [
|
||||
{
|
||||
"url": "/dvm/cmd/discover/device/",
|
||||
"paramgram_used": {
|
||||
"device_username": "admin",
|
||||
"adom": "ansible",
|
||||
"device_ip": "10.7.220.151",
|
||||
"device_unique_name": "FGT1",
|
||||
"mode": "add",
|
||||
"device_serial": null,
|
||||
"device_password": "fortinet"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"device": {
|
||||
"adm_pass": "fortinet",
|
||||
"ip": "10.7.220.151",
|
||||
"adm_usr": "admin"
|
||||
},
|
||||
"odd_request_form": "True"
|
||||
},
|
||||
"raw_response": {
|
||||
"device": {
|
||||
"adm_pass": "fortinet",
|
||||
"ip": "10.7.220.151",
|
||||
"vm_mem": 1003,
|
||||
"maxvdom": 10,
|
||||
"conn_mode": 1,
|
||||
"vm_cpu_limit": 4,
|
||||
"vm_cpu": 1,
|
||||
"branch_pt": 231,
|
||||
"hostname": "ansible-fgt01",
|
||||
"source": 1,
|
||||
"version": 600,
|
||||
"build": 231,
|
||||
"adm_usr": "admin",
|
||||
"av_ver": "1.00000(2018-04-09 18:07)",
|
||||
"conn_status": 1,
|
||||
"beta": -1,
|
||||
"dev_status": 1,
|
||||
"platform_str": "FortiGate-VM64",
|
||||
"last_checked": 1550698136,
|
||||
"vm_mem_limit": 6144,
|
||||
"name": "ansible-fgt01",
|
||||
"tab_status": "<unknown>",
|
||||
"patch": 4,
|
||||
"platform_id": 112,
|
||||
"vm_status": 3,
|
||||
"ips_ver": "6.00741(2015-12-01 02:30)",
|
||||
"flags": 2097153,
|
||||
"sn": "FGVM04TM18000391",
|
||||
"mr": 0,
|
||||
"os_type": 0,
|
||||
"os_ver": 6
|
||||
}
|
||||
},
|
||||
"post_method": "exec"
|
||||
},
|
||||
{
|
||||
"url": "/dvm/cmd/discover/device/",
|
||||
"raw_response": {
|
||||
"device": {
|
||||
"adm_pass": "fortinet",
|
||||
"os_ver": 6,
|
||||
"ip": "10.7.220.152",
|
||||
"vm_mem": 1003,
|
||||
"maxvdom": 10,
|
||||
"conn_mode": 1,
|
||||
"platform_id": 112,
|
||||
"branch_pt": 231,
|
||||
"hostname": "ansible-fgt02",
|
||||
"source": 1,
|
||||
"version": 600,
|
||||
"build": 231,
|
||||
"adm_usr": "admin",
|
||||
"av_ver": "1.00000(2018-04-09 18:07)",
|
||||
"conn_status": 1,
|
||||
"beta": -1,
|
||||
"dev_status": 1,
|
||||
"platform_str": "FortiGate-VM64",
|
||||
"last_checked": 1550698173,
|
||||
"vm_mem_limit": 6144,
|
||||
"name": "ansible-fgt02",
|
||||
"tab_status": "<unknown>",
|
||||
"patch": 4,
|
||||
"vm_cpu_limit": 4,
|
||||
"vm_status": 3,
|
||||
"ips_ver": "6.00741(2015-12-01 02:30)",
|
||||
"flags": 2097153,
|
||||
"sn": "FGVM04TM18000392",
|
||||
"mr": 0,
|
||||
"os_type": 0,
|
||||
"vm_cpu": 1
|
||||
}
|
||||
},
|
||||
"datagram_sent": {
|
||||
"device": {
|
||||
"adm_pass": "fortinet",
|
||||
"ip": "10.7.220.152",
|
||||
"adm_usr": "admin"
|
||||
},
|
||||
"odd_request_form": "True"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"device_username": "admin",
|
||||
"adom": "ansible",
|
||||
"device_ip": "10.7.220.152",
|
||||
"device_unique_name": "FGT2",
|
||||
"mode": "add",
|
||||
"device_serial": null,
|
||||
"device_password": "fortinet"
|
||||
},
|
||||
"post_method": "exec"
|
||||
},
|
||||
{
|
||||
"url": "/dvm/cmd/discover/device/",
|
||||
"paramgram_used": {
|
||||
"device_username": "admin",
|
||||
"adom": "ansible",
|
||||
"device_ip": "10.7.220.153",
|
||||
"device_unique_name": "FGT3",
|
||||
"mode": "add",
|
||||
"device_serial": null,
|
||||
"device_password": "fortinet"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"device": {
|
||||
"adm_pass": "fortinet",
|
||||
"ip": "10.7.220.153",
|
||||
"adm_usr": "admin"
|
||||
},
|
||||
"odd_request_form": "True"
|
||||
},
|
||||
"raw_response": {
|
||||
"device": {
|
||||
"adm_pass": "fortinet",
|
||||
"ip": "10.7.220.153",
|
||||
"vm_mem": 1003,
|
||||
"maxvdom": 10,
|
||||
"conn_mode": 1,
|
||||
"vm_cpu_limit": 4,
|
||||
"vm_cpu": 1,
|
||||
"branch_pt": 231,
|
||||
"hostname": "ansible-fgt03",
|
||||
"source": 1,
|
||||
"version": 600,
|
||||
"build": 231,
|
||||
"adm_usr": "admin",
|
||||
"av_ver": "1.00000(2018-04-09 18:07)",
|
||||
"conn_status": 1,
|
||||
"beta": -1,
|
||||
"dev_status": 1,
|
||||
"platform_str": "FortiGate-VM64",
|
||||
"last_checked": 1550698200,
|
||||
"vm_mem_limit": 6144,
|
||||
"name": "ansible-fgt03",
|
||||
"tab_status": "<unknown>",
|
||||
"patch": 4,
|
||||
"platform_id": 112,
|
||||
"vm_status": 3,
|
||||
"ips_ver": "6.00741(2015-12-01 02:30)",
|
||||
"flags": 2097153,
|
||||
"sn": "FGVM04TM18000393",
|
||||
"mr": 0,
|
||||
"os_type": 0,
|
||||
"os_ver": 6
|
||||
}
|
||||
},
|
||||
"post_method": "exec"
|
||||
}
|
||||
],
|
||||
"get_device": [
|
||||
{
|
||||
"url": "/dvmdb/adom/ansible/device/FGT1",
|
||||
"raw_response": {
|
||||
"adm_pass": [
|
||||
"ENC",
|
||||
"tUEPOPpQM6XsNwOPcWyrWoPoKo2DMjtFqOYEzLfF+99FpTkDmKa+GTmwBMLV1ns0OYrNgWnk6RPbRjSZSvu2LPYvCcWfQONLEZ1HlczZ00kEtDRCvRxG6l7FGtcj1Pl7QO9khy2lKWx4/lbPmLNqCzwCmlkAO5fGXR3nCbWPXH5BrRwO"
|
||||
],
|
||||
"faz.perm": 0,
|
||||
"foslic_ram": 0,
|
||||
"foslic_type": "temporary",
|
||||
"last_checked": 1550635232,
|
||||
"psk": "",
|
||||
"opts": 0,
|
||||
"ip": "10.7.220.151",
|
||||
"foslic_utm": null,
|
||||
"logdisk_size": 30235,
|
||||
"mgmt.__data[6]": 1,
|
||||
"foslic_last_sync": 0,
|
||||
"app_ver": "",
|
||||
"ips_ext": 0,
|
||||
"vm_mem": 1003,
|
||||
"mgmt.__data[4]": 1052262400,
|
||||
"maxvdom": 10,
|
||||
"conn_mode": "passive",
|
||||
"location_from": "GUI(10.0.0.151)",
|
||||
"mgmt.__data[1]": 0,
|
||||
"mgmt.__data[2]": 0,
|
||||
"faz.full_act": 0,
|
||||
"os_ver": "6.0",
|
||||
"node_flags": 0,
|
||||
"hostname": "ansible-fgt01",
|
||||
"mgmt.__data[5]": 0,
|
||||
"mgmt_id": 2076985412,
|
||||
"hw_rev_minor": 0,
|
||||
"mgmt_if": "port1",
|
||||
"source": "faz",
|
||||
"ha_mode": "standalone",
|
||||
"version": 600,
|
||||
"build": 231,
|
||||
"latitude": "47.473991",
|
||||
"foslic_cpu": 0,
|
||||
"last_resync": 1550634702,
|
||||
"desc": "",
|
||||
"adm_usr": "admin",
|
||||
"vm_lic_expire": 0,
|
||||
"ha_slave": null,
|
||||
"av_ver": "1.00000(2018-04-09 18:07)",
|
||||
"fsw_cnt": 0,
|
||||
"tunnel_cookie": "",
|
||||
"foslic_inst_time": 0,
|
||||
"lic_flags": 0,
|
||||
"checksum": "89 1f b7 b7 2a a6 af 54 c5 a5 aa e3 32 92 c7 55",
|
||||
"oid": 366,
|
||||
"conn_status": "up",
|
||||
"fex_cnt": 0,
|
||||
"mgmt.__data[3]": 0,
|
||||
"beta": -1,
|
||||
"ha_group_name": "",
|
||||
"dev_status": "installed",
|
||||
"platform_str": "FortiGate-VM64",
|
||||
"mgmt.__data[7]": 0,
|
||||
"faz.used": 0,
|
||||
"fap_cnt": 0,
|
||||
"foslic_dr_site": "disable",
|
||||
"mgmt_mode": "fmgfaz",
|
||||
"vdom": [
|
||||
{
|
||||
"status": null,
|
||||
"oid": 3,
|
||||
"name": "root",
|
||||
"node_flags": 0,
|
||||
"devid": "FGT1",
|
||||
"tab_status": null,
|
||||
"comments": "",
|
||||
"flags": null,
|
||||
"opmode": "nat",
|
||||
"ext_flags": 1,
|
||||
"rtm_prof_id": 0
|
||||
}
|
||||
],
|
||||
"hdisk_size": 30720,
|
||||
"vm_mem_limit": 6144,
|
||||
"mgmt.__data[0]": 3870643,
|
||||
"ha_group_id": 0,
|
||||
"name": "FGT1",
|
||||
"faz.quota": 0,
|
||||
"mgt_vdom": "root",
|
||||
"tab_status": "",
|
||||
"tunnel_ip": "169.254.0.5",
|
||||
"longitude": "-122.260963",
|
||||
"patch": 4,
|
||||
"vm_cpu_limit": 4,
|
||||
"vm_status": 3,
|
||||
"lic_region": "",
|
||||
"hw_rev_major": 0,
|
||||
"flags": [
|
||||
"has_hdd",
|
||||
"reload"
|
||||
],
|
||||
"sn": "FGVM04TM18000391",
|
||||
"mr": 0,
|
||||
"conf_status": "insync",
|
||||
"os_type": "fos",
|
||||
"ips_ver": "6.00741(2015-12-01 02:30)",
|
||||
"db_status": "nomod",
|
||||
"branch_pt": 231,
|
||||
"vm_cpu": 1
|
||||
},
|
||||
"datagram_sent": {
|
||||
"filter": [
|
||||
"name",
|
||||
"==",
|
||||
"FGT1"
|
||||
],
|
||||
"adom": "ansible"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"device_username": "admin",
|
||||
"adom": "ansible",
|
||||
"device_ip": "10.7.220.151",
|
||||
"device_unique_name": "FGT1",
|
||||
"mode": "add",
|
||||
"device_serial": null,
|
||||
"device_password": "fortinet"
|
||||
},
|
||||
"post_method": "get"
|
||||
},
|
||||
{
|
||||
"url": "/dvmdb/adom/ansible/device/FGT2",
|
||||
"paramgram_used": {
|
||||
"device_username": "admin",
|
||||
"adom": "ansible",
|
||||
"device_ip": "10.7.220.152",
|
||||
"device_unique_name": "FGT2",
|
||||
"mode": "add",
|
||||
"device_serial": null,
|
||||
"device_password": "fortinet"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"filter": [
|
||||
"name",
|
||||
"==",
|
||||
"FGT2"
|
||||
],
|
||||
"adom": "ansible"
|
||||
},
|
||||
"raw_response": {
|
||||
"adm_pass": [
|
||||
"ENC",
|
||||
"F27zJSIl5O8O5rlXIi7BzHIUO5d3ZAuNxoniR42zOxGHyqZCx1OyA81b7v6dNwE30nBhjqfD+IDRmSPEW6qxKIQ2UV5eh8zgDNj8i5lj5gTvbLN5A4BR4CMLQo7nYTTomHUJQrGPfYskuxm74JGik+di9TrqOhvpZL8d1zj3XHx5pq+d"
|
||||
],
|
||||
"faz.perm": 0,
|
||||
"hostname": "ansible-fgt02",
|
||||
"foslic_type": "temporary",
|
||||
"mgmt.__data[7]": 0,
|
||||
"av_ver": "1.00000(2018-04-09 18:07)",
|
||||
"ip": "10.7.220.152",
|
||||
"foslic_utm": null,
|
||||
"logdisk_size": 30235,
|
||||
"mgmt.__data[6]": 1,
|
||||
"fsw_cnt": 0,
|
||||
"app_ver": "",
|
||||
"ips_ext": 0,
|
||||
"vm_mem": 1003,
|
||||
"maxvdom": 10,
|
||||
"conn_mode": "passive",
|
||||
"mgt_vdom": "root",
|
||||
"mgmt.__data[1]": 0,
|
||||
"hw_rev_major": 0,
|
||||
"name": "FGT2",
|
||||
"node_flags": 0,
|
||||
"foslic_ram": 0,
|
||||
"mgmt.__data[5]": 0,
|
||||
"ha_mode": "standalone",
|
||||
"hw_rev_minor": 0,
|
||||
"mgmt_if": "port1",
|
||||
"source": "faz",
|
||||
"mgmt_id": 1555154046,
|
||||
"version": 600,
|
||||
"build": 231,
|
||||
"latitude": "47.473991",
|
||||
"foslic_cpu": 0,
|
||||
"last_resync": 1550634728,
|
||||
"hdisk_size": 30720,
|
||||
"adm_usr": "admin",
|
||||
"vm_lic_expire": 0,
|
||||
"sn": "FGVM04TM18000392",
|
||||
"ha_slave": null,
|
||||
"psk": "",
|
||||
"foslic_last_sync": 0,
|
||||
"tunnel_cookie": "",
|
||||
"vm_mem_limit": 6144,
|
||||
"mr": 0,
|
||||
"lic_flags": 0,
|
||||
"oid": 378,
|
||||
"conn_status": "up",
|
||||
"fex_cnt": 0,
|
||||
"vm_cpu": 1,
|
||||
"beta": -1,
|
||||
"ha_group_name": "",
|
||||
"dev_status": "retrieved",
|
||||
"platform_str": "FortiGate-VM64",
|
||||
"last_checked": 1550634728,
|
||||
"branch_pt": 231,
|
||||
"faz.used": 0,
|
||||
"patch": 4,
|
||||
"fap_cnt": 0,
|
||||
"foslic_dr_site": "disable",
|
||||
"mgmt_mode": "fmgfaz",
|
||||
"vdom": [
|
||||
{
|
||||
"status": null,
|
||||
"oid": 3,
|
||||
"name": "root",
|
||||
"node_flags": 4,
|
||||
"devid": "FGT2",
|
||||
"tab_status": null,
|
||||
"comments": "",
|
||||
"flags": null,
|
||||
"opmode": "nat",
|
||||
"ext_flags": 1,
|
||||
"rtm_prof_id": 0
|
||||
}
|
||||
],
|
||||
"desc": "",
|
||||
"foslic_inst_time": 0,
|
||||
"mgmt.__data[0]": 3870643,
|
||||
"ha_group_id": 0,
|
||||
"location_from": "GUI(10.0.0.151)",
|
||||
"faz.quota": 0,
|
||||
"faz.full_act": 0,
|
||||
"tab_status": "",
|
||||
"tunnel_ip": "169.254.0.3",
|
||||
"longitude": "-122.260963",
|
||||
"mgmt.__data[4]": 1052262400,
|
||||
"vm_cpu_limit": 4,
|
||||
"vm_status": 3,
|
||||
"lic_region": "",
|
||||
"mgmt.__data[2]": 0,
|
||||
"flags": [
|
||||
"has_hdd",
|
||||
"reload"
|
||||
],
|
||||
"opts": 0,
|
||||
"checksum": "56 e9 a7 14 e2 61 05 f9 ec 2b 00 1e 36 bc af c8",
|
||||
"conf_status": "insync",
|
||||
"os_type": "fos",
|
||||
"ips_ver": "6.00741(2015-12-01 02:30)",
|
||||
"db_status": "mod",
|
||||
"mgmt.__data[3]": 0,
|
||||
"os_ver": "6.0"
|
||||
},
|
||||
"post_method": "get"
|
||||
},
|
||||
{
|
||||
"url": "/dvmdb/adom/ansible/device/FGT3",
|
||||
"raw_response": {
|
||||
"adm_pass": [
|
||||
"ENC",
|
||||
"F27zJSIl5O8O5rlXIi7BzHIUO5d3ZAuNxoniR42zOxGHyqZCx1OyA81b7v6dNwE30nBhjqfD+IDRmSPEW6qxKIQ2UV5eh8zgDNj8i5lj5gTvbLN5A4BR4CMLQo7nYTTomHUJQrGPfYskuxm74JGik+di9TrqOhvpZL8d1zj3XHx5pq+d"
|
||||
],
|
||||
"faz.perm": 0,
|
||||
"foslic_ram": 0,
|
||||
"foslic_type": "temporary",
|
||||
"last_checked": 1550634754,
|
||||
"psk": "",
|
||||
"opts": 0,
|
||||
"ip": "10.7.220.153",
|
||||
"foslic_utm": null,
|
||||
"logdisk_size": 30235,
|
||||
"mgmt.__data[6]": 1,
|
||||
"foslic_last_sync": 0,
|
||||
"app_ver": "",
|
||||
"ips_ext": 0,
|
||||
"vm_mem": 1003,
|
||||
"mgmt.__data[4]": 1052262400,
|
||||
"desc": "",
|
||||
"maxvdom": 10,
|
||||
"conn_mode": "passive",
|
||||
"location_from": "GUI(10.0.0.151)",
|
||||
"mgmt.__data[1]": 0,
|
||||
"os_ver": "6.0",
|
||||
"faz.full_act": 0,
|
||||
"node_flags": 0,
|
||||
"hostname": "ansible-fgt03",
|
||||
"mgmt.__data[5]": 0,
|
||||
"mgmt_id": 1175062219,
|
||||
"hw_rev_minor": 0,
|
||||
"mgmt_if": "port1",
|
||||
"source": "faz",
|
||||
"ha_mode": "standalone",
|
||||
"version": 600,
|
||||
"build": 231,
|
||||
"latitude": "47.473991",
|
||||
"foslic_cpu": 0,
|
||||
"last_resync": 1550634754,
|
||||
"hdisk_size": 30720,
|
||||
"adm_usr": "admin",
|
||||
"vm_lic_expire": 0,
|
||||
"conf_status": "insync",
|
||||
"ha_slave": null,
|
||||
"av_ver": "1.00000(2018-04-09 18:07)",
|
||||
"fsw_cnt": 0,
|
||||
"tunnel_cookie": "",
|
||||
"foslic_inst_time": 0,
|
||||
"lic_flags": 0,
|
||||
"oid": 390,
|
||||
"conn_status": "up",
|
||||
"fex_cnt": 0,
|
||||
"mgmt.__data[3]": 0,
|
||||
"beta": -1,
|
||||
"ha_group_name": "",
|
||||
"dev_status": "retrieved",
|
||||
"platform_str": "FortiGate-VM64",
|
||||
"mgmt.__data[7]": 0,
|
||||
"faz.used": 0,
|
||||
"fap_cnt": 0,
|
||||
"foslic_dr_site": "disable",
|
||||
"mgmt_mode": "fmgfaz",
|
||||
"vdom": [
|
||||
{
|
||||
"status": null,
|
||||
"oid": 3,
|
||||
"name": "root",
|
||||
"node_flags": 4,
|
||||
"devid": "FGT3",
|
||||
"tab_status": null,
|
||||
"comments": "",
|
||||
"flags": null,
|
||||
"opmode": "nat",
|
||||
"ext_flags": 1,
|
||||
"rtm_prof_id": 0
|
||||
}
|
||||
],
|
||||
"name": "FGT3",
|
||||
"vm_mem_limit": 6144,
|
||||
"mgmt.__data[0]": 3870643,
|
||||
"ha_group_id": 0,
|
||||
"mgmt.__data[2]": 0,
|
||||
"faz.quota": 0,
|
||||
"checksum": "30 fc af f5 58 e4 1e 2d 46 c0 07 4b b6 4b c2 1b",
|
||||
"tab_status": "",
|
||||
"tunnel_ip": "169.254.0.4",
|
||||
"longitude": "-122.260963",
|
||||
"patch": 4,
|
||||
"vm_cpu_limit": 4,
|
||||
"vm_status": 3,
|
||||
"lic_region": "",
|
||||
"mgt_vdom": "root",
|
||||
"flags": [
|
||||
"has_hdd",
|
||||
"reload"
|
||||
],
|
||||
"sn": "FGVM04TM18000393",
|
||||
"mr": 0,
|
||||
"hw_rev_major": 0,
|
||||
"os_type": "fos",
|
||||
"ips_ver": "6.00741(2015-12-01 02:30)",
|
||||
"db_status": "mod",
|
||||
"branch_pt": 231,
|
||||
"vm_cpu": 1
|
||||
},
|
||||
"datagram_sent": {
|
||||
"filter": [
|
||||
"name",
|
||||
"==",
|
||||
"FGT3"
|
||||
],
|
||||
"adom": "ansible"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"device_username": "admin",
|
||||
"adom": "ansible",
|
||||
"device_ip": "10.7.220.153",
|
||||
"device_unique_name": "FGT3",
|
||||
"mode": "add",
|
||||
"device_serial": null,
|
||||
"device_password": "fortinet"
|
||||
},
|
||||
"post_method": "get"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "Object does not exist",
|
||||
"code": -3
|
||||
},
|
||||
"url": "/dvmdb/adom/ansible/device/FGT1"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"filter": [
|
||||
"name",
|
||||
"==",
|
||||
"FGT1"
|
||||
],
|
||||
"adom": "ansible"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"device_username": "admin",
|
||||
"adom": "ansible",
|
||||
"device_ip": "10.7.220.151",
|
||||
"device_unique_name": "FGT1",
|
||||
"mode": "add",
|
||||
"device_serial": null,
|
||||
"device_password": "fortinet"
|
||||
},
|
||||
"post_method": "get"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"device_username": "admin",
|
||||
"adom": "ansible",
|
||||
"device_ip": "10.7.220.152",
|
||||
"device_unique_name": "FGT2",
|
||||
"mode": "add",
|
||||
"device_serial": null,
|
||||
"device_password": "fortinet"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"filter": [
|
||||
"name",
|
||||
"==",
|
||||
"FGT2"
|
||||
],
|
||||
"adom": "ansible"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "Object does not exist",
|
||||
"code": -3
|
||||
},
|
||||
"url": "/dvmdb/adom/ansible/device/FGT2"
|
||||
},
|
||||
"post_method": "get"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "Object does not exist",
|
||||
"code": -3
|
||||
},
|
||||
"url": "/dvmdb/adom/ansible/device/FGT3"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"filter": [
|
||||
"name",
|
||||
"==",
|
||||
"FGT3"
|
||||
],
|
||||
"adom": "ansible"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"device_username": "admin",
|
||||
"adom": "ansible",
|
||||
"device_ip": "10.7.220.153",
|
||||
"device_unique_name": "FGT3",
|
||||
"mode": "add",
|
||||
"device_serial": null,
|
||||
"device_password": "fortinet"
|
||||
},
|
||||
"post_method": "get"
|
||||
}
|
||||
],
|
||||
"delete_device": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"device_username": "admin",
|
||||
"adom": "root",
|
||||
"device_ip": "10.7.220.151",
|
||||
"device_unique_name": "FGT1",
|
||||
"mode": "delete",
|
||||
"device_serial": null,
|
||||
"device_password": "fortinet"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"device": "FGT1",
|
||||
"flags": [
|
||||
"create_task",
|
||||
"nonblocking"
|
||||
],
|
||||
"adom": "root"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/dvm/cmd/del/device/"
|
||||
},
|
||||
"post_method": "exec"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/dvm/cmd/del/device/"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"device": "FGT2",
|
||||
"flags": [
|
||||
"create_task",
|
||||
"nonblocking"
|
||||
],
|
||||
"adom": "ansible"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"device_username": "admin",
|
||||
"adom": "ansible",
|
||||
"device_ip": "10.7.220.152",
|
||||
"device_unique_name": "FGT2",
|
||||
"mode": "delete",
|
||||
"device_serial": null,
|
||||
"device_password": "fortinet"
|
||||
},
|
||||
"post_method": "exec"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"device_username": "admin",
|
||||
"adom": "ansible",
|
||||
"device_ip": "10.7.220.153",
|
||||
"device_unique_name": "FGT3",
|
||||
"mode": "delete",
|
||||
"device_serial": null,
|
||||
"device_password": "fortinet"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"device": "FGT3",
|
||||
"flags": [
|
||||
"create_task",
|
||||
"nonblocking"
|
||||
],
|
||||
"adom": "ansible"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/dvm/cmd/del/device/"
|
||||
},
|
||||
"post_method": "exec"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,204 @@
|
|||
{
|
||||
"update_device_interface": [
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/device/FGT1/global/system/interface/port2"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"ip": "10.1.1.1/24",
|
||||
"allowaccess": [
|
||||
"ping",
|
||||
"telnet",
|
||||
"https",
|
||||
"http"
|
||||
]
|
||||
},
|
||||
"paramgram_used": {
|
||||
"adom": "ansible",
|
||||
"install_config": "disable",
|
||||
"device_unique_name": "FGT1",
|
||||
"interface": "port2",
|
||||
"device_hostname": null,
|
||||
"interface_ip": "10.1.1.1/24",
|
||||
"interface_allow_access": "ping, telnet, https, http"
|
||||
},
|
||||
"post_method": "update"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/device/FGT2/global/system/interface/port2"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"ip": "10.1.2.1/24",
|
||||
"allowaccess": [
|
||||
"ping",
|
||||
"telnet",
|
||||
"https",
|
||||
"http"
|
||||
]
|
||||
},
|
||||
"paramgram_used": {
|
||||
"adom": "ansible",
|
||||
"install_config": "disable",
|
||||
"device_unique_name": "FGT2",
|
||||
"interface": "port2",
|
||||
"device_hostname": null,
|
||||
"interface_ip": "10.1.2.1/24",
|
||||
"interface_allow_access": "ping, telnet, https, http"
|
||||
},
|
||||
"post_method": "update"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/device/FGT3/global/system/interface/port2"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"ip": "10.1.3.1/24",
|
||||
"allowaccess": [
|
||||
"ping",
|
||||
"telnet",
|
||||
"https",
|
||||
"http"
|
||||
]
|
||||
},
|
||||
"paramgram_used": {
|
||||
"adom": "ansible",
|
||||
"install_config": "disable",
|
||||
"device_unique_name": "FGT3",
|
||||
"interface": "port2",
|
||||
"device_hostname": null,
|
||||
"interface_ip": "10.1.3.1/24",
|
||||
"interface_allow_access": "ping, telnet, https, http"
|
||||
},
|
||||
"post_method": "update"
|
||||
}
|
||||
],
|
||||
"update_device_hostname": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"adom": "ansible",
|
||||
"interface": null,
|
||||
"device_unique_name": "FGT1",
|
||||
"install_config": "disable",
|
||||
"device_hostname": "ansible-fgt01",
|
||||
"interface_ip": null,
|
||||
"interface_allow_access": null
|
||||
},
|
||||
"datagram_sent": {
|
||||
"hostname": "ansible-fgt01"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "pm/config/device/FGT1/global/system/global"
|
||||
},
|
||||
"post_method": "update"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"adom": "ansible",
|
||||
"interface": null,
|
||||
"device_unique_name": "FGT2",
|
||||
"install_config": "disable",
|
||||
"device_hostname": "ansible-fgt02",
|
||||
"interface_ip": null,
|
||||
"interface_allow_access": null
|
||||
},
|
||||
"datagram_sent": {
|
||||
"hostname": "ansible-fgt02"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "pm/config/device/FGT2/global/system/global"
|
||||
},
|
||||
"post_method": "update"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"adom": "ansible",
|
||||
"interface": null,
|
||||
"device_unique_name": "FGT3",
|
||||
"install_config": "disable",
|
||||
"device_hostname": "ansible-fgt03",
|
||||
"interface_ip": null,
|
||||
"interface_allow_access": null
|
||||
},
|
||||
"datagram_sent": {
|
||||
"hostname": "ansible-fgt03"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "pm/config/device/FGT3/global/system/global"
|
||||
},
|
||||
"post_method": "update"
|
||||
}
|
||||
],
|
||||
"exec_config": [
|
||||
{
|
||||
"url": "/securityconsole/install/device",
|
||||
"paramgram_used": {
|
||||
"adom": "ansible",
|
||||
"interface": null,
|
||||
"device_unique_name": "FGT1",
|
||||
"install_config": "enable",
|
||||
"device_hostname": null,
|
||||
"interface_ip": null,
|
||||
"interface_allow_access": null
|
||||
},
|
||||
"datagram_sent": {
|
||||
"scope": {
|
||||
"name": "FGT1"
|
||||
},
|
||||
"flags": "none",
|
||||
"adom": "ansible"
|
||||
},
|
||||
"raw_response": {
|
||||
"task": 243
|
||||
},
|
||||
"post_method": "exec"
|
||||
},
|
||||
{
|
||||
"url": "/securityconsole/install/device",
|
||||
"raw_response": {
|
||||
"task": 244
|
||||
},
|
||||
"datagram_sent": {
|
||||
"scope": {
|
||||
"name": "FGT2, FGT3"
|
||||
},
|
||||
"flags": "none",
|
||||
"adom": "ansible"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"adom": "ansible",
|
||||
"install_config": "enable",
|
||||
"device_unique_name": "FGT2, FGT3",
|
||||
"interface": null,
|
||||
"device_hostname": null,
|
||||
"interface_ip": null,
|
||||
"interface_allow_access": null
|
||||
},
|
||||
"post_method": "exec"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,234 @@
|
|||
{
|
||||
"add_group_member": [
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/dvmdb/adom/ansible/group/TestGroup/object member"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "FGT1",
|
||||
"vdom": "root"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"grp_desc": null,
|
||||
"adom": "ansible",
|
||||
"grp_members": "FGT1",
|
||||
"mode": "add",
|
||||
"grp_name": "TestGroup",
|
||||
"vdom": "root"
|
||||
},
|
||||
"post_method": "add"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/dvmdb/adom/ansible/group/testtest/object member"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "FGT3",
|
||||
"vdom": "root"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"grp_desc": null,
|
||||
"adom": "ansible",
|
||||
"grp_members": "FGT3",
|
||||
"mode": "add",
|
||||
"grp_name": "testtest",
|
||||
"vdom": "root"
|
||||
},
|
||||
"post_method": "add"
|
||||
}
|
||||
],
|
||||
"delete_device_group": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"grp_desc": "CreatedbyAnsible",
|
||||
"adom": "ansible",
|
||||
"grp_members": null,
|
||||
"mode": "delete",
|
||||
"grp_name": "TestGroup",
|
||||
"vdom": "root"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "TestGroup",
|
||||
"adom": "ansible"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/dvmdb/adom/ansible/group/TestGroup"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/dvmdb/adom/ansible/group/testtest"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "testtest",
|
||||
"adom": "ansible"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"grp_desc": "CreatedbyAnsible",
|
||||
"adom": "ansible",
|
||||
"grp_members": null,
|
||||
"mode": "delete",
|
||||
"grp_name": "testtest",
|
||||
"vdom": "root"
|
||||
},
|
||||
"post_method": "delete"
|
||||
}
|
||||
],
|
||||
"add_device_group": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"grp_desc": "CreatedbyAnsible",
|
||||
"adom": "ansible",
|
||||
"grp_members": null,
|
||||
"mode": "add",
|
||||
"grp_name": "TestGroup",
|
||||
"vdom": "root"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"os_type": "fos",
|
||||
"name": "TestGroup",
|
||||
"desc": "CreatedbyAnsible"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "Object already exists",
|
||||
"code": -2
|
||||
},
|
||||
"url": "/dvmdb/adom/ansible/group"
|
||||
},
|
||||
"post_method": "add"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/dvmdb/adom/ansible/group"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"os_type": "fos",
|
||||
"name": "testtest",
|
||||
"desc": "CreatedbyAnsible"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"grp_desc": "CreatedbyAnsible",
|
||||
"adom": "ansible",
|
||||
"grp_members": null,
|
||||
"mode": "add",
|
||||
"grp_name": "testtest",
|
||||
"vdom": "root"
|
||||
},
|
||||
"post_method": "add"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"grp_desc": null,
|
||||
"adom": "ansible",
|
||||
"grp_members": "FGT1",
|
||||
"mode": "add",
|
||||
"grp_name": "TestGroup",
|
||||
"vdom": "root"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"os_type": "fos",
|
||||
"name": "TestGroup",
|
||||
"desc": null
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "Object already exists",
|
||||
"code": -2
|
||||
},
|
||||
"url": "/dvmdb/adom/ansible/group"
|
||||
},
|
||||
"post_method": "add"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"grp_desc": null,
|
||||
"adom": "ansible",
|
||||
"grp_members": "FGT3",
|
||||
"mode": "add",
|
||||
"grp_name": "testtest",
|
||||
"vdom": "root"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"os_type": "fos",
|
||||
"name": "testtest",
|
||||
"desc": null
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "Object already exists",
|
||||
"code": -2
|
||||
},
|
||||
"url": "/dvmdb/adom/ansible/group"
|
||||
},
|
||||
"post_method": "add"
|
||||
}
|
||||
],
|
||||
"delete_group_member": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"grp_desc": null,
|
||||
"adom": "ansible",
|
||||
"grp_members": "FGT3",
|
||||
"mode": "delete",
|
||||
"grp_name": "testtest",
|
||||
"vdom": "root"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "FGT3",
|
||||
"vdom": "root"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/dvmdb/adom/ansible/group/testtest/object member"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/dvmdb/adom/ansible/group/TestGroup/object member"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "FGT1",
|
||||
"vdom": "root"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"grp_desc": null,
|
||||
"adom": "ansible",
|
||||
"grp_members": "FGT1",
|
||||
"mode": "delete",
|
||||
"grp_name": "TestGroup",
|
||||
"vdom": "root"
|
||||
},
|
||||
"post_method": "delete"
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,388 @@
|
|||
{
|
||||
"fmgr_fwobj_ippool_modify": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"source-endip": null,
|
||||
"arp-intf": null,
|
||||
"num-blocks-per-user": null,
|
||||
"name": "Ansible_pool4_overload",
|
||||
"adom": "ansible",
|
||||
"startip": "10.10.10.10",
|
||||
"dynamic_mapping": {
|
||||
"endip": null,
|
||||
"num-blocks-per-user": null,
|
||||
"block-size": null,
|
||||
"startip": null,
|
||||
"arp-intf": null,
|
||||
"comments": null,
|
||||
"source-endip": null,
|
||||
"arp-reply": null,
|
||||
"pba-timeout": null,
|
||||
"associated-interface": null,
|
||||
"source-startip": null,
|
||||
"permit-any-host": null,
|
||||
"type": null
|
||||
},
|
||||
"comments": "Created by ansible",
|
||||
"permit-any-host": null,
|
||||
"arp-reply": "enable",
|
||||
"pba-timeout": null,
|
||||
"endip": "10.10.10.100",
|
||||
"associated-interface": null,
|
||||
"mode": "add",
|
||||
"source-startip": null,
|
||||
"type": "overload",
|
||||
"block-size": null
|
||||
},
|
||||
"datagram_sent": {
|
||||
"endip": "10.10.10.100",
|
||||
"name": "Ansible_pool4_overload",
|
||||
"startip": "10.10.10.10",
|
||||
"comments": "Created by ansible",
|
||||
"arp-reply": "enable",
|
||||
"type": "overload"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/ippool"
|
||||
},
|
||||
"post_method": "add"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/ippool"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"endip": "10.10.20.100",
|
||||
"name": "Ansible_pool4_121",
|
||||
"startip": "10.10.20.10",
|
||||
"comments": "Created by ansible",
|
||||
"arp-reply": "enable",
|
||||
"type": "one-to-one"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"permit-any-host": null,
|
||||
"dynamic_mapping": {
|
||||
"endip": null,
|
||||
"num-blocks-per-user": null,
|
||||
"block-size": null,
|
||||
"startip": null,
|
||||
"arp-intf": null,
|
||||
"comments": null,
|
||||
"source-endip": null,
|
||||
"arp-reply": null,
|
||||
"pba-timeout": null,
|
||||
"associated-interface": null,
|
||||
"source-startip": null,
|
||||
"permit-any-host": null,
|
||||
"type": null
|
||||
},
|
||||
"num-blocks-per-user": null,
|
||||
"name": "Ansible_pool4_121",
|
||||
"adom": "ansible",
|
||||
"startip": "10.10.20.10",
|
||||
"arp-intf": null,
|
||||
"comments": "Created by ansible",
|
||||
"source-endip": null,
|
||||
"arp-reply": "enable",
|
||||
"pba-timeout": null,
|
||||
"endip": "10.10.20.100",
|
||||
"associated-interface": null,
|
||||
"mode": "add",
|
||||
"source-startip": null,
|
||||
"type": "one-to-one",
|
||||
"block-size": null
|
||||
},
|
||||
"post_method": "add"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"source-endip": "192.168.20.20",
|
||||
"arp-intf": null,
|
||||
"num-blocks-per-user": null,
|
||||
"name": "Ansible_pool4_fixed_port",
|
||||
"adom": "ansible",
|
||||
"startip": "10.10.40.10",
|
||||
"dynamic_mapping": {
|
||||
"endip": null,
|
||||
"num-blocks-per-user": null,
|
||||
"block-size": null,
|
||||
"startip": null,
|
||||
"arp-intf": null,
|
||||
"comments": null,
|
||||
"source-endip": null,
|
||||
"arp-reply": null,
|
||||
"pba-timeout": null,
|
||||
"associated-interface": null,
|
||||
"source-startip": null,
|
||||
"permit-any-host": null,
|
||||
"type": null
|
||||
},
|
||||
"comments": "Created by ansible",
|
||||
"permit-any-host": null,
|
||||
"arp-reply": "enable",
|
||||
"pba-timeout": null,
|
||||
"endip": "10.10.40.100",
|
||||
"associated-interface": null,
|
||||
"mode": "add",
|
||||
"source-startip": "192.168.20.1",
|
||||
"type": "fixed-port-range",
|
||||
"block-size": null
|
||||
},
|
||||
"datagram_sent": {
|
||||
"endip": "10.10.40.100",
|
||||
"name": "Ansible_pool4_fixed_port",
|
||||
"startip": "10.10.40.10",
|
||||
"comments": "Created by ansible",
|
||||
"source-endip": "192.168.20.20",
|
||||
"arp-reply": "enable",
|
||||
"source-startip": "192.168.20.1",
|
||||
"type": "fixed-port-range"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/ippool"
|
||||
},
|
||||
"post_method": "add"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/ippool"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"endip": "10.10.30.100",
|
||||
"num-blocks-per-user": 1,
|
||||
"name": "Ansible_pool4_port_block_allocation",
|
||||
"startip": "10.10.30.10",
|
||||
"comments": "Created by ansible",
|
||||
"arp-reply": "enable",
|
||||
"type": "port-block-allocation",
|
||||
"block-size": 128
|
||||
},
|
||||
"paramgram_used": {
|
||||
"permit-any-host": null,
|
||||
"dynamic_mapping": {
|
||||
"endip": null,
|
||||
"num-blocks-per-user": null,
|
||||
"block-size": null,
|
||||
"startip": null,
|
||||
"arp-intf": null,
|
||||
"comments": null,
|
||||
"source-endip": null,
|
||||
"arp-reply": null,
|
||||
"pba-timeout": null,
|
||||
"associated-interface": null,
|
||||
"source-startip": null,
|
||||
"permit-any-host": null,
|
||||
"type": null
|
||||
},
|
||||
"num-blocks-per-user": 1,
|
||||
"name": "Ansible_pool4_port_block_allocation",
|
||||
"adom": "ansible",
|
||||
"startip": "10.10.30.10",
|
||||
"arp-intf": null,
|
||||
"comments": "Created by ansible",
|
||||
"source-endip": null,
|
||||
"arp-reply": "enable",
|
||||
"pba-timeout": null,
|
||||
"endip": "10.10.30.100",
|
||||
"associated-interface": null,
|
||||
"mode": "add",
|
||||
"source-startip": null,
|
||||
"type": "port-block-allocation",
|
||||
"block-size": 128
|
||||
},
|
||||
"post_method": "add"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"source-endip": null,
|
||||
"arp-intf": null,
|
||||
"num-blocks-per-user": null,
|
||||
"name": "Ansible_pool4_overload",
|
||||
"adom": "ansible",
|
||||
"startip": null,
|
||||
"dynamic_mapping": {
|
||||
"endip": null,
|
||||
"num-blocks-per-user": null,
|
||||
"block-size": null,
|
||||
"startip": null,
|
||||
"arp-intf": null,
|
||||
"comments": null,
|
||||
"source-endip": null,
|
||||
"arp-reply": null,
|
||||
"pba-timeout": null,
|
||||
"associated-interface": null,
|
||||
"source-startip": null,
|
||||
"permit-any-host": null,
|
||||
"type": null
|
||||
},
|
||||
"comments": "Created by ansible",
|
||||
"permit-any-host": null,
|
||||
"arp-reply": null,
|
||||
"pba-timeout": null,
|
||||
"endip": null,
|
||||
"associated-interface": null,
|
||||
"mode": "delete",
|
||||
"source-startip": null,
|
||||
"type": null,
|
||||
"block-size": null
|
||||
},
|
||||
"datagram_sent": {},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/ippool/Ansible_pool4_overload"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/ippool/Ansible_pool4_121"
|
||||
},
|
||||
"datagram_sent": {},
|
||||
"paramgram_used": {
|
||||
"permit-any-host": null,
|
||||
"dynamic_mapping": {
|
||||
"endip": null,
|
||||
"num-blocks-per-user": null,
|
||||
"block-size": null,
|
||||
"startip": null,
|
||||
"arp-intf": null,
|
||||
"comments": null,
|
||||
"source-endip": null,
|
||||
"arp-reply": null,
|
||||
"pba-timeout": null,
|
||||
"associated-interface": null,
|
||||
"source-startip": null,
|
||||
"permit-any-host": null,
|
||||
"type": null
|
||||
},
|
||||
"num-blocks-per-user": null,
|
||||
"name": "Ansible_pool4_121",
|
||||
"adom": "ansible",
|
||||
"startip": null,
|
||||
"arp-intf": null,
|
||||
"comments": "Created by ansible",
|
||||
"source-endip": null,
|
||||
"arp-reply": null,
|
||||
"pba-timeout": null,
|
||||
"endip": null,
|
||||
"associated-interface": null,
|
||||
"mode": "delete",
|
||||
"source-startip": null,
|
||||
"type": null,
|
||||
"block-size": null
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"source-endip": null,
|
||||
"arp-intf": null,
|
||||
"num-blocks-per-user": null,
|
||||
"name": "Ansible_pool4_fixed_port",
|
||||
"adom": "ansible",
|
||||
"startip": null,
|
||||
"dynamic_mapping": {
|
||||
"endip": null,
|
||||
"num-blocks-per-user": null,
|
||||
"block-size": null,
|
||||
"startip": null,
|
||||
"arp-intf": null,
|
||||
"comments": null,
|
||||
"source-endip": null,
|
||||
"arp-reply": null,
|
||||
"pba-timeout": null,
|
||||
"associated-interface": null,
|
||||
"source-startip": null,
|
||||
"permit-any-host": null,
|
||||
"type": null
|
||||
},
|
||||
"comments": "Created by ansible",
|
||||
"permit-any-host": null,
|
||||
"arp-reply": null,
|
||||
"pba-timeout": null,
|
||||
"endip": null,
|
||||
"associated-interface": null,
|
||||
"mode": "delete",
|
||||
"source-startip": null,
|
||||
"type": null,
|
||||
"block-size": null
|
||||
},
|
||||
"datagram_sent": {},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/ippool/Ansible_pool4_fixed_port"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/ippool/Ansible_pool4_port_block_allocation"
|
||||
},
|
||||
"datagram_sent": {},
|
||||
"paramgram_used": {
|
||||
"permit-any-host": null,
|
||||
"dynamic_mapping": {
|
||||
"num-blocks-per-user": null,
|
||||
"source-endip": null,
|
||||
"arp-reply": null,
|
||||
"pba-timeout": null,
|
||||
"endip": null,
|
||||
"block-size": null,
|
||||
"startip": null,
|
||||
"arp-intf": null,
|
||||
"comments": null,
|
||||
"permit-any-host": null,
|
||||
"associated-interface": null,
|
||||
"source-startip": null,
|
||||
"type": null
|
||||
},
|
||||
"num-blocks-per-user": null,
|
||||
"name": "Ansible_pool4_port_block_allocation",
|
||||
"adom": "ansible",
|
||||
"startip": null,
|
||||
"arp-intf": null,
|
||||
"comments": "Created by ansible",
|
||||
"source-endip": null,
|
||||
"arp-reply": null,
|
||||
"pba-timeout": null,
|
||||
"endip": null,
|
||||
"associated-interface": null,
|
||||
"mode": "delete",
|
||||
"source-startip": null,
|
||||
"type": null,
|
||||
"block-size": null
|
||||
},
|
||||
"post_method": "delete"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
"fmgr_fwobj_ippool6_modify": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"endip": null,
|
||||
"name": "IPv6 IPPool",
|
||||
"adom": "ansible",
|
||||
"startip": null,
|
||||
"dynamic_mapping": {
|
||||
"startip": null,
|
||||
"endip": null,
|
||||
"comments": null
|
||||
},
|
||||
"comments": null,
|
||||
"mode": "delete"
|
||||
},
|
||||
"datagram_sent": {},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/ippool6/IPv6 IPPool"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/ippool6"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"startip": "fd30:fc67:cb18:ae44::aaaa:aaaa",
|
||||
"endip": "fd30:fc67:cb18:ae44::ffff:ffff",
|
||||
"name": "IPv6 IPPool",
|
||||
"comments": "Created by Ansible"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"endip": "fd30:fc67:cb18:ae44::ffff:ffff",
|
||||
"name": "IPv6 IPPool",
|
||||
"adom": "ansible",
|
||||
"startip": "fd30:fc67:cb18:ae44::aaaa:aaaa",
|
||||
"dynamic_mapping": {
|
||||
"startip": null,
|
||||
"endip": null,
|
||||
"comments": null
|
||||
},
|
||||
"comments": "Created by Ansible",
|
||||
"mode": "add"
|
||||
},
|
||||
"post_method": "add"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,745 @@
|
|||
{
|
||||
"fmgr_fwobj_service_custom": [
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/service/custom/ansible_custom_service"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "ansible_custom_service"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"protocol": null,
|
||||
"custom_type": "all",
|
||||
"color": 22,
|
||||
"object_type": "custom",
|
||||
"group-name": null,
|
||||
"tcp-halfclose-timer": 0,
|
||||
"icmp_type": null,
|
||||
"iprange": "0.0.0.0",
|
||||
"category": null,
|
||||
"protocol-number": null,
|
||||
"udp-idle-timer": 0,
|
||||
"explicit-proxy": "disable",
|
||||
"group-member": null,
|
||||
"application": null,
|
||||
"tcp-portrange": null,
|
||||
"icmp_code": null,
|
||||
"session-ttl": 0,
|
||||
"adom": "ansible",
|
||||
"visibility": "enable",
|
||||
"tcp-timewait-timer": 0,
|
||||
"name": "ansible_custom_service",
|
||||
"app-service-type": null,
|
||||
"fqdn": "",
|
||||
"app-category": null,
|
||||
"check-reset-range": null,
|
||||
"mode": "delete",
|
||||
"tcp-halfopen-timer": 0,
|
||||
"udp-portrange": null,
|
||||
"sctp-portrange": null
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"protocol-number": null,
|
||||
"protocol": null,
|
||||
"custom_type": "all",
|
||||
"color": 22,
|
||||
"object_type": "custom",
|
||||
"group-name": null,
|
||||
"tcp-halfclose-timer": 0,
|
||||
"icmp_type": null,
|
||||
"iprange": "0.0.0.0",
|
||||
"category": null,
|
||||
"explicit-proxy": "disable",
|
||||
"udp-idle-timer": 0,
|
||||
"group-member": null,
|
||||
"application": null,
|
||||
"tcp-portrange": null,
|
||||
"icmp_code": null,
|
||||
"session-ttl": 0,
|
||||
"adom": "ansible",
|
||||
"visibility": "enable",
|
||||
"tcp-timewait-timer": 0,
|
||||
"name": "ansible_custom_icmp",
|
||||
"app-service-type": null,
|
||||
"fqdn": "",
|
||||
"app-category": null,
|
||||
"check-reset-range": null,
|
||||
"mode": "delete",
|
||||
"tcp-halfopen-timer": 0,
|
||||
"udp-portrange": null,
|
||||
"sctp-portrange": null
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "ansible_custom_icmp"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/service/custom/ansible_custom_icmp"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/service/custom/ansible_custom_icmp6"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "ansible_custom_icmp6"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"protocol": null,
|
||||
"custom_type": "all",
|
||||
"color": 22,
|
||||
"object_type": "custom",
|
||||
"group-name": null,
|
||||
"tcp-halfclose-timer": 0,
|
||||
"icmp_type": null,
|
||||
"iprange": "0.0.0.0",
|
||||
"category": null,
|
||||
"protocol-number": null,
|
||||
"udp-idle-timer": 0,
|
||||
"explicit-proxy": "disable",
|
||||
"group-member": null,
|
||||
"application": null,
|
||||
"tcp-portrange": null,
|
||||
"icmp_code": null,
|
||||
"session-ttl": 0,
|
||||
"adom": "ansible",
|
||||
"visibility": "enable",
|
||||
"tcp-timewait-timer": 0,
|
||||
"name": "ansible_custom_icmp6",
|
||||
"app-service-type": null,
|
||||
"fqdn": "",
|
||||
"app-category": null,
|
||||
"check-reset-range": null,
|
||||
"mode": "delete",
|
||||
"tcp-halfopen-timer": 0,
|
||||
"udp-portrange": null,
|
||||
"sctp-portrange": null
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"protocol-number": null,
|
||||
"protocol": null,
|
||||
"custom_type": "all",
|
||||
"color": 22,
|
||||
"object_type": "custom",
|
||||
"group-name": null,
|
||||
"tcp-halfclose-timer": 0,
|
||||
"icmp_type": null,
|
||||
"iprange": "0.0.0.0",
|
||||
"category": null,
|
||||
"explicit-proxy": "disable",
|
||||
"udp-idle-timer": 0,
|
||||
"group-member": null,
|
||||
"application": null,
|
||||
"tcp-portrange": null,
|
||||
"icmp_code": null,
|
||||
"session-ttl": 0,
|
||||
"adom": "ansible",
|
||||
"visibility": "enable",
|
||||
"tcp-timewait-timer": 0,
|
||||
"name": "ansible_custom_ip",
|
||||
"app-service-type": null,
|
||||
"fqdn": "",
|
||||
"app-category": null,
|
||||
"check-reset-range": null,
|
||||
"mode": "delete",
|
||||
"tcp-halfopen-timer": 0,
|
||||
"udp-portrange": null,
|
||||
"sctp-portrange": null
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "ansible_custom_ip"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/service/custom/ansible_custom_ip"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/service/custom/ansible_custom_serviceWithSource"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "ansible_custom_serviceWithSource"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"protocol": null,
|
||||
"custom_type": "all",
|
||||
"color": 22,
|
||||
"object_type": "custom",
|
||||
"group-name": null,
|
||||
"tcp-halfclose-timer": 0,
|
||||
"icmp_type": null,
|
||||
"iprange": "0.0.0.0",
|
||||
"category": null,
|
||||
"protocol-number": null,
|
||||
"udp-idle-timer": 0,
|
||||
"explicit-proxy": "disable",
|
||||
"group-member": null,
|
||||
"application": null,
|
||||
"tcp-portrange": null,
|
||||
"icmp_code": null,
|
||||
"session-ttl": 0,
|
||||
"adom": "ansible",
|
||||
"visibility": "enable",
|
||||
"tcp-timewait-timer": 0,
|
||||
"name": "ansible_custom_serviceWithSource",
|
||||
"app-service-type": null,
|
||||
"fqdn": "",
|
||||
"app-category": null,
|
||||
"check-reset-range": null,
|
||||
"mode": "delete",
|
||||
"tcp-halfopen-timer": 0,
|
||||
"udp-portrange": null,
|
||||
"sctp-portrange": null
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"protocol-number": null,
|
||||
"protocol": null,
|
||||
"custom_type": "all",
|
||||
"color": 22,
|
||||
"object_type": "custom",
|
||||
"group-name": null,
|
||||
"tcp-halfclose-timer": 0,
|
||||
"icmp_type": null,
|
||||
"iprange": "0.0.0.0",
|
||||
"category": null,
|
||||
"explicit-proxy": "disable",
|
||||
"udp-idle-timer": 0,
|
||||
"group-member": null,
|
||||
"application": null,
|
||||
"tcp-portrange": null,
|
||||
"icmp_code": null,
|
||||
"session-ttl": 0,
|
||||
"adom": "ansible",
|
||||
"visibility": "enable",
|
||||
"tcp-timewait-timer": 0,
|
||||
"name": "ansible_custom_proxy_all",
|
||||
"app-service-type": null,
|
||||
"fqdn": "",
|
||||
"app-category": null,
|
||||
"check-reset-range": null,
|
||||
"mode": "delete",
|
||||
"tcp-halfopen-timer": 0,
|
||||
"udp-portrange": null,
|
||||
"sctp-portrange": null
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "ansible_custom_proxy_all"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/service/custom/ansible_custom_proxy_all"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"protocol-number": null,
|
||||
"protocol": null,
|
||||
"custom_type": "tcp_udp_sctp",
|
||||
"color": 22,
|
||||
"object_type": "custom",
|
||||
"group-name": null,
|
||||
"tcp-halfclose-timer": 0,
|
||||
"icmp_type": null,
|
||||
"iprange": "0.0.0.0",
|
||||
"category": "ansibleCategoryTest",
|
||||
"explicit-proxy": "disable",
|
||||
"udp-idle-timer": 0,
|
||||
"group-member": null,
|
||||
"application": null,
|
||||
"tcp-portrange": "443",
|
||||
"icmp_code": null,
|
||||
"session-ttl": 0,
|
||||
"adom": "ansible",
|
||||
"visibility": "enable",
|
||||
"tcp-timewait-timer": 0,
|
||||
"name": "ansible_custom_service",
|
||||
"app-service-type": null,
|
||||
"fqdn": "",
|
||||
"app-category": null,
|
||||
"check-reset-range": null,
|
||||
"mode": "add",
|
||||
"tcp-halfopen-timer": 0,
|
||||
"udp-portrange": "51",
|
||||
"sctp-portrange": "100"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"category": "ansibleCategoryTest",
|
||||
"protocol": "TCP/UDP/SCTP",
|
||||
"name": "ansible_custom_service",
|
||||
"color": 22,
|
||||
"visibility": "enable",
|
||||
"proxy": "disable",
|
||||
"sctp-portrange": [
|
||||
"100"
|
||||
],
|
||||
"udp-portrange": [
|
||||
"51"
|
||||
],
|
||||
"tcp-portrange": [
|
||||
"443"
|
||||
]
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/service/custom"
|
||||
},
|
||||
"post_method": "add"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/service/custom"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"protocol": "TCP/UDP/SCTP",
|
||||
"name": "ansible_custom_serviceWithSource",
|
||||
"color": 22,
|
||||
"visibility": "enable",
|
||||
"proxy": "disable",
|
||||
"tcp-portrange": [
|
||||
"443:1000-2000",
|
||||
"80-82:10000-20000"
|
||||
],
|
||||
"udp-portrange": [
|
||||
"51:100-200",
|
||||
"162:200-400"
|
||||
],
|
||||
"sctp-portrange": [
|
||||
"100:2000-2500"
|
||||
]
|
||||
},
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"protocol": null,
|
||||
"custom_type": "tcp_udp_sctp",
|
||||
"color": 22,
|
||||
"object_type": "custom",
|
||||
"group-name": null,
|
||||
"tcp-halfclose-timer": 0,
|
||||
"icmp_type": null,
|
||||
"iprange": "0.0.0.0",
|
||||
"category": null,
|
||||
"protocol-number": null,
|
||||
"udp-idle-timer": 0,
|
||||
"explicit-proxy": "disable",
|
||||
"group-member": null,
|
||||
"application": null,
|
||||
"tcp-portrange": "443:1000-2000,80-82:10000-20000",
|
||||
"icmp_code": null,
|
||||
"session-ttl": 0,
|
||||
"adom": "ansible",
|
||||
"visibility": "enable",
|
||||
"tcp-timewait-timer": 0,
|
||||
"name": "ansible_custom_serviceWithSource",
|
||||
"app-service-type": null,
|
||||
"fqdn": "",
|
||||
"app-category": null,
|
||||
"check-reset-range": null,
|
||||
"mode": "add",
|
||||
"tcp-halfopen-timer": 0,
|
||||
"udp-portrange": "51:100-200,162:200-400",
|
||||
"sctp-portrange": "100:2000-2500"
|
||||
},
|
||||
"post_method": "add"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"protocol-number": null,
|
||||
"protocol": null,
|
||||
"custom_type": "icmp",
|
||||
"color": 22,
|
||||
"object_type": "custom",
|
||||
"group-name": null,
|
||||
"tcp-halfclose-timer": 0,
|
||||
"icmp_type": 8,
|
||||
"iprange": "0.0.0.0",
|
||||
"category": null,
|
||||
"explicit-proxy": "disable",
|
||||
"udp-idle-timer": 0,
|
||||
"group-member": null,
|
||||
"application": null,
|
||||
"tcp-portrange": null,
|
||||
"icmp_code": 3,
|
||||
"session-ttl": 0,
|
||||
"adom": "ansible",
|
||||
"visibility": "enable",
|
||||
"tcp-timewait-timer": 0,
|
||||
"name": "ansible_custom_icmp",
|
||||
"app-service-type": null,
|
||||
"fqdn": "",
|
||||
"app-category": null,
|
||||
"check-reset-range": null,
|
||||
"mode": "add",
|
||||
"tcp-halfopen-timer": 0,
|
||||
"udp-portrange": null,
|
||||
"sctp-portrange": null
|
||||
},
|
||||
"datagram_sent": {
|
||||
"protocol": "ICMP",
|
||||
"name": "ansible_custom_icmp",
|
||||
"color": 22,
|
||||
"visibility": "enable",
|
||||
"icmptype": 8,
|
||||
"proxy": "disable",
|
||||
"icmpcode": 3
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/service/custom"
|
||||
},
|
||||
"post_method": "add"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/service/custom"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"protocol": "ICMP6",
|
||||
"name": "ansible_custom_icmp6",
|
||||
"color": 22,
|
||||
"visibility": "enable",
|
||||
"icmptype": 5,
|
||||
"proxy": "disable",
|
||||
"icmpcode": 1
|
||||
},
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"protocol": null,
|
||||
"custom_type": "icmp6",
|
||||
"color": 22,
|
||||
"object_type": "custom",
|
||||
"group-name": null,
|
||||
"tcp-halfclose-timer": 0,
|
||||
"icmp_type": 5,
|
||||
"iprange": "0.0.0.0",
|
||||
"category": null,
|
||||
"protocol-number": null,
|
||||
"udp-idle-timer": 0,
|
||||
"explicit-proxy": "disable",
|
||||
"group-member": null,
|
||||
"application": null,
|
||||
"tcp-portrange": null,
|
||||
"icmp_code": 1,
|
||||
"session-ttl": 0,
|
||||
"adom": "ansible",
|
||||
"visibility": "enable",
|
||||
"tcp-timewait-timer": 0,
|
||||
"name": "ansible_custom_icmp6",
|
||||
"app-service-type": null,
|
||||
"fqdn": "",
|
||||
"app-category": null,
|
||||
"check-reset-range": null,
|
||||
"mode": "add",
|
||||
"tcp-halfopen-timer": 0,
|
||||
"udp-portrange": null,
|
||||
"sctp-portrange": null
|
||||
},
|
||||
"post_method": "add"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"protocol-number": 12,
|
||||
"protocol": null,
|
||||
"custom_type": "ip",
|
||||
"color": 22,
|
||||
"object_type": "custom",
|
||||
"group-name": null,
|
||||
"tcp-halfclose-timer": 0,
|
||||
"icmp_type": null,
|
||||
"iprange": "0.0.0.0",
|
||||
"category": null,
|
||||
"explicit-proxy": "disable",
|
||||
"udp-idle-timer": 0,
|
||||
"group-member": null,
|
||||
"application": null,
|
||||
"tcp-portrange": null,
|
||||
"icmp_code": null,
|
||||
"session-ttl": 0,
|
||||
"adom": "ansible",
|
||||
"visibility": "enable",
|
||||
"tcp-timewait-timer": 0,
|
||||
"name": "ansible_custom_ip",
|
||||
"app-service-type": null,
|
||||
"fqdn": "",
|
||||
"app-category": null,
|
||||
"check-reset-range": null,
|
||||
"mode": "add",
|
||||
"tcp-halfopen-timer": 0,
|
||||
"udp-portrange": null,
|
||||
"sctp-portrange": null
|
||||
},
|
||||
"datagram_sent": {
|
||||
"protocol-number": 12,
|
||||
"protocol": "IP",
|
||||
"name": "ansible_custom_ip",
|
||||
"color": 22,
|
||||
"visibility": "enable",
|
||||
"proxy": "disable"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/service/custom"
|
||||
},
|
||||
"post_method": "add"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/service/custom"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"protocol": "ALL",
|
||||
"name": "ansible_custom_proxy_all",
|
||||
"color": 22,
|
||||
"visibility": "enable",
|
||||
"proxy": "enable",
|
||||
"iprange": "www.ansible.com",
|
||||
"tcp-portrange": [
|
||||
"443:1000-2000",
|
||||
"80-82:10000-20000"
|
||||
]
|
||||
},
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"protocol": null,
|
||||
"custom_type": "all",
|
||||
"color": 22,
|
||||
"object_type": "custom",
|
||||
"group-name": null,
|
||||
"tcp-halfclose-timer": 0,
|
||||
"icmp_type": null,
|
||||
"iprange": "www.ansible.com",
|
||||
"category": null,
|
||||
"protocol-number": null,
|
||||
"udp-idle-timer": 0,
|
||||
"explicit-proxy": "enable",
|
||||
"group-member": null,
|
||||
"application": null,
|
||||
"tcp-portrange": "443:1000-2000,80-82:10000-20000",
|
||||
"icmp_code": null,
|
||||
"session-ttl": 0,
|
||||
"adom": "ansible",
|
||||
"visibility": "enable",
|
||||
"tcp-timewait-timer": 0,
|
||||
"name": "ansible_custom_proxy_all",
|
||||
"app-service-type": null,
|
||||
"fqdn": "",
|
||||
"app-category": null,
|
||||
"check-reset-range": null,
|
||||
"mode": "add",
|
||||
"tcp-halfopen-timer": 0,
|
||||
"udp-portrange": null,
|
||||
"sctp-portrange": null
|
||||
},
|
||||
"post_method": "add"
|
||||
}
|
||||
],
|
||||
"fmgr_fwobj_service_group": [
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "Object does not exist",
|
||||
"code": -3
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/service/group/ansibleTestGroup"
|
||||
},
|
||||
"datagram_sent": {},
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"protocol": null,
|
||||
"custom_type": "all",
|
||||
"color": 22,
|
||||
"object_type": "group",
|
||||
"group-name": "ansibleTestGroup",
|
||||
"tcp-halfclose-timer": 0,
|
||||
"icmp_type": null,
|
||||
"iprange": "0.0.0.0",
|
||||
"category": null,
|
||||
"protocol-number": null,
|
||||
"udp-idle-timer": 0,
|
||||
"explicit-proxy": "disable",
|
||||
"group-member": null,
|
||||
"application": null,
|
||||
"tcp-portrange": null,
|
||||
"icmp_code": null,
|
||||
"session-ttl": 0,
|
||||
"adom": "ansible",
|
||||
"visibility": "enable",
|
||||
"tcp-timewait-timer": 0,
|
||||
"name": null,
|
||||
"app-service-type": null,
|
||||
"fqdn": "",
|
||||
"app-category": null,
|
||||
"check-reset-range": null,
|
||||
"mode": "delete",
|
||||
"tcp-halfopen-timer": 0,
|
||||
"udp-portrange": null,
|
||||
"sctp-portrange": null
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"comment": "created by ansible",
|
||||
"protocol-number": null,
|
||||
"protocol": null,
|
||||
"custom_type": "all",
|
||||
"color": 10,
|
||||
"object_type": "group",
|
||||
"group-name": "ansibleTestGroup",
|
||||
"tcp-halfclose-timer": 0,
|
||||
"icmp_type": null,
|
||||
"iprange": "0.0.0.0",
|
||||
"category": null,
|
||||
"explicit-proxy": "disable",
|
||||
"udp-idle-timer": 0,
|
||||
"group-member": "ansible_custom_ip, ansible_custom_icmp, ansible_custom_service",
|
||||
"application": null,
|
||||
"tcp-portrange": null,
|
||||
"icmp_code": null,
|
||||
"session-ttl": 0,
|
||||
"adom": "ansible",
|
||||
"visibility": "enable",
|
||||
"tcp-timewait-timer": 0,
|
||||
"name": null,
|
||||
"app-service-type": null,
|
||||
"fqdn": "",
|
||||
"app-category": null,
|
||||
"check-reset-range": null,
|
||||
"mode": "add",
|
||||
"tcp-halfopen-timer": 0,
|
||||
"udp-portrange": null,
|
||||
"sctp-portrange": null
|
||||
},
|
||||
"datagram_sent": {
|
||||
"comment": "created by ansible",
|
||||
"color": 10,
|
||||
"member": [
|
||||
"ansible_custom_ip",
|
||||
"ansible_custom_icmp",
|
||||
"ansible_custom_service"
|
||||
],
|
||||
"name": "ansibleTestGroup",
|
||||
"proxy": "disable"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "datasrc invalid. object: firewall service group member ansibleTestGroup. detail: ansible_custom_ip. solution: data not exist",
|
||||
"code": -10131
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/service/group"
|
||||
},
|
||||
"post_method": "add"
|
||||
}
|
||||
],
|
||||
"fmgr_fwobj_service_category": [
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "Object already exists",
|
||||
"code": -2
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/firewall/service/category"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"comment": "Created by Ansible",
|
||||
"name": "ansibleCategoryTest"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"protocol": null,
|
||||
"custom_type": "tcp_udp_sctp",
|
||||
"color": 22,
|
||||
"object_type": "custom",
|
||||
"group-name": null,
|
||||
"tcp-halfclose-timer": 0,
|
||||
"icmp_type": null,
|
||||
"iprange": "0.0.0.0",
|
||||
"category": "ansibleCategoryTest",
|
||||
"protocol-number": null,
|
||||
"udp-idle-timer": 0,
|
||||
"explicit-proxy": "disable",
|
||||
"group-member": null,
|
||||
"application": null,
|
||||
"tcp-portrange": "443",
|
||||
"icmp_code": null,
|
||||
"session-ttl": 0,
|
||||
"adom": "ansible",
|
||||
"visibility": "enable",
|
||||
"tcp-timewait-timer": 0,
|
||||
"name": "ansible_custom_service",
|
||||
"app-service-type": null,
|
||||
"fqdn": "",
|
||||
"app-category": null,
|
||||
"check-reset-range": null,
|
||||
"mode": "add",
|
||||
"tcp-halfopen-timer": 0,
|
||||
"udp-portrange": "51",
|
||||
"sctp-portrange": "100"
|
||||
},
|
||||
"post_method": "add"
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,620 @@
|
|||
{
|
||||
"fmgr_firewall_policy_modify": [
|
||||
{
|
||||
"url": "/pm/config/adom/ansible/pkg/default/firewall/policy",
|
||||
"paramgram_used": {
|
||||
"wanopt-passive-opt": null,
|
||||
"package_name": "default",
|
||||
"wanopt-detection": null,
|
||||
"scan-botnet-connections": null,
|
||||
"profile-group": null,
|
||||
"wanopt-peer": null,
|
||||
"dscp-match": null,
|
||||
"replacemsg-override-group": null,
|
||||
"internet-service-negate": null,
|
||||
"np-acceleration": null,
|
||||
"learning-mode": null,
|
||||
"session-ttl": null,
|
||||
"ntlm-guest": null,
|
||||
"ips-sensor": null,
|
||||
"diffservcode-rev": null,
|
||||
"match-vip": null,
|
||||
"natip": null,
|
||||
"dlp-sensor": null,
|
||||
"traffic-shaper": null,
|
||||
"groups": null,
|
||||
"schedule-timeout": null,
|
||||
"name": "Basic_IPv4_Policy",
|
||||
"tcp-session-without-syn": null,
|
||||
"ntlm": null,
|
||||
"permit-stun-host": null,
|
||||
"diffservcode-forward": null,
|
||||
"internet-service-src-custom": null,
|
||||
"mode": "set",
|
||||
"disclaimer": null,
|
||||
"rtp-nat": null,
|
||||
"auth-cert": null,
|
||||
"timeout-send-rst": null,
|
||||
"auth-redirect-addr": null,
|
||||
"ssl-mirror-intf": null,
|
||||
"identity-based-route": null,
|
||||
"natoutbound": null,
|
||||
"wanopt-profile": null,
|
||||
"per-ip-shaper": null,
|
||||
"profile-protocol-options": null,
|
||||
"diffserv-forward": null,
|
||||
"poolname": null,
|
||||
"comments": "Created by Ansible",
|
||||
"label": null,
|
||||
"global-label": null,
|
||||
"firewall-session-dirty": null,
|
||||
"wanopt": null,
|
||||
"schedule": "always",
|
||||
"internet-service-id": null,
|
||||
"auth-path": null,
|
||||
"vlan-cos-fwd": null,
|
||||
"custom-log-fields": null,
|
||||
"dstintf": "any",
|
||||
"srcintf": "any",
|
||||
"block-notification": null,
|
||||
"internet-service-src-id": null,
|
||||
"redirect-url": null,
|
||||
"waf-profile": null,
|
||||
"ntlm-enabled-browsers": null,
|
||||
"dscp-negate": null,
|
||||
"action": "accept",
|
||||
"fsso-agent-for-ntlm": null,
|
||||
"logtraffic": "utm",
|
||||
"vlan-filter": null,
|
||||
"policyid": null,
|
||||
"logtraffic-start": null,
|
||||
"webcache-https": null,
|
||||
"webfilter-profile": null,
|
||||
"internet-service-src": null,
|
||||
"webcache": null,
|
||||
"utm-status": null,
|
||||
"vpn_src_node": {
|
||||
"subnet": null,
|
||||
"host": null,
|
||||
"seq": null
|
||||
},
|
||||
"ippool": null,
|
||||
"service": "ALL",
|
||||
"wccp": null,
|
||||
"auto-asic-offload": null,
|
||||
"dscp-value": null,
|
||||
"url-category": null,
|
||||
"capture-packet": null,
|
||||
"adom": "ansible",
|
||||
"inbound": null,
|
||||
"internet-service": null,
|
||||
"profile-type": null,
|
||||
"ssl-mirror": null,
|
||||
"srcaddr-negate": null,
|
||||
"gtp-profile": null,
|
||||
"mms-profile": null,
|
||||
"send-deny-packet": null,
|
||||
"devices": null,
|
||||
"permit-any-host": null,
|
||||
"av-profile": null,
|
||||
"internet-service-src-negate": null,
|
||||
"service-negate": null,
|
||||
"rsso": null,
|
||||
"app-group": null,
|
||||
"tcp-mss-sender": null,
|
||||
"natinbound": null,
|
||||
"fixedport": null,
|
||||
"ssl-ssh-profile": null,
|
||||
"outbound": null,
|
||||
"spamfilter-profile": null,
|
||||
"application-list": null,
|
||||
"application": null,
|
||||
"dnsfilter-profile": null,
|
||||
"nat": null,
|
||||
"fsso": null,
|
||||
"vlan-cos-rev": null,
|
||||
"status": null,
|
||||
"dsri": null,
|
||||
"users": null,
|
||||
"voip-profile": null,
|
||||
"dstaddr-negate": null,
|
||||
"traffic-shaper-reverse": null,
|
||||
"internet-service-custom": null,
|
||||
"diffserv-reverse": null,
|
||||
"srcaddr": "all",
|
||||
"ssh-filter-profile": null,
|
||||
"delay-tcp-npu-session": null,
|
||||
"icap-profile": null,
|
||||
"captive-portal-exempt": null,
|
||||
"vpn_dst_node": {
|
||||
"subnet": null,
|
||||
"host": null,
|
||||
"seq": null
|
||||
},
|
||||
"app-category": null,
|
||||
"rtp-addr": null,
|
||||
"wsso": null,
|
||||
"tcp-mss-receiver": null,
|
||||
"dstaddr": "all",
|
||||
"radius-mac-auth-bypass": null,
|
||||
"vpntunnel": null
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "Basic_IPv4_Policy",
|
||||
"service": "ALL",
|
||||
"schedule": "always",
|
||||
"comments": "Created by Ansible",
|
||||
"srcaddr": "all",
|
||||
"dstintf": "any",
|
||||
"srcintf": "any",
|
||||
"action": "accept",
|
||||
"dstaddr": "all",
|
||||
"logtraffic": "utm"
|
||||
},
|
||||
"raw_response": {
|
||||
"policyid": 36
|
||||
},
|
||||
"post_method": "set"
|
||||
},
|
||||
{
|
||||
"url": "/pm/config/adom/ansible/pkg/default/firewall/policy",
|
||||
"raw_response": {
|
||||
"policyid": 37
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "Basic_IPv4_Policy_2",
|
||||
"service": [
|
||||
"HTTP",
|
||||
"HTTPS"
|
||||
],
|
||||
"schedule": "always",
|
||||
"comments": "Created by Ansible",
|
||||
"srcaddr": "all",
|
||||
"dstintf": "any",
|
||||
"srcintf": "any",
|
||||
"nat": "enable",
|
||||
"action": "accept",
|
||||
"dstaddr": "google-play",
|
||||
"logtraffic": "utm"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"package_name": "default",
|
||||
"wanopt-detection": null,
|
||||
"scan-botnet-connections": null,
|
||||
"profile-group": null,
|
||||
"dlp-sensor": null,
|
||||
"dscp-match": null,
|
||||
"replacemsg-override-group": null,
|
||||
"internet-service-negate": null,
|
||||
"np-acceleration": null,
|
||||
"learning-mode": null,
|
||||
"session-ttl": null,
|
||||
"ntlm-guest": null,
|
||||
"ips-sensor": null,
|
||||
"diffservcode-rev": null,
|
||||
"match-vip": null,
|
||||
"natip": null,
|
||||
"wanopt-peer": null,
|
||||
"traffic-shaper": null,
|
||||
"groups": null,
|
||||
"schedule-timeout": null,
|
||||
"name": "Basic_IPv4_Policy_2",
|
||||
"tcp-session-without-syn": null,
|
||||
"rtp-nat": null,
|
||||
"permit-stun-host": null,
|
||||
"natoutbound": null,
|
||||
"internet-service-src-custom": null,
|
||||
"mode": "set",
|
||||
"logtraffic": "utm",
|
||||
"ntlm": null,
|
||||
"auth-cert": null,
|
||||
"timeout-send-rst": null,
|
||||
"auth-redirect-addr": null,
|
||||
"ssl-mirror-intf": null,
|
||||
"identity-based-route": null,
|
||||
"diffservcode-forward": null,
|
||||
"wanopt-profile": null,
|
||||
"per-ip-shaper": null,
|
||||
"users": null,
|
||||
"diffserv-forward": null,
|
||||
"poolname": null,
|
||||
"comments": "Created by Ansible",
|
||||
"label": null,
|
||||
"global-label": null,
|
||||
"firewall-session-dirty": null,
|
||||
"wanopt": null,
|
||||
"schedule": "always",
|
||||
"internet-service-id": null,
|
||||
"auth-path": null,
|
||||
"vlan-cos-fwd": null,
|
||||
"custom-log-fields": null,
|
||||
"dstintf": "any",
|
||||
"srcintf": "any",
|
||||
"block-notification": null,
|
||||
"internet-service-src-id": null,
|
||||
"redirect-url": null,
|
||||
"waf-profile": null,
|
||||
"ntlm-enabled-browsers": null,
|
||||
"dscp-negate": null,
|
||||
"action": "accept",
|
||||
"fsso-agent-for-ntlm": null,
|
||||
"disclaimer": null,
|
||||
"vlan-filter": null,
|
||||
"dstaddr-negate": null,
|
||||
"logtraffic-start": null,
|
||||
"webcache-https": null,
|
||||
"webfilter-profile": null,
|
||||
"internet-service-src": null,
|
||||
"webcache": null,
|
||||
"utm-status": null,
|
||||
"vpn_src_node": {
|
||||
"subnet": null,
|
||||
"host": null,
|
||||
"seq": null
|
||||
},
|
||||
"ippool": null,
|
||||
"service": "HTTP, HTTPS",
|
||||
"wccp": null,
|
||||
"auto-asic-offload": null,
|
||||
"dscp-value": null,
|
||||
"url-category": null,
|
||||
"capture-packet": null,
|
||||
"adom": "ansible",
|
||||
"inbound": null,
|
||||
"internet-service": null,
|
||||
"profile-type": null,
|
||||
"ssl-mirror": null,
|
||||
"srcaddr-negate": null,
|
||||
"gtp-profile": null,
|
||||
"mms-profile": null,
|
||||
"send-deny-packet": null,
|
||||
"devices": null,
|
||||
"permit-any-host": null,
|
||||
"av-profile": null,
|
||||
"internet-service-src-negate": null,
|
||||
"service-negate": null,
|
||||
"rsso": null,
|
||||
"application-list": null,
|
||||
"app-group": null,
|
||||
"tcp-mss-sender": null,
|
||||
"natinbound": null,
|
||||
"fixedport": null,
|
||||
"ssl-ssh-profile": null,
|
||||
"outbound": null,
|
||||
"spamfilter-profile": null,
|
||||
"wanopt-passive-opt": null,
|
||||
"application": null,
|
||||
"dnsfilter-profile": null,
|
||||
"nat": "enable",
|
||||
"fsso": null,
|
||||
"vlan-cos-rev": null,
|
||||
"status": null,
|
||||
"dsri": null,
|
||||
"profile-protocol-options": null,
|
||||
"voip-profile": null,
|
||||
"policyid": null,
|
||||
"traffic-shaper-reverse": null,
|
||||
"internet-service-custom": null,
|
||||
"diffserv-reverse": null,
|
||||
"srcaddr": "all",
|
||||
"dstaddr": "google-play",
|
||||
"delay-tcp-npu-session": null,
|
||||
"icap-profile": null,
|
||||
"captive-portal-exempt": null,
|
||||
"vpn_dst_node": {
|
||||
"subnet": null,
|
||||
"host": null,
|
||||
"seq": null
|
||||
},
|
||||
"app-category": null,
|
||||
"rtp-addr": null,
|
||||
"wsso": null,
|
||||
"tcp-mss-receiver": null,
|
||||
"ssh-filter-profile": null,
|
||||
"radius-mac-auth-bypass": null,
|
||||
"vpntunnel": null
|
||||
},
|
||||
"post_method": "set"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"wanopt-passive-opt": null,
|
||||
"package_name": "default",
|
||||
"wanopt-detection": null,
|
||||
"scan-botnet-connections": null,
|
||||
"profile-group": null,
|
||||
"wanopt-peer": null,
|
||||
"dscp-match": null,
|
||||
"replacemsg-override-group": null,
|
||||
"internet-service-negate": null,
|
||||
"np-acceleration": null,
|
||||
"learning-mode": null,
|
||||
"session-ttl": null,
|
||||
"ntlm-guest": null,
|
||||
"ips-sensor": null,
|
||||
"diffservcode-rev": null,
|
||||
"match-vip": null,
|
||||
"natip": null,
|
||||
"dlp-sensor": null,
|
||||
"traffic-shaper": null,
|
||||
"groups": null,
|
||||
"schedule-timeout": null,
|
||||
"name": "Basic_IPv4_Policy",
|
||||
"tcp-session-without-syn": null,
|
||||
"ntlm": null,
|
||||
"permit-stun-host": null,
|
||||
"diffservcode-forward": null,
|
||||
"internet-service-src-custom": null,
|
||||
"mode": "delete",
|
||||
"disclaimer": null,
|
||||
"rtp-nat": null,
|
||||
"auth-cert": null,
|
||||
"timeout-send-rst": null,
|
||||
"auth-redirect-addr": null,
|
||||
"ssl-mirror-intf": null,
|
||||
"identity-based-route": null,
|
||||
"natoutbound": null,
|
||||
"wanopt-profile": null,
|
||||
"per-ip-shaper": null,
|
||||
"profile-protocol-options": null,
|
||||
"diffserv-forward": null,
|
||||
"poolname": null,
|
||||
"comments": null,
|
||||
"label": null,
|
||||
"global-label": null,
|
||||
"firewall-session-dirty": null,
|
||||
"wanopt": null,
|
||||
"schedule": null,
|
||||
"internet-service-id": null,
|
||||
"auth-path": null,
|
||||
"vlan-cos-fwd": null,
|
||||
"custom-log-fields": null,
|
||||
"dstintf": null,
|
||||
"srcintf": null,
|
||||
"block-notification": null,
|
||||
"internet-service-src-id": null,
|
||||
"redirect-url": null,
|
||||
"waf-profile": null,
|
||||
"ntlm-enabled-browsers": null,
|
||||
"dscp-negate": null,
|
||||
"action": null,
|
||||
"fsso-agent-for-ntlm": null,
|
||||
"logtraffic": null,
|
||||
"vlan-filter": null,
|
||||
"policyid": 36,
|
||||
"logtraffic-start": null,
|
||||
"webcache-https": null,
|
||||
"webfilter-profile": null,
|
||||
"internet-service-src": null,
|
||||
"webcache": null,
|
||||
"utm-status": null,
|
||||
"vpn_src_node": {
|
||||
"subnet": null,
|
||||
"host": null,
|
||||
"seq": null
|
||||
},
|
||||
"ippool": null,
|
||||
"service": null,
|
||||
"wccp": null,
|
||||
"auto-asic-offload": null,
|
||||
"dscp-value": null,
|
||||
"url-category": null,
|
||||
"capture-packet": null,
|
||||
"adom": "ansible",
|
||||
"inbound": null,
|
||||
"internet-service": null,
|
||||
"profile-type": null,
|
||||
"ssl-mirror": null,
|
||||
"srcaddr-negate": null,
|
||||
"gtp-profile": null,
|
||||
"mms-profile": null,
|
||||
"send-deny-packet": null,
|
||||
"devices": null,
|
||||
"permit-any-host": null,
|
||||
"av-profile": null,
|
||||
"internet-service-src-negate": null,
|
||||
"service-negate": null,
|
||||
"rsso": null,
|
||||
"app-group": null,
|
||||
"tcp-mss-sender": null,
|
||||
"natinbound": null,
|
||||
"fixedport": null,
|
||||
"ssl-ssh-profile": null,
|
||||
"outbound": null,
|
||||
"spamfilter-profile": null,
|
||||
"application-list": null,
|
||||
"application": null,
|
||||
"dnsfilter-profile": null,
|
||||
"nat": null,
|
||||
"fsso": null,
|
||||
"vlan-cos-rev": null,
|
||||
"status": null,
|
||||
"dsri": null,
|
||||
"users": null,
|
||||
"voip-profile": null,
|
||||
"dstaddr-negate": null,
|
||||
"traffic-shaper-reverse": null,
|
||||
"internet-service-custom": null,
|
||||
"diffserv-reverse": null,
|
||||
"srcaddr": null,
|
||||
"ssh-filter-profile": null,
|
||||
"delay-tcp-npu-session": null,
|
||||
"icap-profile": null,
|
||||
"captive-portal-exempt": null,
|
||||
"vpn_dst_node": {
|
||||
"subnet": null,
|
||||
"host": null,
|
||||
"seq": null
|
||||
},
|
||||
"app-category": null,
|
||||
"rtp-addr": null,
|
||||
"wsso": null,
|
||||
"tcp-mss-receiver": null,
|
||||
"dstaddr": null,
|
||||
"radius-mac-auth-bypass": null,
|
||||
"vpntunnel": null
|
||||
},
|
||||
"datagram_sent": {
|
||||
"policyid": 36
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/pkg/default/firewall/policy/36"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/pkg/default/firewall/policy/37"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"policyid": 37
|
||||
},
|
||||
"paramgram_used": {
|
||||
"package_name": "default",
|
||||
"wanopt-detection": null,
|
||||
"scan-botnet-connections": null,
|
||||
"profile-group": null,
|
||||
"dlp-sensor": null,
|
||||
"dscp-match": null,
|
||||
"replacemsg-override-group": null,
|
||||
"internet-service-negate": null,
|
||||
"np-acceleration": null,
|
||||
"learning-mode": null,
|
||||
"session-ttl": null,
|
||||
"ntlm-guest": null,
|
||||
"ips-sensor": null,
|
||||
"diffservcode-rev": null,
|
||||
"match-vip": null,
|
||||
"natip": null,
|
||||
"wanopt-peer": null,
|
||||
"traffic-shaper": null,
|
||||
"groups": null,
|
||||
"schedule-timeout": null,
|
||||
"name": "Basic_IPv4_Policy_2",
|
||||
"tcp-session-without-syn": null,
|
||||
"rtp-nat": null,
|
||||
"permit-stun-host": null,
|
||||
"natoutbound": null,
|
||||
"internet-service-src-custom": null,
|
||||
"mode": "delete",
|
||||
"logtraffic": null,
|
||||
"ntlm": null,
|
||||
"auth-cert": null,
|
||||
"timeout-send-rst": null,
|
||||
"auth-redirect-addr": null,
|
||||
"ssl-mirror-intf": null,
|
||||
"identity-based-route": null,
|
||||
"diffservcode-forward": null,
|
||||
"wanopt-profile": null,
|
||||
"per-ip-shaper": null,
|
||||
"users": null,
|
||||
"diffserv-forward": null,
|
||||
"poolname": null,
|
||||
"comments": null,
|
||||
"label": null,
|
||||
"global-label": null,
|
||||
"firewall-session-dirty": null,
|
||||
"wanopt": null,
|
||||
"schedule": null,
|
||||
"internet-service-id": null,
|
||||
"auth-path": null,
|
||||
"vlan-cos-fwd": null,
|
||||
"custom-log-fields": null,
|
||||
"dstintf": null,
|
||||
"srcintf": null,
|
||||
"block-notification": null,
|
||||
"internet-service-src-id": null,
|
||||
"redirect-url": null,
|
||||
"waf-profile": null,
|
||||
"ntlm-enabled-browsers": null,
|
||||
"dscp-negate": null,
|
||||
"action": null,
|
||||
"fsso-agent-for-ntlm": null,
|
||||
"disclaimer": null,
|
||||
"vlan-filter": null,
|
||||
"dstaddr-negate": null,
|
||||
"logtraffic-start": null,
|
||||
"webcache-https": null,
|
||||
"webfilter-profile": null,
|
||||
"internet-service-src": null,
|
||||
"webcache": null,
|
||||
"utm-status": null,
|
||||
"vpn_src_node": {
|
||||
"subnet": null,
|
||||
"host": null,
|
||||
"seq": null
|
||||
},
|
||||
"ippool": null,
|
||||
"service": null,
|
||||
"wccp": null,
|
||||
"auto-asic-offload": null,
|
||||
"dscp-value": null,
|
||||
"url-category": null,
|
||||
"capture-packet": null,
|
||||
"adom": "ansible",
|
||||
"internet-service": null,
|
||||
"inbound": null,
|
||||
"profile-type": null,
|
||||
"ssl-mirror": null,
|
||||
"srcaddr-negate": null,
|
||||
"gtp-profile": null,
|
||||
"mms-profile": null,
|
||||
"send-deny-packet": null,
|
||||
"devices": null,
|
||||
"permit-any-host": null,
|
||||
"av-profile": null,
|
||||
"internet-service-src-negate": null,
|
||||
"service-negate": null,
|
||||
"rsso": null,
|
||||
"application-list": null,
|
||||
"app-group": null,
|
||||
"tcp-mss-sender": null,
|
||||
"natinbound": null,
|
||||
"fixedport": null,
|
||||
"ssl-ssh-profile": null,
|
||||
"outbound": null,
|
||||
"spamfilter-profile": null,
|
||||
"wanopt-passive-opt": null,
|
||||
"application": null,
|
||||
"dnsfilter-profile": null,
|
||||
"nat": null,
|
||||
"fsso": null,
|
||||
"vlan-cos-rev": null,
|
||||
"status": null,
|
||||
"dsri": null,
|
||||
"profile-protocol-options": null,
|
||||
"voip-profile": null,
|
||||
"policyid": 37,
|
||||
"traffic-shaper-reverse": null,
|
||||
"internet-service-custom": null,
|
||||
"diffserv-reverse": null,
|
||||
"srcaddr": null,
|
||||
"dstaddr": null,
|
||||
"delay-tcp-npu-session": null,
|
||||
"icap-profile": null,
|
||||
"captive-portal-exempt": null,
|
||||
"vpn_dst_node": {
|
||||
"subnet": null,
|
||||
"host": null,
|
||||
"seq": null
|
||||
},
|
||||
"app-category": null,
|
||||
"rtp-addr": null,
|
||||
"wsso": null,
|
||||
"tcp-mss-receiver": null,
|
||||
"ssh-filter-profile": null,
|
||||
"radius-mac-auth-bypass": null,
|
||||
"vpntunnel": null
|
||||
},
|
||||
"post_method": "delete"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,279 @@
|
|||
{
|
||||
"fmgr_fwpol_package_folder": [
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/pkg/adom/ansible"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"type": "folder",
|
||||
"name": "ansibleTestFolder1"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"ssl-ssh-profile": null,
|
||||
"name": "ansibleTestFolder1",
|
||||
"adom": "ansible",
|
||||
"fwpolicy6-implicit-log": "disable",
|
||||
"object_type": "folder",
|
||||
"fwpolicy-implicit-log": "disable",
|
||||
"package-folder": null,
|
||||
"inspection-mode": "flow",
|
||||
"scope_members": null,
|
||||
"mode": "set",
|
||||
"parent_folder": null,
|
||||
"scope_members_vdom": "root",
|
||||
"central-nat": "disable",
|
||||
"ngfw-mode": "profile-based"
|
||||
},
|
||||
"post_method": "set"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/pkg/adom/ansible"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"subobj": [
|
||||
{
|
||||
"type": "folder",
|
||||
"name": "ansibleTestFolder2"
|
||||
}
|
||||
],
|
||||
"type": "folder",
|
||||
"name": "ansibleTestFolder1"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"ssl-ssh-profile": null,
|
||||
"name": "ansibleTestFolder2",
|
||||
"adom": "ansible",
|
||||
"fwpolicy6-implicit-log": "disable",
|
||||
"object_type": "folder",
|
||||
"fwpolicy-implicit-log": "disable",
|
||||
"package-folder": null,
|
||||
"inspection-mode": "flow",
|
||||
"scope_members": null,
|
||||
"mode": "set",
|
||||
"parent_folder": "ansibleTestFolder1",
|
||||
"scope_members_vdom": "root",
|
||||
"central-nat": "disable",
|
||||
"ngfw-mode": "profile-based"
|
||||
},
|
||||
"post_method": "set"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"ssl-ssh-profile": null,
|
||||
"scope_members_vdom": "root",
|
||||
"name": "ansibleTestFolder2",
|
||||
"adom": "ansible",
|
||||
"fwpolicy6-implicit-log": "disable",
|
||||
"object_type": "folder",
|
||||
"fwpolicy-implicit-log": "disable",
|
||||
"central-nat": "disable",
|
||||
"inspection-mode": "flow",
|
||||
"scope_members": null,
|
||||
"mode": "delete",
|
||||
"parent_folder": "ansibleTestFolder1",
|
||||
"package-folder": null,
|
||||
"ngfw-mode": "profile-based"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "ansibleTestFolder2"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/pkg/adom/ansible/ansibleTestFolder1/ansibleTestFolder2"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/pkg/adom/ansible/ansibleTestFolder1"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "ansibleTestFolder1"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"adom": "ansible",
|
||||
"fwpolicy6-implicit-log": "disable",
|
||||
"object_type": "folder",
|
||||
"inspection-mode": "flow",
|
||||
"parent_folder": null,
|
||||
"ngfw-mode": "profile-based",
|
||||
"ssl-ssh-profile": null,
|
||||
"name": "ansibleTestFolder1",
|
||||
"central-nat": "disable",
|
||||
"fwpolicy-implicit-log": "disable",
|
||||
"package-folder": null,
|
||||
"scope_members": null,
|
||||
"mode": "delete",
|
||||
"scope_members_vdom": "root"
|
||||
},
|
||||
"post_method": "delete"
|
||||
}
|
||||
],
|
||||
"fmgr_fwpol_package": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"ssl-ssh-profile": null,
|
||||
"name": "ansibleTestPackage1",
|
||||
"adom": "ansible",
|
||||
"fwpolicy6-implicit-log": "disable",
|
||||
"object_type": "pkg",
|
||||
"fwpolicy-implicit-log": "disable",
|
||||
"package-folder": null,
|
||||
"inspection-mode": "flow",
|
||||
"scope_members": "FGT2, FGT3",
|
||||
"mode": "set",
|
||||
"parent_folder": null,
|
||||
"scope_members_vdom": "root",
|
||||
"central-nat": "disable",
|
||||
"ngfw-mode": "profile-based"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"type": "pkg",
|
||||
"name": "ansibleTestPackage1",
|
||||
"scope member": [
|
||||
{
|
||||
"name": "FGT2",
|
||||
"vdom": "root"
|
||||
},
|
||||
{
|
||||
"name": "FGT3",
|
||||
"vdom": "root"
|
||||
}
|
||||
],
|
||||
"package settings": {
|
||||
"inspection-mode": "flow",
|
||||
"central-nat": "disable",
|
||||
"fwpolicy-implicit-log": "disable",
|
||||
"fwpolicy6-implicit-log": "disable",
|
||||
"ngfw-mode": "profile-based"
|
||||
}
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/pkg/adom/ansible"
|
||||
},
|
||||
"post_method": "set"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"ssl-ssh-profile": null,
|
||||
"name": "ansibleTestPackage2",
|
||||
"adom": "ansible",
|
||||
"fwpolicy6-implicit-log": "disable",
|
||||
"object_type": "pkg",
|
||||
"fwpolicy-implicit-log": "disable",
|
||||
"package-folder": null,
|
||||
"inspection-mode": "flow",
|
||||
"scope_members": null,
|
||||
"mode": "set",
|
||||
"parent_folder": "ansibleTestFolder1",
|
||||
"scope_members_vdom": "root",
|
||||
"central-nat": "disable",
|
||||
"ngfw-mode": "profile-based"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"subobj": [
|
||||
{
|
||||
"type": "pkg",
|
||||
"name": "ansibleTestPackage2",
|
||||
"scope member": [],
|
||||
"package settings": {
|
||||
"inspection-mode": "flow",
|
||||
"central-nat": "disable",
|
||||
"fwpolicy-implicit-log": "disable",
|
||||
"fwpolicy6-implicit-log": "disable",
|
||||
"ngfw-mode": "profile-based"
|
||||
}
|
||||
}
|
||||
],
|
||||
"type": "folder",
|
||||
"name": "ansibleTestFolder1"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/pkg/adom/ansible"
|
||||
},
|
||||
"post_method": "set"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"ssl-ssh-profile": null,
|
||||
"name": "ansibleTestPackage1",
|
||||
"adom": "ansible",
|
||||
"fwpolicy6-implicit-log": "disable",
|
||||
"object_type": "pkg",
|
||||
"fwpolicy-implicit-log": "disable",
|
||||
"package-folder": null,
|
||||
"inspection-mode": "flow",
|
||||
"scope_members": null,
|
||||
"mode": "delete",
|
||||
"parent_folder": null,
|
||||
"scope_members_vdom": "root",
|
||||
"central-nat": "disable",
|
||||
"ngfw-mode": "profile-based"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "ansibleTestPackage1"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/pkg/adom/ansible/ansibleTestPackage1"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/pkg/adom/ansible/ansibleTestFolder1/ansibleTestPackage2"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "ansibleTestPackage2"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"ssl-ssh-profile": null,
|
||||
"name": "ansibleTestPackage2",
|
||||
"adom": "ansible",
|
||||
"fwpolicy6-implicit-log": "disable",
|
||||
"object_type": "pkg",
|
||||
"fwpolicy-implicit-log": "disable",
|
||||
"package-folder": null,
|
||||
"inspection-mode": "flow",
|
||||
"scope_members": null,
|
||||
"mode": "delete",
|
||||
"parent_folder": "ansibleTestFolder1",
|
||||
"scope_members_vdom": "root",
|
||||
"central-nat": "disable",
|
||||
"ngfw-mode": "profile-based"
|
||||
},
|
||||
"post_method": "delete"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,241 @@
|
|||
{
|
||||
"fmgr_set_ha_peer": [
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/cli/global/system/ha/peer/"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"status": "enable",
|
||||
"ip": "10.7.220.36",
|
||||
"serial-number": "FMG-VMTM18001882",
|
||||
"ip6": null,
|
||||
"id": 1
|
||||
},
|
||||
"paramgram_used": {
|
||||
"fmgr_ha_peer_sn": "FMG-VMTM18001882",
|
||||
"next_peer_id": 2,
|
||||
"fmgr_ha_hb_threshold": 3,
|
||||
"fmgr_ha_cluster_pw": null,
|
||||
"fmgr_ha_peer_ipv6": null,
|
||||
"fmgr_ha_peer_status": "enable",
|
||||
"fmgr_ha_file_quota": 4096,
|
||||
"fmgr_ha_cluster_id": 1,
|
||||
"peer_id": 1,
|
||||
"fmgr_ha_peer_ipv4": "10.7.220.36",
|
||||
"fmgr_ha_hb_interval": 5,
|
||||
"fmgr_ha_mode": null
|
||||
},
|
||||
"post_method": "set"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"fmgr_ha_peer_sn": "FMG-VMTM18001881",
|
||||
"next_peer_id": 1,
|
||||
"fmgr_ha_hb_threshold": 3,
|
||||
"fmgr_ha_cluster_pw": "fortinet",
|
||||
"fmgr_ha_hb_interval": 5,
|
||||
"fmgr_ha_cluster_id": 2,
|
||||
"fmgr_ha_file_quota": 4096,
|
||||
"fmgr_ha_peer_status": "enable",
|
||||
"peer_id": 1,
|
||||
"fmgr_ha_peer_ipv4": "10.7.220.35",
|
||||
"fmgr_ha_peer_ipv6": null,
|
||||
"fmgr_ha_mode": "slave"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"status": "enable",
|
||||
"ip": "10.7.220.35",
|
||||
"serial-number": "FMG-VMTM18001881",
|
||||
"ip6": null,
|
||||
"id": 1
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/cli/global/system/ha/peer/"
|
||||
},
|
||||
"post_method": "set"
|
||||
}
|
||||
],
|
||||
"fmgr_get_ha_peer_list": [
|
||||
{
|
||||
"url": "/cli/global/system/ha/peer/",
|
||||
"paramgram_used": {
|
||||
"fmgr_ha_peer_sn": "FMG-VMTM18001882",
|
||||
"fmgr_ha_hb_threshold": 3,
|
||||
"fmgr_ha_cluster_pw": null,
|
||||
"fmgr_ha_peer_ipv6": null,
|
||||
"fmgr_ha_peer_status": "enable",
|
||||
"fmgr_ha_file_quota": 4096,
|
||||
"fmgr_ha_cluster_id": 1,
|
||||
"fmgr_ha_peer_ipv4": "10.7.220.36",
|
||||
"fmgr_ha_hb_interval": 5,
|
||||
"fmgr_ha_mode": null
|
||||
},
|
||||
"datagram_sent": {},
|
||||
"raw_response": [
|
||||
{
|
||||
"status": "enable",
|
||||
"ip": "10.7.220.140",
|
||||
"serial-number": "FMG-VM0A17005535",
|
||||
"ip6": "::",
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"post_method": "get"
|
||||
},
|
||||
{
|
||||
"url": "/cli/global/system/ha/peer/",
|
||||
"raw_response": [
|
||||
{
|
||||
"status": "enable",
|
||||
"ip": "10.7.220.35",
|
||||
"serial-number": "FMG-VMTM18001881",
|
||||
"ip6": "::",
|
||||
"id": 1
|
||||
}
|
||||
],
|
||||
"datagram_sent": {},
|
||||
"paramgram_used": {
|
||||
"fmgr_ha_peer_sn": "FMG-VMTM18001881",
|
||||
"fmgr_ha_hb_threshold": 3,
|
||||
"fmgr_ha_cluster_pw": "fortinet",
|
||||
"fmgr_ha_hb_interval": 5,
|
||||
"fmgr_ha_cluster_id": 2,
|
||||
"fmgr_ha_file_quota": 4096,
|
||||
"fmgr_ha_peer_status": "enable",
|
||||
"fmgr_ha_peer_ipv4": "10.7.220.35",
|
||||
"fmgr_ha_peer_ipv6": null,
|
||||
"fmgr_ha_mode": "slave"
|
||||
},
|
||||
"post_method": "get"
|
||||
}
|
||||
],
|
||||
"fmgr_set_ha_mode": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"fmgr_ha_peer_sn": null,
|
||||
"fmgr_ha_hb_threshold": 10,
|
||||
"fmgr_ha_cluster_pw": "fortinet",
|
||||
"fmgr_ha_peer_ipv6": null,
|
||||
"fmgr_ha_peer_status": null,
|
||||
"fmgr_ha_file_quota": 2048,
|
||||
"fmgr_ha_cluster_id": 2,
|
||||
"fmgr_ha_peer_ipv4": null,
|
||||
"fmgr_ha_hb_interval": 15,
|
||||
"fmgr_ha_mode": "master"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"file-quota": 2048,
|
||||
"clusterid": 2,
|
||||
"hb-lost-threshold": 10,
|
||||
"mode": "master",
|
||||
"hb-interval": 15,
|
||||
"password": "fortinet"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/cli/global/system/ha"
|
||||
},
|
||||
"post_method": "set"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/cli/global/system/ha"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"file-quota": 4096,
|
||||
"clusterid": 2,
|
||||
"hb-lost-threshold": 3,
|
||||
"mode": "slave",
|
||||
"hb-interval": 5,
|
||||
"password": "fortinet"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"fmgr_ha_peer_sn": null,
|
||||
"fmgr_ha_hb_threshold": 3,
|
||||
"fmgr_ha_cluster_pw": "fortinet",
|
||||
"fmgr_ha_hb_interval": 5,
|
||||
"fmgr_ha_cluster_id": 2,
|
||||
"fmgr_ha_file_quota": 4096,
|
||||
"fmgr_ha_peer_status": null,
|
||||
"fmgr_ha_peer_ipv4": null,
|
||||
"fmgr_ha_peer_ipv6": null,
|
||||
"fmgr_ha_mode": "slave"
|
||||
},
|
||||
"post_method": "set"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"fmgr_ha_peer_sn": "FMG-VMTM18001881",
|
||||
"fmgr_ha_hb_threshold": 3,
|
||||
"fmgr_ha_cluster_pw": "fortinet",
|
||||
"fmgr_ha_peer_ipv6": null,
|
||||
"fmgr_ha_peer_status": "enable",
|
||||
"fmgr_ha_file_quota": 4096,
|
||||
"fmgr_ha_cluster_id": 2,
|
||||
"fmgr_ha_peer_ipv4": "10.7.220.35",
|
||||
"fmgr_ha_hb_interval": 5,
|
||||
"fmgr_ha_mode": "slave"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"file-quota": 4096,
|
||||
"clusterid": 2,
|
||||
"hb-lost-threshold": 3,
|
||||
"mode": "slave",
|
||||
"hb-interval": 5,
|
||||
"password": "fortinet"
|
||||
},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/cli/global/system/ha"
|
||||
},
|
||||
"post_method": "set"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/cli/global/system/ha"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"hb-lost-threshold": 3,
|
||||
"hb-interval": 5,
|
||||
"clusterid": 1,
|
||||
"mode": "standalone",
|
||||
"file-quota": 4096
|
||||
},
|
||||
"paramgram_used": {
|
||||
"fmgr_ha_file_quota": 4096,
|
||||
"fmgr_ha_cluster_pw": null,
|
||||
"fmgr_ha_peer_sn": null,
|
||||
"fmgr_ha_hb_interval": 5,
|
||||
"fmgr_ha_cluster_id": 1,
|
||||
"fmgr_ha_mode": "standalone",
|
||||
"fmgr_ha_peer_status": null,
|
||||
"fmgr_ha_hb_threshold": 3,
|
||||
"fmgr_ha_peer_ipv4": null,
|
||||
"fmgr_ha_peer_ipv6": null
|
||||
},
|
||||
"post_method": "set"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
{
|
||||
"fmgr_get_task_status": [
|
||||
{
|
||||
"url": "/task/task/247",
|
||||
"paramgram_used": {
|
||||
"custom_endpoint": null,
|
||||
"object": "task",
|
||||
"task_id": "247",
|
||||
"adom": "ansible",
|
||||
"device_ip": null,
|
||||
"custom_dict": null,
|
||||
"device_unique_name": null,
|
||||
"nodes": null,
|
||||
"device_serial": null
|
||||
},
|
||||
"datagram_sent": {
|
||||
"adom": "ansible"
|
||||
},
|
||||
"raw_response": {
|
||||
"src": "device manager",
|
||||
"num_warn": 0,
|
||||
"num_lines": 1,
|
||||
"adom": 133,
|
||||
"tot_percent": 100,
|
||||
"pid": 0,
|
||||
"end_tm": 1550716014,
|
||||
"num_err": 0,
|
||||
"percent": 100,
|
||||
"state": "done",
|
||||
"start_tm": 1550716010,
|
||||
"flags": 0,
|
||||
"user": "ansible",
|
||||
"title": "upddevtitle",
|
||||
"line": [
|
||||
{
|
||||
"name": "FGT3",
|
||||
"err": 0,
|
||||
"ip": "10.7.220.153",
|
||||
"oid": 0,
|
||||
"percent": 100,
|
||||
"detail": "updatesuccess",
|
||||
"state": "done",
|
||||
"vdom": null
|
||||
}
|
||||
],
|
||||
"num_done": 1,
|
||||
"id": 247,
|
||||
"history": [
|
||||
{
|
||||
"percent": 100,
|
||||
"detail": "2019-02-20 18:26:54:updatesuccess",
|
||||
"vdom": null,
|
||||
"name": "FGT3"
|
||||
}
|
||||
]
|
||||
},
|
||||
"post_method": "get"
|
||||
}
|
||||
],
|
||||
"fmgr_get_custom": [
|
||||
{
|
||||
"url": "/dvmdb/adom/ansible/script",
|
||||
"raw_response": [
|
||||
{
|
||||
"filter_hostname": null,
|
||||
"filter_device": 0,
|
||||
"filter_serial": null,
|
||||
"name": "TestScript",
|
||||
"type": "cli",
|
||||
"oid": 365,
|
||||
"filter_osver": "unknown",
|
||||
"content": "get system status",
|
||||
"modification_time": "2019-02-13 23:45:29",
|
||||
"filter_build": -1,
|
||||
"filter_platform": "",
|
||||
"desc": "Create by Ansible",
|
||||
"script_schedule": null,
|
||||
"filter_ostype": "unknown",
|
||||
"target": "remote_device"
|
||||
}
|
||||
],
|
||||
"datagram_sent": {
|
||||
"type": "cli"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"custom_endpoint": "/dvmdb/adom/ansible/script",
|
||||
"device_ip": null,
|
||||
"device_unique_name": null,
|
||||
"task_id": null,
|
||||
"adom": "ansible",
|
||||
"nodes": null,
|
||||
"object": "custom",
|
||||
"device_serial": null,
|
||||
"custom_dict": {
|
||||
"type": "cli"
|
||||
}
|
||||
},
|
||||
"post_method": "get"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
{
|
||||
"delete_script": [
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/dvmdb/adom/ansible/script/TestScript"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"name": "TestScript"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"vdom": "root",
|
||||
"script_target": null,
|
||||
"script_content": null,
|
||||
"adom": "ansible",
|
||||
"script_description": null,
|
||||
"script_package": null,
|
||||
"mode": "delete",
|
||||
"script_scope": null,
|
||||
"script_name": "TestScript",
|
||||
"script_type": null
|
||||
},
|
||||
"post_method": "delete"
|
||||
}
|
||||
],
|
||||
"set_script": [
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/dvmdb/adom/ansible/script/"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"content": "get system status",
|
||||
"type": "cli",
|
||||
"target": "remote_device",
|
||||
"name": "TestScript",
|
||||
"desc": "Create by Ansible"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"script_content": "get system status",
|
||||
"adom": "ansible",
|
||||
"script_scope": null,
|
||||
"script_name": "TestScript",
|
||||
"script_target": "remote_device",
|
||||
"mode": "add",
|
||||
"script_description": "Create by Ansible",
|
||||
"script_package": null,
|
||||
"vdom": "root",
|
||||
"script_type": "cli"
|
||||
},
|
||||
"post_method": "set"
|
||||
}
|
||||
],
|
||||
"execute_script": [
|
||||
{
|
||||
"url": "/dvmdb/adom/ansible/script/execute",
|
||||
"paramgram_used": {
|
||||
"script_content": null,
|
||||
"adom": "ansible",
|
||||
"script_scope": "FGT1",
|
||||
"script_name": "TestScript",
|
||||
"script_target": null,
|
||||
"mode": "execute",
|
||||
"script_description": null,
|
||||
"script_package": null,
|
||||
"vdom": "root",
|
||||
"script_type": null
|
||||
},
|
||||
"datagram_sent": {
|
||||
"scope": [
|
||||
{
|
||||
"name": "FGT1",
|
||||
"vdom": "root"
|
||||
}
|
||||
],
|
||||
"adom": "ansible",
|
||||
"script": "TestScript",
|
||||
"package": null
|
||||
},
|
||||
"raw_response": {
|
||||
"task": 277
|
||||
},
|
||||
"post_method": "exec"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,250 @@
|
|||
{
|
||||
"fmgr_application_list_modify": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"other-application-log": null,
|
||||
"replacemsg-group": null,
|
||||
"adom": "ansible",
|
||||
"unknown-application-log": null,
|
||||
"p2p-black-list": null,
|
||||
"unknown-application-action": null,
|
||||
"extended-log": null,
|
||||
"deep-app-inspection": null,
|
||||
"mode": "delete",
|
||||
"other-application-action": null,
|
||||
"entries": {
|
||||
"behavior": null,
|
||||
"rate-duration": null,
|
||||
"sub-category": null,
|
||||
"session-ttl": null,
|
||||
"per-ip-shaper": null,
|
||||
"category": null,
|
||||
"log": null,
|
||||
"parameters": {
|
||||
"value": null
|
||||
},
|
||||
"technology": null,
|
||||
"quarantine-expiry": null,
|
||||
"application": null,
|
||||
"protocols": null,
|
||||
"log-packet": null,
|
||||
"quarantine-log": null,
|
||||
"vendor": null,
|
||||
"risk": null,
|
||||
"rate-count": null,
|
||||
"quarantine": null,
|
||||
"popularity": null,
|
||||
"shaper": null,
|
||||
"shaper-reverse": null,
|
||||
"rate-track": null,
|
||||
"rate-mode": null,
|
||||
"action": null
|
||||
},
|
||||
"options": null,
|
||||
"app-replacemsg": null,
|
||||
"name": "Ansible_Application_Control_Profile"
|
||||
},
|
||||
"datagram_sent": {},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/application/list/Ansible_Application_Control_Profile"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/application/list"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"name": "Ansible_Application_Control_Profile",
|
||||
"entries": [
|
||||
{
|
||||
"quarantine-log": "enable",
|
||||
"log": "enable",
|
||||
"quarantine": "attacker",
|
||||
"action": "block",
|
||||
"log-packet": "enable",
|
||||
"protocols": [
|
||||
"1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"action": "pass",
|
||||
"category": [
|
||||
"2",
|
||||
"3",
|
||||
"4"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"paramgram_used": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"other-application-log": null,
|
||||
"replacemsg-group": null,
|
||||
"p2p-black-list": null,
|
||||
"unknown-application-log": null,
|
||||
"adom": "ansible",
|
||||
"unknown-application-action": null,
|
||||
"extended-log": null,
|
||||
"deep-app-inspection": null,
|
||||
"mode": "set",
|
||||
"other-application-action": null,
|
||||
"entries": [
|
||||
{
|
||||
"quarantine-log": "enable",
|
||||
"log": "enable",
|
||||
"quarantine": "attacker",
|
||||
"action": "block",
|
||||
"log-packet": "enable",
|
||||
"protocols": [
|
||||
"1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"action": "pass",
|
||||
"category": [
|
||||
"2",
|
||||
"3",
|
||||
"4"
|
||||
]
|
||||
}
|
||||
],
|
||||
"options": null,
|
||||
"app-replacemsg": null,
|
||||
"name": "Ansible_Application_Control_Profile"
|
||||
},
|
||||
"post_method": "set"
|
||||
},
|
||||
{
|
||||
"paramgram_used": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"other-application-log": null,
|
||||
"replacemsg-group": null,
|
||||
"adom": "ansible",
|
||||
"unknown-application-log": null,
|
||||
"p2p-black-list": null,
|
||||
"unknown-application-action": null,
|
||||
"extended-log": null,
|
||||
"options": null,
|
||||
"deep-app-inspection": null,
|
||||
"mode": "delete",
|
||||
"other-application-action": null,
|
||||
"entries": {
|
||||
"behavior": null,
|
||||
"rate-duration": null,
|
||||
"sub-category": null,
|
||||
"session-ttl": null,
|
||||
"per-ip-shaper": null,
|
||||
"category": null,
|
||||
"log": null,
|
||||
"parameters": {
|
||||
"value": null
|
||||
},
|
||||
"technology": null,
|
||||
"quarantine-expiry": null,
|
||||
"application": null,
|
||||
"protocols": null,
|
||||
"log-packet": null,
|
||||
"quarantine-log": null,
|
||||
"vendor": null,
|
||||
"risk": null,
|
||||
"rate-count": null,
|
||||
"quarantine": null,
|
||||
"popularity": null,
|
||||
"shaper": null,
|
||||
"shaper-reverse": null,
|
||||
"rate-track": null,
|
||||
"rate-mode": null,
|
||||
"action": null
|
||||
},
|
||||
"app-replacemsg": null,
|
||||
"name": "Ansible_Application_Ctl_Profile2"
|
||||
},
|
||||
"datagram_sent": {},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/application/list/Ansible_Application_Ctl_Profile2"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/application/list"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"name": "Ansible_Application_Ctl_Profile2",
|
||||
"entries": {
|
||||
"quarantine-log": "enable",
|
||||
"log": "enable",
|
||||
"quarantine": "attacker",
|
||||
"action": "pass",
|
||||
"log-packet": "enable",
|
||||
"protocols": "['1']"
|
||||
}
|
||||
},
|
||||
"paramgram_used": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"adom": "ansible",
|
||||
"unknown-application-log": null,
|
||||
"extended-log": null,
|
||||
"other-application-action": null,
|
||||
"entries": {
|
||||
"rate-duration": null,
|
||||
"sub-category": null,
|
||||
"vendor": null,
|
||||
"technology": null,
|
||||
"risk": null,
|
||||
"category": null,
|
||||
"log": "enable",
|
||||
"parameters": {
|
||||
"value": null
|
||||
},
|
||||
"per-ip-shaper": null,
|
||||
"quarantine-expiry": null,
|
||||
"application": null,
|
||||
"protocols": "['1']",
|
||||
"log-packet": "enable",
|
||||
"quarantine-log": "enable",
|
||||
"session-ttl": null,
|
||||
"behavior": null,
|
||||
"rate-count": null,
|
||||
"quarantine": "attacker",
|
||||
"popularity": null,
|
||||
"shaper": null,
|
||||
"shaper-reverse": null,
|
||||
"rate-track": null,
|
||||
"rate-mode": null,
|
||||
"action": "pass"
|
||||
},
|
||||
"replacemsg-group": null,
|
||||
"other-application-log": null,
|
||||
"name": "Ansible_Application_Ctl_Profile2",
|
||||
"p2p-black-list": null,
|
||||
"unknown-application-action": null,
|
||||
"deep-app-inspection": null,
|
||||
"mode": "set",
|
||||
"app-replacemsg": null,
|
||||
"options": null
|
||||
},
|
||||
"post_method": "set"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,252 @@
|
|||
{
|
||||
"fmgr_antivirus_profile_modify": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"smtp": {
|
||||
"executables": null,
|
||||
"archive-log": null,
|
||||
"outbreak-prevention": null,
|
||||
"emulator": null,
|
||||
"archive-block": null,
|
||||
"content-disarm": null,
|
||||
"options": null
|
||||
},
|
||||
"extended-log": null,
|
||||
"analytics-db": null,
|
||||
"analytics-wl-filetype": null,
|
||||
"av-virus-log": null,
|
||||
"content-disarm": {
|
||||
"office-hylink": null,
|
||||
"pdf-act-gotor": null,
|
||||
"pdf-act-java": null,
|
||||
"original-file-destination": null,
|
||||
"cover-page": null,
|
||||
"pdf-act-sound": null,
|
||||
"detect-only": null,
|
||||
"office-embed": null,
|
||||
"office-linked": null,
|
||||
"pdf-javacode": null,
|
||||
"pdf-hyperlink": null,
|
||||
"pdf-embedfile": null,
|
||||
"office-macro": null,
|
||||
"pdf-act-form": null,
|
||||
"pdf-act-launch": null,
|
||||
"pdf-act-movie": null
|
||||
},
|
||||
"ftp": {
|
||||
"archive-block": null,
|
||||
"emulator": null,
|
||||
"archive-log": null,
|
||||
"outbreak-prevention": null,
|
||||
"options": null
|
||||
},
|
||||
"mapi": {
|
||||
"executables": null,
|
||||
"archive-log": null,
|
||||
"outbreak-prevention": null,
|
||||
"emulator": null,
|
||||
"archive-block": null,
|
||||
"options": null
|
||||
},
|
||||
"analytics-max-upload": null,
|
||||
"nntp": {
|
||||
"archive-block": null,
|
||||
"emulator": null,
|
||||
"archive-log": null,
|
||||
"outbreak-prevention": null,
|
||||
"options": null
|
||||
},
|
||||
"smb": {
|
||||
"archive-block": null,
|
||||
"emulator": null,
|
||||
"archive-log": null,
|
||||
"outbreak-prevention": null,
|
||||
"options": null
|
||||
},
|
||||
"analytics-bl-filetype": null,
|
||||
"http": {
|
||||
"archive-log": null,
|
||||
"outbreak-prevention": null,
|
||||
"emulator": null,
|
||||
"archive-block": null,
|
||||
"content-disarm": null,
|
||||
"options": null
|
||||
},
|
||||
"adom": "ansible",
|
||||
"av-block-log": null,
|
||||
"pop3": {
|
||||
"executables": null,
|
||||
"archive-log": null,
|
||||
"outbreak-prevention": null,
|
||||
"emulator": null,
|
||||
"archive-block": null,
|
||||
"content-disarm": null,
|
||||
"options": null
|
||||
},
|
||||
"inspection-mode": null,
|
||||
"ftgd-analytics": null,
|
||||
"imap": {
|
||||
"executables": null,
|
||||
"archive-log": null,
|
||||
"outbreak-prevention": null,
|
||||
"emulator": null,
|
||||
"archive-block": null,
|
||||
"content-disarm": null,
|
||||
"options": null
|
||||
},
|
||||
"replacemsg-group": null,
|
||||
"name": "Ansible_AV_Profile",
|
||||
"scan-mode": null,
|
||||
"nac-quar": {
|
||||
"infected": null,
|
||||
"log": null,
|
||||
"expiry": null
|
||||
},
|
||||
"mode": "delete",
|
||||
"mobile-malware-db": null
|
||||
},
|
||||
"datagram_sent": {},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/antivirus/profile/Ansible_AV_Profile"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/ansible/obj/antivirus/profile"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"ftp": {
|
||||
"outbreak-prevention": "files",
|
||||
"options": "scan",
|
||||
"archive-log": "timeout",
|
||||
"emulator": "disable",
|
||||
"archive-block": "encrypted"
|
||||
},
|
||||
"name": "Ansible_AV_Profile",
|
||||
"scan-mode": "full",
|
||||
"av-block-log": "enable",
|
||||
"inspection-mode": "proxy",
|
||||
"av-virus-log": "enable",
|
||||
"ftgd-analytics": "everything",
|
||||
"mobile-malware-db": "enable"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"av-block-log": "enable",
|
||||
"extended-log": null,
|
||||
"analytics-db": null,
|
||||
"analytics-wl-filetype": null,
|
||||
"av-virus-log": "enable",
|
||||
"content-disarm": {
|
||||
"pdf-act-movie": null,
|
||||
"pdf-act-gotor": null,
|
||||
"pdf-act-java": null,
|
||||
"original-file-destination": null,
|
||||
"cover-page": null,
|
||||
"pdf-act-sound": null,
|
||||
"detect-only": null,
|
||||
"office-embed": null,
|
||||
"pdf-embedfile": null,
|
||||
"office-linked": null,
|
||||
"pdf-javacode": null,
|
||||
"pdf-hyperlink": null,
|
||||
"office-hylink": null,
|
||||
"office-macro": null,
|
||||
"pdf-act-form": null,
|
||||
"pdf-act-launch": null
|
||||
},
|
||||
"ftp": {
|
||||
"outbreak-prevention": "files",
|
||||
"options": "scan",
|
||||
"archive-log": "timeout",
|
||||
"emulator": "disable",
|
||||
"archive-block": "encrypted"
|
||||
},
|
||||
"smtp": {
|
||||
"executables": null,
|
||||
"archive-log": null,
|
||||
"outbreak-prevention": null,
|
||||
"emulator": null,
|
||||
"archive-block": null,
|
||||
"content-disarm": null,
|
||||
"options": null
|
||||
},
|
||||
"mapi": {
|
||||
"executables": null,
|
||||
"archive-log": null,
|
||||
"outbreak-prevention": null,
|
||||
"emulator": null,
|
||||
"archive-block": null,
|
||||
"options": null
|
||||
},
|
||||
"analytics-max-upload": null,
|
||||
"nntp": {
|
||||
"outbreak-prevention": null,
|
||||
"options": null,
|
||||
"archive-log": null,
|
||||
"emulator": null,
|
||||
"archive-block": null
|
||||
},
|
||||
"smb": {
|
||||
"outbreak-prevention": null,
|
||||
"options": null,
|
||||
"archive-log": null,
|
||||
"emulator": null,
|
||||
"archive-block": null
|
||||
},
|
||||
"analytics-bl-filetype": null,
|
||||
"http": {
|
||||
"archive-log": null,
|
||||
"outbreak-prevention": null,
|
||||
"emulator": null,
|
||||
"archive-block": null,
|
||||
"content-disarm": null,
|
||||
"options": null
|
||||
},
|
||||
"adom": "ansible",
|
||||
"scan-mode": "full",
|
||||
"pop3": {
|
||||
"executables": null,
|
||||
"archive-log": null,
|
||||
"outbreak-prevention": null,
|
||||
"emulator": null,
|
||||
"archive-block": null,
|
||||
"content-disarm": null,
|
||||
"options": null
|
||||
},
|
||||
"inspection-mode": "proxy",
|
||||
"ftgd-analytics": "everything",
|
||||
"imap": {
|
||||
"executables": null,
|
||||
"archive-log": null,
|
||||
"outbreak-prevention": null,
|
||||
"emulator": null,
|
||||
"archive-block": null,
|
||||
"content-disarm": null,
|
||||
"options": null
|
||||
},
|
||||
"name": "Ansible_AV_Profile",
|
||||
"replacemsg-group": null,
|
||||
"nac-quar": {
|
||||
"infected": null,
|
||||
"log": null,
|
||||
"expiry": null
|
||||
},
|
||||
"mode": "set",
|
||||
"mobile-malware-db": "enable"
|
||||
},
|
||||
"post_method": "set"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"fmgr_dnsfilter_profile_modify": [
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/root/obj/dnsfilter/profile"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"name": "Ansible_DNS_Profile",
|
||||
"block-action": "block"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"ftgd-dns": {
|
||||
"options": null,
|
||||
"filters": {
|
||||
"action": null,
|
||||
"category": null,
|
||||
"log": null
|
||||
}
|
||||
},
|
||||
"adom": "root",
|
||||
"youtube-restrict": null,
|
||||
"sdns-domain-log": null,
|
||||
"block-botnet": null,
|
||||
"external-ip-blocklist": null,
|
||||
"block-action": "block",
|
||||
"name": "Ansible_DNS_Profile",
|
||||
"redirect-portal": null,
|
||||
"sdns-ftgd-err-log": null,
|
||||
"safe-search": null,
|
||||
"domain-filter": {
|
||||
"domain-filter-table": null
|
||||
},
|
||||
"log-all-domain": null,
|
||||
"mode": "set"
|
||||
},
|
||||
"post_method": "set"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
{
|
||||
"fmgr_ips_sensor_modify": [
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/root/obj/ips/sensor"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"block-malicious-url": "enable",
|
||||
"name": "Ansible_IPS_Profile",
|
||||
"entries": [
|
||||
{
|
||||
"action": "block",
|
||||
"log-packet": "enable",
|
||||
"severity": "high"
|
||||
},
|
||||
{
|
||||
"action": "pass",
|
||||
"severity": "medium"
|
||||
}
|
||||
]
|
||||
},
|
||||
"paramgram_used": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"block-malicious-url": "enable",
|
||||
"mode": "set",
|
||||
"name": "Ansible_IPS_Profile",
|
||||
"adom": "root",
|
||||
"override": {
|
||||
"status": null,
|
||||
"exempt-ip": {
|
||||
"src-ip": null,
|
||||
"dst-ip": null
|
||||
},
|
||||
"quarantine-log": null,
|
||||
"log": null,
|
||||
"action": null,
|
||||
"log-packet": null,
|
||||
"quarantine": null,
|
||||
"quarantine-expiry": null,
|
||||
"rule-id": null
|
||||
},
|
||||
"entries": [
|
||||
{
|
||||
"action": "block",
|
||||
"log-packet": "enable",
|
||||
"severity": "high"
|
||||
},
|
||||
{
|
||||
"action": "pass",
|
||||
"severity": "medium"
|
||||
}
|
||||
],
|
||||
"filter": {
|
||||
"status": null,
|
||||
"quarantine-log": null,
|
||||
"protocol": null,
|
||||
"severity": null,
|
||||
"log": null,
|
||||
"name": null,
|
||||
"quarantine": null,
|
||||
"quarantine-expiry": null,
|
||||
"application": null,
|
||||
"location": null,
|
||||
"action": null,
|
||||
"log-packet": null,
|
||||
"os": null
|
||||
},
|
||||
"extended-log": null,
|
||||
"replacemsg-group": null
|
||||
},
|
||||
"post_method": "set"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
"fmgr_firewall_profile_group_modify": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"ssl-ssh-profile": null,
|
||||
"waf-profile": null,
|
||||
"adom": "root",
|
||||
"webfilter-profile": null,
|
||||
"profile-protocol-options": null,
|
||||
"application-list": null,
|
||||
"icap-profile": null,
|
||||
"voip-profile": null,
|
||||
"ips-sensor": null,
|
||||
"dnsfilter-profile": null,
|
||||
"av-profile": null,
|
||||
"spamfilter-profile": null,
|
||||
"dlp-sensor": null,
|
||||
"mode": "delete",
|
||||
"ssh-filter-profile": null,
|
||||
"mms-profile": null,
|
||||
"name": "Ansible_TEST_Profile_Group"
|
||||
},
|
||||
"datagram_sent": {},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "Object does not exist",
|
||||
"code": -3
|
||||
},
|
||||
"url": "/pm/config/adom/root/obj/firewall/profile-group/Ansible_TEST_Profile_Group"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "datasrc invalid. object: firewall profile-group av-profile Ansible_TEST_Profile_Group. detail: Ansible_AV_Profile. solution: data not exist",
|
||||
"code": -10131
|
||||
},
|
||||
"url": "/pm/config/adom/root/obj/firewall/profile-group"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"av-profile": "Ansible_AV_Profile",
|
||||
"profile-protocol-options": "default",
|
||||
"name": "Ansible_TEST_Profile_Group"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"ssl-ssh-profile": null,
|
||||
"application-list": null,
|
||||
"waf-profile": null,
|
||||
"adom": "root",
|
||||
"webfilter-profile": null,
|
||||
"ips-sensor": null,
|
||||
"spamfilter-profile": null,
|
||||
"icap-profile": null,
|
||||
"dnsfilter-profile": null,
|
||||
"name": "Ansible_TEST_Profile_Group",
|
||||
"voip-profile": null,
|
||||
"av-profile": "Ansible_AV_Profile",
|
||||
"mode": "set",
|
||||
"dlp-sensor": null,
|
||||
"mms-profile": null,
|
||||
"ssh-filter-profile": null,
|
||||
"profile-protocol-options": "default"
|
||||
},
|
||||
"post_method": "set"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
"fmgr_web_proxy_profile_modify": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"header-via-request": null,
|
||||
"name": "Ansible_Web_Proxy_Profile",
|
||||
"header-front-end-https": null,
|
||||
"log-header-change": null,
|
||||
"adom": "root",
|
||||
"headers": {
|
||||
"action": null,
|
||||
"content": null,
|
||||
"name": null
|
||||
},
|
||||
"mode": "delete",
|
||||
"header-via-response": null,
|
||||
"header-x-authenticated-user": null,
|
||||
"strip-encoding": null,
|
||||
"header-x-forwarded-for": null,
|
||||
"header-x-authenticated-groups": null,
|
||||
"header-client-ip": null
|
||||
},
|
||||
"datagram_sent": {},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/root/obj/web-proxy/profile/Ansible_Web_Proxy_Profile"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/root/obj/web-proxy/profile"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"header-via-request": "remove",
|
||||
"name": "Ansible_Web_Proxy_Profile",
|
||||
"header-front-end-https": "add",
|
||||
"log-header-change": "enable",
|
||||
"headers": {
|
||||
"action": "add-to-request",
|
||||
"content": "test",
|
||||
"name": "test_header"
|
||||
},
|
||||
"header-via-response": "pass",
|
||||
"header-x-authenticated-user": "remove",
|
||||
"strip-encoding": "enable",
|
||||
"header-x-forwarded-for": "pass",
|
||||
"header-x-authenticated-groups": "add",
|
||||
"header-client-ip": "pass"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"header-via-request": "remove",
|
||||
"header-client-ip": "pass",
|
||||
"header-front-end-https": "add",
|
||||
"header-x-authenticated-groups": "add",
|
||||
"name": "Ansible_Web_Proxy_Profile",
|
||||
"log-header-change": "enable",
|
||||
"adom": "root",
|
||||
"headers": {
|
||||
"action": "add-to-request",
|
||||
"content": "test",
|
||||
"name": "test_header"
|
||||
},
|
||||
"mode": "set",
|
||||
"header-via-response": "pass",
|
||||
"header-x-authenticated-user": "remove",
|
||||
"strip-encoding": "enable",
|
||||
"header-x-forwarded-for": "pass"
|
||||
},
|
||||
"post_method": "set"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
{
|
||||
"fmgr_spamfilter_profile_modify": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"smtp": {
|
||||
"local-override": null,
|
||||
"hdrip": null,
|
||||
"log": null,
|
||||
"tag-type": null,
|
||||
"tag-msg": null,
|
||||
"action": null
|
||||
},
|
||||
"spam-log": null,
|
||||
"gmail": {
|
||||
"log": null
|
||||
},
|
||||
"spam-bword-table": null,
|
||||
"mapi": {
|
||||
"action": null,
|
||||
"log": null
|
||||
},
|
||||
"flow-based": null,
|
||||
"spam-mheader-table": null,
|
||||
"spam-log-fortiguard-response": null,
|
||||
"yahoo-mail": {
|
||||
"log": null
|
||||
},
|
||||
"adom": "root",
|
||||
"pop3": {
|
||||
"action": null,
|
||||
"tag-msg": null,
|
||||
"tag-type": null,
|
||||
"log": null
|
||||
},
|
||||
"external": null,
|
||||
"spam-rbl-table": null,
|
||||
"imap": {
|
||||
"action": null,
|
||||
"tag-msg": null,
|
||||
"tag-type": null,
|
||||
"log": null
|
||||
},
|
||||
"spam-iptrust-table": null,
|
||||
"replacemsg-group": null,
|
||||
"name": "Ansible_Spam_Filter_Profile",
|
||||
"spam-bwl-table": null,
|
||||
"spam-filtering": null,
|
||||
"msn-hotmail": {
|
||||
"log": null
|
||||
},
|
||||
"spam-bword-threshold": null,
|
||||
"mode": "delete",
|
||||
"options": null
|
||||
},
|
||||
"datagram_sent": {},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/root/obj/spamfilter/profile/Ansible_Spam_Filter_Profile"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/root/obj/spamfilter/profile"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"comment": "Created by Ansible",
|
||||
"spam-log-fortiguard-response": "enable",
|
||||
"spam-log": "enable",
|
||||
"name": "Ansible_Spam_Filter_Profile",
|
||||
"spam-filtering": "enable",
|
||||
"flow-based": "enable",
|
||||
"spam-bword-threshold": 10,
|
||||
"external": "enable",
|
||||
"options": [
|
||||
"bannedword",
|
||||
"spamfsip",
|
||||
"spamfsurl",
|
||||
"spamrbl",
|
||||
"spamfsphish",
|
||||
"spambwl"
|
||||
],
|
||||
"gmail": {
|
||||
"log": "enable"
|
||||
}
|
||||
},
|
||||
"paramgram_used": {
|
||||
"comment": "Created by Ansible",
|
||||
"smtp": {
|
||||
"local-override": null,
|
||||
"hdrip": null,
|
||||
"log": null,
|
||||
"tag-type": null,
|
||||
"tag-msg": null,
|
||||
"action": null
|
||||
},
|
||||
"yahoo-mail": {
|
||||
"log": null
|
||||
},
|
||||
"gmail": {
|
||||
"log": "enable"
|
||||
},
|
||||
"spam-bword-table": null,
|
||||
"mapi": {
|
||||
"action": null,
|
||||
"log": null
|
||||
},
|
||||
"flow-based": "enable",
|
||||
"spam-mheader-table": null,
|
||||
"spam-log-fortiguard-response": "enable",
|
||||
"spam-log": "enable",
|
||||
"adom": "root",
|
||||
"pop3": {
|
||||
"action": null,
|
||||
"tag-type": null,
|
||||
"log": null,
|
||||
"tag-msg": null
|
||||
},
|
||||
"external": "enable",
|
||||
"spam-rbl-table": null,
|
||||
"imap": {
|
||||
"action": null,
|
||||
"tag-type": null,
|
||||
"log": null,
|
||||
"tag-msg": null
|
||||
},
|
||||
"spam-iptrust-table": null,
|
||||
"name": "Ansible_Spam_Filter_Profile",
|
||||
"replacemsg-group": null,
|
||||
"spam-bwl-table": null,
|
||||
"spam-filtering": "enable",
|
||||
"msn-hotmail": {
|
||||
"log": null
|
||||
},
|
||||
"spam-bword-threshold": 10,
|
||||
"mode": "set",
|
||||
"options": [
|
||||
"bannedword",
|
||||
"spamfsip",
|
||||
"spamfsurl",
|
||||
"spamrbl",
|
||||
"spamfsphish",
|
||||
"spambwl"
|
||||
]
|
||||
},
|
||||
"post_method": "set"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,214 @@
|
|||
{
|
||||
"fmgr_firewall_ssl_ssh_profile_modify": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"untrusted-caname": null,
|
||||
"mapi-over-https": null,
|
||||
"whitelist": null,
|
||||
"caname": null,
|
||||
"ftps": {
|
||||
"status": null,
|
||||
"allow-invalid-server-cert": null,
|
||||
"unsupported-ssl": null,
|
||||
"client-cert-request": null,
|
||||
"ports": null,
|
||||
"untrusted-cert": null
|
||||
},
|
||||
"ssl-exemptions-log": null,
|
||||
"https": {
|
||||
"status": null,
|
||||
"allow-invalid-server-cert": null,
|
||||
"unsupported-ssl": null,
|
||||
"client-cert-request": null,
|
||||
"ports": null,
|
||||
"untrusted-cert": null
|
||||
},
|
||||
"imaps": {
|
||||
"status": null,
|
||||
"allow-invalid-server-cert": null,
|
||||
"unsupported-ssl": null,
|
||||
"client-cert-request": null,
|
||||
"ports": null,
|
||||
"untrusted-cert": null
|
||||
},
|
||||
"server-cert-mode": null,
|
||||
"adom": "root",
|
||||
"ssl-exempt": {
|
||||
"regex": null,
|
||||
"wildcard-fqdn": null,
|
||||
"fortiguard-category": null,
|
||||
"address6": null,
|
||||
"address": null,
|
||||
"type": null
|
||||
},
|
||||
"ssl": {
|
||||
"inspect-all": null,
|
||||
"allow-invalid-server-cert": null,
|
||||
"client-cert-request": null,
|
||||
"untrusted-cert": null,
|
||||
"unsupported-ssl": null
|
||||
},
|
||||
"ssh": {
|
||||
"status": null,
|
||||
"inspect-all": null,
|
||||
"ssh-tun-policy-check": null,
|
||||
"ssh-policy-check": null,
|
||||
"ssh-algorithm": null,
|
||||
"unsupported-version": null,
|
||||
"ports": null
|
||||
},
|
||||
"use-ssl-server": null,
|
||||
"server-cert": null,
|
||||
"name": "Ansible_SSL_SSH_Profile",
|
||||
"ssl-anomalies-log": null,
|
||||
"ssl-server": {
|
||||
"pop3s-client-cert-request": null,
|
||||
"imaps-client-cert-request": null,
|
||||
"smtps-client-cert-request": null,
|
||||
"ip": null,
|
||||
"ssl-other-client-cert-request": null,
|
||||
"https-client-cert-request": null,
|
||||
"ftps-client-cert-request": null
|
||||
},
|
||||
"smtps": {
|
||||
"status": null,
|
||||
"allow-invalid-server-cert": null,
|
||||
"unsupported-ssl": null,
|
||||
"client-cert-request": null,
|
||||
"ports": null,
|
||||
"untrusted-cert": null
|
||||
},
|
||||
"rpc-over-https": null,
|
||||
"mode": "delete",
|
||||
"pop3s": {
|
||||
"status": null,
|
||||
"allow-invalid-server-cert": null,
|
||||
"unsupported-ssl": null,
|
||||
"client-cert-request": null,
|
||||
"ports": null,
|
||||
"untrusted-cert": null
|
||||
}
|
||||
},
|
||||
"datagram_sent": {},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/root/obj/firewall/ssl-ssh-profile/Ansible_SSL_SSH_Profile"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/root/obj/firewall/ssl-ssh-profile"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"server-cert-mode": "replace",
|
||||
"name": "Ansible_SSL_SSH_Profile",
|
||||
"ssl-anomalies-log": "enable",
|
||||
"mapi-over-https": "enable",
|
||||
"whitelist": "enable",
|
||||
"ssl-exemptions-log": "enable",
|
||||
"rpc-over-https": "enable",
|
||||
"use-ssl-server": "enable"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"untrusted-caname": null,
|
||||
"mapi-over-https": "enable",
|
||||
"whitelist": "enable",
|
||||
"caname": null,
|
||||
"ftps": {
|
||||
"status": null,
|
||||
"allow-invalid-server-cert": null,
|
||||
"unsupported-ssl": null,
|
||||
"untrusted-cert": null,
|
||||
"client-cert-request": null,
|
||||
"ports": null
|
||||
},
|
||||
"ssl-exemptions-log": "enable",
|
||||
"https": {
|
||||
"status": null,
|
||||
"allow-invalid-server-cert": null,
|
||||
"unsupported-ssl": null,
|
||||
"untrusted-cert": null,
|
||||
"client-cert-request": null,
|
||||
"ports": null
|
||||
},
|
||||
"pop3s": {
|
||||
"status": null,
|
||||
"allow-invalid-server-cert": null,
|
||||
"unsupported-ssl": null,
|
||||
"untrusted-cert": null,
|
||||
"client-cert-request": null,
|
||||
"ports": null
|
||||
},
|
||||
"server-cert-mode": "replace",
|
||||
"adom": "root",
|
||||
"ssl-exempt": {
|
||||
"regex": null,
|
||||
"wildcard-fqdn": null,
|
||||
"fortiguard-category": null,
|
||||
"address6": null,
|
||||
"address": null,
|
||||
"type": null
|
||||
},
|
||||
"ssl": {
|
||||
"unsupported-ssl": null,
|
||||
"inspect-all": null,
|
||||
"allow-invalid-server-cert": null,
|
||||
"untrusted-cert": null,
|
||||
"client-cert-request": null
|
||||
},
|
||||
"ssh": {
|
||||
"status": null,
|
||||
"inspect-all": null,
|
||||
"ssh-tun-policy-check": null,
|
||||
"ssh-policy-check": null,
|
||||
"ssh-algorithm": null,
|
||||
"unsupported-version": null,
|
||||
"ports": null
|
||||
},
|
||||
"server-cert": null,
|
||||
"name": "Ansible_SSL_SSH_Profile",
|
||||
"ssl-anomalies-log": "enable",
|
||||
"ssl-server": {
|
||||
"pop3s-client-cert-request": null,
|
||||
"imaps-client-cert-request": null,
|
||||
"smtps-client-cert-request": null,
|
||||
"ip": null,
|
||||
"ssl-other-client-cert-request": null,
|
||||
"https-client-cert-request": null,
|
||||
"ftps-client-cert-request": null
|
||||
},
|
||||
"smtps": {
|
||||
"status": null,
|
||||
"allow-invalid-server-cert": null,
|
||||
"unsupported-ssl": null,
|
||||
"untrusted-cert": null,
|
||||
"client-cert-request": null,
|
||||
"ports": null
|
||||
},
|
||||
"imaps": {
|
||||
"status": null,
|
||||
"allow-invalid-server-cert": null,
|
||||
"unsupported-ssl": null,
|
||||
"untrusted-cert": null,
|
||||
"client-cert-request": null,
|
||||
"ports": null
|
||||
},
|
||||
"rpc-over-https": "enable",
|
||||
"mode": "set",
|
||||
"use-ssl-server": "enable"
|
||||
},
|
||||
"post_method": "set"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,257 @@
|
|||
{
|
||||
"fmgr_voip_profile_modify": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"comment": null,
|
||||
"sip": {
|
||||
"block-publish": null,
|
||||
"ssl-max-version": null,
|
||||
"malformed-header-rack": null,
|
||||
"rtp": null,
|
||||
"publish-rate": null,
|
||||
"ssl-client-renegotiation": null,
|
||||
"malformed-header-from": null,
|
||||
"open-contact-pinhole": null,
|
||||
"ssl-client-certificate": null,
|
||||
"malformed-header-p-asserted-identity": null,
|
||||
"rfc2543-branch": null,
|
||||
"malformed-header-via": null,
|
||||
"notify-rate": null,
|
||||
"preserve-override": null,
|
||||
"block-info": null,
|
||||
"options-rate": null,
|
||||
"block-update": null,
|
||||
"max-body-length": null,
|
||||
"block-subscribe": null,
|
||||
"ssl-pfs": null,
|
||||
"ssl-send-empty-frags": null,
|
||||
"ssl-auth-client": null,
|
||||
"malformed-header-record-route": null,
|
||||
"refer-rate": null,
|
||||
"info-rate": null,
|
||||
"open-record-route-pinhole": null,
|
||||
"register-rate": null,
|
||||
"unknown-header": null,
|
||||
"block-unknown": null,
|
||||
"ssl-server-certificate": null,
|
||||
"block-invite": null,
|
||||
"strict-register": null,
|
||||
"max-dialogs": null,
|
||||
"block-cancel": null,
|
||||
"no-sdp-fixup": null,
|
||||
"open-register-pinhole": null,
|
||||
"block-notify": null,
|
||||
"max-idle-dialogs": null,
|
||||
"malformed-request-line": null,
|
||||
"block-long-lines": null,
|
||||
"log-violations": null,
|
||||
"ssl-min-version": null,
|
||||
"provisional-invite-expiry-time": null,
|
||||
"block-prack": null,
|
||||
"malformed-header-max-forwards": null,
|
||||
"block-message": null,
|
||||
"malformed-header-call-id": null,
|
||||
"invite-rate": null,
|
||||
"cancel-rate": null,
|
||||
"register-contact-trace": null,
|
||||
"block-register": null,
|
||||
"ssl-mode": null,
|
||||
"prack-rate": null,
|
||||
"block-bye": null,
|
||||
"ssl-algorithm": null,
|
||||
"malformed-header-to": null,
|
||||
"block-geo-red-options": null,
|
||||
"call-keepalive": null,
|
||||
"message-rate": null,
|
||||
"malformed-header-expires": null,
|
||||
"block-options": null,
|
||||
"log-call-summary": null,
|
||||
"hnt-restrict-source-ip": null,
|
||||
"ssl-auth-server": null,
|
||||
"contact-fixup": null,
|
||||
"ack-rate": null,
|
||||
"malformed-header-allow": null,
|
||||
"malformed-header-sdp-v": null,
|
||||
"malformed-header-sdp-t": null,
|
||||
"malformed-header-contact": null,
|
||||
"malformed-header-sdp-s": null,
|
||||
"hosted-nat-traversal": null,
|
||||
"subscribe-rate": null,
|
||||
"malformed-header-content-length": null,
|
||||
"malformed-header-sdp-z": null,
|
||||
"malformed-header-route": null,
|
||||
"malformed-header-sdp-b": null,
|
||||
"malformed-header-sdp-c": null,
|
||||
"malformed-header-sdp-a": null,
|
||||
"malformed-header-sdp-o": null,
|
||||
"malformed-header-sdp-m": null,
|
||||
"malformed-header-sdp-k": null,
|
||||
"malformed-header-sdp-i": null,
|
||||
"status": null,
|
||||
"open-via-pinhole": null,
|
||||
"bye-rate": null,
|
||||
"block-ack": null,
|
||||
"malformed-header-sdp-r": null,
|
||||
"block-refer": null,
|
||||
"ips-rtp": null,
|
||||
"malformed-header-content-type": null,
|
||||
"nat-trace": null,
|
||||
"malformed-header-rseq": null,
|
||||
"max-line-length": null,
|
||||
"update-rate": null,
|
||||
"malformed-header-cseq": null
|
||||
},
|
||||
"name": "Ansible_VOIP_Profile",
|
||||
"adom": "root",
|
||||
"sccp": {
|
||||
"status": null,
|
||||
"log-call-summary": null,
|
||||
"block-mcast": null,
|
||||
"max-calls": null,
|
||||
"verify-header": null,
|
||||
"log-violations": null
|
||||
},
|
||||
"mode": "delete"
|
||||
},
|
||||
"datagram_sent": {},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/root/obj/voip/profile/Ansible_VOIP_Profile"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/root/obj/voip/profile"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"comment": "Created by Ansible",
|
||||
"sccp": {
|
||||
"status": "enable",
|
||||
"log-call-summary": "enable",
|
||||
"log-violations": "enable",
|
||||
"block-mcast": "enable"
|
||||
},
|
||||
"name": "Ansible_VOIP_Profile"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"comment": "Created by Ansible",
|
||||
"sip": {
|
||||
"block-publish": null,
|
||||
"ssl-max-version": null,
|
||||
"malformed-header-rack": null,
|
||||
"rtp": null,
|
||||
"publish-rate": null,
|
||||
"ssl-client-renegotiation": null,
|
||||
"malformed-header-from": null,
|
||||
"ssl-client-certificate": null,
|
||||
"malformed-header-p-asserted-identity": null,
|
||||
"info-rate": null,
|
||||
"malformed-header-via": null,
|
||||
"notify-rate": null,
|
||||
"preserve-override": null,
|
||||
"block-info": null,
|
||||
"options-rate": null,
|
||||
"block-update": null,
|
||||
"max-body-length": null,
|
||||
"block-subscribe": null,
|
||||
"ssl-pfs": null,
|
||||
"ssl-send-empty-frags": null,
|
||||
"ssl-auth-client": null,
|
||||
"malformed-header-record-route": null,
|
||||
"refer-rate": null,
|
||||
"open-record-route-pinhole": null,
|
||||
"register-rate": null,
|
||||
"unknown-header": null,
|
||||
"block-unknown": null,
|
||||
"ssl-server-certificate": null,
|
||||
"block-invite": null,
|
||||
"malformed-request-line": null,
|
||||
"max-dialogs": null,
|
||||
"block-cancel": null,
|
||||
"no-sdp-fixup": null,
|
||||
"open-register-pinhole": null,
|
||||
"block-options": null,
|
||||
"max-idle-dialogs": null,
|
||||
"strict-register": null,
|
||||
"block-long-lines": null,
|
||||
"log-violations": null,
|
||||
"ssl-min-version": null,
|
||||
"provisional-invite-expiry-time": null,
|
||||
"rfc2543-branch": null,
|
||||
"block-ack": null,
|
||||
"malformed-header-max-forwards": null,
|
||||
"block-message": null,
|
||||
"malformed-header-call-id": null,
|
||||
"invite-rate": null,
|
||||
"cancel-rate": null,
|
||||
"register-contact-trace": null,
|
||||
"block-refer": null,
|
||||
"block-register": null,
|
||||
"ssl-mode": null,
|
||||
"prack-rate": null,
|
||||
"block-bye": null,
|
||||
"ssl-algorithm": null,
|
||||
"malformed-header-to": null,
|
||||
"block-geo-red-options": null,
|
||||
"call-keepalive": null,
|
||||
"message-rate": null,
|
||||
"malformed-header-expires": null,
|
||||
"log-call-summary": null,
|
||||
"hnt-restrict-source-ip": null,
|
||||
"ssl-auth-server": null,
|
||||
"contact-fixup": null,
|
||||
"ack-rate": null,
|
||||
"malformed-header-allow": null,
|
||||
"malformed-header-sdp-v": null,
|
||||
"malformed-header-sdp-t": null,
|
||||
"malformed-header-contact": null,
|
||||
"malformed-header-sdp-s": null,
|
||||
"hosted-nat-traversal": null,
|
||||
"subscribe-rate": null,
|
||||
"malformed-header-content-length": null,
|
||||
"malformed-header-sdp-z": null,
|
||||
"malformed-header-route": null,
|
||||
"block-notify": null,
|
||||
"malformed-header-sdp-b": null,
|
||||
"malformed-header-sdp-c": null,
|
||||
"malformed-header-sdp-a": null,
|
||||
"malformed-header-sdp-o": null,
|
||||
"malformed-header-sdp-m": null,
|
||||
"malformed-header-sdp-k": null,
|
||||
"malformed-header-sdp-i": null,
|
||||
"status": null,
|
||||
"open-via-pinhole": null,
|
||||
"bye-rate": null,
|
||||
"block-prack": null,
|
||||
"malformed-header-sdp-r": null,
|
||||
"open-contact-pinhole": null,
|
||||
"ips-rtp": null,
|
||||
"malformed-header-content-type": null,
|
||||
"nat-trace": null,
|
||||
"malformed-header-rseq": null,
|
||||
"max-line-length": null,
|
||||
"update-rate": null,
|
||||
"malformed-header-cseq": null
|
||||
},
|
||||
"name": "Ansible_VOIP_Profile",
|
||||
"adom": "root",
|
||||
"sccp": {
|
||||
"status": "enable",
|
||||
"log-call-summary": "enable",
|
||||
"log-violations": "enable",
|
||||
"block-mcast": "enable"
|
||||
},
|
||||
"mode": "set"
|
||||
},
|
||||
"post_method": "set"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,365 @@
|
|||
{
|
||||
"fmgr_waf_profile_modify": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"name": "Ansible_WAF_Profile",
|
||||
"adom": "root",
|
||||
"address-list": {
|
||||
"blocked-address": null,
|
||||
"status": null,
|
||||
"severity": null,
|
||||
"blocked-log": null,
|
||||
"trusted-address": null
|
||||
},
|
||||
"constraint": {
|
||||
"header-length": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"length": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"content-length": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"length": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"max-cookie": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"max-cookie": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"url-param-length": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"length": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"hostname": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"line-length": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"length": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"exception": {
|
||||
"regex": null,
|
||||
"header-length": null,
|
||||
"content-length": null,
|
||||
"max-cookie": null,
|
||||
"pattern": null,
|
||||
"hostname": null,
|
||||
"line-length": null,
|
||||
"max-range-segment": null,
|
||||
"url-param-length": null,
|
||||
"version": null,
|
||||
"param-length": null,
|
||||
"malformed": null,
|
||||
"address": null,
|
||||
"max-url-param": null,
|
||||
"max-header-line": null,
|
||||
"method": null
|
||||
},
|
||||
"max-range-segment": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"max-range-segment": null,
|
||||
"severity": null,
|
||||
"log": null
|
||||
},
|
||||
"version": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"param-length": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"length": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"malformed": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"max-url-param": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"max-url-param": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"max-header-line": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"max-header-line": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"method": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
}
|
||||
},
|
||||
"extended-log": null,
|
||||
"url-access": {
|
||||
"action": null,
|
||||
"address": null,
|
||||
"severity": null,
|
||||
"access-pattern": {
|
||||
"negate": null,
|
||||
"pattern": null,
|
||||
"srcaddr": null,
|
||||
"regex": null
|
||||
},
|
||||
"log": null
|
||||
},
|
||||
"external": null,
|
||||
"signature": {
|
||||
"custom-signature": {
|
||||
"status": null,
|
||||
"direction": null,
|
||||
"target": null,
|
||||
"severity": null,
|
||||
"case-sensitivity": null,
|
||||
"name": null,
|
||||
"pattern": null,
|
||||
"action": null,
|
||||
"log": null
|
||||
},
|
||||
"credit-card-detection-threshold": null,
|
||||
"main-class": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"disabled-signature": null,
|
||||
"disabled-sub-class": null
|
||||
},
|
||||
"method": {
|
||||
"status": null,
|
||||
"severity": null,
|
||||
"default-allowed-methods": null,
|
||||
"log": null,
|
||||
"method-policy": {
|
||||
"regex": null,
|
||||
"pattern": null,
|
||||
"allowed-methods": null,
|
||||
"address": null
|
||||
}
|
||||
},
|
||||
"mode": "delete"
|
||||
},
|
||||
"datagram_sent": {},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/root/obj/waf/profile/Ansible_WAF_Profile"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/root/obj/waf/profile"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"name": "Ansible_WAF_Profile"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"adom": "root",
|
||||
"address-list": {
|
||||
"blocked-address": null,
|
||||
"status": null,
|
||||
"severity": null,
|
||||
"blocked-log": null,
|
||||
"trusted-address": null
|
||||
},
|
||||
"extended-log": null,
|
||||
"url-access": {
|
||||
"action": null,
|
||||
"severity": null,
|
||||
"log": null,
|
||||
"access-pattern": {
|
||||
"negate": null,
|
||||
"pattern": null,
|
||||
"srcaddr": null,
|
||||
"regex": null
|
||||
},
|
||||
"address": null
|
||||
},
|
||||
"external": null,
|
||||
"name": "Ansible_WAF_Profile",
|
||||
"constraint": {
|
||||
"content-length": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"length": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"max-cookie": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"max-cookie": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"line-length": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"length": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"max-range-segment": {
|
||||
"action": null,
|
||||
"severity": null,
|
||||
"status": null,
|
||||
"log": null,
|
||||
"max-range-segment": null
|
||||
},
|
||||
"param-length": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"length": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"malformed": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"max-url-param": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"max-url-param": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"header-length": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"length": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"exception": {
|
||||
"regex": null,
|
||||
"header-length": null,
|
||||
"content-length": null,
|
||||
"max-cookie": null,
|
||||
"pattern": null,
|
||||
"hostname": null,
|
||||
"line-length": null,
|
||||
"max-range-segment": null,
|
||||
"url-param-length": null,
|
||||
"version": null,
|
||||
"param-length": null,
|
||||
"malformed": null,
|
||||
"address": null,
|
||||
"max-url-param": null,
|
||||
"max-header-line": null,
|
||||
"method": null
|
||||
},
|
||||
"hostname": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"url-param-length": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"length": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"version": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"max-header-line": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"max-header-line": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"method": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
}
|
||||
},
|
||||
"mode": "set",
|
||||
"signature": {
|
||||
"custom-signature": {
|
||||
"status": null,
|
||||
"direction": null,
|
||||
"log": null,
|
||||
"severity": null,
|
||||
"target": null,
|
||||
"action": null,
|
||||
"pattern": null,
|
||||
"case-sensitivity": null,
|
||||
"name": null
|
||||
},
|
||||
"credit-card-detection-threshold": null,
|
||||
"main-class": {
|
||||
"action": null,
|
||||
"status": null,
|
||||
"log": null,
|
||||
"severity": null
|
||||
},
|
||||
"disabled-signature": null,
|
||||
"disabled-sub-class": null
|
||||
},
|
||||
"method": {
|
||||
"status": null,
|
||||
"default-allowed-methods": null,
|
||||
"method-policy": {
|
||||
"regex": null,
|
||||
"pattern": null,
|
||||
"allowed-methods": null,
|
||||
"address": null
|
||||
},
|
||||
"log": null,
|
||||
"severity": null
|
||||
}
|
||||
},
|
||||
"post_method": "set"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,162 @@
|
|||
{
|
||||
"fmgr_wanopt_profile_modify": [
|
||||
{
|
||||
"paramgram_used": {
|
||||
"ftp": {
|
||||
"status": null,
|
||||
"log-traffic": null,
|
||||
"byte-caching": null,
|
||||
"prefer-chunking": null,
|
||||
"secure-tunnel": null,
|
||||
"port": null,
|
||||
"tunnel-sharing": null
|
||||
},
|
||||
"http": {
|
||||
"status": null,
|
||||
"ssl": null,
|
||||
"tunnel-non-http": null,
|
||||
"log-traffic": null,
|
||||
"byte-caching": null,
|
||||
"unknown-http-version": null,
|
||||
"prefer-chunking": null,
|
||||
"tunnel-sharing": null,
|
||||
"port": null,
|
||||
"ssl-port": null,
|
||||
"secure-tunnel": null
|
||||
},
|
||||
"cifs": {
|
||||
"status": null,
|
||||
"log-traffic": null,
|
||||
"byte-caching": null,
|
||||
"prefer-chunking": null,
|
||||
"secure-tunnel": null,
|
||||
"port": null,
|
||||
"tunnel-sharing": null
|
||||
},
|
||||
"adom": "root",
|
||||
"auth-group": null,
|
||||
"mapi": {
|
||||
"status": null,
|
||||
"log-traffic": null,
|
||||
"byte-caching": null,
|
||||
"secure-tunnel": null,
|
||||
"port": null,
|
||||
"tunnel-sharing": null
|
||||
},
|
||||
"tcp": {
|
||||
"status": null,
|
||||
"byte-caching-opt": null,
|
||||
"ssl": null,
|
||||
"log-traffic": null,
|
||||
"byte-caching": null,
|
||||
"secure-tunnel": null,
|
||||
"port": null,
|
||||
"ssl-port": null,
|
||||
"tunnel-sharing": null
|
||||
},
|
||||
"mode": "delete",
|
||||
"comments": null,
|
||||
"transparent": null,
|
||||
"name": "Ansible_WanOpt_Profile"
|
||||
},
|
||||
"datagram_sent": {},
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/root/obj/wanopt/profile/Ansible_WanOpt_Profile"
|
||||
},
|
||||
"post_method": "delete"
|
||||
},
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/root/obj/wanopt/profile"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"ftp": {
|
||||
"status": "enable",
|
||||
"log-traffic": "enable",
|
||||
"byte-caching": "enable",
|
||||
"prefer-chunking": "dynamic",
|
||||
"tunnel-sharing": "private",
|
||||
"port": 80,
|
||||
"secure-tunnel": "disable"
|
||||
},
|
||||
"name": "Ansible_WanOpt_Profile",
|
||||
"cifs": {
|
||||
"status": "enable",
|
||||
"log-traffic": "enable",
|
||||
"byte-caching": "enable",
|
||||
"prefer-chunking": "dynamic",
|
||||
"port": 80,
|
||||
"tunnel-sharing": "private"
|
||||
},
|
||||
"comments": "Created by Ansible",
|
||||
"transparent": "enable"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"http": {
|
||||
"status": null,
|
||||
"log-traffic": null,
|
||||
"prefer-chunking": null,
|
||||
"port": null,
|
||||
"ssl": null,
|
||||
"tunnel-non-http": null,
|
||||
"byte-caching": null,
|
||||
"unknown-http-version": null,
|
||||
"secure-tunnel": null,
|
||||
"ssl-port": null,
|
||||
"tunnel-sharing": null
|
||||
},
|
||||
"cifs": {
|
||||
"status": "enable",
|
||||
"log-traffic": "enable",
|
||||
"byte-caching": "enable",
|
||||
"prefer-chunking": "dynamic",
|
||||
"port": 80,
|
||||
"tunnel-sharing": "private"
|
||||
},
|
||||
"adom": "root",
|
||||
"auth-group": null,
|
||||
"tcp": {
|
||||
"status": null,
|
||||
"log-traffic": null,
|
||||
"byte-caching-opt": null,
|
||||
"byte-caching": null,
|
||||
"ssl": null,
|
||||
"tunnel-sharing": null,
|
||||
"port": null,
|
||||
"ssl-port": null,
|
||||
"secure-tunnel": null
|
||||
},
|
||||
"transparent": "enable",
|
||||
"ftp": {
|
||||
"status": "enable",
|
||||
"log-traffic": "enable",
|
||||
"byte-caching": "enable",
|
||||
"prefer-chunking": "dynamic",
|
||||
"tunnel-sharing": "private",
|
||||
"port": 80,
|
||||
"secure-tunnel": "disable"
|
||||
},
|
||||
"name": "Ansible_WanOpt_Profile",
|
||||
"mapi": {
|
||||
"status": null,
|
||||
"log-traffic": null,
|
||||
"byte-caching": null,
|
||||
"secure-tunnel": null,
|
||||
"port": null,
|
||||
"tunnel-sharing": null
|
||||
},
|
||||
"comments": "Created by Ansible",
|
||||
"mode": "set"
|
||||
},
|
||||
"post_method": "set"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
{
|
||||
"fmgr_webfilter_profile_modify": [
|
||||
{
|
||||
"raw_response": {
|
||||
"status": {
|
||||
"message": "OK",
|
||||
"code": 0
|
||||
},
|
||||
"url": "/pm/config/adom/root/obj/webfilter/profile"
|
||||
},
|
||||
"datagram_sent": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"web-extended-all-action-log": "enable",
|
||||
"web-filter-cookie-removal-log": "enable",
|
||||
"extended-log": "enable",
|
||||
"log-all-url": "enable",
|
||||
"wisp": "enable",
|
||||
"web-filter-vbs-log": "enable",
|
||||
"ovrd-perm": [
|
||||
"bannedword-override"
|
||||
],
|
||||
"web-filter-command-block-log": "enable",
|
||||
"web-invalid-domain-log": "enable",
|
||||
"web-filter-referer-log": "enable",
|
||||
"inspection-mode": "proxy",
|
||||
"post-action": "block",
|
||||
"web-content-log": "enable",
|
||||
"web-filter-applet-log": "enable",
|
||||
"web-ftgd-err-log": "enable",
|
||||
"name": "Ansible_Web_Proxy_Profile",
|
||||
"web-filter-jscript-log": "enable",
|
||||
"web-filter-activex-log": "enable",
|
||||
"web-filter-js-log": "enable",
|
||||
"web-ftgd-quota-usage": "enable",
|
||||
"web-filter-unknown-log": "enable",
|
||||
"web-filter-cookie-log": "enable",
|
||||
"youtube-channel-status": "blacklist",
|
||||
"web-url-log": "enable",
|
||||
"options": [
|
||||
"js"
|
||||
],
|
||||
"wisp-algorithm": "auto-learning"
|
||||
},
|
||||
"paramgram_used": {
|
||||
"comment": "Created by Ansible Module TEST",
|
||||
"web-filter-command-block-log": "enable",
|
||||
"web-invalid-domain-log": "enable",
|
||||
"web-extended-all-action-log": "enable",
|
||||
"adom": "root",
|
||||
"ftgd-wf": {
|
||||
"rate-javascript-urls": null,
|
||||
"quota": {
|
||||
"category": null,
|
||||
"value": null,
|
||||
"override-replacemsg": null,
|
||||
"duration": null,
|
||||
"type": null,
|
||||
"unit": null
|
||||
},
|
||||
"rate-image-urls": null,
|
||||
"filters": {
|
||||
"category": null,
|
||||
"auth-usr-grp": null,
|
||||
"log": null,
|
||||
"warning-prompt": null,
|
||||
"override-replacemsg": null,
|
||||
"action": null,
|
||||
"warn-duration": null,
|
||||
"warning-duration-type": null
|
||||
},
|
||||
"rate-css-urls": null,
|
||||
"ovrd": null,
|
||||
"exempt-quota": null,
|
||||
"max-quota-timeout": null,
|
||||
"rate-crl-urls": null,
|
||||
"options": null
|
||||
},
|
||||
"web-content-log": "enable",
|
||||
"web-filter-referer-log": "enable",
|
||||
"log-all-url": "enable",
|
||||
"extended-log": "enable",
|
||||
"inspection-mode": "proxy",
|
||||
"web-filter-cookie-removal-log": "enable",
|
||||
"post-action": "block",
|
||||
"web-filter-activex-log": "enable",
|
||||
"web-filter-cookie-log": "enable",
|
||||
"web": {
|
||||
"blacklist": null,
|
||||
"log-search": null,
|
||||
"keyword-match": null,
|
||||
"urlfilter-table": null,
|
||||
"bword-table": null,
|
||||
"safe-search": null,
|
||||
"whitelist": null,
|
||||
"content-header-list": null,
|
||||
"youtube-restrict": null,
|
||||
"bword-threshold": null
|
||||
},
|
||||
"web-filter-applet-log": "enable",
|
||||
"web-ftgd-err-log": "enable",
|
||||
"replacemsg-group": null,
|
||||
"web-filter-jscript-log": "enable",
|
||||
"web-ftgd-quota-usage": "enable",
|
||||
"url-extraction": {
|
||||
"status": null,
|
||||
"server-fqdn": null,
|
||||
"redirect-url": null,
|
||||
"redirect-header": null,
|
||||
"redirect-no-content": null
|
||||
},
|
||||
"web-filter-js-log": "enable",
|
||||
"youtube-channel-filter": {
|
||||
"comment": null,
|
||||
"channel-id": null
|
||||
},
|
||||
"name": "Ansible_Web_Proxy_Profile",
|
||||
"wisp": "enable",
|
||||
"web-filter-vbs-log": "enable",
|
||||
"web-filter-unknown-log": "enable",
|
||||
"mode": "set",
|
||||
"youtube-channel-status": "blacklist",
|
||||
"override": {
|
||||
"profile": null,
|
||||
"ovrd-user-group": null,
|
||||
"ovrd-scope": null,
|
||||
"ovrd-cookie": null,
|
||||
"ovrd-dur-mode": null,
|
||||
"profile-attribute": null,
|
||||
"ovrd-dur": null,
|
||||
"profile-type": null
|
||||
},
|
||||
"web-url-log": "enable",
|
||||
"ovrd-perm": [
|
||||
"bannedword-override"
|
||||
],
|
||||
"https-replacemsg": null,
|
||||
"options": [
|
||||
"js"
|
||||
],
|
||||
"wisp-servers": null,
|
||||
"wisp-algorithm": "auto-learning"
|
||||
},
|
||||
"post_method": "set"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
# (c) 2016 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase
|
||||
|
||||
|
||||
class TestFortimanagerModule(ModuleTestCase):
|
||||
|
||||
def execute_module(self, failed=False, changed=False, commands=None, sort=True, defaults=False):
|
||||
|
||||
self.load_fixtures(commands)
|
||||
|
||||
if failed:
|
||||
result = self.failed()
|
||||
self.assertTrue(result['failed'], result)
|
||||
else:
|
||||
result = self.changed(changed)
|
||||
self.assertEqual(result['changed'], changed, result)
|
||||
|
||||
if commands is not None:
|
||||
if sort:
|
||||
self.assertEqual(sorted(commands), sorted(result['commands']), result['commands'])
|
||||
else:
|
||||
self.assertEqual(commands, result['commands'], result['commands'])
|
||||
|
||||
return result
|
||||
|
||||
def failed(self):
|
||||
with self.assertRaises(AnsibleFailJson) as exc:
|
||||
self.module.main()
|
||||
|
||||
result = exc.exception.args[0]
|
||||
self.assertTrue(result['failed'], result)
|
||||
return result
|
||||
|
||||
def changed(self, changed=False):
|
||||
with self.assertRaises(AnsibleExitJson) as exc:
|
||||
self.module.main()
|
||||
|
||||
result = exc.exception.args[0]
|
||||
self.assertEqual(result['changed'], changed, result)
|
||||
return result
|
||||
|
||||
def load_fixtures(self, commands=None):
|
||||
pass
|
||||
|
|
@ -0,0 +1,272 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_device
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_device.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_discover_device(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# device_username: admin
|
||||
# adom: ansible
|
||||
# device_ip: 10.7.220.151
|
||||
# device_unique_name: FGT1
|
||||
# mode: exec
|
||||
# device_serial: None
|
||||
# device_password: fortinet
|
||||
##################################################
|
||||
##################################################
|
||||
# device_username: admin
|
||||
# adom: ansible
|
||||
# device_ip: 10.7.220.152
|
||||
# device_unique_name: FGT2
|
||||
# mode: exec
|
||||
# device_serial: None
|
||||
# device_password: fortinet
|
||||
##################################################
|
||||
##################################################
|
||||
# device_username: admin
|
||||
# adom: ansible
|
||||
# device_ip: 10.7.220.153
|
||||
# device_unique_name: FGT3
|
||||
# mode: exec
|
||||
# device_serial: None
|
||||
# device_password: fortinet
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_device.discover_device(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert isinstance(output['raw_response'], dict) is True
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_device.discover_device(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert isinstance(output['raw_response'], dict) is True
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_device.discover_device(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert isinstance(output['raw_response'], dict) is True
|
||||
|
||||
|
||||
def test_add_device(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# device_username: admin
|
||||
# adom: ansible
|
||||
# device_ip: 10.7.220.151
|
||||
# device_unique_name: FGT1
|
||||
# mode: exec
|
||||
# device_serial: None
|
||||
# device_password: fortinet
|
||||
##################################################
|
||||
##################################################
|
||||
# device_username: admin
|
||||
# adom: ansible
|
||||
# device_ip: 10.7.220.152
|
||||
# device_unique_name: FGT2
|
||||
# mode: exec
|
||||
# device_serial: None
|
||||
# device_password: fortinet
|
||||
##################################################
|
||||
##################################################
|
||||
# device_username: admin
|
||||
# adom: ansible
|
||||
# device_ip: 10.7.220.153
|
||||
# device_unique_name: FGT3
|
||||
# mode: exec
|
||||
# device_serial: None
|
||||
# device_password: fortinet
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_device.add_device(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert isinstance(output['raw_response'], dict) is True
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_device.add_device(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert isinstance(output['raw_response'], dict) is True
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_device.add_device(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert isinstance(output['raw_response'], dict) is True
|
||||
|
||||
|
||||
def test_delete_device(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# device_username: admin
|
||||
# adom: root
|
||||
# device_ip: 10.7.220.151
|
||||
# device_unique_name: FGT1
|
||||
# mode: exec
|
||||
# device_serial: None
|
||||
# device_password: fortinet
|
||||
##################################################
|
||||
##################################################
|
||||
# device_username: admin
|
||||
# adom: ansible
|
||||
# device_ip: 10.7.220.152
|
||||
# device_unique_name: FGT2
|
||||
# mode: exec
|
||||
# device_serial: None
|
||||
# device_password: fortinet
|
||||
##################################################
|
||||
##################################################
|
||||
# device_username: admin
|
||||
# adom: ansible
|
||||
# device_ip: 10.7.220.153
|
||||
# device_unique_name: FGT3
|
||||
# mode: exec
|
||||
# device_serial: None
|
||||
# device_password: fortinet
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_device.delete_device(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_device.delete_device(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_device.delete_device(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
||||
|
||||
def test_get_device(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# device_username: admin
|
||||
# adom: ansible
|
||||
# device_ip: 10.7.220.151
|
||||
# device_unique_name: FGT1
|
||||
# mode: get
|
||||
# device_serial: None
|
||||
# device_password: fortinet
|
||||
##################################################
|
||||
##################################################
|
||||
# device_username: admin
|
||||
# adom: ansible
|
||||
# device_ip: 10.7.220.152
|
||||
# device_unique_name: FGT2
|
||||
# mode: get
|
||||
# device_serial: None
|
||||
# device_password: fortinet
|
||||
##################################################
|
||||
##################################################
|
||||
# device_username: admin
|
||||
# adom: ansible
|
||||
# device_ip: 10.7.220.153
|
||||
# device_unique_name: FGT3
|
||||
# mode: get
|
||||
# device_serial: None
|
||||
# device_password: fortinet
|
||||
##################################################
|
||||
##################################################
|
||||
# device_username: admin
|
||||
# adom: ansible
|
||||
# device_ip: 10.7.220.151
|
||||
# device_unique_name: FGT1
|
||||
# mode: get
|
||||
# device_serial: None
|
||||
# device_password: fortinet
|
||||
##################################################
|
||||
##################################################
|
||||
# device_username: admin
|
||||
# adom: ansible
|
||||
# device_ip: 10.7.220.152
|
||||
# device_unique_name: FGT2
|
||||
# mode: get
|
||||
# device_serial: None
|
||||
# device_password: fortinet
|
||||
##################################################
|
||||
##################################################
|
||||
# device_username: admin
|
||||
# adom: ansible
|
||||
# device_ip: 10.7.220.153
|
||||
# device_unique_name: FGT3
|
||||
# mode: get
|
||||
# device_serial: None
|
||||
# device_password: fortinet
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_device.get_device(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert isinstance(output['raw_response'], dict) is True
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_device.get_device(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert isinstance(output['raw_response'], dict) is True
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_device.get_device(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert isinstance(output['raw_response'], dict) is True
|
||||
# Test using fixture 4 #
|
||||
output = fmgr_device.get_device(fmg_instance, fixture_data[3]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -3
|
||||
# Test using fixture 5 #
|
||||
output = fmgr_device.get_device(fmg_instance, fixture_data[4]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -3
|
||||
# Test using fixture 6 #
|
||||
output = fmgr_device.get_device(fmg_instance, fixture_data[5]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -3
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_device_config
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_device_config.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_update_device_hostname(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# adom: ansible
|
||||
# interface: None
|
||||
# device_unique_name: FGT1
|
||||
# install_config: disable
|
||||
# device_hostname: ansible-fgt01
|
||||
# interface_ip: None
|
||||
# interface_allow_access: None
|
||||
# mode: update
|
||||
##################################################
|
||||
##################################################
|
||||
# adom: ansible
|
||||
# interface: None
|
||||
# device_unique_name: FGT2
|
||||
# install_config: disable
|
||||
# device_hostname: ansible-fgt02
|
||||
# interface_ip: None
|
||||
# interface_allow_access: None
|
||||
# mode: update
|
||||
##################################################
|
||||
##################################################
|
||||
# adom: ansible
|
||||
# interface: None
|
||||
# device_unique_name: FGT3
|
||||
# install_config: disable
|
||||
# device_hostname: ansible-fgt03
|
||||
# interface_ip: None
|
||||
# interface_allow_access: None
|
||||
# mode: update
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_device_config.update_device_hostname(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_device_config.update_device_hostname(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_device_config.update_device_hostname(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
||||
|
||||
def test_update_device_interface(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# adom: ansible
|
||||
# install_config: disable
|
||||
# device_unique_name: FGT1
|
||||
# interface: port2
|
||||
# device_hostname: None
|
||||
# interface_ip: 10.1.1.1/24
|
||||
# interface_allow_access: ping, telnet, https, http
|
||||
# mode: update
|
||||
##################################################
|
||||
##################################################
|
||||
# adom: ansible
|
||||
# install_config: disable
|
||||
# device_unique_name: FGT2
|
||||
# interface: port2
|
||||
# device_hostname: None
|
||||
# interface_ip: 10.1.2.1/24
|
||||
# interface_allow_access: ping, telnet, https, http
|
||||
# mode: update
|
||||
##################################################
|
||||
##################################################
|
||||
# adom: ansible
|
||||
# install_config: disable
|
||||
# device_unique_name: FGT3
|
||||
# interface: port2
|
||||
# device_hostname: None
|
||||
# interface_ip: 10.1.3.1/24
|
||||
# interface_allow_access: ping, telnet, https, http
|
||||
# mode: update
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_device_config.update_device_interface(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_device_config.update_device_interface(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_device_config.update_device_interface(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
||||
|
||||
def test_exec_config(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# adom: ansible
|
||||
# interface: None
|
||||
# device_unique_name: FGT1
|
||||
# install_config: enable
|
||||
# device_hostname: None
|
||||
# interface_ip: None
|
||||
# interface_allow_access: None
|
||||
# mode: exec
|
||||
##################################################
|
||||
##################################################
|
||||
# adom: ansible
|
||||
# install_config: enable
|
||||
# device_unique_name: FGT2, FGT3
|
||||
# interface: None
|
||||
# device_hostname: None
|
||||
# interface_ip: None
|
||||
# interface_allow_access: None
|
||||
# mode: exec
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_device_config.exec_config(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert isinstance(output['raw_response'], dict) is True
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_device_config.exec_config(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert isinstance(output['raw_response'], dict) is True
|
||||
|
|
@ -0,0 +1,202 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_device_group
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_device_group.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_add_device_group(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# grp_desc: CreatedbyAnsible
|
||||
# adom: ansible
|
||||
# grp_members: None
|
||||
# mode: add
|
||||
# grp_name: TestGroup
|
||||
# vdom: root
|
||||
##################################################
|
||||
##################################################
|
||||
# grp_desc: CreatedbyAnsible
|
||||
# adom: ansible
|
||||
# grp_members: None
|
||||
# mode: add
|
||||
# grp_name: testtest
|
||||
# vdom: root
|
||||
##################################################
|
||||
##################################################
|
||||
# grp_desc: None
|
||||
# adom: ansible
|
||||
# grp_members: FGT1
|
||||
# mode: add
|
||||
# grp_name: TestGroup
|
||||
# vdom: root
|
||||
##################################################
|
||||
##################################################
|
||||
# grp_desc: None
|
||||
# adom: ansible
|
||||
# grp_members: FGT3
|
||||
# mode: add
|
||||
# grp_name: testtest
|
||||
# vdom: root
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_device_group.add_device_group(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -2
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_device_group.add_device_group(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_device_group.add_device_group(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -2
|
||||
# Test using fixture 4 #
|
||||
output = fmgr_device_group.add_device_group(fmg_instance, fixture_data[3]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -2
|
||||
|
||||
|
||||
def test_delete_device_group(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# grp_desc: CreatedbyAnsible
|
||||
# adom: ansible
|
||||
# grp_members: None
|
||||
# mode: delete
|
||||
# grp_name: TestGroup
|
||||
# vdom: root
|
||||
##################################################
|
||||
##################################################
|
||||
# grp_desc: CreatedbyAnsible
|
||||
# adom: ansible
|
||||
# grp_members: None
|
||||
# mode: delete
|
||||
# grp_name: testtest
|
||||
# vdom: root
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_device_group.delete_device_group(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_device_group.delete_device_group(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
||||
|
||||
def test_add_group_member(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# grp_desc: None
|
||||
# adom: ansible
|
||||
# grp_members: FGT1
|
||||
# mode: add
|
||||
# grp_name: TestGroup
|
||||
# vdom: root
|
||||
##################################################
|
||||
##################################################
|
||||
# grp_desc: None
|
||||
# adom: ansible
|
||||
# grp_members: FGT3
|
||||
# mode: add
|
||||
# grp_name: testtest
|
||||
# vdom: root
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_device_group.add_group_member(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_device_group.add_group_member(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
||||
|
||||
def test_delete_group_member(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# grp_desc: None
|
||||
# adom: ansible
|
||||
# grp_members: FGT3
|
||||
# mode: delete
|
||||
# grp_name: testtest
|
||||
# vdom: root
|
||||
##################################################
|
||||
##################################################
|
||||
# grp_desc: None
|
||||
# adom: ansible
|
||||
# grp_members: FGT1
|
||||
# mode: delete
|
||||
# grp_name: TestGroup
|
||||
# vdom: root
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_device_group.delete_group_member(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_device_group.delete_group_member(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,156 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_fwobj_address
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_fwobj_address.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_fwobj_ipv4(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -3
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 4 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[3]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -3
|
||||
# Test using fixture 5 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[4]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 6 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[5]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -3
|
||||
# Test using fixture 7 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[6]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 8 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[7]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 9 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[8]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 10 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[9]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 11 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[10]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -3
|
||||
# Test using fixture 12 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[11]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 13 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[12]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 14 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[13]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 15 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[14]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 16 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[15]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 17 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[16]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -3
|
||||
# Test using fixture 18 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv4(fmg_instance, fixture_data[17]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
||||
|
||||
def test_fmgr_fwobj_ipv6(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv6(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -3
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv6(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -3
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv6(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 4 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv6(fmg_instance, fixture_data[3]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 5 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_ipv6(fmg_instance, fixture_data[4]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -10131
|
||||
|
||||
|
||||
def test_fmgr_fwobj_multicast(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_multicast(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_multicast(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_fwobj_address.fmgr_fwobj_multicast(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_fwobj_ippool
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_fwobj_ippool.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_fwobj_ippool_modify(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_fwobj_ippool.fmgr_fwobj_ippool_modify(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_fwobj_ippool.fmgr_fwobj_ippool_modify(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_fwobj_ippool.fmgr_fwobj_ippool_modify(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 4 #
|
||||
output = fmgr_fwobj_ippool.fmgr_fwobj_ippool_modify(fmg_instance, fixture_data[3]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 5 #
|
||||
output = fmgr_fwobj_ippool.fmgr_fwobj_ippool_modify(fmg_instance, fixture_data[4]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 6 #
|
||||
output = fmgr_fwobj_ippool.fmgr_fwobj_ippool_modify(fmg_instance, fixture_data[5]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 7 #
|
||||
output = fmgr_fwobj_ippool.fmgr_fwobj_ippool_modify(fmg_instance, fixture_data[6]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 8 #
|
||||
output = fmgr_fwobj_ippool.fmgr_fwobj_ippool_modify(fmg_instance, fixture_data[7]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_fwobj_ippool6
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_fwobj_ippool6.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_fwobj_ippool6_modify(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_fwobj_ippool6.fmgr_fwobj_ippool6_modify(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_fwobj_ippool6.fmgr_fwobj_ippool6_modify(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_fwobj_service
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_fwobj_service.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_fwobj_service_custom(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_fwobj_service.fmgr_fwobj_service_custom(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_fwobj_service.fmgr_fwobj_service_custom(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_fwobj_service.fmgr_fwobj_service_custom(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 4 #
|
||||
output = fmgr_fwobj_service.fmgr_fwobj_service_custom(fmg_instance, fixture_data[3]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 5 #
|
||||
output = fmgr_fwobj_service.fmgr_fwobj_service_custom(fmg_instance, fixture_data[4]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 6 #
|
||||
output = fmgr_fwobj_service.fmgr_fwobj_service_custom(fmg_instance, fixture_data[5]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 7 #
|
||||
output = fmgr_fwobj_service.fmgr_fwobj_service_custom(fmg_instance, fixture_data[6]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 8 #
|
||||
output = fmgr_fwobj_service.fmgr_fwobj_service_custom(fmg_instance, fixture_data[7]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 9 #
|
||||
output = fmgr_fwobj_service.fmgr_fwobj_service_custom(fmg_instance, fixture_data[8]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 10 #
|
||||
output = fmgr_fwobj_service.fmgr_fwobj_service_custom(fmg_instance, fixture_data[9]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 11 #
|
||||
output = fmgr_fwobj_service.fmgr_fwobj_service_custom(fmg_instance, fixture_data[10]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 12 #
|
||||
output = fmgr_fwobj_service.fmgr_fwobj_service_custom(fmg_instance, fixture_data[11]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
||||
|
||||
def test_fmgr_fwobj_service_group(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_fwobj_service.fmgr_fwobj_service_group(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -3
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_fwobj_service.fmgr_fwobj_service_group(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -10131
|
||||
|
||||
|
||||
def test_fmgr_fwobj_service_category(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_fwobj_service.fmgr_fwobj_service_category(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -2
|
||||
|
|
@ -0,0 +1,785 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_fwobj_vip
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_fwobj_vip.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_firewall_vip_modify(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# comment: Created by Ansible
|
||||
# ssl-send-empty-frags: None
|
||||
# srcintf-filter: None
|
||||
# ssl-max-version: None
|
||||
# ssl-server-session-state-max: None
|
||||
# ssl-hpkp: None
|
||||
# mapped-addr: None
|
||||
# ssl-client-session-state-timeout: None
|
||||
# src-filter: None
|
||||
# server-type: None
|
||||
# ssl-hpkp-include-subdomains: None
|
||||
# ssl-http-location-conversion: None
|
||||
# https-cookie-secure: None
|
||||
# mappedip: 10.7.220.25
|
||||
# ssl-server-cipher-suites: {'priority': None, 'cipher': None, 'versions': None}
|
||||
# protocol: tcp
|
||||
# ssl-hpkp-backup: None
|
||||
# ssl-dh-bits: None
|
||||
# dns-mapping-ttl: None
|
||||
# ssl-hsts-age: None
|
||||
# extaddr: None
|
||||
# ssl-client-renegotiation: None
|
||||
# monitor: None
|
||||
# service: None
|
||||
# ssl-hpkp-age: None
|
||||
# http-cookie-age: None
|
||||
# weblogic-server: None
|
||||
# http-cookie-share: None
|
||||
# color: 17
|
||||
# ssl-mode: None
|
||||
# portforward: enable
|
||||
# http-multiplex: None
|
||||
# http-cookie-generation: None
|
||||
# ssl-client-fallback: None
|
||||
# extip: 82.72.192.185
|
||||
# extintf: any
|
||||
# persistence: None
|
||||
# websphere-server: None
|
||||
# nat-source-vip: None
|
||||
# portmapping-type: None
|
||||
|
||||
# adom: ansible
|
||||
# ssl-client-session-state-max: None
|
||||
# http-ip-header: None
|
||||
# http-ip-header-name: None
|
||||
# ssl-certificate: None
|
||||
# ssl-hsts: None
|
||||
# arp-reply: None
|
||||
# ssl-hsts-include-subdomains: None
|
||||
# ssl-min-version: None
|
||||
# ldb-method: None
|
||||
# ssl-server-session-state-timeout: None
|
||||
# ssl-server-min-version: None
|
||||
# http-cookie-domain: None
|
||||
# mappedport: 443
|
||||
# name: Basic PNAT Map Port 10443
|
||||
# ssl-cipher-suites: {'cipher': None, 'versions': None}
|
||||
# ssl-hpkp-primary: None
|
||||
# outlook-web-access: None
|
||||
# ssl-server-session-state-type: None
|
||||
# ssl-client-session-state-type: None
|
||||
|
||||
# ssl-http-match-host: None
|
||||
|
||||
# ssl-server-max-version: None
|
||||
# ssl-hpkp-report-uri: None
|
||||
# http-cookie-domain-from-host: None
|
||||
# ssl-algorithm: None
|
||||
# gratuitous-arp-interval: None
|
||||
# extport: 10443
|
||||
# max-embryonic-connections: None
|
||||
# mode: set
|
||||
# http-cookie-path: None
|
||||
# ssl-pfs: None
|
||||
# ssl-server-algorithm: None
|
||||
##################################################
|
||||
##################################################
|
||||
# comment: Created by Ansible
|
||||
# ssl-send-empty-frags: None
|
||||
# srcintf-filter: None
|
||||
# ssl-max-version: None
|
||||
# ssl-server-session-state-max: None
|
||||
# ssl-hpkp: None
|
||||
# ssl-hsts-include-subdomains: None
|
||||
# mapped-addr: None
|
||||
# src-filter: None
|
||||
# server-type: None
|
||||
# mode: set
|
||||
# ssl-hpkp-include-subdomains: None
|
||||
# ssl-http-location-conversion: None
|
||||
# https-cookie-secure: None
|
||||
# mappedip: 3.3.3.0/24, 4.0.0.0/24
|
||||
# ssl-server-cipher-suites: {'priority': None, 'cipher': None, 'versions': None}
|
||||
# protocol: None
|
||||
# ssl-hpkp-backup: None
|
||||
# ssl-dh-bits: None
|
||||
# dns-mapping-ttl: None
|
||||
# ssl-hsts-age: None
|
||||
# ssl-client-renegotiation: None
|
||||
# monitor: None
|
||||
# service: None
|
||||
# ssl-hpkp-age: None
|
||||
# http-cookie-age: None
|
||||
# adom: ansible
|
||||
# http-cookie-share: None
|
||||
# ssl-server-session-state-timeout: None
|
||||
# color: 12
|
||||
# ssl-mode: None
|
||||
# portforward: None
|
||||
# http-cookie-generation: None
|
||||
# max-embryonic-connections: None
|
||||
# ssl-client-fallback: None
|
||||
# ssl-hpkp-report-uri: None
|
||||
# extip: 192.168.0.1-192.168.0.100
|
||||
# extintf: dmz
|
||||
# persistence: None
|
||||
# websphere-server: None
|
||||
# nat-source-vip: None
|
||||
# portmapping-type: None
|
||||
# http-ip-header-name: None
|
||||
# weblogic-server: None
|
||||
# ssl-client-session-state-max: None
|
||||
# http-ip-header: None
|
||||
|
||||
# ssl-hsts: None
|
||||
# arp-reply: None
|
||||
# extaddr: None
|
||||
# ssl-min-version: None
|
||||
# ldb-method: None
|
||||
# ssl-certificate: None
|
||||
# ssl-server-min-version: None
|
||||
# http-cookie-domain: None
|
||||
# mappedport: None
|
||||
# outlook-web-access: None
|
||||
# ssl-cipher-suites: {'cipher': None, 'versions': None}
|
||||
# ssl-hpkp-primary: None
|
||||
# name: Basic DNS Translation
|
||||
# ssl-server-session-state-type: None
|
||||
# ssl-client-session-state-type: None
|
||||
|
||||
# ssl-http-match-host: None
|
||||
|
||||
# ssl-pfs: None
|
||||
# ssl-server-max-version: None
|
||||
# ssl-client-session-state-timeout: None
|
||||
# http-cookie-domain-from-host: None
|
||||
# extport: None
|
||||
# ssl-server-algorithm: None
|
||||
# gratuitous-arp-interval: None
|
||||
# http-cookie-path: None
|
||||
# ssl-algorithm: None
|
||||
# http-multiplex: None
|
||||
##################################################
|
||||
##################################################
|
||||
# comment: Created by Ansible
|
||||
# ssl-send-empty-frags: None
|
||||
# srcintf-filter: None
|
||||
# ssl-max-version: None
|
||||
# ssl-server-session-state-max: None
|
||||
# ssl-hpkp: None
|
||||
# mapped-addr: google-play
|
||||
# ssl-client-session-state-timeout: None
|
||||
# src-filter: None
|
||||
# ldb-method: None
|
||||
# server-type: None
|
||||
# ssl-hpkp-include-subdomains: None
|
||||
# ssl-client-renegotiation: None
|
||||
# ssl-http-location-conversion: None
|
||||
# https-cookie-secure: None
|
||||
# mappedip: None
|
||||
# ssl-server-cipher-suites: {'priority': None, 'cipher': None, 'versions': None}
|
||||
# protocol: None
|
||||
# ssl-hpkp-backup: None
|
||||
# ssl-dh-bits: None
|
||||
# dns-mapping-ttl: None
|
||||
# ssl-hsts-age: None
|
||||
# extaddr: None
|
||||
# monitor: None
|
||||
# service: None
|
||||
# ssl-hpkp-age: None
|
||||
# http-cookie-age: None
|
||||
# weblogic-server: None
|
||||
# http-cookie-share: None
|
||||
# color: 5
|
||||
# ssl-mode: None
|
||||
# portforward: None
|
||||
# http-cookie-generation: None
|
||||
# ssl-client-fallback: None
|
||||
# extip: None
|
||||
# extintf: None
|
||||
# persistence: None
|
||||
# websphere-server: None
|
||||
# nat-source-vip: None
|
||||
# portmapping-type: None
|
||||
|
||||
# adom: ansible
|
||||
# ssl-client-session-state-max: None
|
||||
# http-ip-header: None
|
||||
# http-ip-header-name: None
|
||||
# ssl-certificate: None
|
||||
# ssl-hsts: None
|
||||
# arp-reply: None
|
||||
# extport: None
|
||||
# ssl-min-version: None
|
||||
# ssl-server-algorithm: None
|
||||
# ssl-server-session-state-timeout: None
|
||||
# ssl-server-min-version: None
|
||||
# http-cookie-domain: None
|
||||
# mappedport: None
|
||||
# name: Basic FQDN Translation
|
||||
# ssl-cipher-suites: {'cipher': None, 'versions': None}
|
||||
# ssl-hpkp-primary: None
|
||||
# outlook-web-access: None
|
||||
# ssl-server-session-state-type: None
|
||||
# ssl-client-session-state-type: None
|
||||
|
||||
# ssl-http-match-host: None
|
||||
|
||||
# ssl-server-max-version: None
|
||||
# ssl-hpkp-report-uri: None
|
||||
# http-cookie-domain-from-host: None
|
||||
# ssl-algorithm: None
|
||||
# gratuitous-arp-interval: None
|
||||
# ssl-hsts-include-subdomains: None
|
||||
# max-embryonic-connections: None
|
||||
# mode: set
|
||||
# http-cookie-path: None
|
||||
# ssl-pfs: None
|
||||
# http-multiplex: None
|
||||
##################################################
|
||||
##################################################
|
||||
# comment: Created by Ansible
|
||||
# ssl-send-empty-frags: None
|
||||
# srcintf-filter: None
|
||||
# ssl-max-version: None
|
||||
# ssl-server-session-state-max: None
|
||||
# ssl-hpkp: None
|
||||
# mapped-addr: None
|
||||
# src-filter: None
|
||||
# server-type: None
|
||||
# mode: set
|
||||
# ssl-hpkp-include-subdomains: None
|
||||
# extport: None
|
||||
# ssl-http-location-conversion: None
|
||||
# https-cookie-secure: None
|
||||
# mappedip: 10.7.220.25
|
||||
# ssl-server-cipher-suites: {'priority': None, 'cipher': None, 'versions': None}
|
||||
# protocol: None
|
||||
# ssl-hpkp-backup: None
|
||||
# ssl-dh-bits: None
|
||||
# dns-mapping-ttl: None
|
||||
# ssl-hsts-age: None
|
||||
# ssl-server-algorithm: None
|
||||
# extaddr: None
|
||||
# monitor: None
|
||||
# service: None
|
||||
# ssl-hpkp-age: None
|
||||
# http-cookie-age: None
|
||||
# adom: ansible
|
||||
# http-cookie-share: None
|
||||
# ssl-server-session-state-timeout: None
|
||||
# color: 17
|
||||
# ssl-mode: None
|
||||
# portforward: None
|
||||
# http-cookie-generation: None
|
||||
# max-embryonic-connections: None
|
||||
# ssl-client-fallback: None
|
||||
# ssl-hpkp-report-uri: None
|
||||
# extip: 82.72.192.185
|
||||
# extintf: any
|
||||
# persistence: None
|
||||
# websphere-server: None
|
||||
# nat-source-vip: None
|
||||
# portmapping-type: None
|
||||
# http-ip-header-name: None
|
||||
# weblogic-server: None
|
||||
# ssl-client-session-state-max: None
|
||||
# http-ip-header: None
|
||||
|
||||
# ssl-hsts: None
|
||||
# arp-reply: None
|
||||
# ssl-client-renegotiation: None
|
||||
# ssl-min-version: None
|
||||
# ldb-method: None
|
||||
# ssl-certificate: None
|
||||
# ssl-server-min-version: None
|
||||
# http-cookie-domain: None
|
||||
# mappedport: None
|
||||
# outlook-web-access: None
|
||||
# ssl-cipher-suites: {'cipher': None, 'versions': None}
|
||||
# ssl-hpkp-primary: None
|
||||
# name: Basic StaticNAT Map
|
||||
# ssl-server-session-state-type: None
|
||||
# ssl-client-session-state-type: None
|
||||
|
||||
# ssl-http-match-host: None
|
||||
|
||||
# ssl-pfs: None
|
||||
# ssl-client-session-state-timeout: None
|
||||
# http-cookie-domain-from-host: None
|
||||
# ssl-hsts-include-subdomains: None
|
||||
# ssl-server-max-version: None
|
||||
# gratuitous-arp-interval: None
|
||||
# http-cookie-path: None
|
||||
# ssl-algorithm: None
|
||||
# http-multiplex: None
|
||||
##################################################
|
||||
##################################################
|
||||
# comment: Created by Ansible
|
||||
# ssl-send-empty-frags: None
|
||||
# srcintf-filter: None
|
||||
# ssl-max-version: None
|
||||
# ssl-server-session-state-max: None
|
||||
# ssl-hpkp: None
|
||||
# mapped-addr: None
|
||||
# ssl-client-session-state-timeout: None
|
||||
# src-filter: None
|
||||
# server-type: None
|
||||
# ssl-hpkp-include-subdomains: None
|
||||
# ssl-client-renegotiation: None
|
||||
# ssl-http-location-conversion: None
|
||||
# https-cookie-secure: None
|
||||
# mappedip: 10.7.220.25
|
||||
# ssl-server-cipher-suites: {'priority': None, 'cipher': None, 'versions': None}
|
||||
# protocol: tcp
|
||||
# ssl-hpkp-backup: None
|
||||
# ssl-dh-bits: None
|
||||
# dns-mapping-ttl: None
|
||||
# ssl-hsts-age: None
|
||||
# extaddr: None
|
||||
# monitor: None
|
||||
# service: None
|
||||
# ssl-hpkp-age: None
|
||||
# http-cookie-age: None
|
||||
# weblogic-server: None
|
||||
# http-cookie-share: None
|
||||
# color: 17
|
||||
# ssl-mode: None
|
||||
# portforward: enable
|
||||
# http-cookie-generation: None
|
||||
# ssl-client-fallback: None
|
||||
# extip: 82.72.192.185
|
||||
# extintf: any
|
||||
# persistence: None
|
||||
# websphere-server: None
|
||||
# nat-source-vip: None
|
||||
# portmapping-type: None
|
||||
|
||||
# adom: ansible
|
||||
# ssl-client-session-state-max: None
|
||||
# http-ip-header: None
|
||||
# http-ip-header-name: None
|
||||
# ssl-min-version: None
|
||||
# ssl-certificate: None
|
||||
# ssl-hsts: None
|
||||
# arp-reply: None
|
||||
# ssl-hsts-include-subdomains: None
|
||||
# http-multiplex: None
|
||||
# ldb-method: None
|
||||
# ssl-server-session-state-timeout: None
|
||||
# ssl-server-min-version: None
|
||||
# http-cookie-domain: None
|
||||
# mappedport: 443
|
||||
# name: Basic PNAT Map Port 10443
|
||||
# ssl-cipher-suites: {'cipher': None, 'versions': None}
|
||||
# ssl-hpkp-primary: None
|
||||
# outlook-web-access: None
|
||||
# ssl-server-session-state-type: None
|
||||
# ssl-client-session-state-type: None
|
||||
|
||||
# ssl-http-match-host: None
|
||||
|
||||
# ssl-server-max-version: None
|
||||
# ssl-hpkp-report-uri: None
|
||||
# http-cookie-domain-from-host: None
|
||||
# ssl-algorithm: None
|
||||
# gratuitous-arp-interval: None
|
||||
# extport: 10443
|
||||
# max-embryonic-connections: None
|
||||
# mode: set
|
||||
# http-cookie-path: None
|
||||
# ssl-pfs: None
|
||||
# ssl-server-algorithm: None
|
||||
##################################################
|
||||
##################################################
|
||||
# comment: None
|
||||
# ssl-send-empty-frags: None
|
||||
# srcintf-filter: None
|
||||
# ssl-max-version: None
|
||||
# ssl-server-session-state-max: None
|
||||
# ssl-hpkp: None
|
||||
# ssl-hsts-include-subdomains: None
|
||||
# mapped-addr: None
|
||||
# src-filter: None
|
||||
# server-type: None
|
||||
# mode: delete
|
||||
# ssl-hpkp-include-subdomains: None
|
||||
# ssl-http-location-conversion: None
|
||||
# https-cookie-secure: None
|
||||
# mappedip: None
|
||||
# ssl-server-cipher-suites: {'priority': None, 'cipher': None, 'versions': None}
|
||||
# protocol: None
|
||||
# ssl-hpkp-backup: None
|
||||
# ssl-dh-bits: None
|
||||
# dns-mapping-ttl: None
|
||||
# ssl-hsts-age: None
|
||||
# extaddr: None
|
||||
# monitor: None
|
||||
# service: None
|
||||
# ssl-hpkp-age: None
|
||||
# http-cookie-age: None
|
||||
# adom: ansible
|
||||
# http-cookie-share: None
|
||||
# ssl-server-session-state-timeout: None
|
||||
# color: None
|
||||
# ssl-mode: None
|
||||
# portforward: None
|
||||
# http-cookie-generation: None
|
||||
# max-embryonic-connections: None
|
||||
# ssl-client-fallback: None
|
||||
# ssl-hpkp-report-uri: None
|
||||
# extip: None
|
||||
# extintf: None
|
||||
# persistence: None
|
||||
# websphere-server: None
|
||||
# nat-source-vip: None
|
||||
# portmapping-type: None
|
||||
# http-ip-header-name: None
|
||||
# weblogic-server: None
|
||||
# ssl-client-session-state-max: None
|
||||
# http-ip-header: None
|
||||
|
||||
# ssl-hsts: None
|
||||
# arp-reply: None
|
||||
# ssl-client-renegotiation: None
|
||||
# http-multiplex: None
|
||||
# ldb-method: None
|
||||
# ssl-certificate: None
|
||||
# ssl-server-min-version: None
|
||||
# http-cookie-domain: None
|
||||
# mappedport: None
|
||||
# outlook-web-access: None
|
||||
# ssl-cipher-suites: {'cipher': None, 'versions': None}
|
||||
# ssl-hpkp-primary: None
|
||||
# name: Basic PNAT Map Port 10443
|
||||
# ssl-server-session-state-type: None
|
||||
# ssl-client-session-state-type: None
|
||||
|
||||
# ssl-http-match-host: None
|
||||
|
||||
# ssl-pfs: None
|
||||
# ssl-server-max-version: None
|
||||
# ssl-client-session-state-timeout: None
|
||||
# http-cookie-domain-from-host: None
|
||||
# extport: None
|
||||
# ssl-server-algorithm: None
|
||||
# gratuitous-arp-interval: None
|
||||
# http-cookie-path: None
|
||||
# ssl-algorithm: None
|
||||
# ssl-min-version: None
|
||||
##################################################
|
||||
##################################################
|
||||
# comment: None
|
||||
# ssl-send-empty-frags: None
|
||||
# srcintf-filter: None
|
||||
# ssl-max-version: None
|
||||
# ssl-server-session-state-max: None
|
||||
# mappedip: None
|
||||
# mapped-addr: None
|
||||
# ssl-client-session-state-timeout: None
|
||||
# src-filter: None
|
||||
# ldb-method: None
|
||||
# server-type: None
|
||||
# ssl-hpkp-include-subdomains: None
|
||||
# ssl-http-location-conversion: None
|
||||
# https-cookie-secure: None
|
||||
# ssl-hpkp: None
|
||||
# ssl-server-cipher-suites: {'priority': None, 'cipher': None, 'versions': None}
|
||||
# protocol: None
|
||||
# ssl-hpkp-backup: None
|
||||
# ssl-dh-bits: None
|
||||
# dns-mapping-ttl: None
|
||||
# ssl-hsts-age: None
|
||||
# extaddr: None
|
||||
# ssl-client-renegotiation: None
|
||||
# monitor: None
|
||||
# service: None
|
||||
# ssl-hpkp-age: None
|
||||
# http-cookie-age: None
|
||||
# weblogic-server: None
|
||||
# http-cookie-share: None
|
||||
# color: None
|
||||
# ssl-mode: None
|
||||
# portforward: None
|
||||
# http-cookie-generation: None
|
||||
# ssl-client-fallback: None
|
||||
# extip: None
|
||||
# extintf: None
|
||||
# persistence: None
|
||||
# websphere-server: None
|
||||
# nat-source-vip: None
|
||||
# portmapping-type: None
|
||||
|
||||
# adom: ansible
|
||||
# ssl-client-session-state-max: None
|
||||
# http-ip-header: None
|
||||
# http-ip-header-name: None
|
||||
# ssl-certificate: None
|
||||
# ssl-hsts: None
|
||||
# arp-reply: None
|
||||
# extport: None
|
||||
# http-multiplex: None
|
||||
# ssl-server-algorithm: None
|
||||
# ssl-server-session-state-timeout: None
|
||||
# ssl-server-min-version: None
|
||||
# http-cookie-domain: None
|
||||
# mappedport: None
|
||||
# name: Basic StaticNAT Map
|
||||
# ssl-cipher-suites: {'cipher': None, 'versions': None}
|
||||
# ssl-hpkp-primary: None
|
||||
# outlook-web-access: None
|
||||
# ssl-server-session-state-type: None
|
||||
# ssl-client-session-state-type: None
|
||||
|
||||
# ssl-http-match-host: None
|
||||
|
||||
# ssl-server-max-version: None
|
||||
# ssl-hpkp-report-uri: None
|
||||
# http-cookie-domain-from-host: None
|
||||
# ssl-algorithm: None
|
||||
# gratuitous-arp-interval: None
|
||||
# ssl-hsts-include-subdomains: None
|
||||
# max-embryonic-connections: None
|
||||
# mode: delete
|
||||
# http-cookie-path: None
|
||||
# ssl-pfs: None
|
||||
# ssl-min-version: None
|
||||
##################################################
|
||||
##################################################
|
||||
# comment: None
|
||||
# ssl-send-empty-frags: None
|
||||
# srcintf-filter: None
|
||||
# ssl-max-version: None
|
||||
# ssl-server-session-state-max: None
|
||||
# mappedip: None
|
||||
# mapped-addr: None
|
||||
# src-filter: None
|
||||
# server-type: None
|
||||
# mode: delete
|
||||
# ssl-hpkp-include-subdomains: None
|
||||
# extport: None
|
||||
# ssl-http-location-conversion: None
|
||||
# https-cookie-secure: None
|
||||
# ssl-hpkp: None
|
||||
# ssl-server-cipher-suites: {'priority': None, 'cipher': None, 'versions': None}
|
||||
# protocol: None
|
||||
# ssl-hpkp-backup: None
|
||||
# ssl-dh-bits: None
|
||||
# dns-mapping-ttl: None
|
||||
# ssl-hsts-age: None
|
||||
# ssl-server-algorithm: None
|
||||
# ssl-client-renegotiation: None
|
||||
# monitor: None
|
||||
# service: None
|
||||
# ssl-hpkp-age: None
|
||||
# http-cookie-age: None
|
||||
# adom: ansible
|
||||
# http-cookie-share: None
|
||||
# ssl-server-session-state-timeout: None
|
||||
# color: None
|
||||
# ssl-mode: None
|
||||
# portforward: None
|
||||
# http-multiplex: None
|
||||
# http-cookie-generation: None
|
||||
# max-embryonic-connections: None
|
||||
# ssl-client-fallback: None
|
||||
# ssl-hpkp-report-uri: None
|
||||
# extip: None
|
||||
# extintf: None
|
||||
# persistence: None
|
||||
# websphere-server: None
|
||||
# nat-source-vip: None
|
||||
# portmapping-type: None
|
||||
# http-ip-header-name: None
|
||||
# weblogic-server: None
|
||||
# ssl-client-session-state-max: None
|
||||
# http-ip-header: None
|
||||
# ssl-hsts: None
|
||||
# arp-reply: None
|
||||
# extaddr: None
|
||||
# ssl-hpkp-primary: None
|
||||
# ldb-method: None
|
||||
# ssl-certificate: None
|
||||
# ssl-server-min-version: None
|
||||
# http-cookie-domain: None
|
||||
# mappedport: None
|
||||
# outlook-web-access: None
|
||||
# ssl-cipher-suites: {'cipher': None, 'versions': None}
|
||||
# ssl-client-session-state-type: None
|
||||
# name: Basic DNS Translation
|
||||
# ssl-server-session-state-type: None
|
||||
|
||||
# ssl-http-match-host: None
|
||||
# ssl-pfs: None
|
||||
# ssl-client-session-state-timeout: None
|
||||
# http-cookie-domain-from-host: None
|
||||
# ssl-hsts-include-subdomains: None
|
||||
# ssl-server-max-version: None
|
||||
# gratuitous-arp-interval: None
|
||||
# http-cookie-path: None
|
||||
# ssl-algorithm: None
|
||||
# ssl-min-version: None
|
||||
##################################################
|
||||
##################################################
|
||||
# ldb-method: None
|
||||
# ssl-send-empty-frags: None
|
||||
# srcintf-filter: None
|
||||
# ssl-max-version: None
|
||||
# ssl-server-session-state-max: None
|
||||
# mappedip: None
|
||||
# ssl-hsts: None
|
||||
# mapped-addr: None
|
||||
# src-filter: None
|
||||
# server-type: None
|
||||
# ssl-hpkp-include-subdomains: None
|
||||
# ssl-client-renegotiation: None
|
||||
# ssl-http-location-conversion: None
|
||||
# https-cookie-secure: None
|
||||
# extip: None
|
||||
# ssl-hpkp: None
|
||||
# ssl-server-cipher-suites: {'priority': None, 'cipher': None, 'versions': None}
|
||||
# protocol: None
|
||||
# ssl-hpkp-backup: None
|
||||
# ssl-dh-bits: None
|
||||
# dns-mapping-ttl: None
|
||||
# ssl-hsts-age: None
|
||||
# extaddr: None
|
||||
# ssl-hpkp-primary: None
|
||||
# monitor: None
|
||||
# service: None
|
||||
# ssl-hpkp-age: None
|
||||
# http-cookie-age: None
|
||||
# weblogic-server: None
|
||||
# http-cookie-share: None
|
||||
# name: Basic FQDN Translation
|
||||
# color: None
|
||||
# ssl-mode: None
|
||||
# portforward: None
|
||||
# http-cookie-generation: None
|
||||
# ssl-client-fallback: None
|
||||
|
||||
# http-ip-header: None
|
||||
# persistence: None
|
||||
# websphere-server: None
|
||||
# nat-source-vip: None
|
||||
# portmapping-type: None
|
||||
# adom: ansible
|
||||
# ssl-client-session-state-max: None
|
||||
# extintf: None
|
||||
# ssl-server-max-version: None
|
||||
# http-ip-header-name: None
|
||||
# ssl-certificate: None
|
||||
# ssl-server-session-state-type: None
|
||||
# arp-reply: None
|
||||
# ssl-hsts-include-subdomains: None
|
||||
# ssl-min-version: None
|
||||
# ssl-server-algorithm: None
|
||||
# ssl-server-session-state-timeout: None
|
||||
# ssl-server-min-version: None
|
||||
# http-cookie-domain: None
|
||||
# mappedport: None
|
||||
# outlook-web-access: None
|
||||
# ssl-cipher-suites: {'cipher': None, 'versions': None}
|
||||
# ssl-client-session-state-type: None
|
||||
# ssl-http-match-host: None
|
||||
|
||||
# ssl-client-session-state-timeout: None
|
||||
# comment: None
|
||||
# ssl-hpkp-report-uri: None
|
||||
# http-cookie-domain-from-host: None
|
||||
# ssl-algorithm: None
|
||||
# gratuitous-arp-interval: None
|
||||
# extport: None
|
||||
# max-embryonic-connections: None
|
||||
# mode: delete
|
||||
# http-cookie-path: None
|
||||
# ssl-pfs: None
|
||||
# http-multiplex: None
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_fwobj_vip.fmgr_firewall_vip_modify(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_fwobj_vip.fmgr_firewall_vip_modify(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -10131
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_fwobj_vip.fmgr_firewall_vip_modify(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 4 #
|
||||
output = fmgr_fwobj_vip.fmgr_firewall_vip_modify(fmg_instance, fixture_data[3]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 5 #
|
||||
output = fmgr_fwobj_vip.fmgr_firewall_vip_modify(fmg_instance, fixture_data[4]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 6 #
|
||||
output = fmgr_fwobj_vip.fmgr_firewall_vip_modify(fmg_instance, fixture_data[5]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 7 #
|
||||
output = fmgr_fwobj_vip.fmgr_firewall_vip_modify(fmg_instance, fixture_data[6]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 8 #
|
||||
output = fmgr_fwobj_vip.fmgr_firewall_vip_modify(fmg_instance, fixture_data[7]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -3
|
||||
# Test using fixture 9 #
|
||||
output = fmgr_fwobj_vip.fmgr_firewall_vip_modify(fmg_instance, fixture_data[8]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
|
@ -0,0 +1,596 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_fwpol_ipv4
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_fwpol_ipv4.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_firewall_policy_modify(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# wanopt-passive-opt: None
|
||||
# package_name: default
|
||||
# wanopt-detection: None
|
||||
# scan-botnet-connections: None
|
||||
# profile-group: None
|
||||
# wanopt-peer: None
|
||||
# dscp-match: None
|
||||
# replacemsg-override-group: None
|
||||
# internet-service-negate: None
|
||||
# np-acceleration: None
|
||||
# learning-mode: None
|
||||
# session-ttl: None
|
||||
# ntlm-guest: None
|
||||
# ips-sensor: None
|
||||
# diffservcode-rev: None
|
||||
# match-vip: None
|
||||
# natip: None
|
||||
# dlp-sensor: None
|
||||
# traffic-shaper: None
|
||||
# groups: None
|
||||
# schedule-timeout: None
|
||||
# name: Basic_IPv4_Policy
|
||||
# tcp-session-without-syn: None
|
||||
# ntlm: None
|
||||
# permit-stun-host: None
|
||||
# diffservcode-forward: None
|
||||
# internet-service-src-custom: None
|
||||
# mode: set
|
||||
# disclaimer: None
|
||||
# rtp-nat: None
|
||||
# auth-cert: None
|
||||
# timeout-send-rst: None
|
||||
# auth-redirect-addr: None
|
||||
# ssl-mirror-intf: None
|
||||
# identity-based-route: None
|
||||
# natoutbound: None
|
||||
# wanopt-profile: None
|
||||
# per-ip-shaper: None
|
||||
# profile-protocol-options: None
|
||||
# diffserv-forward: None
|
||||
# poolname: None
|
||||
# comments: Created by Ansible
|
||||
# label: None
|
||||
# global-label: None
|
||||
# firewall-session-dirty: None
|
||||
# wanopt: None
|
||||
# schedule: always
|
||||
# internet-service-id: None
|
||||
# auth-path: None
|
||||
# vlan-cos-fwd: None
|
||||
# custom-log-fields: None
|
||||
# dstintf: any
|
||||
# srcintf: any
|
||||
# block-notification: None
|
||||
# internet-service-src-id: None
|
||||
# redirect-url: None
|
||||
# waf-profile: None
|
||||
# ntlm-enabled-browsers: None
|
||||
# dscp-negate: None
|
||||
# action: accept
|
||||
# fsso-agent-for-ntlm: None
|
||||
# logtraffic: utm
|
||||
# vlan-filter: None
|
||||
# policyid: None
|
||||
# logtraffic-start: None
|
||||
# webcache-https: None
|
||||
# webfilter-profile: None
|
||||
# internet-service-src: None
|
||||
# webcache: None
|
||||
# utm-status: None
|
||||
# vpn_src_node: {'subnet': None, 'host': None, 'seq': None}
|
||||
# ippool: None
|
||||
# service: ALL
|
||||
# wccp: None
|
||||
# auto-asic-offload: None
|
||||
# dscp-value: None
|
||||
# url-category: None
|
||||
# capture-packet: None
|
||||
# adom: ansible
|
||||
# inbound: None
|
||||
# internet-service: None
|
||||
# profile-type: None
|
||||
# ssl-mirror: None
|
||||
# srcaddr-negate: None
|
||||
# gtp-profile: None
|
||||
# mms-profile: None
|
||||
# send-deny-packet: None
|
||||
# devices: None
|
||||
# permit-any-host: None
|
||||
# av-profile: None
|
||||
# internet-service-src-negate: None
|
||||
# service-negate: None
|
||||
# rsso: None
|
||||
# app-group: None
|
||||
# tcp-mss-sender: None
|
||||
# natinbound: None
|
||||
# fixedport: None
|
||||
# ssl-ssh-profile: None
|
||||
# outbound: None
|
||||
# spamfilter-profile: None
|
||||
# application-list: None
|
||||
# application: None
|
||||
# dnsfilter-profile: None
|
||||
# nat: None
|
||||
# fsso: None
|
||||
# vlan-cos-rev: None
|
||||
# status: None
|
||||
# dsri: None
|
||||
# users: None
|
||||
# voip-profile: None
|
||||
# dstaddr-negate: None
|
||||
# traffic-shaper-reverse: None
|
||||
# internet-service-custom: None
|
||||
# diffserv-reverse: None
|
||||
# srcaddr: all
|
||||
# ssh-filter-profile: None
|
||||
# delay-tcp-npu-session: None
|
||||
# icap-profile: None
|
||||
# captive-portal-exempt: None
|
||||
# vpn_dst_node: {'subnet': None, 'host': None, 'seq': None}
|
||||
# app-category: None
|
||||
# rtp-addr: None
|
||||
# wsso: None
|
||||
# tcp-mss-receiver: None
|
||||
# dstaddr: all
|
||||
# radius-mac-auth-bypass: None
|
||||
# vpntunnel: None
|
||||
##################################################
|
||||
##################################################
|
||||
# package_name: default
|
||||
# wanopt-detection: None
|
||||
# scan-botnet-connections: None
|
||||
# profile-group: None
|
||||
# dlp-sensor: None
|
||||
# dscp-match: None
|
||||
# replacemsg-override-group: None
|
||||
# internet-service-negate: None
|
||||
# np-acceleration: None
|
||||
# learning-mode: None
|
||||
# session-ttl: None
|
||||
# ntlm-guest: None
|
||||
# ips-sensor: None
|
||||
# diffservcode-rev: None
|
||||
# match-vip: None
|
||||
# natip: None
|
||||
# wanopt-peer: None
|
||||
# traffic-shaper: None
|
||||
# groups: None
|
||||
# schedule-timeout: None
|
||||
# name: Basic_IPv4_Policy_2
|
||||
# tcp-session-without-syn: None
|
||||
# rtp-nat: None
|
||||
# permit-stun-host: None
|
||||
# natoutbound: None
|
||||
# internet-service-src-custom: None
|
||||
# mode: set
|
||||
# logtraffic: utm
|
||||
# ntlm: None
|
||||
# auth-cert: None
|
||||
# timeout-send-rst: None
|
||||
# auth-redirect-addr: None
|
||||
# ssl-mirror-intf: None
|
||||
# identity-based-route: None
|
||||
# diffservcode-forward: None
|
||||
# wanopt-profile: None
|
||||
# per-ip-shaper: None
|
||||
# users: None
|
||||
# diffserv-forward: None
|
||||
# poolname: None
|
||||
# comments: Created by Ansible
|
||||
# label: None
|
||||
# global-label: None
|
||||
# firewall-session-dirty: None
|
||||
# wanopt: None
|
||||
# schedule: always
|
||||
# internet-service-id: None
|
||||
# auth-path: None
|
||||
# vlan-cos-fwd: None
|
||||
# custom-log-fields: None
|
||||
# dstintf: any
|
||||
# srcintf: any
|
||||
# block-notification: None
|
||||
# internet-service-src-id: None
|
||||
# redirect-url: None
|
||||
# waf-profile: None
|
||||
# ntlm-enabled-browsers: None
|
||||
# dscp-negate: None
|
||||
# action: accept
|
||||
# fsso-agent-for-ntlm: None
|
||||
# disclaimer: None
|
||||
# vlan-filter: None
|
||||
# dstaddr-negate: None
|
||||
# logtraffic-start: None
|
||||
# webcache-https: None
|
||||
# webfilter-profile: None
|
||||
# internet-service-src: None
|
||||
# webcache: None
|
||||
# utm-status: None
|
||||
# vpn_src_node: {'subnet': None, 'host': None, 'seq': None}
|
||||
# ippool: None
|
||||
# service: HTTP, HTTPS
|
||||
# wccp: None
|
||||
# auto-asic-offload: None
|
||||
# dscp-value: None
|
||||
# url-category: None
|
||||
# capture-packet: None
|
||||
# adom: ansible
|
||||
# inbound: None
|
||||
# internet-service: None
|
||||
# profile-type: None
|
||||
# ssl-mirror: None
|
||||
# srcaddr-negate: None
|
||||
# gtp-profile: None
|
||||
# mms-profile: None
|
||||
# send-deny-packet: None
|
||||
# devices: None
|
||||
# permit-any-host: None
|
||||
# av-profile: None
|
||||
# internet-service-src-negate: None
|
||||
# service-negate: None
|
||||
# rsso: None
|
||||
# application-list: None
|
||||
# app-group: None
|
||||
# tcp-mss-sender: None
|
||||
# natinbound: None
|
||||
# fixedport: None
|
||||
# ssl-ssh-profile: None
|
||||
# outbound: None
|
||||
# spamfilter-profile: None
|
||||
# wanopt-passive-opt: None
|
||||
# application: None
|
||||
# dnsfilter-profile: None
|
||||
# nat: enable
|
||||
# fsso: None
|
||||
# vlan-cos-rev: None
|
||||
# status: None
|
||||
# dsri: None
|
||||
# profile-protocol-options: None
|
||||
# voip-profile: None
|
||||
# policyid: None
|
||||
# traffic-shaper-reverse: None
|
||||
# internet-service-custom: None
|
||||
# diffserv-reverse: None
|
||||
# srcaddr: all
|
||||
# dstaddr: google-play
|
||||
# delay-tcp-npu-session: None
|
||||
# icap-profile: None
|
||||
# captive-portal-exempt: None
|
||||
# vpn_dst_node: {'subnet': None, 'host': None, 'seq': None}
|
||||
# app-category: None
|
||||
# rtp-addr: None
|
||||
# wsso: None
|
||||
# tcp-mss-receiver: None
|
||||
# ssh-filter-profile: None
|
||||
# radius-mac-auth-bypass: None
|
||||
# vpntunnel: None
|
||||
##################################################
|
||||
##################################################
|
||||
# wanopt-passive-opt: None
|
||||
# package_name: default
|
||||
# wanopt-detection: None
|
||||
# scan-botnet-connections: None
|
||||
# profile-group: None
|
||||
# wanopt-peer: None
|
||||
# dscp-match: None
|
||||
# replacemsg-override-group: None
|
||||
# internet-service-negate: None
|
||||
# np-acceleration: None
|
||||
# learning-mode: None
|
||||
# session-ttl: None
|
||||
# ntlm-guest: None
|
||||
# ips-sensor: None
|
||||
# diffservcode-rev: None
|
||||
# match-vip: None
|
||||
# natip: None
|
||||
# dlp-sensor: None
|
||||
# traffic-shaper: None
|
||||
# groups: None
|
||||
# schedule-timeout: None
|
||||
# name: Basic_IPv4_Policy
|
||||
# tcp-session-without-syn: None
|
||||
# ntlm: None
|
||||
# permit-stun-host: None
|
||||
# diffservcode-forward: None
|
||||
# internet-service-src-custom: None
|
||||
# mode: delete
|
||||
# disclaimer: None
|
||||
# rtp-nat: None
|
||||
# auth-cert: None
|
||||
# timeout-send-rst: None
|
||||
# auth-redirect-addr: None
|
||||
# ssl-mirror-intf: None
|
||||
# identity-based-route: None
|
||||
# natoutbound: None
|
||||
# wanopt-profile: None
|
||||
# per-ip-shaper: None
|
||||
# profile-protocol-options: None
|
||||
# diffserv-forward: None
|
||||
# poolname: None
|
||||
# comments: None
|
||||
# label: None
|
||||
# global-label: None
|
||||
# firewall-session-dirty: None
|
||||
# wanopt: None
|
||||
# schedule: None
|
||||
# internet-service-id: None
|
||||
# auth-path: None
|
||||
# vlan-cos-fwd: None
|
||||
# custom-log-fields: None
|
||||
# dstintf: None
|
||||
# srcintf: None
|
||||
# block-notification: None
|
||||
# internet-service-src-id: None
|
||||
# redirect-url: None
|
||||
# waf-profile: None
|
||||
# ntlm-enabled-browsers: None
|
||||
# dscp-negate: None
|
||||
# action: None
|
||||
# fsso-agent-for-ntlm: None
|
||||
# logtraffic: None
|
||||
# vlan-filter: None
|
||||
# policyid: 36
|
||||
# logtraffic-start: None
|
||||
# webcache-https: None
|
||||
# webfilter-profile: None
|
||||
# internet-service-src: None
|
||||
# webcache: None
|
||||
# utm-status: None
|
||||
# vpn_src_node: {'subnet': None, 'host': None, 'seq': None}
|
||||
# ippool: None
|
||||
# service: None
|
||||
# wccp: None
|
||||
# auto-asic-offload: None
|
||||
# dscp-value: None
|
||||
# url-category: None
|
||||
# capture-packet: None
|
||||
# adom: ansible
|
||||
# inbound: None
|
||||
# internet-service: None
|
||||
# profile-type: None
|
||||
# ssl-mirror: None
|
||||
# srcaddr-negate: None
|
||||
# gtp-profile: None
|
||||
# mms-profile: None
|
||||
# send-deny-packet: None
|
||||
# devices: None
|
||||
# permit-any-host: None
|
||||
# av-profile: None
|
||||
# internet-service-src-negate: None
|
||||
# service-negate: None
|
||||
# rsso: None
|
||||
# app-group: None
|
||||
# tcp-mss-sender: None
|
||||
# natinbound: None
|
||||
# fixedport: None
|
||||
# ssl-ssh-profile: None
|
||||
# outbound: None
|
||||
# spamfilter-profile: None
|
||||
# application-list: None
|
||||
# application: None
|
||||
# dnsfilter-profile: None
|
||||
# nat: None
|
||||
# fsso: None
|
||||
# vlan-cos-rev: None
|
||||
# status: None
|
||||
# dsri: None
|
||||
# users: None
|
||||
# voip-profile: None
|
||||
# dstaddr-negate: None
|
||||
# traffic-shaper-reverse: None
|
||||
# internet-service-custom: None
|
||||
# diffserv-reverse: None
|
||||
# srcaddr: None
|
||||
# ssh-filter-profile: None
|
||||
# delay-tcp-npu-session: None
|
||||
# icap-profile: None
|
||||
# captive-portal-exempt: None
|
||||
# vpn_dst_node: {'subnet': None, 'host': None, 'seq': None}
|
||||
# app-category: None
|
||||
# rtp-addr: None
|
||||
# wsso: None
|
||||
# tcp-mss-receiver: None
|
||||
# dstaddr: None
|
||||
# radius-mac-auth-bypass: None
|
||||
# vpntunnel: None
|
||||
##################################################
|
||||
##################################################
|
||||
# package_name: default
|
||||
# wanopt-detection: None
|
||||
# scan-botnet-connections: None
|
||||
# profile-group: None
|
||||
# dlp-sensor: None
|
||||
# dscp-match: None
|
||||
# replacemsg-override-group: None
|
||||
# internet-service-negate: None
|
||||
# np-acceleration: None
|
||||
# learning-mode: None
|
||||
# session-ttl: None
|
||||
# ntlm-guest: None
|
||||
# ips-sensor: None
|
||||
# diffservcode-rev: None
|
||||
# match-vip: None
|
||||
# natip: None
|
||||
# wanopt-peer: None
|
||||
# traffic-shaper: None
|
||||
# groups: None
|
||||
# schedule-timeout: None
|
||||
# name: Basic_IPv4_Policy_2
|
||||
# tcp-session-without-syn: None
|
||||
# rtp-nat: None
|
||||
# permit-stun-host: None
|
||||
# natoutbound: None
|
||||
# internet-service-src-custom: None
|
||||
# mode: delete
|
||||
# logtraffic: None
|
||||
# ntlm: None
|
||||
# auth-cert: None
|
||||
# timeout-send-rst: None
|
||||
# auth-redirect-addr: None
|
||||
# ssl-mirror-intf: None
|
||||
# identity-based-route: None
|
||||
# diffservcode-forward: None
|
||||
# wanopt-profile: None
|
||||
# per-ip-shaper: None
|
||||
# users: None
|
||||
# diffserv-forward: None
|
||||
# poolname: None
|
||||
# comments: None
|
||||
# label: None
|
||||
# global-label: None
|
||||
# firewall-session-dirty: None
|
||||
# wanopt: None
|
||||
# schedule: None
|
||||
# internet-service-id: None
|
||||
# auth-path: None
|
||||
# vlan-cos-fwd: None
|
||||
# custom-log-fields: None
|
||||
# dstintf: None
|
||||
# srcintf: None
|
||||
# block-notification: None
|
||||
# internet-service-src-id: None
|
||||
# redirect-url: None
|
||||
# waf-profile: None
|
||||
# ntlm-enabled-browsers: None
|
||||
# dscp-negate: None
|
||||
# action: None
|
||||
# fsso-agent-for-ntlm: None
|
||||
# disclaimer: None
|
||||
# vlan-filter: None
|
||||
# dstaddr-negate: None
|
||||
# logtraffic-start: None
|
||||
# webcache-https: None
|
||||
# webfilter-profile: None
|
||||
# internet-service-src: None
|
||||
# webcache: None
|
||||
# utm-status: None
|
||||
# vpn_src_node: {'subnet': None, 'host': None, 'seq': None}
|
||||
# ippool: None
|
||||
# service: None
|
||||
# wccp: None
|
||||
# auto-asic-offload: None
|
||||
# dscp-value: None
|
||||
# url-category: None
|
||||
# capture-packet: None
|
||||
# adom: ansible
|
||||
# internet-service: None
|
||||
# inbound: None
|
||||
# profile-type: None
|
||||
# ssl-mirror: None
|
||||
# srcaddr-negate: None
|
||||
# gtp-profile: None
|
||||
# mms-profile: None
|
||||
# send-deny-packet: None
|
||||
# devices: None
|
||||
# permit-any-host: None
|
||||
# av-profile: None
|
||||
# internet-service-src-negate: None
|
||||
# service-negate: None
|
||||
# rsso: None
|
||||
# application-list: None
|
||||
# app-group: None
|
||||
# tcp-mss-sender: None
|
||||
# natinbound: None
|
||||
# fixedport: None
|
||||
# ssl-ssh-profile: None
|
||||
# outbound: None
|
||||
# spamfilter-profile: None
|
||||
# wanopt-passive-opt: None
|
||||
# application: None
|
||||
# dnsfilter-profile: None
|
||||
# nat: None
|
||||
# fsso: None
|
||||
# vlan-cos-rev: None
|
||||
# status: None
|
||||
# dsri: None
|
||||
# profile-protocol-options: None
|
||||
# voip-profile: None
|
||||
# policyid: 37
|
||||
# traffic-shaper-reverse: None
|
||||
# internet-service-custom: None
|
||||
# diffserv-reverse: None
|
||||
# srcaddr: None
|
||||
# dstaddr: None
|
||||
# delay-tcp-npu-session: None
|
||||
# icap-profile: None
|
||||
# captive-portal-exempt: None
|
||||
# vpn_dst_node: {'subnet': None, 'host': None, 'seq': None}
|
||||
# app-category: None
|
||||
# rtp-addr: None
|
||||
# wsso: None
|
||||
# tcp-mss-receiver: None
|
||||
# ssh-filter-profile: None
|
||||
# radius-mac-auth-bypass: None
|
||||
# vpntunnel: None
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_fwpol_ipv4.fmgr_firewall_policy_modify(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert isinstance(output['raw_response'], dict) is True
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_fwpol_ipv4.fmgr_firewall_policy_modify(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert isinstance(output['raw_response'], dict) is True
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_fwpol_ipv4.fmgr_firewall_policy_modify(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 4 #
|
||||
output = fmgr_fwpol_ipv4.fmgr_firewall_policy_modify(fmg_instance, fixture_data[3]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_fwpol_package
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_fwpol_package.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_fwpol_package(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_fwpol_package.fmgr_fwpol_package(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_fwpol_package.fmgr_fwpol_package(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_fwpol_package.fmgr_fwpol_package(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 4 #
|
||||
output = fmgr_fwpol_package.fmgr_fwpol_package(fmg_instance, fixture_data[3]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
||||
|
||||
def test_fmgr_fwpol_package_folder(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_fwpol_package.fmgr_fwpol_package_folder(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_fwpol_package.fmgr_fwpol_package_folder(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_fwpol_package.fmgr_fwpol_package_folder(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 4 #
|
||||
output = fmgr_fwpol_package.fmgr_fwpol_package_folder(fmg_instance, fixture_data[3]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
216
tests/unit/plugins/modules/network/fortimanager/test_fmgr_ha.py
Normal file
216
tests/unit/plugins/modules/network/fortimanager/test_fmgr_ha.py
Normal file
|
|
@ -0,0 +1,216 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_ha
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_ha.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_set_ha_mode(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# fmgr_ha_peer_sn: None
|
||||
# fmgr_ha_hb_threshold: 10
|
||||
# fmgr_ha_cluster_pw: fortinet
|
||||
# fmgr_ha_peer_ipv6: None
|
||||
# fmgr_ha_peer_status: None
|
||||
# fmgr_ha_file_quota: 2048
|
||||
# fmgr_ha_cluster_id: 2
|
||||
# fmgr_ha_peer_ipv4: None
|
||||
# fmgr_ha_hb_interval: 15
|
||||
# fmgr_ha_mode: master
|
||||
# mode: set
|
||||
##################################################
|
||||
##################################################
|
||||
# fmgr_ha_peer_sn: None
|
||||
# fmgr_ha_hb_threshold: 3
|
||||
# fmgr_ha_cluster_pw: fortinet
|
||||
# fmgr_ha_hb_interval: 5
|
||||
# fmgr_ha_cluster_id: 2
|
||||
# fmgr_ha_file_quota: 4096
|
||||
# fmgr_ha_peer_status: None
|
||||
# fmgr_ha_peer_ipv4: None
|
||||
# fmgr_ha_peer_ipv6: None
|
||||
# fmgr_ha_mode: slave
|
||||
# mode: set
|
||||
##################################################
|
||||
##################################################
|
||||
# fmgr_ha_peer_sn: FMG-VMTM18001881
|
||||
# fmgr_ha_hb_threshold: 3
|
||||
# fmgr_ha_cluster_pw: fortinet
|
||||
# fmgr_ha_peer_ipv6: None
|
||||
# fmgr_ha_peer_status: enable
|
||||
# fmgr_ha_file_quota: 4096
|
||||
# fmgr_ha_cluster_id: 2
|
||||
# fmgr_ha_peer_ipv4: 10.7.220.35
|
||||
# fmgr_ha_hb_interval: 5
|
||||
# fmgr_ha_mode: slave
|
||||
# mode: set
|
||||
##################################################
|
||||
##################################################
|
||||
# fmgr_ha_file_quota: 4096
|
||||
# fmgr_ha_cluster_pw: None
|
||||
# fmgr_ha_peer_sn: None
|
||||
# fmgr_ha_hb_interval: 5
|
||||
# fmgr_ha_cluster_id: 1
|
||||
# fmgr_ha_mode: standalone
|
||||
# fmgr_ha_peer_status: None
|
||||
# fmgr_ha_hb_threshold: 3
|
||||
# fmgr_ha_peer_ipv4: None
|
||||
# fmgr_ha_peer_ipv6: None
|
||||
# mode: set
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_ha.fmgr_set_ha_mode(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_ha.fmgr_set_ha_mode(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_ha.fmgr_set_ha_mode(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 4 #
|
||||
output = fmgr_ha.fmgr_set_ha_mode(fmg_instance, fixture_data[3]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
||||
|
||||
def test_fmgr_get_ha_peer_list(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# fmgr_ha_peer_sn: FMG-VMTM18001882
|
||||
# fmgr_ha_hb_threshold: 3
|
||||
# fmgr_ha_cluster_pw: None
|
||||
# fmgr_ha_peer_ipv6: None
|
||||
# fmgr_ha_peer_status: enable
|
||||
# fmgr_ha_file_quota: 4096
|
||||
# fmgr_ha_cluster_id: 1
|
||||
# fmgr_ha_peer_ipv4: 10.7.220.36
|
||||
# fmgr_ha_hb_interval: 5
|
||||
# fmgr_ha_mode: None
|
||||
# mode: get
|
||||
##################################################
|
||||
##################################################
|
||||
# fmgr_ha_peer_sn: FMG-VMTM18001881
|
||||
# fmgr_ha_hb_threshold: 3
|
||||
# fmgr_ha_cluster_pw: fortinet
|
||||
# fmgr_ha_hb_interval: 5
|
||||
# fmgr_ha_cluster_id: 2
|
||||
# fmgr_ha_file_quota: 4096
|
||||
# fmgr_ha_peer_status: enable
|
||||
# fmgr_ha_peer_ipv4: 10.7.220.35
|
||||
# fmgr_ha_peer_ipv6: None
|
||||
# fmgr_ha_mode: slave
|
||||
# mode: get
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_ha.fmgr_get_ha_peer_list(fmg_instance)
|
||||
assert isinstance(output['raw_response'], list) is True
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_ha.fmgr_get_ha_peer_list(fmg_instance)
|
||||
assert isinstance(output['raw_response'], list) is True
|
||||
|
||||
|
||||
def test_fmgr_set_ha_peer(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# fmgr_ha_peer_sn: FMG-VMTM18001882
|
||||
# next_peer_id: 2
|
||||
# fmgr_ha_hb_threshold: 3
|
||||
# fmgr_ha_cluster_pw: None
|
||||
# fmgr_ha_peer_ipv6: None
|
||||
# fmgr_ha_peer_status: enable
|
||||
# fmgr_ha_file_quota: 4096
|
||||
# fmgr_ha_cluster_id: 1
|
||||
# peer_id: 1
|
||||
# fmgr_ha_peer_ipv4: 10.7.220.36
|
||||
# fmgr_ha_hb_interval: 5
|
||||
# fmgr_ha_mode: None
|
||||
# mode: set
|
||||
##################################################
|
||||
##################################################
|
||||
# fmgr_ha_peer_sn: FMG-VMTM18001881
|
||||
# next_peer_id: 1
|
||||
# fmgr_ha_hb_threshold: 3
|
||||
# fmgr_ha_cluster_pw: fortinet
|
||||
# fmgr_ha_hb_interval: 5
|
||||
# fmgr_ha_cluster_id: 2
|
||||
# fmgr_ha_file_quota: 4096
|
||||
# fmgr_ha_peer_status: enable
|
||||
# peer_id: 1
|
||||
# fmgr_ha_peer_ipv4: 10.7.220.35
|
||||
# fmgr_ha_peer_ipv6: None
|
||||
# fmgr_ha_mode: slave
|
||||
# mode: set
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_ha.fmgr_set_ha_peer(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_ha.fmgr_set_ha_peer(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
# (c) 2016 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = []
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_provisioning
|
||||
from .fortimanager_module import TestFortimanagerModule
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
|
||||
except ImportError:
|
||||
pytestmark.append(pytest.mark.skip("Could not load required modules for testing"))
|
||||
|
||||
try:
|
||||
from pyFMG.fortimgr import FortiManager
|
||||
except ImportError:
|
||||
pytestmark.append(pytest.mark.skip("FortiManager tests require pyFMG package"))
|
||||
|
||||
|
||||
class TestFmgrProvisioningModule(TestFortimanagerModule):
|
||||
|
||||
module = fmgr_provisioning
|
||||
|
||||
def test_fmg_script_fail_connect(self):
|
||||
set_module_args(dict(host='1.1.1.1', username='admin', password='admin', adom='root',
|
||||
vdom='root', policy_package='root', name='FGT1', serial='FGVM000000117992',
|
||||
platform='FortiGate-VM64', os_version='5.0', minor_release='6',
|
||||
patch_release='0', os_type='fos'))
|
||||
result = self.execute_module(failed=True)
|
||||
self.assertEqual(result['msg'], 'Connection to FortiManager Failed')
|
||||
|
||||
def test_fmg_script_login_fail_host(self):
|
||||
set_module_args(dict(username='admin', password='admin', adom='root',
|
||||
vdom='root', policy_package='root', name='FGT1', serial='FGVM000000117992',
|
||||
platform='FortiGate-VM64', os_version='5.0', minor_release='6',
|
||||
patch_release='0', os_type='fos'))
|
||||
result = self.execute_module(failed=True)
|
||||
self.assertEqual(result['msg'], 'missing required arguments: host')
|
||||
|
||||
def test_fmg_script_login_fail_username(self):
|
||||
set_module_args(dict(host='1.1.1.1', password='admin', adom='root',
|
||||
vdom='root', policy_package='root', name='FGT1', serial='FGVM000000117992',
|
||||
platform='FortiGate-VM64', os_version='5.0', minor_release='6',
|
||||
patch_release='0', os_type='fos'))
|
||||
result = self.execute_module(failed=True)
|
||||
self.assertEqual(result['msg'], 'Host and username are required for connection')
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_query
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_query.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_get_custom(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# custom_endpoint: /dvmdb/adom/ansible/script
|
||||
# device_ip: None
|
||||
# device_unique_name: None
|
||||
# task_id: None
|
||||
# adom: ansible
|
||||
# nodes: None
|
||||
# object: custom
|
||||
# device_serial: None
|
||||
# custom_dict: {'type': 'cli'}
|
||||
# mode: get
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_query.fmgr_get_custom(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert isinstance(output['raw_response'], list) is True
|
||||
|
||||
|
||||
def test_fmgr_get_task_status(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# custom_endpoint: None
|
||||
# object: task
|
||||
# task_id: 247
|
||||
# adom: ansible
|
||||
# device_ip: None
|
||||
# custom_dict: None
|
||||
# device_unique_name: None
|
||||
# nodes: None
|
||||
# device_serial: None
|
||||
# mode: get
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_query.fmgr_get_task_status(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert isinstance(output['raw_response'], dict) is True
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_script
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_script.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_set_script(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# script_content: get system status
|
||||
# adom: ansible
|
||||
# script_scope: None
|
||||
# script_name: TestScript
|
||||
# script_target: remote_device
|
||||
# mode: set
|
||||
# script_description: Create by Ansible
|
||||
# script_package: None
|
||||
# vdom: root
|
||||
# script_type: cli
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_script.set_script(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
||||
|
||||
def test_delete_script(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# vdom: root
|
||||
# script_target: None
|
||||
# script_content: None
|
||||
# adom: ansible
|
||||
# script_description: None
|
||||
# script_package: None
|
||||
# mode: delete
|
||||
# script_scope: None
|
||||
# script_name: TestScript
|
||||
# script_type: None
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_script.delete_script(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
||||
|
||||
def test_execute_script(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# script_content: None
|
||||
# adom: ansible
|
||||
# script_scope: FGT1
|
||||
# script_name: TestScript
|
||||
# script_target: None
|
||||
# mode: exec
|
||||
# script_description: None
|
||||
# script_package: None
|
||||
# vdom: root
|
||||
# script_type: None
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_script.execute_script(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert isinstance(output['raw_response'], dict) is True
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_secprof_appctrl
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_secprof_appctrl.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_application_list_modify(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_secprof_appctrl.fmgr_application_list_modify(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_secprof_appctrl.fmgr_application_list_modify(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 3 #
|
||||
output = fmgr_secprof_appctrl.fmgr_application_list_modify(fmg_instance, fixture_data[2]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 4 #
|
||||
output = fmgr_secprof_appctrl.fmgr_application_list_modify(fmg_instance, fixture_data[3]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_secprof_av
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_secprof_av.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_antivirus_profile_modify(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_secprof_av.fmgr_antivirus_profile_modify(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_secprof_av.fmgr_antivirus_profile_modify(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_secprof_dns
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_secprof_dns.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_dnsfilter_profile_modify(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# comment: Created by Ansible Module TEST
|
||||
# ftgd-dns: {'options': None, 'filters': {'action': None, 'category': None, 'log': None}}
|
||||
# adom: root
|
||||
# youtube-restrict: None
|
||||
# sdns-domain-log: None
|
||||
# block-botnet: None
|
||||
# external-ip-blocklist: None
|
||||
# block-action: block
|
||||
# name: Ansible_DNS_Profile
|
||||
# redirect-portal: None
|
||||
# sdns-ftgd-err-log: None
|
||||
# safe-search: None
|
||||
# domain-filter: {'domain-filter-table': None}
|
||||
# log-all-domain: None
|
||||
# mode: set
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_secprof_dns.fmgr_dnsfilter_profile_modify(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_secprof_ips
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_secprof_ips.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_ips_sensor_modify(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_secprof_ips.fmgr_ips_sensor_modify(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_secprof_profile_group
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_secprof_profile_group.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_firewall_profile_group_modify(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
# Fixture sets used:###########################
|
||||
|
||||
##################################################
|
||||
# ssl-ssh-profile: None
|
||||
# waf-profile: None
|
||||
# adom: root
|
||||
# webfilter-profile: None
|
||||
# profile-protocol-options: None
|
||||
# application-list: None
|
||||
# icap-profile: None
|
||||
# voip-profile: None
|
||||
# ips-sensor: None
|
||||
# dnsfilter-profile: None
|
||||
# av-profile: None
|
||||
# spamfilter-profile: None
|
||||
# dlp-sensor: None
|
||||
# mode: delete
|
||||
# ssh-filter-profile: None
|
||||
# mms-profile: None
|
||||
# name: Ansible_TEST_Profile_Group
|
||||
##################################################
|
||||
##################################################
|
||||
# ssl-ssh-profile: None
|
||||
# application-list: None
|
||||
# waf-profile: None
|
||||
# adom: root
|
||||
# webfilter-profile: None
|
||||
# ips-sensor: None
|
||||
# spamfilter-profile: None
|
||||
# icap-profile: None
|
||||
# dnsfilter-profile: None
|
||||
# name: Ansible_TEST_Profile_Group
|
||||
# voip-profile: None
|
||||
# av-profile: Ansible_AV_Profile
|
||||
# mode: set
|
||||
# dlp-sensor: None
|
||||
# mms-profile: None
|
||||
# ssh-filter-profile: None
|
||||
# profile-protocol-options: default
|
||||
##################################################
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_secprof_profile_group.fmgr_firewall_profile_group_modify(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -3
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_secprof_profile_group.fmgr_firewall_profile_group_modify(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == -10131
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_secprof_proxy
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_secprof_proxy.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_web_proxy_profile_modify(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_secprof_proxy.fmgr_web_proxy_profile_modify(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_secprof_proxy.fmgr_web_proxy_profile_modify(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_secprof_spam
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_secprof_spam.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_spamfilter_profile_modify(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_secprof_spam.fmgr_spamfilter_profile_modify(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_secprof_spam.fmgr_spamfilter_profile_modify(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_secprof_ssl_ssh
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_secprof_ssl_ssh.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_firewall_ssl_ssh_profile_modify(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
output = fmgr_secprof_ssl_ssh.fmgr_firewall_ssl_ssh_profile_modify(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
output = fmgr_secprof_ssl_ssh.fmgr_firewall_ssl_ssh_profile_modify(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_secprof_voip
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_secprof_voip.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_voip_profile_modify(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_secprof_voip.fmgr_voip_profile_modify(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_secprof_voip.fmgr_voip_profile_modify(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_secprof_waf
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_secprof_waf.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_waf_profile_modify(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
output = fmgr_secprof_waf.fmgr_waf_profile_modify(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
output = fmgr_secprof_waf.fmgr_waf_profile_modify(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_secprof_wanopt
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_secprof_wanopt.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_wanopt_profile_modify(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
|
||||
# Test using fixture 1 #
|
||||
output = fmgr_secprof_wanopt.fmgr_wanopt_profile_modify(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
# Test using fixture 2 #
|
||||
output = fmgr_secprof_wanopt.fmgr_wanopt_profile_modify(fmg_instance, fixture_data[1]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
# Copyright 2018 Fortinet, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible_collections.community.general.plugins.modules.network.fortimanager import fmgr_secprof_web
|
||||
except ImportError:
|
||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||
|
||||
|
||||
def load_fixtures():
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||
filename=os.path.splitext(os.path.basename(__file__))[0])
|
||||
try:
|
||||
with open(fixture_path, "r") as fixture_file:
|
||||
fixture_data = json.load(fixture_file)
|
||||
except IOError:
|
||||
return []
|
||||
return [fixture_data]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible.module_utils.basic.AnsibleModule')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def connection_mock(mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.fortimanager.fmgr_secprof_web.Connection')
|
||||
return connection_class_mock
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", params=load_fixtures())
|
||||
def fixture_data(request):
|
||||
func_name = request.function.__name__.replace("test_", "")
|
||||
return request.param.get(func_name, None)
|
||||
|
||||
|
||||
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||
|
||||
|
||||
def test_fmgr_webfilter_profile_modify(fixture_data, mocker):
|
||||
mocker.patch('ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.fortimanager.FortiManagerHandler.process_request',
|
||||
side_effect=fixture_data)
|
||||
output = fmgr_secprof_web.fmgr_webfilter_profile_modify(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||
assert output['raw_response']['status']['code'] == 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue