diff --git a/Packs/NetQuestOMX/Integrations/NetQuestOMX/NetQuestOMX.py b/Packs/NetQuestOMX/Integrations/NetQuestOMX/NetQuestOMX.py index 972580748b28..d75df98bfba2 100644 --- a/Packs/NetQuestOMX/Integrations/NetQuestOMX/NetQuestOMX.py +++ b/Packs/NetQuestOMX/Integrations/NetQuestOMX/NetQuestOMX.py @@ -128,10 +128,11 @@ def address_list_optimize_request(self) -> dict: return response_json - def address_list_create_request(self, name: str): + def address_list_create_request(self, name: str, value: str): try: self._http_request( - method="POST", url_suffix="/api/Systems/Filters/ListImport/Config/Install", json_data={"Name": name}, + method="POST", url_suffix="/api/Systems/Filters/ListImport/Config/Install", + json_data={"Name": name, "Value": value}, ok_codes=(200,) ) except Exception as e: @@ -139,11 +140,11 @@ def address_list_create_request(self, name: str): "An error was occurred when creating the list of IPs." ) from e - def address_list_rename_request(self, new_name: str, existing_name: str): + def address_list_rename_request(self, new_name: str, new_value: str, existing_name: str): try: self._http_request( method="PUT", url_suffix=f"/api/Systems/Filters/ListImport/ListName/{existing_name}/Config/Install", - json_data={"Name": new_name}, + json_data={"Name": new_name, "Value": new_value}, ok_codes=(200,) ) except Exception as e: @@ -284,8 +285,9 @@ def address_list_create_command(client: Client, args: dict) -> CommandResults: A CommandResults containing a success indication or a DemistoException. """ name = args["name"] # a required argument - The name of the address list to create + value = args["value"] # a required argument - The name of the address list to create try: - client.address_list_create_request(name) + client.address_list_create_request(name, value) except Exception as e: raise DemistoException( f"An error was occurred when creating an IP list with {name=}." @@ -304,10 +306,11 @@ def address_list_rename_command(client: Client, args: dict) -> CommandResults: A CommandResults containing a success indication or a DemistoException. """ new_name = args["new_name"] # a required argument - The new name for an existing address list + new_value = args["new_value"] # a required argument - The new value for an existing address list existing_name = args["existing_name"] # a required argument - Name of the existing address list that we want to modify try: - client.address_list_rename_request(new_name, existing_name) + client.address_list_rename_request(new_name, new_value, existing_name) except Exception as e: raise DemistoException( f"An error was occurred when renaming {existing_name} IPs list to {new_name}." diff --git a/Packs/NetQuestOMX/Integrations/NetQuestOMX/NetQuestOMX.yml b/Packs/NetQuestOMX/Integrations/NetQuestOMX/NetQuestOMX.yml index aef35e8fe02b..cf94854e3e4f 100644 --- a/Packs/NetQuestOMX/Integrations/NetQuestOMX/NetQuestOMX.yml +++ b/Packs/NetQuestOMX/Integrations/NetQuestOMX/NetQuestOMX.yml @@ -87,12 +87,18 @@ script: - description: 'What to name the new address list.' name: name required: true + - description: 'The value for the new address list.' + name: value + required: true description: "This replaces the old list entity and overrides it." name: netquest-address-list-create - arguments: - description: 'The new name for an existing address list.' name: new_name required: true + - description: 'The new value for an existing address list.' + name: new_value + required: true - description: 'The existing list name of the address list that we want to modify.' name: existing_name required: true diff --git a/Packs/NetQuestOMX/Integrations/NetQuestOMX/NetQuestOMX_test.py b/Packs/NetQuestOMX/Integrations/NetQuestOMX/NetQuestOMX_test.py index 262f629afd9f..63ff517e910f 100644 --- a/Packs/NetQuestOMX/Integrations/NetQuestOMX/NetQuestOMX_test.py +++ b/Packs/NetQuestOMX/Integrations/NetQuestOMX/NetQuestOMX_test.py @@ -193,15 +193,15 @@ def test_address_list_create_command(requests_mock, net_quest_omx_client): """ Given: - A mocked client - - A name for the new list + - A name and a value for the new list When: - Executing netquest-address-list-create command Then: - Ensure command is not failed and the readable_output as expected """ - name = "TEST" + name, value = "TEST", "0.0.0.0/24" requests_mock.post(f'{BASE_URL}Systems/Filters/ListImport/Config/Install', json={}) - result = address_list_create_command(client=net_quest_omx_client, args={"name": name}) + result = address_list_create_command(client=net_quest_omx_client, args={"name": name, "value": value}) assert result.readable_output == f"Successfully created a new instance of {name}" @@ -210,15 +210,16 @@ def test_address_list_rename_command(requests_mock, net_quest_omx_client): Given: - A mocked client - The name of the list to rename - - A new name for the list + - A new name and a new value for the list When: - Executing netquest-address-list-rename command Then: - Ensure command is not failed and the readable_output as expected """ - new_name, existing_name = "NEW_TEST", "TEST" + new_name, new_value, existing_name = "NEW_TEST", "0.0.0.0/24", "TEST" requests_mock.put(f'{BASE_URL}Systems/Filters/ListImport/ListName/{existing_name}/Config/Install', json={}) - result = address_list_rename_command(client=net_quest_omx_client, args={"new_name": new_name, "existing_name": existing_name}) + result = address_list_rename_command(client=net_quest_omx_client, + args={"new_name": new_name, "new_value": new_value, "existing_name": existing_name}) assert result.readable_output == f"Successfully renamed {existing_name} to {new_name}"