mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
New FortiManager Module: fmgr_fwobj_service (#53027)
* Auto Commit for: fmgr_fwobj_service * Auto Commit for: fmgr_fwobj_service
This commit is contained in:
committed by
Nilashish Chakraborty
parent
8e26c2dfbe
commit
e585e948fb
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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.module_utils.network.fortimanager.fortimanager import FortiManagerHandler
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from ansible.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.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.module_utils.network.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.module_utils.network.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.module_utils.network.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
|
||||
Reference in New Issue
Block a user