def _send_request(call): logger.info( '_send_request request_props:{}'.format(call)) host = call.get('host') username = call.get('username') password = call.get('password') use_ssl = call.get('use_ssl', False) verify_ssl = call.get('verify_ssl', False) vdom = call.get('vdom', 'root') path = call.get('path') name = call.get('name') data = call.get('data', {}) method = call.get('method') # TODO# add api key method option and client certificate verifications # TODO# upload license call / check license when connection is on fgt_instance = FortiOSAPI() if use_ssl == True: fgt_instance.https('on') else: fgt_instance.https(status='off') fgt_instance.login(host, username, password, verify=verify_ssl) if method == "LICENSE": code, response = fgt_instance.license() logger.debug('---> Method: {} \n code: {} \n response: \n {}'.format(method, code, response)) if method == "GET": code, response = fgt_instance.get(path, name, vdom=None, mkey=None, parameters=None) logger.debug('---> Method: {} \n code: {} \n response: \n {}'.format(method, code, response)) # if method == "UPDATE": # if method == "SET": # if method == "REPLACE": # if method == "CLONE": if method == "SETOVERLAY": code, response = fgt_instance.setoverlayconfig(data, vdom=vdom) logger.debug('---> Method: {} \n code: {} \n response: \n {}'.format(method, code, response)) fgt_instance.logout() return code, response