i am running below python code to get output of "show-gateway-and-servers" from 81.10 MDS but not sure where i am missing the key parameter. any suggestions would be helpful, thanks
class GetServerDetails(test):
def api_call(self, ip_addr, port, command, json_payload, sid):
url = "https://" + ip_addr + ":" + port + "/gaia_api/" + command
if sid == "":
request_headers = {"Content-Type": "application/json"}
else:
request_headers = {"Content-Type": "application/json", "X-chkp-sid": sid}
r = requests.post(
url, data=json.dumps(json_payload), headers=request_headers, verify=False
)
return r.json()
def login(self, user, password):
payload = {"user": user, "password": password}
response = self.api_call(self.node, "443", "login", payload, "")
self.sid = response["sid"]
def run_script(self, script):
payload = {"script": script}
response = self.api_call(self.node, "443", "run-script", payload, self.sid)
return response["task-id"]
def show_task(self, task_id):
payload = {"task-id": task_id}
response = self.api_call(self.node, "443", "show-task", payload, self.sid)
return response
def collect(self):
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
self.password = "xxxxx"
sid = self.login("xxxxx", self.password)
show_cluster_result = self.api_call(
self.node, "443", "show-gateways-and-servers", {}, self.sid
)
return show_cluster_result
Output:
{'code': 'generic_err_command_not_found',
'errors': 'Requested API command: '
'[show-gateways-and-servers] not ''found',
'message': 'Command Not Found'}