FortiManager Plugin Module Conversion: fmgr_secprof_dns (#52771)
* Auto Commit for: fmgr_secprof_dns * Auto Commit for: fmgr_secprof_dns
This commit is contained in:
parent
e8c983155c
commit
ff368ff55d
3 changed files with 104 additions and 280 deletions
|
@ -28,6 +28,8 @@ DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: fmgr_secprof_dns
|
module: fmgr_secprof_dns
|
||||||
version_added: "2.8"
|
version_added: "2.8"
|
||||||
|
notes:
|
||||||
|
- Full Documentation at U(https://ftnt-ansible-docs.readthedocs.io/en/latest/).
|
||||||
author:
|
author:
|
||||||
- Luke Weighall (@lweighall)
|
- Luke Weighall (@lweighall)
|
||||||
- Andrew Welsh (@Ghilli3)
|
- Andrew Welsh (@Ghilli3)
|
||||||
|
@ -43,21 +45,6 @@ options:
|
||||||
required: false
|
required: false
|
||||||
default: root
|
default: root
|
||||||
|
|
||||||
host:
|
|
||||||
description:
|
|
||||||
- The FortiManager's address.
|
|
||||||
required: true
|
|
||||||
|
|
||||||
username:
|
|
||||||
description:
|
|
||||||
- The username associated with the account.
|
|
||||||
required: true
|
|
||||||
|
|
||||||
password:
|
|
||||||
description:
|
|
||||||
- The password associated with the username account.
|
|
||||||
required: true
|
|
||||||
|
|
||||||
mode:
|
mode:
|
||||||
description:
|
description:
|
||||||
- Sets one of three modes for managing the object.
|
- Sets one of three modes for managing the object.
|
||||||
|
@ -199,18 +186,12 @@ options:
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: DELETE Profile
|
- name: DELETE Profile
|
||||||
fmgr_secprof_dns:
|
fmgr_secprof_dns:
|
||||||
host: "{{inventory_hostname}}"
|
|
||||||
username: "{{ username }}"
|
|
||||||
password: "{{ password }}"
|
|
||||||
name: "Ansible_DNS_Profile"
|
name: "Ansible_DNS_Profile"
|
||||||
comment: "Created by Ansible Module TEST"
|
comment: "Created by Ansible Module TEST"
|
||||||
mode: "delete"
|
mode: "delete"
|
||||||
|
|
||||||
- name: CREATE Profile
|
- name: CREATE Profile
|
||||||
fmgr_secprof_dns:
|
fmgr_secprof_dns:
|
||||||
host: "{{inventory_hostname}}"
|
|
||||||
username: "{{ username }}"
|
|
||||||
password: "{{ password }}"
|
|
||||||
name: "Ansible_DNS_Profile"
|
name: "Ansible_DNS_Profile"
|
||||||
comment: "Created by Ansible Module TEST"
|
comment: "Created by Ansible Module TEST"
|
||||||
mode: "set"
|
mode: "set"
|
||||||
|
@ -227,15 +208,15 @@ api_result:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, env_fallback
|
from ansible.module_utils.basic import AnsibleModule, env_fallback
|
||||||
from ansible.module_utils.network.fortimanager.fortimanager import AnsibleFortiManager
|
from ansible.module_utils.connection import Connection
|
||||||
|
from ansible.module_utils.network.fortimanager.fortimanager import FortiManagerHandler
|
||||||
# check for pyFMG lib
|
from ansible.module_utils.network.fortimanager.common import FMGBaseException
|
||||||
try:
|
from ansible.module_utils.network.fortimanager.common import FMGRCommon
|
||||||
from pyFMG.fortimgr import FortiManager
|
from ansible.module_utils.network.fortimanager.common import FMGRMethods
|
||||||
|
from ansible.module_utils.network.fortimanager.common import DEFAULT_RESULT_OBJ
|
||||||
HAS_PYFMGR = True
|
from ansible.module_utils.network.fortimanager.common import FAIL_SOCKET_MSG
|
||||||
except ImportError:
|
from ansible.module_utils.network.fortimanager.common import prepare_dict
|
||||||
HAS_PYFMGR = False
|
from ansible.module_utils.network.fortimanager.common import scrub_dict
|
||||||
|
|
||||||
|
|
||||||
###############
|
###############
|
||||||
|
@ -243,9 +224,14 @@ except ImportError:
|
||||||
###############
|
###############
|
||||||
|
|
||||||
|
|
||||||
def fmgr_dnsfilter_profile_addsetdelete(fmg, paramgram):
|
def fmgr_dnsfilter_profile_modify(fmgr, paramgram):
|
||||||
"""
|
"""
|
||||||
fmgr_dnsfilter_profile -- Your Description here, bruh
|
:param fmgr: The fmgr object instance from fortimanager.py
|
||||||
|
:type fmgr: class object
|
||||||
|
:param paramgram: The formatted dictionary of options to process
|
||||||
|
:type paramgram: dict
|
||||||
|
:return: The response from the FortiManager
|
||||||
|
:rtype: dict
|
||||||
"""
|
"""
|
||||||
|
|
||||||
mode = paramgram["mode"]
|
mode = paramgram["mode"]
|
||||||
|
@ -253,12 +239,12 @@ def fmgr_dnsfilter_profile_addsetdelete(fmg, paramgram):
|
||||||
url = ""
|
url = ""
|
||||||
datagram = {}
|
datagram = {}
|
||||||
|
|
||||||
response = (-100000, {"msg": "Illegal or malformed paramgram discovered. System Exception"})
|
response = DEFAULT_RESULT_OBJ
|
||||||
|
|
||||||
# EVAL THE MODE PARAMETER FOR SET OR ADD
|
# EVAL THE MODE PARAMETER FOR SET OR ADD
|
||||||
if mode in ['set', 'add', 'update']:
|
if mode in ['set', 'add', 'update']:
|
||||||
url = '/pm/config/adom/{adom}/obj/dnsfilter/profile'.format(adom=adom)
|
url = '/pm/config/adom/{adom}/obj/dnsfilter/profile'.format(adom=adom)
|
||||||
datagram = fmgr_del_none(fmgr_prepare_dict(paramgram))
|
datagram = scrub_dict(prepare_dict(paramgram))
|
||||||
|
|
||||||
# EVAL THE MODE PARAMETER FOR DELETE
|
# EVAL THE MODE PARAMETER FOR DELETE
|
||||||
elif mode == "delete":
|
elif mode == "delete":
|
||||||
|
@ -266,128 +252,11 @@ def fmgr_dnsfilter_profile_addsetdelete(fmg, paramgram):
|
||||||
url = '/pm/config/adom/{adom}/obj/dnsfilter/profile/{name}'.format(adom=adom, name=paramgram["name"])
|
url = '/pm/config/adom/{adom}/obj/dnsfilter/profile/{name}'.format(adom=adom, name=paramgram["name"])
|
||||||
datagram = {}
|
datagram = {}
|
||||||
|
|
||||||
# IF MODE = SET -- USE THE 'SET' API CALL MODE
|
response = fmgr.process_request(url, datagram, paramgram["mode"])
|
||||||
if mode == "set":
|
|
||||||
response = fmg.set(url, datagram)
|
|
||||||
# IF MODE = UPDATE -- USER THE 'UPDATE' API CALL MODE
|
|
||||||
elif mode == "update":
|
|
||||||
response = fmg.update(url, datagram)
|
|
||||||
# IF MODE = ADD -- USE THE 'ADD' API CALL MODE
|
|
||||||
elif mode == "add":
|
|
||||||
response = fmg.add(url, datagram)
|
|
||||||
# IF MODE = DELETE -- USE THE DELETE URL AND API CALL MODE
|
|
||||||
elif mode == "delete":
|
|
||||||
response = fmg.delete(url, datagram)
|
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
# ADDITIONAL COMMON FUNCTIONS
|
|
||||||
# FUNCTION/METHOD FOR LOGGING OUT AND ANALYZING ERROR CODES
|
|
||||||
def fmgr_logout(fmg, module, msg="NULL", results=(), good_codes=(0,), logout_on_fail=True, logout_on_success=False):
|
|
||||||
"""
|
|
||||||
THIS METHOD CONTROLS THE LOGOUT AND ERROR REPORTING AFTER AN METHOD OR FUNCTION RUNS
|
|
||||||
"""
|
|
||||||
|
|
||||||
# VALIDATION ERROR (NO RESULTS, JUST AN EXIT)
|
|
||||||
if msg != "NULL" and len(results) == 0:
|
|
||||||
try:
|
|
||||||
fmg.logout()
|
|
||||||
except BaseException:
|
|
||||||
pass
|
|
||||||
module.fail_json(msg=msg)
|
|
||||||
|
|
||||||
# SUBMISSION ERROR
|
|
||||||
if len(results) > 0:
|
|
||||||
if msg == "NULL":
|
|
||||||
try:
|
|
||||||
msg = results[1]['status']['message']
|
|
||||||
except BaseException:
|
|
||||||
msg = "No status message returned from pyFMG. Possible that this was a GET with a tuple result."
|
|
||||||
|
|
||||||
if results[0] not in good_codes:
|
|
||||||
if logout_on_fail:
|
|
||||||
fmg.logout()
|
|
||||||
module.fail_json(msg=msg, **results[1])
|
|
||||||
else:
|
|
||||||
return msg
|
|
||||||
else:
|
|
||||||
if logout_on_success:
|
|
||||||
fmg.logout()
|
|
||||||
module.exit_json(msg=msg, **results[1])
|
|
||||||
else:
|
|
||||||
return msg
|
|
||||||
|
|
||||||
|
|
||||||
# FUNCTION/METHOD FOR CONVERTING CIDR TO A NETMASK
|
|
||||||
# DID NOT USE IP ADDRESS MODULE TO KEEP INCLUDES TO A MINIMUM
|
|
||||||
def fmgr_cidr_to_netmask(cidr):
|
|
||||||
cidr = int(cidr)
|
|
||||||
mask = (0xffffffff >> (32 - cidr)) << (32 - cidr)
|
|
||||||
return (str((0xff000000 & mask) >> 24) + '.' +
|
|
||||||
str((0x00ff0000 & mask) >> 16) + '.' +
|
|
||||||
str((0x0000ff00 & mask) >> 8) + '.' +
|
|
||||||
str((0x000000ff & mask)))
|
|
||||||
|
|
||||||
|
|
||||||
# utility function: removing keys wih value of None, nothing in playbook for that key
|
|
||||||
def fmgr_del_none(obj):
|
|
||||||
if isinstance(obj, dict):
|
|
||||||
return type(obj)((fmgr_del_none(k), fmgr_del_none(v))
|
|
||||||
for k, v in obj.items() if k is not None and (v is not None and not fmgr_is_empty_dict(v)))
|
|
||||||
else:
|
|
||||||
return obj
|
|
||||||
|
|
||||||
|
|
||||||
# utility function: remove keys that are need for the logic but the FMG API won't accept them
|
|
||||||
def fmgr_prepare_dict(obj):
|
|
||||||
list_of_elems = ["mode", "adom", "host", "username", "password"]
|
|
||||||
if isinstance(obj, dict):
|
|
||||||
obj = dict((key, fmgr_prepare_dict(value)) for (key, value) in obj.items() if key not in list_of_elems)
|
|
||||||
return obj
|
|
||||||
|
|
||||||
|
|
||||||
def fmgr_is_empty_dict(obj):
|
|
||||||
return_val = False
|
|
||||||
if isinstance(obj, dict):
|
|
||||||
if len(obj) > 0:
|
|
||||||
for k, v in obj.items():
|
|
||||||
if isinstance(v, dict):
|
|
||||||
if len(v) == 0:
|
|
||||||
return_val = True
|
|
||||||
elif len(v) > 0:
|
|
||||||
for k1, v1 in v.items():
|
|
||||||
if v1 is None:
|
|
||||||
return_val = True
|
|
||||||
elif v1 is not None:
|
|
||||||
return_val = False
|
|
||||||
return return_val
|
|
||||||
elif v is None:
|
|
||||||
return_val = True
|
|
||||||
elif v is not None:
|
|
||||||
return_val = False
|
|
||||||
return return_val
|
|
||||||
elif len(obj) == 0:
|
|
||||||
return_val = True
|
|
||||||
|
|
||||||
return return_val
|
|
||||||
|
|
||||||
|
|
||||||
def fmgr_split_comma_strings_into_lists(obj):
|
|
||||||
if isinstance(obj, dict):
|
|
||||||
if len(obj) > 0:
|
|
||||||
for k, v in obj.items():
|
|
||||||
if isinstance(v, str):
|
|
||||||
new_list = list()
|
|
||||||
if "," in v:
|
|
||||||
new_items = v.split(",")
|
|
||||||
for item in new_items:
|
|
||||||
new_list.append(item.strip())
|
|
||||||
obj[k] = new_list
|
|
||||||
|
|
||||||
return obj
|
|
||||||
|
|
||||||
|
|
||||||
#############
|
#############
|
||||||
# END METHODS
|
# END METHODS
|
||||||
#############
|
#############
|
||||||
|
@ -396,9 +265,6 @@ def fmgr_split_comma_strings_into_lists(obj):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
adom=dict(type="str", default="root"),
|
adom=dict(type="str", default="root"),
|
||||||
host=dict(required=True, type="str"),
|
|
||||||
password=dict(fallback=(env_fallback, ["ANSIBLE_NET_PASSWORD"]), no_log=True, required=True),
|
|
||||||
username=dict(fallback=(env_fallback, ["ANSIBLE_NET_USERNAME"]), no_log=True, required=True),
|
|
||||||
mode=dict(choices=["add", "set", "delete", "update"], type="str", default="add"),
|
mode=dict(choices=["add", "set", "delete", "update"], type="str", default="add"),
|
||||||
|
|
||||||
youtube_restrict=dict(required=False, type="str", choices=["strict", "moderate"]),
|
youtube_restrict=dict(required=False, type="str", choices=["strict", "moderate"]),
|
||||||
|
@ -423,8 +289,7 @@ def main():
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(argument_spec, supports_check_mode=False)
|
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=False, )
|
||||||
|
|
||||||
# MODULE PARAMGRAM
|
# MODULE PARAMGRAM
|
||||||
paramgram = {
|
paramgram = {
|
||||||
"mode": module.params["mode"],
|
"mode": module.params["mode"],
|
||||||
|
@ -453,30 +318,26 @@ def main():
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# CHECK IF THE HOST/USERNAME/PW EXISTS, AND IF IT DOES, LOGIN.
|
module.paramgram = paramgram
|
||||||
host = module.params["host"]
|
fmgr = None
|
||||||
password = module.params["password"]
|
if module._socket_path:
|
||||||
username = module.params["username"]
|
connection = Connection(module._socket_path)
|
||||||
if host is None or username is None or password is None:
|
fmgr = FortiManagerHandler(connection, module)
|
||||||
module.fail_json(msg="Host and username and password are required")
|
fmgr.tools = FMGRCommon()
|
||||||
|
|
||||||
# CHECK IF LOGIN FAILED
|
|
||||||
fmg = AnsibleFortiManager(module, module.params["host"], module.params["username"], module.params["password"])
|
|
||||||
|
|
||||||
response = fmg.login()
|
|
||||||
if response[1]['status']['code'] != 0:
|
|
||||||
module.fail_json(msg="Connection to FortiManager Failed")
|
|
||||||
|
|
||||||
results = fmgr_dnsfilter_profile_addsetdelete(fmg, paramgram)
|
|
||||||
if results[0] != 0:
|
|
||||||
fmgr_logout(fmg, module, results=results, good_codes=[0])
|
|
||||||
|
|
||||||
fmg.logout()
|
|
||||||
|
|
||||||
if results is not None:
|
|
||||||
return module.exit_json(**results[1])
|
|
||||||
else:
|
else:
|
||||||
return module.exit_json(msg="No results were returned from the API call.")
|
module.fail_json(**FAIL_SOCKET_MSG)
|
||||||
|
|
||||||
|
results = DEFAULT_RESULT_OBJ
|
||||||
|
|
||||||
|
try:
|
||||||
|
results = fmgr_dnsfilter_profile_modify(fmgr, paramgram)
|
||||||
|
fmgr.govern_response(module=module, results=results,
|
||||||
|
ansible_facts=fmgr.construct_ansible_facts(results, module.params, paramgram))
|
||||||
|
|
||||||
|
except Exception as err:
|
||||||
|
raise FMGBaseException(err)
|
||||||
|
|
||||||
|
return module.exit_json(**results[1])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -1,76 +1,45 @@
|
||||||
{
|
{
|
||||||
"fmgr_dnsfilter_profile_addsetdelete": [
|
"fmgr_dnsfilter_profile_modify": [
|
||||||
{
|
{
|
||||||
"paramgram_used": {
|
"raw_response": {
|
||||||
"comment": "Created by Ansible Module TEST",
|
"status": {
|
||||||
"ftgd-dns": {
|
"message": "OK",
|
||||||
"options": null,
|
"code": 0
|
||||||
"filters": {
|
},
|
||||||
"action": null,
|
"url": "/pm/config/adom/root/obj/dnsfilter/profile"
|
||||||
"category": null,
|
},
|
||||||
"log": null
|
"datagram_sent": {
|
||||||
}
|
"comment": "Created by Ansible Module TEST",
|
||||||
},
|
"name": "Ansible_DNS_Profile",
|
||||||
"name": "Ansible_DNS_Profile",
|
"block-action": "block"
|
||||||
"adom": "root",
|
},
|
||||||
"redirect-portal": null,
|
"paramgram_used": {
|
||||||
"sdns-ftgd-err-log": null,
|
"comment": "Created by Ansible Module TEST",
|
||||||
"youtube-restrict": null,
|
"ftgd-dns": {
|
||||||
"sdns-domain-log": null,
|
"options": null,
|
||||||
"domain-filter": {
|
"filters": {
|
||||||
"domain-filter-table": null
|
"action": null,
|
||||||
},
|
"category": null,
|
||||||
"log-all-domain": null,
|
"log": null
|
||||||
"mode": "delete",
|
}
|
||||||
"block-botnet": null,
|
},
|
||||||
"safe-search": null,
|
"adom": "root",
|
||||||
"external-ip-blocklist": null,
|
"youtube-restrict": null,
|
||||||
"block-action": null
|
"sdns-domain-log": null,
|
||||||
},
|
"block-botnet": null,
|
||||||
"raw_response": {
|
"external-ip-blocklist": null,
|
||||||
"status": {
|
"block-action": "block",
|
||||||
"message": "OK",
|
"name": "Ansible_DNS_Profile",
|
||||||
"code": 0
|
"redirect-portal": null,
|
||||||
},
|
"sdns-ftgd-err-log": null,
|
||||||
"url": "/pm/config/adom/root/obj/dnsfilter/profile/Ansible_DNS_Profile"
|
"safe-search": null,
|
||||||
},
|
"domain-filter": {
|
||||||
"post_method": "delete"
|
"domain-filter-table": null
|
||||||
},
|
},
|
||||||
{
|
"log-all-domain": null,
|
||||||
"raw_response": {
|
"mode": "set"
|
||||||
"status": {
|
},
|
||||||
"message": "OK",
|
"post_method": "set"
|
||||||
"code": 0
|
}
|
||||||
},
|
]
|
||||||
"url": "/pm/config/adom/root/obj/dnsfilter/profile"
|
|
||||||
},
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ __metaclass__ = type
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
from pyFMG.fortimgr import FortiManager
|
from ansible.module_utils.network.fortimanager.fortimanager import FortiManagerHandler
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -27,8 +27,6 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
pytest.skip("Could not load required modules for testing", allow_module_level=True)
|
||||||
|
|
||||||
fmg_instance = FortiManager("1.1.1.1", "admin", "")
|
|
||||||
|
|
||||||
|
|
||||||
def load_fixtures():
|
def load_fixtures():
|
||||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') + "/{filename}.json".format(
|
||||||
|
@ -41,33 +39,32 @@ def load_fixtures():
|
||||||
return [fixture_data]
|
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_secprof_dns.Connection')
|
||||||
|
return connection_class_mock
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="function", params=load_fixtures())
|
@pytest.fixture(scope="function", params=load_fixtures())
|
||||||
def fixture_data(request):
|
def fixture_data(request):
|
||||||
func_name = request.function.__name__.replace("test_", "")
|
func_name = request.function.__name__.replace("test_", "")
|
||||||
return request.param.get(func_name, None)
|
return request.param.get(func_name, None)
|
||||||
|
|
||||||
|
|
||||||
def test_fmgr_dnsfilter_profile_addsetdelete(fixture_data, mocker):
|
fmg_instance = FortiManagerHandler(connection_mock, module_mock)
|
||||||
mocker.patch("pyFMG.fortimgr.FortiManager._post_request", side_effect=fixture_data)
|
|
||||||
|
|
||||||
|
def test_fmgr_dnsfilter_profile_modify(fixture_data, mocker):
|
||||||
|
mocker.patch("ansible.module_utils.network.fortimanager.fortimanager.FortiManagerHandler.process_request",
|
||||||
|
side_effect=fixture_data)
|
||||||
# Fixture sets used:###########################
|
# Fixture sets used:###########################
|
||||||
|
|
||||||
##################################################
|
|
||||||
# comment: Created by Ansible Module TEST
|
|
||||||
# ftgd-dns: {'options': None, 'filters': {'action': None, 'category': None, 'log': None}}
|
|
||||||
# name: Ansible_DNS_Profile
|
|
||||||
# adom: root
|
|
||||||
# redirect-portal: None
|
|
||||||
# sdns-ftgd-err-log: None
|
|
||||||
# youtube-restrict: None
|
|
||||||
# sdns-domain-log: None
|
|
||||||
# domain-filter: {'domain-filter-table': None}
|
|
||||||
# log-all-domain: None
|
|
||||||
# mode: delete
|
|
||||||
# block-botnet: None
|
|
||||||
# safe-search: None
|
|
||||||
# external-ip-blocklist: None
|
|
||||||
# block-action: None
|
|
||||||
##################################################
|
|
||||||
##################################################
|
##################################################
|
||||||
# comment: Created by Ansible Module TEST
|
# comment: Created by Ansible Module TEST
|
||||||
# ftgd-dns: {'options': None, 'filters': {'action': None, 'category': None, 'log': None}}
|
# ftgd-dns: {'options': None, 'filters': {'action': None, 'category': None, 'log': None}}
|
||||||
|
@ -87,8 +84,5 @@ def test_fmgr_dnsfilter_profile_addsetdelete(fixture_data, mocker):
|
||||||
##################################################
|
##################################################
|
||||||
|
|
||||||
# Test using fixture 1 #
|
# Test using fixture 1 #
|
||||||
output = fmgr_secprof_dns.fmgr_dnsfilter_profile_addsetdelete(fmg_instance, fixture_data[0]['paramgram_used'])
|
output = fmgr_secprof_dns.fmgr_dnsfilter_profile_modify(fmg_instance, fixture_data[0]['paramgram_used'])
|
||||||
assert output['raw_response']['status']['code'] == 0
|
|
||||||
# Test using fixture 2 #
|
|
||||||
output = fmgr_secprof_dns.fmgr_dnsfilter_profile_addsetdelete(fmg_instance, fixture_data[1]['paramgram_used'])
|
|
||||||
assert output['raw_response']['status']['code'] == 0
|
assert output['raw_response']['status']['code'] == 0
|
||||||
|
|
Loading…
Reference in a new issue