Infoblox
Infoblox NIOS enables you to receive metadata about IPs in your network and manages the DNS Firewall by configuring RPZs. It defines RPZ rules to block DNS resolution for malicious or unauthorized hostnames, or redirect clients to a walled garden by substituting responses.
Network Security · Infoblox NIOS
Details
| ID | Infoblox |
|---|---|
| Provider | Infoblox |
| Category | Network Security |
| From Version | 5.0.0 |
| Docker Image | demisto/python3:3.12.13.10116658 |
| Supported Modules | Agentix XSIAM |
README
Infoblox NIOS enables you to receive metadata about IPs in your network and manages the DNS Firewall by configuring RPZs. It defines RPZ rules to block DNS resolution for malicious or unauthorized hostnames, or redirect clients to a walled garden by substituting responses. This integration was integrated and tested with version V2 of Infoblox
Configure Infoblox NIOS on XSOAR
Required Permissions
The API supports only HTTP Basic Authentication. Every user must have permissions that grants them access to the API.
- Navigate to Settings > Integrations > Servers & Services.
- Search for Infoblox NIOS.
- Click Add instance to create and configure a new integration instance.
- Name: a textual name for the integration instance.
- Server URL (e.g. https://example.net)
- User Name
- Password
- Trust any certificate (not secure)
- Use system proxy settings
- Click Test to validate the new instance.
Commands
You can execute these commands from the Cortex XSOAR CLI, as part of an automation, or in a playbook. After you successfully execute a command, a DBot message appears in the War Room with the command details.
- Get IP info: infoblox-get-ip.
- Searches IP related objects by a given IP: infoblox-search-related-objects-by-ip.
- Lists all response policy rules that belong to the given response policy zone: infoblox-list-response-policy-zone-rules.
- List all response policy zones: infoblox-list-response-policy-zones.
- Creates a response policy zone: infoblox-create-response-policy-zone.
- Creates a response policy rule: infoblox-create-rpz-rule.
- Creates a substitute record rule: infoblox-create-a-substitute-record-rule.
- Creates a substitute rule for an AAAA record: infoblox-create-aaaa-substitute-record-rule.
- Creates a substitute rule for the MX record: infoblox-create-mx-substitute-record-rule.
- Creates a substitute rule for a NAPTR record: infoblox-create-naptr-substitute-record-rule.
- Creates a substitute rule of the PTR record: infoblox-create-ptr-substitute-record-rule.
- Creates a substitute rule of a SRV record: infoblox-create-srv-substitute-record-rule.
- Create a substitute rule for a txt record: infoblox-create-txt-substitute-record-rule.
- Create a substitute rule for an IPv4 rule: infoblox-create-ipv4-substitute-record-rule.
- Creates a substitute of the IPv6 record rule: infoblox-create-ipv6-substitute-record-rule.
- Disables a rule by its reference ID (reference ID can be extracted by running the search rules command): infoblox-enable-rule.
- Disable a rule by its reference ID (reference ID can be extracted by running the ‘infoblox-search-rule’ command): infoblox-disable-rule.
- Returns the object fields names which can be used in the search rules command: infoblox-get-object-fields.
- Searches a specific rule by its name: infoblox-search-rule.
- Deletes a rule: infoblox-delete-rpz-rule.
- Deletes a given response policy zone: infoblox-delete-response-policy-zone.
- List host information: infoblox-list-host-info.
- List network information: infoblox-list-network-info.
- Update a response policy zone rule: infoblox-update-rpz-rule.
- Create a host record: infoblox-create-host-record.
- Look up a DHCP lease: infoblox-dhcp-lease-lookup.
infoblox-get-ip
Get IP information.
Base Command
infoblox-get-ip
Input
| Argument Name | Description | Required |
|---|---|---|
| ip | The IP address for which to retrieve information, e.g. “192.168.1.1”, “2001:db8::1”. Cannot be used in conjunction with network or from/to_ip arguments. |
Optional |
| network | The network that the IP belongs in FQDN/CIDR format, e.g. “192.168.1.0/24”, “2001:db8::/64”. Cannot be used in conjunction with ip or from/to_ip arguments. |
Optional |
| from_ip | The beginning of the IP range, e.g. “192.168.1.0”, “2001:db8::”. Must be used in conjunction with to_ip. |
Optional |
| to_ip | The end of the IP range, e.g. “192.168.1.254”, “2001:db8::254”. Must be used in conjunction with from_ip. |
Optional |
| status | The status of the IP device. Used in conjunction with the network or ip argument. Possible values are ACTIVE, UNUSED and USED. |
Optional |
| extended_attrs | Comma-separated key/value formatted filter for extended attributes, e.g. “Site=New York,OtherProp=MyValue”. | Optional |
| max_results | The maximum results to return. Maximum is 1000. Default is 50. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.IP.ReferenceID | number | Reference ID of the object. |
| Infoblox.IP.MacAddress | string | The Mac address of the IP. |
| Infoblox.IP.Network | string | The network that the IP belongs (in FQDN/CIDR format.) |
| Infoblox.IP.NetworkView | string | The name of the network view. |
| Infoblox.IP.Status | string | The current status of the address. |
| Infoblox.IP.IsConflict | string | Whether the IP address has either a MAC address conflict or a DHCP lease conflict detected through a network discovery (if set to true). |
| Infoblox.IP.Objects | string | The objects associated with the IP address. |
| Infoblox.IP.Types | string | The current status of the address. |
| Infoblox.IP.Names | string | The DNS names. For example, if the IP address belongs to a host record, this field contains the hostname. |
| Infoblox.IP.Extattrs | string | Extra attributes relevant for this object. |
| Infoblox.IP.IpAddress | string | The IP address. |
| Infoblox.IP.Usage | string | Indicates whether the IP address is configured for DNS or DHCP. |
Command Example
!infoblox-get-ip ip="172.0.0.0"
Context Example
{
"Infoblox.IP": [
"Extattrs": {},
"IpAddress": "172.0.0.0",
"IsConflict": false,
"MacAddress": "",
"Names": [],
"Network": "172.0.0.0/24",
"NetworkView": "default",
"Objects": [],
"ReferenceID": "ipv4address/Li5pcHY0X2FkZHJlc3MkMTcyLjAuMC4wLzA:172.0.0.0",
"Status": "USED",
"Types": [
"NETWORK"
],
"Usage": []
]
}
Human Readable Output
Infoblox Integration
| Extattrs | Ip Address | Is Conflict | Mac Address | Names | Network | Network View | Objects | Reference ID | Status | Types | Usage |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 172.0.0.0 | false | 172.0.0.0/24 | default | ipv4address/Li5pcHY0X2FkZHJlc3MkMTcyLjAuMC4wLzA:172.0.0.0 | USED | NETWORK |
infoblox-search-related-objects-by-ip
Searches IP related objects by a given IP.
Base Command
infoblox-search-related-objects-by-ip
Input
| Argument Name | Description | Required |
|---|---|---|
| ip | The IP address for which to search. | Required |
| max_results | The maximum results to return. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.IPRelatedObjects.ReferenceID | Unknown | The reference ID of the related object. |
Command Example
!infoblox-search-related-objects-by-ip ip="172.0.0.0"
Context Example
{
"Infoblox.IPRelatedObjects": [
{
"Network": "172.0.0.0/24",
"NetworkView": "default",
"ReferenceID": "network/ZG5zLm5ldHdvcmskMTcyLjAuMC4wLzI0LzA:172.0.0.0/24/default"
}
]
}
Human Readable Output
Infoblox Integration - IP: 172.0.0.0 search results
| Network | Network View | Reference ID |
|---|---|---|
| 172.0.0.0/24 | default | network/ZG5zLm5ldHdvcmskMTcyLjAuMC4wLzI0LzA:172.0.0.0/24/default |
infoblox-list-response-policy-zone-rules
Lists all response policy rules that belong to the given response policy zone.
Base Command
infoblox-list-response-policy-zone-rules
Input
| Argument Name | Description | Required |
|---|---|---|
| response_policy_zone_name | The response policy zone name to list the rules (FQDN). | Optional |
| page_size | The number of results in each page. | Optional |
| next_page_id | The next page ID that was returned when last running this command. | Optional |
| view | The DNS view in which the records are located. By default, the ‘default’ DNS view is searched. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.ResponsePolicyZoneRulesList.Name | string | Rule name. |
| Infoblox.ResponsePolicyZoneRulesList.Disable | boolean | Whether the rule is disabled. |
| Infoblox.ResponsePolicyZoneRulesList.Comment | string | The comment for this rule. |
| Infoblox.ResponsePolicyZoneRulesList.Type | string | The object type as used in Infoblox. |
| Infoblox.ResponsePolicyZoneRulesList.View | string | View of the definition. |
| Infoblox.ResponsePolicyZoneRulesList.Zone | string | The zone to which this rule belongs. |
| Infoblox.RulesNextPage.NextPageID | string | Retrieves the next page of the search. The last NextpageID corresponds to the last search performed. |
Command Example
!infoblox-list-response-policy-zone-rules response_policy_zone_name=infoblow.com page_size="8"
Context Example
{
"Infoblox.ResponsePolicyZoneRulesList": [
{
"Comment": "",
"Disable": false,
"Name": "4.4.4.5",
"Type": "record:rpz:cname",
"View": "default",
"Zone": "infoblow.com"
},
{
"Comment": "",
"Disable": false,
"Name": "1.1.1.1",
"Type": "record:rpz:cname:ipaddressdn",
"View": "default",
"Zone": "infoblow.com"
},
{
"Comment": "",
"Disable": false,
"Name": "2.2.2.2",
"Type": "record:rpz:a:ipaddress",
"View": "default",
"Zone": "infoblow.com"
},
{
"Comment": "",
"Disable": false,
"Name": "5.5.5.111",
"Type": "record:rpz:cname:ipaddress",
"View": "default",
"Zone": "infoblow.com"
},
{
"Comment": "",
"Disable": false,
"Name": "moshe",
"Type": "record:rpz:cname",
"View": "default",
"Zone": "infoblow.com"
},
{
"Comment": "",
"Disable": false,
"Name": "moshe2",
"Type": "record:rpz:cname",
"View": "default",
"Zone": "infoblow.com"
},
{
"Comment": "",
"Disable": false,
"Name": "moshe3",
"Type": "record:rpz:cname",
"View": "default",
"Zone": "infoblow.com"
}
],
"Infoblox.RulesNextPage": {
"NextPageID": "789c9d525b4ec33010fcf739905a89cacaa3a5ed11fa83101cc0726c2735385ecb7668cbe9d935a1503e51a4489edd9d997d2c75a8d9cb02a2c953f4a2b7c6e92446d069c1428391fb054b2f8b111344908321b86587aa2654c681de6bb6d46183b91fe00dbe1fd8d2852dbeadefa17370e20a46c4774c26e29267110bd19e1d76c443c4829211ab2ba614840ba60c0c7f0a7cca71521922066bb65433eb99a31aef6432ec09eb0f886242c39410dd645db65e0806ddab5119f1963de6e75017ab3579ed219e64d4a4f8f0dd4fca326642b68810e0ec680bb09b9d0e90410448365bf002fa3e9912dfcf055a664983ab48a7a1c9f636a65cfa885abc990b4569ae34137e6d45fbc43bebb5505e8ee68e0b6d7a39b9fc3bebc4377c4d1f51b4c59e44eaa34cc29b33d968d6df9d1c8dd4242a14c09ba5a5341b36fca90ad1bc5384faafae915babdb7f5a1d211d4d4b0c38b7d42139ae225f42b1b24752e95c0c1f5f62e5a88a83db3b24b8a6636a696224b7a2135ba1d2687c5e699b64e7cc6ae66d5b3c30dce2d4fd949785b71be22e9b206cee977f02207ef4bc-1cbe432a6c562d903bd34ea2dd75f482330d98e249c3359e4e258b9"
}
}
Human Readable Output
Infoblox Integration - Zone: Infoblow.com rule list
| Comment | Disable | Name | Type | View | Zone |
|---|---|---|---|---|---|
| false | 4.4.4.5 | record:rpz:cname | default | infoblow.com | |
| false | 1.1.1.1 | record:rpz:cname:ipaddressdn | default | infoblow.com | |
| false | 2.2.2.2 | record:rpz:a:ipaddress | default | infoblow.com | |
| false | 5.5.5.111 | record:rpz:cname:ipaddress | default | infoblow.com | |
| false | moshe | record:rpz:cname | default | infoblow.com | |
| false | moshe2 | record:rpz:cname | default | infoblow.com | |
| false | moshe3 | record:rpz:cname | default | infoblow.com |
infoblox-list-response-policy-zones
List all response policy zones.
Base Command
infoblox-list-response-policy-zones
Input
| Argument Name | Description | Required |
|---|---|---|
| max_results | Maximum results to return. (Default is 50) | Optional |
| fqdn | The name of the DNS zone in FQDN format. | Optional |
| view | The name of the DNS view in which the zone resides. | Optional |
| comment | The comment for the zone to retrieve. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.ResponsePolicyZones.Disable | boolean | Whether this zone is disabled. |
| Infoblox.ResponsePolicyZones.FQDN | string | The fully qualified domain name. |
| Infoblox.ResponsePolicyZones.ReferenceID | string | The reference ID of the object. |
| Infoblox.ResponsePolicyZones.RpzPolicy | string | The response policy zone override policy. |
| Infoblox.ResponsePolicyZones.RpzSeverity | string | The severity of this response policy zone. |
| Infoblox.ResponsePolicyZones.RpzType | string | The type of response policy zone. |
| Infoblox.ResponsePolicyZones.View | string | The view of the definition. |
Command Example
!infoblox-list-response-policy-zones
Context Example
{
"Infoblox.ResponsePolicyZones": [
{
"Disable": false,
"FQDN": "local.rpz",
"ReferenceID": "zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LnJwei5sb2NhbA:local.rpz/default",
"RpzPolicy": "GIVEN",
"RpzSeverity": "MAJOR",
"RpzType": "LOCAL",
"View": "default"
},
{
"Disable": false,
"FQDN": "infoblow.com",
"ReferenceID": "zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS5pbmZvYmxvdw:infoblow.com/default",
"RpzPolicy": "SUBSTITUTE",
"RpzSeverity": "WARNING",
"RpzType": "LOCAL",
"SubstituteName": "infoblox.com",
"View": "default"
},
{
"Disable": false,
"FQDN": "google.com",
"ReferenceID": "zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS5nb29nbGU:google.com/default",
"RpzPolicy": "DISABLED",
"RpzSeverity": "INFORMATIONAL",
"RpzType": "LOCAL",
"SubstituteName": "sdfdsf",
"View": "default"
},
{
"Disable": false,
"FQDN": "google2.com",
"ReferenceID": "zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS5nb29nbGUy:google2.com/default",
"RpzPolicy": "DISABLED",
"RpzSeverity": "INFORMATIONAL",
"RpzType": "LOCAL",
"SubstituteName": "sdfdsf",
"View": "default"
},
{
"Disable": false,
"FQDN": "google3.com",
"ReferenceID": "zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS5nb29nbGUz:google3.com/default",
"RpzPolicy": "DISABLED",
"RpzSeverity": "INFORMATIONAL",
"RpzType": "LOCAL",
"SubstituteName": "sdfdsf",
"View": "default"
},
{
"Disable": false,
"FQDN": "google4.com",
"ReferenceID": "zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS5nb29nbGU0:google4.com/default",
"RpzPolicy": "DISABLED",
"RpzSeverity": "INFORMATIONAL",
"RpzType": "LOCAL",
"SubstituteName": "sdfdsf",
"View": "default"
},
{
"Disable": false,
"FQDN": "google33.com",
"ReferenceID": "zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS5nb29nbGUzMw:google33.com/default",
"RpzPolicy": "GIVEN",
"RpzSeverity": "WARNING",
"RpzType": "LOCAL",
"View": "default"
},
{
"Disable": false,
"FQDN": "google.test.com",
"ReferenceID": "zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50ZXN0Lmdvb2dsZQ:google.test.com/default",
"RpzPolicy": "NXDOMAIN",
"RpzSeverity": "INFORMATIONAL",
"RpzType": "LOCAL",
"View": "default"
},
{
"Disable": false,
"FQDN": "google.test2.com",
"ReferenceID": "zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50ZXN0Mi5nb29nbGU:google.test2.com/default",
"RpzPolicy": "NXDOMAIN",
"RpzSeverity": "INFORMATIONAL",
"RpzType": "LOCAL",
"View": "default"
},
{
"Disable": false,
"FQDN": "google.test4.com",
"ReferenceID": "zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50ZXN0NC5nb29nbGU:google.test4.com/default",
"RpzPolicy": "NXDOMAIN",
"RpzSeverity": "INFORMATIONAL",
"RpzType": "LOCAL",
"View": "default"
},
{
"Disable": false,
"FQDN": "test.com",
"ReferenceID": "zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50ZXN0:test.com/default",
"RpzPolicy": "GIVEN",
"RpzSeverity": "WARNING",
"RpzType": "LOCAL",
"View": "default"
},
{
"Disable": false,
"FQDN": "test123.com",
"ReferenceID": "zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50ZXN0MTIz:test123.com/default",
"RpzPolicy": "GIVEN",
"RpzSeverity": "WARNING",
"RpzType": "LOCAL",
"View": "default"
}
]
}
Human Readable Output
Infoblox Integration - Response Policy Zones list (fetched 12 results)
| Disable | FQDN | Reference ID | Rpz Policy | Rpz Severity | Rpz Type | View |
|---|---|---|---|---|---|---|
| false | local.rpz | zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LnJwei5sb2NhbA:local.rpz/default | GIVEN | MAJOR | LOCAL | default |
| false | infoblow.com | zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS5pbmZvYmxvdw:infoblow.com/default | SUBSTITUTE | WARNING | LOCAL | default |
| false | google.com | zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS5nb29nbGU:google.com/default | DISABLED | INFORMATIONAL | LOCAL | default |
| false | google2.com | zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS5nb29nbGUy:google2.com/default | DISABLED | INFORMATIONAL | LOCAL | default |
| false | google3.com | zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS5nb29nbGUz:google3.com/default | DISABLED | INFORMATIONAL | LOCAL | default |
| false | google4.com | zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS5nb29nbGU0:google4.com/default | DISABLED | INFORMATIONAL | LOCAL | default |
| false | google33.com | zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS5nb29nbGUzMw:google33.com/default | GIVEN | WARNING | LOCAL | default |
| false | google.test.com | zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50ZXN0Lmdvb2dsZQ:google.test.com/default | NXDOMAIN | INFORMATIONAL | LOCAL | default |
| false | google.test2.com | zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50ZXN0Mi5nb29nbGU:google.test2.com/default | NXDOMAIN | INFORMATIONAL | LOCAL | default |
| false | google.test4.com | zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50ZXN0NC5nb29nbGU:google.test4.com/default | NXDOMAIN | INFORMATIONAL | LOCAL | default |
| false | test.com | zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50ZXN0:test.com/default | GIVEN | WARNING | LOCAL | default |
| false | test123.com | zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50ZXN0MTIz:test123.com/default | GIVEN | WARNING | LOCAL | default |
5. infoblox-create-response-policy-zone
Creates a response policy zone.
Base Command
infoblox-create-response-policy-zone
Input
| Argument Name | Description | Required |
|---|---|---|
| FQDN | The name of this DNS zone in FQDN format. | Required |
| rpz_policy | The override policy of the response policy zone. Can be: “DISABLED”, “GIVEN”, “NODATA”, “NXDOMAIN”, “PASSTHRU”, or “SUBSTITUTE”. | Required |
| rpz_severity | The severity of the response policy zone. Can be: “CRITICAL”, “MAJOR”, “WARNING”, or “INFORMATIONAL”. | Required |
| substitute_name | The alternative name of the redirect target in a substitute response policy. policy zone. | Optional |
| rpz_type | The type of the RPZ. Can be: “FEED”, “FIREEYE”, or “LOCAL”. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.ResponsePolicyZones.Disable | boolean | Whether this zone is disabled. |
| Infoblox.ResponsePolicyZones.FQDN | string | A fully qualified domain name. |
| Infoblox.ResponsePolicyZones.ReferenceID | string | The reference ID of the object. |
| Infoblox.ResponsePolicyZones.RpzPolicy | string | The response policy zone override policy. |
| Infoblox.ResponsePolicyZones.RpzSeverity | string | The severity of the response policy zone. |
| Infoblox.ResponsePolicyZones.RpzType | string | The type of RPZ. |
| Infoblox.ResponsePolicyZones.View | string | The view of the definition. |
Command Example
!infoblox-create-response-policy-zone FQDN="infonlox.nightly.tpb.com" rpz_policy="DISABLED" rpz_severity="INFORMATIONAL" rpz_type="FEED"
Context Example
{
"Infoblox.ResponsePolicyZones": {
"Disable": false,
"FQDN": "infonlox.nightly.tpb.com",
"ReferenceID": "zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50cGIubmlnaHRseS5pbmZvbmxveA:infonlox.nightly.tpb.com/default",
"RpzPolicy": "DISABLED",
"RpzSeverity": "INFORMATIONAL",
"RpzType": "LOCAL",
"View": "default"
}
}
Human Readable Output
Infoblox Integration - Response Policy Zone: infonlox.nightly.tpb.com has been created
| Disable | FQDN | Reference ID | Rpz Policy | Rpz Severity | Rpz Type | View |
|---|---|---|---|---|---|---|
| false | infonlox.nightly.tpb.com | zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50cGIubmlnaHRseS5pbmZvbmxveA:infonlox.nightly.tpb.com/default | DISABLED | INFORMATIONAL | LOCAL | default |
infoblox-create-rpz-rule
Creates a response policy rule.
Base Command
infoblox-create-rpz-rule
Input
| Argument Name | Description | Required |
|---|---|---|
| rule_type | The type of the rule to create. Can be: “Passthru”, “Block” (No such domain), “Block” (No data), or “Substitute” (domain name). | Required |
| object_type | The type of the object for which to assign the rule. Can be: “Domain Name”, “IP address”, or “Client IP address”. | Required |
| name | The rule name in a FQDN format. | Required |
| rp_zone | The zone to assign the rule to. | Required |
| comment | Comment for this rule. | Optional |
| substitute_name | The substitute name to assign (substitute domain only). | Optional |
| view | The DNS view in which the records are located. By default, the ‘default’ DNS view is searched. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.ModifiedResponsePolicyZoneRules.Name | string | The rule name. |
| Infoblox.ModifiedResponsePolicyZoneRules.Disable | boolean | Whether this rule is disabled. |
| Infoblox.ModifiedResponsePolicyZoneRules.Comment | string | The comment for this rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Type | string | The object type as used in Infoblox. |
| Infoblox.ModifiedResponsePolicyZoneRules.View | string | The view of the definition. |
| Infoblox.ModifiedResponsePolicyZoneRules.Zone | string | The zone to which this rule belongs. |
| Infoblox.ModifiedResponsePolicyZoneRules.ReferenceID | string | The reference ID of the rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Canonical | string | Canonical value of the rule. |
Command Example
!infoblox-create-rpz-rule rule_type="Passthru" object_type="Domain Name" name="nightly-test-rpz-sub.infoblow.com" rp_zone="infoblow.com" comment="nightly-test-rpz-sub"
Context Example
{
"Infoblox.ModifiedResponsePolicyZoneRules": {
"Canonical": "nightly-test-rpz-sub.infoblow.com",
"Disable": false,
"Name": "nightly-test-rpz-sub.infoblow.com",
"ReferenceID": "record:rpz:cname/ZG5zLmJpbmRfY25hbWUkLl9kZWZhdWx0LmNvbS5pbmZvYmxvdy5uaWdodGx5LXRlc3QtcnB6LXN1Yg:nightly-test-rpz-sub.infoblow.com/default",
"Type": "record:rpz:cname",
"View": "default",
"Zone": "infoblow.com"
}
}
Human Readable Output
Infoblox Integration - Response Policy Zone rule: nightly-test-rpz-sub.infoblow.com has been created
| Canonical | Disable | Name | Reference ID | Type | View | Zone |
|---|---|---|---|---|---|---|
| nightly-test-rpz-sub.infoblow.com | false | nightly-test-rpz-sub.infoblow.com | record:rpz:cname/ZG5zLmJpbmRfY25hbWUkLl9kZWZhdWx0LmNvbS5pbmZvYmxvdy5uaWdodGx5LXRlc3QtcnB6LXN1Yg:nightly-test-rpz-sub.infoblow.com/default | record:rpz:cname | default | infoblow.com |
infoblox-create-a-substitute-record-rule
Creates a substitute record rule.
Base Command
infoblox-create-a-substitute-record-rule
Input
| Argument Name | Description | Required |
|---|---|---|
| name | The name for a record in FQDN format. | Required |
| rp_zone | The zone to assign the rule to to. | Required |
| comment | Comment for this rule. | Optional |
| ipv4addr | The IPv4 address of the substitute rule. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.ModifiedResponsePolicyZoneRules.Name | string | The name of the rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Disable | boolean | Whether this rule is disabled. |
| Infoblox.ModifiedResponsePolicyZoneRules.Comment | string | The comment for this rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Type | string | The object type as used in Infoblox. |
| Infoblox.ModifiedResponsePolicyZoneRules.View | string | The view of the definition. |
| Infoblox.ModifiedResponsePolicyZoneRules.Zone | string | The zone to which this rule belongs. |
| Infoblox.ModifiedResponsePolicyZoneRules.ReferenceID | string | The reference ID of the rule. |
Command Example
!infoblox-create-a-substitute-record-rule name="nightly-test-a-sub.infoblow.com" rp_zone="infoblow.com" comment="nightly-test-a-sub" ipv4addr="0.0.0.0"
Context Example
{
"Infoblox.ModifiedResponsePolicyZoneRules": {
"Comment": "nightly-test-a-sub",
"Disable": false,
"Ipv4addr": "0.0.0.0",
"Name": "nightly-test-a-sub.infoblow.com",
"ReferenceID": "record:rpz:a/ZG5zLmJpbmRfYSQuX2RlZmF1bHQuY29tLmluZm9ibG93LG5pZ2h0bHktdGVzdC1hLXN1YiwwLjAuMC4w:nightly-test-a-sub.infoblow.com/default",
"Type": "record:rpz:a",
"View": "default",
"Zone": "infoblow.com"
}
}
Human Readable Output
Infoblox Integration - Response Policy Zone rule: nightly-test-a-sub.infoblow.com has been created
| Comment | Disable | Ipv 4 Addr | Name | Reference ID | Type | View | Zone |
|---|---|---|---|---|---|---|---|
| nightly-test-a-sub | false | 0.0.0.0 | nightly-test-a-sub.infoblow.com | record:rpz:a/ZG5zLmJpbmRfYSQuX2RlZmF1bHQuY29tLmluZm9ibG93LG5pZ2h0bHktdGVzdC1hLXN1YiwwLjAuMC4w:nightly-test-a-sub.infoblow.com/default | record:rpz:a | default | infoblow.com |
infoblox-create-aaaa-substitute-record-rule
Creates a substitute rule for an AAAA record.
Base Command
infoblox-create-aaaa-substitute-record-rule
Input
| Argument Name | Description | Required |
|---|---|---|
| name | The name for a record in FQDN format. | Required |
| rp_zone | The zone to assign the rule to to. | Required |
| comment | Comment for this rule. | Optional |
| ipv6addr | The IPv6 address of the substitute rule. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.ModifiedResponsePolicyZoneRules.Name | string | The name of the rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Disable | boolean | Whether this rule is disabled. |
| Infoblox.ModifiedResponsePolicyZoneRules.Comment | string | The comment for this rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Type | string | The object type as used in Infoblox. |
| Infoblox.ModifiedResponsePolicyZoneRules.View | string | The view of the definition. |
| Infoblox.ModifiedResponsePolicyZoneRules.Zone | string | The zone to which this rule belongs. |
| Infoblox.ModifiedResponsePolicyZoneRules.ReferenceID | string | The reference ID of the rule. |
Command Example
!infoblox-create-aaaa-substitute-record-rule name="nightly-test-aaaa-sub.infoblow.com" rp_zone="infoblow.com" comment="nightly-test-aaaa-sub" ipv6addr="fd60:e32:f1b9::2"
Context Example
{
"Infoblox.ModifiedResponsePolicyZoneRules": {
"Comment": "nightly-test-aaaa-sub",
"Disable": false,
"Ipv6addr": "fd60:e32:f1b9::2",
"Name": "nightly-test-aaaa-sub.infoblow.com",
"ReferenceID": "record:rpz:aaaa/ZG5zLmJpbmRfYWFhYSQuX2RlZmF1bHQuY29tLmluZm9ibG93LG5pZ2h0bHktdGVzdC1hYWFhLXN1YixmZDYwOmUzMjpmMWI5Ojoy:nightly-test-aaaa-sub.infoblow.com/default",
"Type": "record:rpz:aaaa",
"View": "default",
"Zone": "infoblow.com"
}
}
Human Readable Output
Infoblox Integration - Response Policy Zone rule: nightly-test-aaaa-sub.infoblow.com has been created
| Comment | Disable | Ipv 6 Addr | Name | Reference ID | Type | View | Zone |
|---|---|---|---|---|---|---|---|
| nightly-test-aaaa-sub | false | fd60:e32:f1b9::2 | nightly-test-aaaa-sub.infoblow.com | record:rpz:aaaa/ZG5zLmJpbmRfYWFhYSQuX2RlZmF1bHQuY29tLmluZm9ibG93LG5pZ2h0bHktdGVzdC1hYWFhLXN1YixmZDYwOmUzMjpmMWI5Ojoy:nightly-test-aaaa-sub.infoblow.com/default | record:rpz:aaaa | default | infoblow.com |
infoblox-create-mx-substitute-record-rule
Creates a substitute rule for the MX record.
Base Command
infoblox-create-mx-substitute-record-rule
Input
| Argument Name | Description | Required |
|---|---|---|
| name | The name for a record in FQDN format. | Required |
| rp_zone | The zone to assign the rule to to. | Required |
| comment | Comment for this rule. | Optional |
| mail_exchanger | The mail exchanger name in FQDN format. This value can be in unicode format. | Required |
| preference | Preference value, 0 to 65535 (inclusive). | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.ModifiedResponsePolicyZoneRules.Name | string | The name of the rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Disable | boolean | Whether this rule is disabled. |
| Infoblox.ModifiedResponsePolicyZoneRules.Comment | string | The comment for this rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Type | string | The object type as used in Infoblox. |
| Infoblox.ModifiedResponsePolicyZoneRules.View | string | The view of the definition. |
| Infoblox.ModifiedResponsePolicyZoneRules.Zone | string | The zone to which this rule belongs. |
| Infoblox.ModifiedResponsePolicyZoneRules.ReferenceID | string | The reference ID of the rule. |
Command Example
!infoblox-create-mx-substitute-record-rule name="nightly-test-mx-sub.infoblow.com" rp_zone="infoblow.com" comment="nightly-test-mx-sub" mail_exchanger="0.0.0.0" preference="5"
Context Example
{
"Infoblox.ModifiedResponsePolicyZoneRules": {
"Comment": "nightly-test-mx-sub",
"Disable": false,
"MailExchanger": "0.0.0.0",
"Name": "nightly-test-mx-sub.infoblow.com",
"Preference": 5,
"ReferenceID": "record:rpz:mx/ZG5zLmJpbmRfbXgkLl9kZWZhdWx0LmNvbS5pbmZvYmxvdy5uaWdodGx5LXRlc3QtbXgtc3ViLjAuMC4wLjAuNQ:nightly-test-mx-sub.infoblow.com/default",
"Type": "record:rpz:mx",
"View": "default",
"Zone": "infoblow.com"
}
}
Human Readable Output
Infoblox Integration - Response Policy Zone rule: nightly-test-mx-sub.infoblow.com has been created
| Comment | Disable | Mail Exchanger | Name | Preference | Reference ID | Type | View | Zone |
|---|---|---|---|---|---|---|---|---|
| nightly-test-mx-sub | false | 0.0.0.0 | nightly-test-mx-sub.infoblow.com | 5 | record:rpz:mx/ZG5zLmJpbmRfbXgkLl9kZWZhdWx0LmNvbS5pbmZvYmxvdy5uaWdodGx5LXRlc3QtbXgtc3ViLjAuMC4wLjAuNQ:nightly-test-mx-sub.infoblow.com/default | record:rpz:mx | default | infoblow.com |
infoblox-create-naptr-substitute-record-rule
Creates a substitute rule for a NAPTR record.
Base Command
infoblox-create-naptr-substitute-record-rule
Input
| Argument Name | Description | Required |
|---|---|---|
| name | The name for a record in FQDN format. | Required |
| rp_zone | The zone to assign the rule to to. | Required |
| comment | Comment for this rule. | Optional |
| order | The order parameter of the substitute rule of the NAPTR record. This parameter specifies the order in which the NAPTR rules are applied when multiple rules are present. Can be from 0 to 65535 (inclusive). | Required |
| preference | Preference value, 0 to 65535 (inclusive). | Required |
| replacement | The substitute rule object replacement field of the NAPTR record. For non-terminal NAPTR records, this field specifies the next domain name to look up. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.ModifiedResponsePolicyZoneRules.Name | string | The name of the rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Disable | boolean | Whether this rule is disabled. |
| Infoblox.ModifiedResponsePolicyZoneRules.Comment | string | The comment for this rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Type | string | The object type as used in Infoblox. |
| Infoblox.ModifiedResponsePolicyZoneRules.View | string | The view of the definition. |
| Infoblox.ModifiedResponsePolicyZoneRules.Zone | string | The zone to which this rule belongs. |
| Infoblox.ModifiedResponsePolicyZoneRules.ReferenceID | string | The reference ID of the rule. |
Command Example
!infoblox-create-naptr-substitute-record-rule name="nightly-test-naptr-sub.infoblow.com" rp_zone="infoblow.com" comment="nightly-test-naptr-sub" order="0" preference="1" replacement="infoblow.com"
Context Example
{
"Infoblox.ModifiedResponsePolicyZoneRules": {
"Comment": "nightly-test-naptr-sub",
"Disable": false,
"Name": "nightly-test-naptr-sub.infoblow.com",
"Order": 0,
"Preference": 1,
"ReferenceID": "record:rpz:naptr/ZG5zLmJpbmRfbmFwdHIkLl9kZWZhdWx0LmNvbS5pbmZvYmxvdyxuaWdodGx5LXRlc3QtbmFwdHItc3ViLDAsMSwsLCxpbmZvYmxvdy5jb20:nightly-test-naptr-sub.infoblow.com/default",
"Regexp": "",
"Replacement": "infoblow.com",
"Services": "",
"Type": "record:rpz:naptr",
"View": "default",
"Zone": "infoblow.com"
}
}
Human Readable Output
Infoblox Integration - Response Policy Zone rule: nightly-test-naptr-sub.infoblow.com has been created
| Comment | Disable | Name | Order | Preference | Reference ID | Regexp | Replacement | Services | Type | View | Zone |
|---|---|---|---|---|---|---|---|---|---|---|---|
| nightly-test-naptr-sub | false | nightly-test-naptr-sub.infoblow.com | 0 | 1 | record:rpz:naptr/ZG5zLmJpbmRfbmFwdHIkLl9kZWZhdWx0LmNvbS5pbmZvYmxvdyxuaWdodGx5LXRlc3QtbmFwdHItc3ViLDAsMSwsLCxpbmZvYmxvdy5jb20:nightly-test-naptr-sub.infoblow.com/default | infoblow.com | record:rpz:naptr | default | infoblow.com |
infoblox-create-ptr-substitute-record-rule
Creates a substitute rule of the PTR record.
Base Command
infoblox-create-ptr-substitute-record-rule
Input
| Argument Name | Description | Required |
|---|---|---|
| rp_zone | The zone to assign the rule to to. | Required |
| comment | Comment for this rule. | Optional |
| ptrdname | The domain name of the RPZ substitute rule object of the PTR record in FQDN format. | Required |
| name | The name of the RPZ Substitute rule object of the PTR record in FQDN format. | Optional |
| ipv4addr | The IPv4 address of the substitute rule. | Optional |
| ipv6addr | The IPv6 address of the substitute rule. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.ModifiedResponsePolicyZoneRules.Name | string | The name of the rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Disable | boolean | Whether this rule is disabled. |
| Infoblox.ModifiedResponsePolicyZoneRules.Comment | string | The Comment for this rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Type | string | The object type as used in Infoblox. |
| Infoblox.ModifiedResponsePolicyZoneRules.View | string | The view of the definition. |
| Infoblox.ModifiedResponsePolicyZoneRules.Zone | string | The zone to which this rule belongs. |
| Infoblox.ModifiedResponsePolicyZoneRules.ReferenceID | string | The reference ID of the rule. |
Command Example
!infoblox-create-ptr-substitute-record-rule rp_zone="infoblow.com" comment="nightly-test-ptr-sub" ptrdname="infoblow.com" ipv4addr="0.0.0.0"
Context Example
{
"Infoblox.ModifiedResponsePolicyZoneRules": {
"Comment": "nightly-test-ptr-sub",
"Disable": false,
"Ipv4addr": "0.0.0.0",
"Name": "0.0.0.0.in-addr.arpa.infoblow.com",
"Ptrdname": "infoblow.com",
"ReferenceID": "record:rpz:ptr/ZG5zLmJpbmRfcHRyJC5fZGVmYXVsdC5jb20uaW5mb2Jsb3cuYXJwYS5pbi1hZGRyLjAuMC4wLjAuaW5mb2Jsb3cuY29t:0.0.0.0.in-addr.arpa.infoblow.com/default",
"Type": "record:rpz:ptr",
"View": "default",
"Zone": "infoblow.com"
}
}
Human Readable Output
Infoblox Integration - Response Policy Zone rule: None has been created
| Comment | Disable | Ipv 4 Addr | Name | Ptrdname | Reference ID | Type | View | Zone |
|---|---|---|---|---|---|---|---|---|
| nightly-test-ptr-sub | false | 0.0.0.0 | 0.0.0.0.in-addr.arpa.infoblow.com | infoblow.com | record:rpz:ptr/ZG5zLmJpbmRfcHRyJC5fZGVmYXVsdC5jb20uaW5mb2Jsb3cuYXJwYS5pbi1hZGRyLjAuMC4wLjAuaW5mb2Jsb3cuY29t:0.0.0.0.in-addr.arpa.infoblow.com/default | record:rpz:ptr | default | infoblow.com |
infoblox-create-srv-substitute-record-rule
Creates a substitute rule of a SRV record.
Base Command
infoblox-create-srv-substitute-record-rule
Input
| Argument Name | Description | Required |
|---|---|---|
| name | The name for a record in FQDN format. | Required |
| rp_zone | The zone to assign the rule to. | Required |
| comment | Comment for this rule. | Optional |
| port | The port of the substitute rule of the SRV record. Can be 0 to 65535 (inclusive). | Required |
| priority | The priority of the substitute rule for the SRV Record. Can be 0 to 65535 (inclusive). | Required |
| target | The target of the substitute rule of the SRV record in FQDN format. This value can be in unicode format. | Required |
| weight | The weight of the substitute rule of the SRV record. Can be 0 to 65535 (inclusive). | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.ModifiedResponsePolicyZoneRules.Name | string | The rule name. |
| Infoblox.ModifiedResponsePolicyZoneRules.Disable | boolean | Whether this rule is disabled. |
| Infoblox.ModifiedResponsePolicyZoneRules.Comment | string | The comment for this rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Type | string | The object type as used in Infoblox. |
| Infoblox.ModifiedResponsePolicyZoneRules.View | string | The view of the definition. |
| Infoblox.ModifiedResponsePolicyZoneRules.Zone | string | The zone to which this rule belongs. |
| Infoblox.ModifiedResponsePolicyZoneRules.ReferenceID | string | The reference ID of the rule. |
Command Example
!infoblox-create-srv-substitute-record-rule name="nightly-test-srv-sub.infoblow.com" rp_zone="infoblow.com" comment="nightly-test-srv-sub" port="22" priority="10" target="infoblow.com" weight="10"
Context Example
{
"Infoblox.ModifiedResponsePolicyZoneRules": {
"Comment": "nightly-test-srv-sub",
"Disable": false,
"Name": "nightly-test-srv-sub.infoblow.com",
"Port": 22,
"Priority": 10,
"ReferenceID": "record:rpz:srv/ZG5zLmJpbmRfc3J2JC5fZGVmYXVsdC5jb20uaW5mb2Jsb3cvbmlnaHRseS10ZXN0LXNydi1zdWIvMTAvMTAvMjIvaW5mb2Jsb3cuY29t:nightly-test-srv-sub.infoblow.com/default",
"Target": "infoblow.com",
"Type": "record:rpz:srv",
"View": "default",
"Weight": 10,
"Zone": "infoblow.com"
}
}
Human Readable Output
Infoblox Integration - Response Policy Zone rule: nightly-test-srv-sub.infoblow.com has been created
| Comment | Disable | Name | Port | Priority | Reference ID | Target | Type | View | Weight | Zone |
|---|---|---|---|---|---|---|---|---|---|---|
| nightly-test-srv-sub | false | nightly-test-srv-sub.infoblow.com | 22 | 10 | record:rpz:srv/ZG5zLmJpbmRfc3J2JC5fZGVmYXVsdC5jb20uaW5mb2Jsb3cvbmlnaHRseS10ZXN0LXNydi1zdWIvMTAvMTAvMjIvaW5mb2Jsb3cuY29t:nightly-test-srv-sub.infoblow.com/default | infoblow.com | record:rpz:srv | default | 10 | infoblow.com |
infoblox-create-txt-substitute-record-rule
Create a substitute rule for a txt record.
Base Command
infoblox-create-txt-substitute-record-rule
Input
| Argument Name | Description | Required |
|---|---|---|
| name | The name for a record in FQDN format. | Required |
| rp_zone | The zone to assign the rule to. | Required |
| comment | Comment for this rule. | Optional |
| text | Text associated with the record. To enter leading, trailing, or embedded spaces in the text, add quotes around the text to preserve the spaces. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.ModifiedResponsePolicyZoneRules.Name | string | The rule name. |
| Infoblox.ModifiedResponsePolicyZoneRules.Disable | boolean | Whether this rule is disabled. |
| Infoblox.ModifiedResponsePolicyZoneRules.Comment | string | The comment for this rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Type | string | The object type as used in Infoblox. |
| Infoblox.ModifiedResponsePolicyZoneRules.View | string | The view of the definition. |
| Infoblox.ModifiedResponsePolicyZoneRules.Zone | string | The zone to which this rule belongs. |
| Infoblox.ModifiedResponsePolicyZoneRules.ReferenceID | string | The reference ID of the rule. |
Command Example
!infoblox-create-txt-substitute-record-rule name="nightly-test-txt-sub.infoblow.com" rp_zone="infoblow.com" comment="nightly-test-txt-sub" text="nightly-test-txt-sub"
Context Example
{
"Infoblox.ModifiedResponsePolicyZoneRules": {
"Comment": "nightly-test-txt-sub",
"Disable": false,
"Name": "nightly-test-txt-sub.infoblow.com",
"ReferenceID": "record:rpz:txt/ZG5zLmJpbmRfdHh0JC5fZGVmYXVsdC5jb20uaW5mb2Jsb3cubmlnaHRseS10ZXN0LXR4dC1zdWIuIm5pZ2h0bHktdGVzdC10eHQtc3ViIg:nightly-test-txt-sub.infoblow.com/default",
"Text": "nightly-test-txt-sub",
"Type": "record:rpz:txt",
"View": "default",
"Zone": "infoblow.com"
}
}
Human Readable Output
Infoblox Integration - Response Policy Zone rule: nightly-test-txt-sub.infoblow.com has been created
| Comment | Disable | Name | Reference ID | Text | Type | View | Zone |
|---|---|---|---|---|---|---|---|
| nightly-test-txt-sub | false | nightly-test-txt-sub.infoblow.com | record:rpz:txt/ZG5zLmJpbmRfdHh0JC5fZGVmYXVsdC5jb20uaW5mb2Jsb3cubmlnaHRseS10ZXN0LXR4dC1zdWIuIm5pZ2h0bHktdGVzdC10eHQtc3ViIg:nightly-test-txt-sub.infoblow.com/default | nightly-test-txt-sub | record:rpz:txt | default | infoblow.com |
infoblox-create-ipv4-substitute-record-rule
Create a substitute rule for an IPv4 rule.
Base Command
infoblox-create-ipv4-substitute-record-rule
Input
| Argument Name | Description | Required |
|---|---|---|
| name | The name for a record in FQDN format. | Required |
| rp_zone | The zone to assign the rule to. | Required |
| comment | Comment for this rule. | Optional |
| ipv4addr | The IPv4 Address of the substitute rule. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.ModifiedResponsePolicyZoneRules.Name | string | The rule name. |
| Infoblox.ModifiedResponsePolicyZoneRules.Disable | boolean | Whether this rule is disabled. |
| Infoblox.ModifiedResponsePolicyZoneRules.Comment | string | The comment for this rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Type | string | The object type as used in Infoblox. |
| Infoblox.ModifiedResponsePolicyZoneRules.View | string | The view of the definition. |
| Infoblox.ModifiedResponsePolicyZoneRules.Zone | string | The zone to which this rule belongs. |
| Infoblox.ModifiedResponsePolicyZoneRules.ReferenceID | string | The reference ID of the rule. |
Command Example
!infoblox-create-ipv4-substitute-record-rule name="3.3.3.3.infoblow.com" rp_zone="infoblow.com" comment="nightly-test-ipv4-sub" ipv4addr="3.3.3.4"
Context Example
{
"Infoblox.ModifiedResponsePolicyZoneRules": {
"Comment": "nightly-test-ipv4-sub",
"Disable": false,
"Ipv4addr": "3.3.3.4",
"Name": "3.3.3.3.infoblow.com",
"ReferenceID": "record:rpz:a:ipaddress/ZG5zLmJpbmRfYSQuX2RlZmF1bHQuY29tLmluZm9ibG93LHJwei1pcC4zLjMuMy4zLjMyLDMuMy4zLjQ:3.3.3.3.infoblow.com/default",
"Type": "record:rpz:a:ipaddress",
"View": "default",
"Zone": "infoblow.com"
}
}
Human Readable Output
Infoblox Integration - Response Policy Zone rule: 3.3.3.3.infoblow.com has been created
| Comment | Disable | Ipv 4 Addr | Name | Reference ID | Type | View | Zone |
|---|---|---|---|---|---|---|---|
| nightly-test-ipv4-sub | false | 3.3.3.4 | 3.3.3.3.infoblow.com | record:rpz:a:ipaddress/ZG5zLmJpbmRfYSQuX2RlZmF1bHQuY29tLmluZm9ibG93LHJwei1pcC4zLjMuMy4zLjMyLDMuMy4zLjQ:3.3.3.3.infoblow.com/default | record:rpz:a:ipaddress | default | infoblow.com |
infoblox-create-ipv6-substitute-record-rule
Creates a substitute of the IPv6 record rule.
Base Command
infoblox-create-ipv6-substitute-record-rule
Input
| Argument Name | Description | Required |
|---|---|---|
| name | The name for a record in FQDN format. | Required |
| rp_zone | The zone to assign the rule to. | Required |
| comment | Comment for this rule. | Optional |
| ipv6addr | The IPv6 Address of the substitute rule. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.ModifiedResponsePolicyZoneRules.Name | string | The rule name. |
| Infoblox.ModifiedResponsePolicyZoneRules.Disable | boolean | Whether this rule is disabled. |
| Infoblox.ModifiedResponsePolicyZoneRules.Comment | string | The comment for this rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Type | string | The object type as used in Infoblox. |
| Infoblox.ModifiedResponsePolicyZoneRules.View | string | The view of the definition. |
| Infoblox.ModifiedResponsePolicyZoneRules.Zone | string | The zone to which this rule belongs. |
| Infoblox.ModifiedResponsePolicyZoneRules.ReferenceID | string | The reference ID of the rule. |
Command Example
!infoblox-create-ipv6-substitute-record-rule name="000:000:000::1.infoblow.com" rp_zone="infoblow.com" comment="nightly-test-ipv6-sub" ipv6addr="fd60:e22:f1b9::2"
Context Example
{
"Infoblox.ModifiedResponsePolicyZoneRules": {
"Comment": "nightly-test-ipv6-sub",
"Disable": false,
"Ipv6addr": "fd60:e22:f1b9::2",
"Name": "::1.infoblow.com",
"ReferenceID": "record:rpz:aaaa:ipaddress/ZG5zLmJpbmRfYWFhYSQuX2RlZmF1bHQuY29tLmluZm9ibG93LHJwei1pcC56ei4xLjEyOCxmZDYwOmUyMjpmMWI5Ojoy:%3A%3A1.infoblow.com/default",
"Type": "record:rpz:aaaa:ipaddress",
"View": "default",
"Zone": "infoblow.com"
}
}
Human Readable Output
Infoblox Integration - Response Policy Zone rule: 000:000:000::1.infoblow.com has been created
| Comment | Disable | Ipv 6 Addr | Name | Reference ID | Type | View | Zone |
|---|---|---|---|---|---|---|---|
| nightly-test-ipv6-sub | false | fd60:e22:f1b9::2 | ::1.infoblow.com | record:rpz:aaaa:ipaddress/ZG5zLmJpbmRfYWFhYSQuX2RlZmF1bHQuY29tLmluZm9ibG93LHJwei1pcC56ei4xLjEyOCxmZDYwOmUyMjpmMWI5Ojoy:%3A%3A1.infoblow.com/default | record:rpz:aaaa:ipaddress | default | infoblow.com |
infoblox-enable-rule
Disables a rule by its reference ID (reference ID can be extracted by running the search rules command).
Base Command
infoblox-enable-rule
Input
| Argument Name | Description | Required |
|---|---|---|
| reference_id | The ID of the rule reference (can be extracted by running the search rules command). | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.ModifiedResponsePolicyZoneRules.Disable | boolean | Whether this rule is disabled. |
| Infoblox.ModifiedResponsePolicyZoneRules.Comment | string | The rule comment. |
| Infoblox.ModifiedResponsePolicyZoneRules.Name | string | The rule name. |
| Infoblox.ModifiedResponsePolicyZoneRules.ReferenceID | string | The reference ID of the rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Zone | string | The response policy zone to which this rule belongs. |
| Infoblox.ModifiedResponsePolicyZoneRules.View | string | The view of the definition. |
Command Example
!infoblox-enable-rule reference_id="record:rpz:cname/ZG5zLmJpbmRfY25hbWUkLl9kZWZhdWx0LmNvbS5pbmZvYmxvdy41LjQuNC40:4.4.4.5.infoblow.com/default"
Context Example
{
"Infoblox.ModifiedResponsePolicyZoneRules": {
"Canonical": "4.4.4.5.infoblow.com",
"Disable": false,
"Name": "4.4.4.5.infoblow.com",
"ReferenceID": "record:rpz:cname/ZG5zLmJpbmRfY25hbWUkLl9kZWZhdWx0LmNvbS5pbmZvYmxvdy41LjQuNC40:4.4.4.5.infoblow.com/default",
"View": "default",
"Zone": "infoblow.com"
}
}
Human Readable Output
Infoblox Integration - Response Policy Zone rule: 4.4.4.5.infoblow.com has been enabled
| Canonical | Disable | Name | Reference ID | View | Zone |
|---|---|---|---|---|---|
| 4.4.4.5.infoblow.com | false | 4.4.4.5.infoblow.com | record:rpz:cname/ZG5zLmJpbmRfY25hbWUkLl9kZWZhdWx0LmNvbS5pbmZvYmxvdy41LjQuNC40:4.4.4.5.infoblow.com/default | default | infoblow.com |
infoblox-disable-rule
Disable a rule by its reference ID (reference ID can be extracted by running the ‘infoblox-search-rule’ command).
Base Command
infoblox-disable-rule
Input
| Argument Name | Description | Required |
|---|---|---|
| reference_id | The ID of the rule reference (reference ID can be extracted by running the ‘infoblox-search-rule’ command). | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.ModifiedResponsePolicyZoneRules.Disable | boolean | Whether this rule is disabled. |
| Infoblox.ModifiedResponsePolicyZoneRules.Comment | string | The rule comment. |
| Infoblox.ModifiedResponsePolicyZoneRules.Name | string | The rule name. |
| Infoblox.ModifiedResponsePolicyZoneRules.ReferenceID | string | The ID of the rule reference. |
| Infoblox.ModifiedResponsePolicyZoneRules.Zone | string | The response policy zone to which this rule belongs. |
| Infoblox.ModifiedResponsePolicyZoneRules.View | string | The view of the definition. |
Command Example
!infoblox-disable-rule reference_id="record:rpz:cname/ZG5zLmJpbmRfY25hbWUkLl9kZWZhdWx0LmNvbS5pbmZvYmxvdy41LjQuNC40:4.4.4.5.infoblow.com/default"
Context Example
{
"Infoblox.ModifiedResponsePolicyZoneRules": {
"Canonical": "4.4.4.5.infoblow.com",
"Disable": true,
"Name": "4.4.4.5.infoblow.com",
"ReferenceID": "record:rpz:cname/ZG5zLmJpbmRfY25hbWUkLl9kZWZhdWx0LmNvbS5pbmZvYmxvdy41LjQuNC40:4.4.4.5.infoblow.com/default",
"View": "default",
"Zone": "infoblow.com"
}
}
Human Readable Output
Infoblox Integration - Response Policy Zone rule: 4.4.4.5.infoblow.com has been disabled
| Canonical | Disable | Name | Reference ID | View | Zone |
|---|---|---|---|---|---|
| 4.4.4.5.infoblow.com | true | 4.4.4.5.infoblow.com | record:rpz:cname/ZG5zLmJpbmRfY25hbWUkLl9kZWZhdWx0LmNvbS5pbmZvYmxvdy41LjQuNC40:4.4.4.5.infoblow.com/default | default | infoblow.com |
infoblox-get-object-fields
Returns the object fields names which can be used in the search rules command.
Base Command
infoblox-get-object-fields
Input
| Argument Name | Description | Required |
|---|---|---|
| object_type | The Infoblox object type (can be retrieved by running the ‘infoblox-list-response-policy-zone-rules’ command). | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.ObjectFields.ObjectType | string | The Infoblox object type. |
| Infoblox.ObjectFields.SupportedFields | string | The list of supported fields for this object. |
Command Example
!infoblox-get-object-fields object_type="record:rpz:cname"
Context Example
{
"Infoblox.ObjectFields": {
"ObjectType": "record:rpz:cname",
"SupportedFields": [
"canonical",
"comment",
"disable",
"extattrs",
"name",
"rp_zone",
"ttl",
"use_ttl",
"view",
"zone"
]
}
}
Human Readable Output
Infoblox Integration - Object record:rpz:cname supported fields
| Field Names |
|---|
| canonical |
| comment |
| disable |
| extattrs |
| name |
| rp_zone |
| ttl |
| use_ttl |
| view |
| zone |
infoblox-search-rule
Searches a specific rule by its name.
Base Command
infoblox-search-rule
Input
| Argument Name | Description | Required |
|---|---|---|
| object_type | The Infoblox object type (can be retrieved by running the ‘infoblox-list-response-policy-zone-rules’ command). | Required |
| rule_name | The full rule name (usually the rule name followed by its zone. Example: name.domain.com) | Required |
| output_fields | The fields to include in the return object (supported object fields can be retrieved by running the *infoblox-get-object-fields* command). | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.RulesSearchResults.Name | string | The rule name. |
| Infoblox.RulesSearchResults.ReferenceID | string | The reference ID of the rule. |
| Infoblox.RulesSearchResults.View | string | The view of the definition. |
| Infoblox.RulesSearchResults.Canonical | string | The canonical value of the rule. |
Command Example
!infoblox-search-rule object_type="record:rpz:cname" rule_name="4.4.4.5.infoblow.com" output_fields="canonical,comment,disable,extattrs,name,rp_zone,ttl,use_ttl,view,zone"
Context Example
{
"Infoblox.RulesSearchResults": [
{
"Canonical": "4.4.4.5.infoblow.com",
"Disable": false,
"Extattrs": {},
"Name": "4.4.4.5.infoblow.com",
"ReferenceID": "record:rpz:cname/ZG5zLmJpbmRfY25hbWUkLl9kZWZhdWx0LmNvbS5pbmZvYmxvdy41LjQuNC40:4.4.4.5.infoblow.com/default",
"UseTtl": false,
"View": "default",
"Zone": "infoblow.com"
}
]
}
Human Readable Output
Infoblox Integration - Search result for: 4.4.4.5.infoblow.com
| Canonical | Disable | Extattrs | Name | Reference ID | Use Ttl | View | Zone |
|---|---|---|---|---|---|---|---|
| 4.4.4.5.infoblow.com | false | 4.4.4.5.infoblow.com | record:rpz:cname/ZG5zLmJpbmRfY25hbWUkLl9kZWZhdWx0LmNvbS5pbmZvYmxvdy41LjQuNC40:4.4.4.5.infoblow.com/default | false | default | infoblow.com |
infoblox-delete-rpz-rule
Deletes a rule.
Base Command
infoblox-delete-rpz-rule
Input
| Argument Name | Description | Required |
|---|---|---|
| reference_id | The reference ID of the rule (reference ID can be retrieved by running the ‘infoblox-search-rule’ command). | Required |
Context Output
There are no context output for this command.
Command Example
!infoblox-delete-rpz-rule reference_id=record:rpz:ptr/ZG5zLmJpbmRfcHRyJC5fZGVmYXVsdC5jb20uaW5mb2Jsb3cuYXJwYS5pbi1hZGRyLjAuMC4wLjAuaW5mb2Jsb3cuY29t:0.0.0.0.in-addr.arpa.infoblow.com/default
Context Example
{}
Human Readable Output
Infoblox Integration - A rule with the following id was deleted: record:rpz:ptr/ZG5zLmJpbmRfcHRyJC5fZGVmYXVsdC5jb20uaW5mb2Jsb3cuYXJwYS5pbi1hZGRyLjAuMC4wLjAuaW5mb2Jsb3cuY29t:0.0.0.0.in-addr.arpa.infoblow.com/default
infoblox-delete-response-policy-zone
Deletes a given response policy zone.
Base Command
infoblox-delete-response-policy-zone
Input
| Argument Name | Description | Required |
|---|---|---|
| reference_id | The reference ID of the rule (can be extracted by running the search rules command). | Required |
Context Output
There are no context output for this command.
Command Example
!infoblox-delete-response-policy-zone reference_id="zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50cGIubmlnaHRseS5pbmZvbmxveA:infonlox.nightly.tpb.com/default\"
Context Example
{}
Human Readable Output
Infoblox Integration - Response Policy Zone with the following id was deleted: zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50cGIubmlnaHRseS5pbmZvbmxveA:infonlox.nightly.tpb.com/default
Additional Information
In order to create new rule for a response policy zone for all rules different from substitute record use the command ‘create-rpz-rule’. For substitute record rules use the designated command for each use case.
Known Limitations
Troubleshooting
Context Output
There are no context output for this command.
Command Example
!infoblox-delete-response-policy-zone reference_id="zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50cGIubmlnaHRseS5pbmZvbmxveA:infonlox.nightly.tpb.com/default\"
Context Example
{}
Human Readable Output
Infoblox Integration - Response Policy Zone with the following id was deleted: zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50cGIubmlnaHRseS5pbmZvbmxveA:infonlox.nightly.tpb.com/default
Additional Information
In order to create new rule for a response policy zone for all rules different from substitute record use the command 'create-rpz-rule'. For substitute record rules use the designated command for each use case.
Known Limitations
Troubleshooting
infoblox-list-host-info
Get all host records.
Base Command
infoblox-list-host-info
Input
| Argument Name | Description | Required |
|---|---|---|
| host_name | The hostname to retrieve records for, e.g. localhost.test. | Optional |
| extattrs | Comma-separated key/value formatted filter for extended attributes, e.g. “Site=New York,OtherProp=MyValue”. | Optional |
| max_results | The maximum number of records to return. Default is 50, maximum is 1000. | Optional |
| additional_return_fields | Comma-separated list of additional fields to return for each host, e.g. extattrs,aliases. Default is extattrs. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.Host.Reference | String | The host record reference ID. |
| Infoblox.Host.IPv4Address | String | The host first IPv4 address. |
| Infoblox.Host.ConfigureForDHCP | Boolean | Whether the host is configured for DHCP. |
| Infoblox.Host.Name | String | The host record name. |
| Infoblox.Host.ExtendedAttributes | Unknown | The network extended attributes. |
| Infoblox.Host.AdditionalFields | Unknown | The additional fields for network. |
Command example
#### Context Example
```json
{
"Infoblox": {
"Host": [
{
"ConfigureForDHCP": false,
"ExtendedAttributes": {},
"IPv4Address": "192.168.10.10",
"Name": "localhost.test",
"Reference": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQudGVzdC5sb2NhbGhvc3QuMTkyLjE2OC4xMC4xMC4:192.168.10.10/localhost.test/default"
},
{
"ConfigureForDHCP": false,
"ExtendedAttributes": {
"IB Discovery Owned": "EMEA",
"Site": "Tel-Aviv"
},
"IPv4Address": "192.168.100.100",
"Name": "localdoman.localhost.test",
"Reference": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQudGVzdC5sb2NhbGhvc3QubG9jYWxkb21hbi4xOTIuMTY4LjEwMC4xMDAu:192.168.100.100/localdoman.localhost.test/default"
},
{
"ConfigureForDHCP": false,
"ExtendedAttributes": {
"Site": "Local"
},
"IPv4Address": "255.255.255.192",
"Name": "test",
"Reference": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQudGVzdC4uMjU1LjI1NS4yNTUuMTkyLg:255.255.255.192/test/default"
},
{
"ConfigureForDHCP": false,
"ExtendedAttributes": {
"IB Discovery Owned": "dummy value",
"Site": "ciac-5843"
},
"IPv4Address": "192.168.1.0",
"Name": "ciac-3607.test",
"Reference": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQudGVzdC5jaWFjLTM2MDcuMTkyLjE2OC4xLjAu:192.168.1.0/ciac-3607.test/default"
}
]
}
}
Human Readable Output
Host records (first 50)
ConfigureForDHCP ExtendedAttributes IPv4Address Name Reference false 192.168.10.10 localhost.test record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQudGVzdC5sb2NhbGhvc3QuMTkyLjE2OC4xMC4xMC4:192.168.10.10/localhost.test/default false IB Discovery Owned: EMEA
Site: Tel-Aviv192.168.100.100 localdoman.localhost.test record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQudGVzdC5sb2NhbGhvc3QubG9jYWxkb21hbi4xOTIuMTY4LjEwMC4xMDAu:192.168.100.100/localdoman.localhost.test/default false Site: Local 255.255.255.192 test record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQudGVzdC4uMjU1LjI1NS4yNTUuMTkyLg:255.255.255.192/test/default false IB Discovery Owned: dummy value
Site: ciac-5843192.168.1.0 ciac-3607.test record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQudGVzdC5jaWFjLTM2MDcuMTkyLjE2OC4xLjAu:192.168.1.0/ciac-3607.test/default
Command example
!infoblox-list-host-info additional_return_fields=extattrs,aliases
Context Example
{
"Infoblox": {
"Host": [
{
"ConfigureForDHCP": false,
"ExtendedAttributes": {},
"IPv4Address": "192.168.10.10",
"Name": "localhost.test",
"Reference": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQudGVzdC5sb2NhbGhvc3QuMTkyLjE2OC4xMC4xMC4:192.168.10.10/localhost.test/default"
},
{
"ConfigureForDHCP": false,
"ExtendedAttributes": {
"IB Discovery Owned": "EMEA",
"Site": "Tel-Aviv"
},
"IPv4Address": "192.168.100.100",
"Name": "localdoman.localhost.test",
"Reference": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQudGVzdC5sb2NhbGhvc3QubG9jYWxkb21hbi4xOTIuMTY4LjEwMC4xMDAu:192.168.100.100/localdoman.localhost.test/default"
},
{
"ConfigureForDHCP": false,
"ExtendedAttributes": {
"Site": "Local"
},
"IPv4Address": "255.255.255.192",
"Name": "test",
"Reference": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQudGVzdC4uMjU1LjI1NS4yNTUuMTkyLg:255.255.255.192/test/default"
},
{
"AdditionalFields": [
{
"Aliases": [
"test_host.test"
]
}
],
"ConfigureForDHCP": false,
"ExtendedAttributes": {
"IB Discovery Owned": "dummy value",
"Site": "ciac-5843"
},
"IPv4Address": "192.168.1.0",
"Name": "ciac-3607.test",
"Reference": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQudGVzdC5jaWFjLTM2MDcuMTkyLjE2OC4xLjAu:192.168.1.0/ciac-3607.test/default"
}
]
}
}
Human Readable Output
Host records (first 50)
ConfigureForDHCP ExtendedAttributes IPv4Address Name Reference false 192.168.10.10 localhost.test record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQudGVzdC5sb2NhbGhvc3QuMTkyLjE2OC4xMC4xMC4:192.168.10.10/localhost.test/default false IB Discovery Owned: EMEA
Site: Tel-Aviv192.168.100.100 localdoman.localhost.test record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQudGVzdC5sb2NhbGhvc3QubG9jYWxkb21hbi4xOTIuMTY4LjEwMC4xMDAu:192.168.100.100/localdoman.localhost.test/default false Site: Local 255.255.255.192 test record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQudGVzdC4uMjU1LjI1NS4yNTUuMTkyLg:255.255.255.192/test/default false IB Discovery Owned: dummy value
Site: ciac-5843192.168.1.0 ciac-3607.test record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQudGVzdC5jaWFjLTM2MDcuMTkyLjE2OC4xLjAu:192.168.1.0/ciac-3607.test/default
infoblox-list-network-info
List network information.
Base Command
infoblox-list-network-info
Input
| Argument Name | Description | Required |
|---|---|---|
| pattern | Filter networks by pattern, e.g. ‘.0/24’ for netmask, ‘192.168’ for subnet. | Optional |
| extattrs | comma-separated key/value formatted filter for extended attributes, e.g. “Site=New York,OtherProp=MyValue”. | Optional |
| max_results | The maximum number of records to return. Maximum is 1000. Default is 50. | Optional |
| additional_return_fields | Comma separated list of additional fields to return for each host, e.g. extattrs,aliases. Default is extattrs. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.NetworkInfo.Reference | String | The network reference. |
| Infoblox.NetworkInfo.Name | String | The network name. |
| Infoblox.NetworkInfo.NetworkView | String | The network view name. |
| Infoblox.NetworkInfo.ExtendedAttributes | Unknown | The network extended attributes. |
| Infoblox.NetworkInfo.AdditionalFields | Unknown | The additional fields for network. |
Command example
#### Context Example
```json
{
"Infoblox": {
"NetworkInfo": [
{
"ExtendedAttributes": {},
"Name": "192.168.1.0/24",
"NetworkView": "default",
"Reference": "network/ZG5zLm5ldHdvcmskMTkyLjE2OC4xLjAvMjQvMA:192.168.1.0/24/default"
},
{
"ExtendedAttributes": {
"Region": "EMEA"
},
"Name": "255.255.255.192/26",
"NetworkView": "default",
"Reference": "network/ZG5zLm5ldHdvcmskMjU1LjI1NS4yNTUuMTkyLzI2LzA:255.255.255.192/26/default"
}
]
}
}
Human Readable Output
Network information found (50 limit)
ExtendedAttributes Name NetworkView Reference 192.168.1.0/24 default network/ZG5zLm5ldHdvcmskMTkyLjE2OC4xLjAvMjQvMA:192.168.1.0/24/default Region: EMEA 255.255.255.192/26 default network/ZG5zLm5ldHdvcmskMjU1LjI1NS4yNTUuMTkyLzI2LzA:255.255.255.192/26/default
Command example
!infoblox-list-network-info pattern=255.255 extattrs="Region=EMEA"
Context Example
{
"Infoblox": {
"NetworkInfo": [
{
"ExtendedAttributes": {
"Region": "EMEA"
},
"Name": "255.255.255.192/26",
"NetworkView": "default",
"Reference": "network/ZG5zLm5ldHdvcmskMjU1LjI1NS4yNTUuMTkyLzI2LzA:255.255.255.192/26/default"
}
]
}
}
Human Readable Output
Network information found (50 limit)
ExtendedAttributes Name NetworkView Reference Region: EMEA 255.255.255.192/26 default network/ZG5zLm5ldHdvcmskMjU1LjI1NS4yNTUuMTkyLzI2LzA:255.255.255.192/26/default
infoblox-update-rpz-rule
Update a response policy zone rule.
Base Command
infoblox-update-rpz-rule
Input
| Argument Name | Description | Required |
|---|---|---|
| reference_id | The reference ID of the existing RPZ rule to update. | Required |
| name | The name of the response policy zone rule. | Required |
| rule_type | The type of the response policy zone rule. Possible values are: Passthru, Block (No such domain), Block (No data), Substitute (domain name). | Required |
| rp_zone | The zone to assign the rule to. | Required |
| comment | The comment for this rule update. | Optional |
| substitute_name | The substitute name to assign (substitute domain only). | Optional |
| view | The DNS view in which the records are located. Default is default. | Optional |
| additional_parameters | JSON object containing additional parameters (disable, use_ttl, ttl, extattrs) to update RPZ rule. Example: {“disable”: true, “use_ttl”: true, “ttl”: 3600}. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.ModifiedResponsePolicyZoneRules.Name | string | Rule name. |
| Infoblox.ModifiedResponsePolicyZoneRules.Canonical | string | Canonical value of the rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Disable | boolean | Whether the rule is disabled. |
| Infoblox.ModifiedResponsePolicyZoneRules.Comment | string | The comment for this rule. |
| Infoblox.ModifiedResponsePolicyZoneRules.Type | string | The object type as used in Infoblox. |
| Infoblox.ModifiedResponsePolicyZoneRules.View | string | View of the definition. |
| Infoblox.ModifiedResponsePolicyZoneRules.Zone | string | The zone to which this rule belongs. |
| Infoblox.ModifiedResponsePolicyZoneRules.ReferenceID | string | The reference ID of the rule. |
Command example
!infoblox-update-rpz-rule reference_id="record:rpz:cname/sample.example.com/default" name="sample.example.com" rp_zone="example.com" rule_type="PASSTHRU" comment="Updated passthru rule"
Context Example
{
"Infoblox": {
"ModifiedResponsePolicyZoneRules": {
"Canonical": "",
"Comment": "Updated passthru rule",
"Disable": false,
"Extattrs": {},
"Name": "sample.example.com",
"ReferenceID": "record:rpz:cname/sample.example.com/default",
"Type": "record:rpz:cname",
"View": "default",
"Zone": "example.com"
}
}
}
Human Readable Output
Infoblox Integration - Response Policy Zone rule: sample.example.com has been updated
Comment Disable Name Reference ID Type View Zone Updated passthru rule false sample.example.com record:rpz:cname/sample.example.com/default record:rpz:cname default example.com
infoblox-create-host-record
Creates a host record. Note: Either ipv4_address or ipv6_address is required.
Base Command
infoblox-create-host-record
Input
| Argument Name | Description | Required |
|---|---|---|
| name | The name of the host in FQDN format ‘{name}.{zone}’ (e.g. example.auth_zone). It must belong to an existing DNS zone. | Required |
| view | The DNS view in which the records are located. Default is default. | Optional |
| ipv4_address | The IPv4 addresses for the host record. Example: [{“ipv4addr”: “192.168.1.0”}], [{“ipv4addr”: “192.168.1.1”, “configure_for_dhcp”: true, “mac”: “00:01:00:01:00:01”}]. | Optional |
| ipv6_address | The IPv6 addresses for the host record. Example: [{“ipv6addr”: “2001:db8::1”}], [{“ipv6addr”: “2001:db8::2”, “configure_for_dhcp”: true, “duid”: “00:01:00:01:0a:1a”}]. | Optional |
| comment | The comment for this host record. | Optional |
| aliases | The aliases for this host record. Example: [“alias1”, “alias2”]. | Optional |
| configure_for_dns | Whether to configure the host record for DNS. Possible values are: Yes, No. Default is Yes. | Optional |
| extattrs | The extended attributes for this host record. Example: {“Site”: {“value”: “example”}}. | Optional |
| additional_parameters | JSON object containing additional parameters to create host record. Example: {“use_ttl”: true, “ttl”: 3600, “disable”: true}. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.Host.ReferenceID | String | The host record reference ID. |
| Infoblox.Host.IPV4Addresses | String | The host IPv4 addresses. |
| Infoblox.Host.IPV6Addresses | String | The host IPv6 addresses. |
| Infoblox.Host.ConfigureForDNS | Boolean | Whether the host is configured for DNS. |
| Infoblox.Host.Name | String | The host record name. |
| Infoblox.Host.ExtendedAttributes | Unknown | The network extended attributes. |
| Infoblox.Host.AdditionalFields | Unknown | The additional fields for network. |
| Infoblox.Host.Aliases | String | The aliases for this host record. |
| Infoblox.Host.AllowTelnet | Boolean | Whether the host is allowed to use telnet. |
| Infoblox.Host.NetworkView | String | The network view of the host record. |
| Infoblox.Host.View | String | The view of the host record. |
| Infoblox.Host.Zone | String | The zone of the host record. |
| Infoblox.Host.Disable | Boolean | Whether the host is disabled. |
| Infoblox.Host.DNSName | String | The DNS name of the host record. |
Command example
!infoblox-create-host-record name=example.com ipv4_address="[{\"ipv4addr\": \"0.0.0.1\"}]" ipv6_address="[{\"ipv6addr\": \"0000:000:0000::0000:000:001\", \"configure_for_dhcp\": false}]" configure_for_dns=false aliases="[\"example2.com\", \"example3.com\"]"
Context Example
{
"Infoblox": {
"Host": {
"Aliases": [
"example2.com",
"example3.com"
],
"AllowTelnet": false,
"ConfigureForDNS": false,
"DDNSProtected": false,
"DNSName": "example.com",
"Disable": false,
"DisableDiscovery": false,
"DnsAliases": [
"example2.com",
"example3.com"
],
"Extattrs": {},
"IPV4Addresses": [
{
"ConfigureForDHCP": false,
"Host": "example.com",
"IPV4Address": "0.0.0.1",
"ReferenceID": "record:host_ipv4addr/12345:0.0.0.1/example.com/ "
}
],
"IPV6Addresses": [
{
"ConfigureForDHCP": false,
"Host": "example.com",
"IPV6Address": "0000:000:0000::0000:000:001",
"ReferenceID": "record:host_ipv6addr/23456:0000:000:0000::0000:000:001/example.com/ "
}
],
"Name": "example.com",
"NetworkView": "default",
"RRSetOrder": "cyclic",
"ReferenceID": "record:host/45678:example.com/ ",
"Type": "record:host",
"UseCLICredentials": false,
"UseSNMP3Credential": false,
"UseSNMPCredential": false,
"UseTTL": false,
"View": " ",
"Zone": ""
}
}
}
Human Readable Output
Host record created
Aliases Allow Telnet Configure For DNS DDNS Protected DNS Name Disable Disable Discovery Dns Aliases IPV4 Addresses IPV6 Addresses Name Network View RR Set Order Reference ID Type Use CLI Credentials Use SNMP3 Credential Use SNMP Credential Use TTL View example2.com,
example3.comfalse false false example.com false false example2.com,
example3.com- ReferenceID: record:host_ipv4addr/12345:0.0.0.1/example.com/
ConfigureForDHCP: false
Host: example.com
IPV4Address: 0.0.0.1- ReferenceID: record:host_ipv6addr/23456:0000:000:0000::0000:000:001/example.com/
ConfigureForDHCP: false
Host: example.com
IPV6Address: 0000:000:0000::0000:000:001example.com default cyclic record:host/45678:example.com/ record:host false false false false
infoblox-dhcp-lease-lookup
Look up a DHCP lease.
Base Command
infoblox-dhcp-lease-lookup
Input
| Argument Name | Description | Required |
|---|---|---|
| ip_address | Lease IP address (IPv4 or IPv6). | Optional |
| hardware | MAC address for IPv4 leases. Regex or exact search supported. | Optional |
| hostname | Hostname sent via DHCP option 12. Regex/exact search. | Optional |
| ipv6_duid | IPv6 DUID identifier for IPv6 leases. Regex/exact search. | Optional |
| protocol | The protocol of the DHCP lease. Possible values are: IPV4, IPV6, BOTH. Default is BOTH. | Optional |
| fingerprint | DHCP client fingerprint; case-insensitive or regex search. | Optional |
| username | Specify the user associated with the lease request. | Optional |
| limit | Specify the maximum number of leases to return. Default is 100. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Infoblox.DHCPLease.ReferenceID | String | The DHCP lease reference ID. |
| Infoblox.DHCPLease.Address | String | The DHCP lease address. |
| Infoblox.DHCPLease.BindingState | String | The DHCP lease binding state. |
| Infoblox.DHCPLease.ClientHostname | String | The DHCP lease client hostname. |
| Infoblox.DHCPLease.CLTT | String | The DHCP lease client last transaction time. |
| Infoblox.DHCPLease.Ends | String | The DHCP lease ends time. |
| Infoblox.DHCPLease.Fingerprint | String | The DHCP lease fingerprint. |
| Infoblox.DHCPLease.Hardware | String | The DHCP lease hardware address. |
| Infoblox.DHCPLease.IPV6PrefixBits | String | The DHCP lease IPv6 prefix bits. |
| Infoblox.DHCPLease.IsInvalidMAC | Boolean | The Flag indicating if the MAC address is invalid. |
| Infoblox.DHCPLease.NetworkView | String | The network view of the DHCP lease record. |
| Infoblox.DHCPLease.Network | String | The network of the DHCP lease record. |
| Infoblox.DHCPLease.Protocol | String | The protocol of the DHCP lease record. |
| Infoblox.DHCPLease.Starts | String | The DHCP lease starts time. |
| Infoblox.DHCPLease.Variable | String | The DHCP lease variable. |
| Infoblox.DHCPLease.UID | String | The unique identifier of the DHCP lease record. |
Command example
!infoblox-dhcp-lease-lookup limit=3
Context Example
{
"Infoblox": {
"DHCPLease": [
{
"Address": "0.0.0.2",
"BindingState": "FREE",
"CLTT": 1757322665,
"Ends": 1757365865,
"Fingerprint": "Microsoft Windows 10",
"Hardware": "00:00:00:00:00:02",
"IPV6PrefixBits": 0,
"IsInvalidMAC": false,
"Network": "0.0.0.5/20",
"NetworkView": "default",
"NeverEnds": false,
"NeverStarts": false,
"Protocol": "IPV4",
"ReferenceID": "lease/123:0.0.0.2/default",
"ServedBy": "0.0.0.0",
"ServerHostName": "infoblox.localdomain",
"Starts": 1757322665,
"TSTP": 1757365865,
"UID": "123",
"Variable": "vendor-class-identifier=\"MSFT 5.0\""
},
{
"Address": "0.0.0.3",
"BindingState": "ACTIVE",
"CLTT": 1757399758,
"ClientHostname": "CE",
"Ends": 1757442958,
"Fingerprint": "Ubuntu/Debian 5/Knoppix 6",
"Hardware": "00:00:00:00:00:03",
"IPV6PrefixBits": 0,
"IsInvalidMAC": false,
"Network": "0.0.0.5/20",
"NetworkView": "default",
"NeverEnds": false,
"NeverStarts": false,
"NextBindingState": "FREE",
"Protocol": "IPV4",
"ReferenceID": "lease/234:0.0.0.3/default",
"ServedBy": "0.0.0.0",
"ServerHostName": "infoblox.localdomain",
"Starts": 1757399758,
"UID": "234"
},
{
"Address": "0.0.0.4",
"BindingState": "ABANDONED",
"CLTT": 1757365722,
"ClientHostname": "rhel",
"Fingerprint": "Ubuntu/Debian 5/Knoppix 6",
"IPV6PrefixBits": 0,
"IsInvalidMAC": false,
"Network": "0.0.0.5/20",
"NetworkView": "default",
"NeverEnds": true,
"NeverStarts": false,
"NextBindingState": "FREE",
"Protocol": "IPV4",
"ReferenceID": "lease/345:0.0.0.4/default",
"ServedBy": "0.0.0.0",
"ServerHostName": "infoblox.localdomain",
"Starts": 1757365722
}
]
}
}
Human Readable Output
DHCP lease lookup, found 3 records
Address Binding State CLTT Ends Fingerprint Hardware IPV6 Prefix Bits Is Invalid MAC Network Network View Never Ends Never Starts Protocol Reference ID Served By Server Host Name Starts TSTP UID Variable 0.0.0.2 FREE 1757322665 1757365865 Microsoft Windows 10 00:00:00:00:00:02 0 false 0.0.0.5/20 default false false IPV4 lease/123:0.0.0.2/default 0.0.0.0 infoblox.localdomain 1757322665 1757365865 123 vendor-class-identifier=”MSFT 5.0” 0.0.0.3 ACTIVE 1757399758 1757442958 Ubuntu/Debian 5/Knoppix 6 00:00:00:00:00:03 0 false 0.0.0.5/20 default false false IPV4 lease/234:0.0.0.3/default 0.0.0.0 infoblox.localdomain 1757399758 234 0.0.0.4 ABANDONED 1757365722 Ubuntu/Debian 5/Knoppix 6 0 false 0.0.0.5/20 default true false IPV4 lease/345:0.0.0.4/default 0.0.0.0 infoblox.localdomain 1757365722
Configuration parameters
url— Server URL (e.g., https://example.net) (required)credentials— User Nameinsecure— Trust any certificate (not secure)proxy— Use system proxy settings
Commands (26)
-
infoblox-create-a-substitute-record-ruleCreates a substitute record rule.
-
infoblox-create-aaaa-substitute-record-ruleCreates a substitute rule for an AAAA record.
-
infoblox-create-host-recordCreates a host record. Note: Either ipv4_address or ipv6_address is required.
-
infoblox-create-ipv4-substitute-record-ruleCreate a substitute rule for an IPv4 rule.
-
infoblox-create-ipv6-substitute-record-ruleCreates a substitute of the IPv6 record rule.
-
infoblox-create-mx-substitute-record-ruleCreates a substitute rule for the MX record.
-
infoblox-create-naptr-substitute-record-ruleCreates a substitute rule for a NAPTR record.
-
infoblox-create-ptr-substitute-record-ruleCreates a substitute rule of the PTR record.
-
infoblox-create-response-policy-zoneCreates a response policy zone.
-
infoblox-create-rpz-ruleCreates a response policy rule.
-
infoblox-create-srv-substitute-record-ruleCreates a substitute rule of a SRV record.
-
infoblox-create-txt-substitute-record-ruleCreate a substitute rule for a txt record.
-
infoblox-delete-response-policy-zoneDeletes a given response policy zone.
-
infoblox-delete-rpz-ruleDeletes a rule.
-
infoblox-dhcp-lease-lookupLook up a DHCP lease.
-
infoblox-disable-ruleDisable a rule by its reference ID (reference ID can be extracted by running the 'infoblox-search-rule' command).
-
infoblox-enable-ruleDisables a rule by its reference ID (reference ID can be extracted by running the search rules command).
-
infoblox-get-ipGet IP information.
-
infoblox-get-object-fieldsReturns the object fields names which can be used in the search rules command.
-
infoblox-list-host-infoGet all host records.
-
infoblox-list-network-infoList network information.
-
infoblox-list-response-policy-zone-rulesLists all response policy rules that belong to the given response policy zone.
-
infoblox-list-response-policy-zonesList all response policy zones.
-
infoblox-search-related-objects-by-ipSearches IP related objects by a given IP.
-
infoblox-search-ruleSearches a specific rule by its name.
-
infoblox-update-rpz-ruleUpdate a response policy zone rule.
import json from pathlib import Path from typing import Any, cast from urllib.parse import quote import demistomock as demisto import pytest from CommonServerPython import DemistoException, assign_params from Infoblox import ( INTEGRATION_COMMON_ADDITIONAL_FIELDS_CONTEXT_KEY, INTEGRATION_COMMON_EXTENSION_ATTRIBUTES_CONTEXT_KEY, INTEGRATION_COMMON_NAME_CONTEXT_KEY, INTEGRATION_COMMON_NETWORKVIEW_CONTEXT_KEY, INTEGRATION_COMMON_RAW_RESULT_EXTENSION_ATTRIBUTES_KEY, INTEGRATION_COMMON_REFERENCE_CONTEXT_KEY, INTEGRATION_COMMON_REFERENCE_ID_CONTEXT_KEY, INTEGRATION_CONTEXT_NAME, INTEGRATION_HOST_RECORDS_CONFIGURE_FOR_DHCP_KEY_CONTEXT_KEY, INTEGRATION_HOST_RECORDS_CONTEXT_NAME, INTEGRATION_HOST_RECORDS_IPV4ADDRESS_CONTEXT_KEY, INTEGRATION_IP_CONTEXT_NAME, INTEGRATION_MAX_RESULTS_DEFAULT, INTEGRATION_NETWORK_INFO_CONTEXT_KEY, IP_MAPPING, InfoBloxNIOSClient, IPv4AddressStatus, get_extended_attributes_context, get_host_records_command, get_ip_command, get_network_info_command, transform_ext_attrs, transform_host_records_context, transform_ip_context, transform_ipv4_range, transform_network_info_context, ) BASE_URL = "https://example.com/v1/" POST_NEW_ZONE_RESPONSE = { "result": { "_ref": "zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50ZXN0:test.com/default", "disable": False, "fqdn": "test.com", "rpz_policy": "GIVEN", "rpz_severity": "WARNING", "rpz_type": "LOCAL", "view": "default", } } API_ERROR_OBJ = { "Error": "AdmConDataError: None (IBDataConflictError: IB.Data.Conflict:Duplicate object 'test123.com' of type zone " "exists in the database.)", "code": "Client.Ibap.Data.Conflict", "text": "Duplicate object 'test123.com' of type zone exists in the database.", } # disable-secrets-detection-start SSL_ERROR = ( 'Failed to parse json object from response: b\'<html>\r\n<head>\r\n<meta http-equiv="Content-Type" ' 'content="text/html; charset=utf-8">\r\n<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">\r\n<meta ' 'name="viewport" content="initial-scale=1.0">\r\n<title>Certificate Error</title>\r\n<style>\r\n ' "#content {\r\n border:3px solid#aaa;\r\n background-color:#fff;\r\n margin:1.5em;\r\n " "padding:1.5em;\r\n font-family:Tahoma,Helvetica,Arial,sans-serif;\r\n font-size:1em;\r\n }\r\n " "h1 {\r\n font-size:1.3em;\r\n font-weight:bold;\r\n color:#196390;\r\n }\r\n b {\r\n " "color:#196390;\r\n }\r\n</style>\r\n</head>\r\n<body " '">\r\n<div id="content">\r\n<h1>Certificate Error</h1>\r\n<p>There is an issue with ' "the SSL certificate of the server you are trying to contact.</p>\r\n<p><b>Certificate Name:</b> " "www.infoblox.com </p>\r\n<p><b>IP:</b> </p>\r\n<p><b>Category:</b> any </p>\r\n<p><b>Issuer:</b> " "www.infoblox.com </p>\r\n<p><b>Status:</b> expired </p>\r\n<p><b>Reason:</b> </p>\r\n<p><b>User:</b> " "</p>\r\n</div>\r\n</body>\r\n</html>\r\n\r\n'" ) # disable-secrets-detection-end GET_USER_LIST = { "account": [ {"username": "User1", "name": "DBot Demisto", "isLocked": False}, {"username": "User2", "name": "Demisto DBot", "isLocked": True}, ] } REQUEST_PARAM_ZONE = ( f"?{InfoBloxNIOSClient.REQUEST_PARAMS_RETURN_AS_OBJECT_KEY}=1&_return_fields%2B=fqdn%2Crpz_policy%2Crpz_severity%2Crpz_type%2C" "substitute_name%2Ccomment%2Cdisable" ) # noqa: E501 client = InfoBloxNIOSClient("https://example.com/v1/") TEST_PATH = Path(__file__).parent / "test_data" def util_load_json(file_name: str): """Load file in JSON format.""" file_path = TEST_PATH / file_name with open(file_path, encoding="utf-8") as f: return json.loads(f.read()) def util_load_text_data(file_name: str) -> str: """Load a text file.""" file_path = TEST_PATH / file_name with open(file_path, encoding="utf-8") as f: return f.read() class TestHelperFunctions: def test_parse_demisto_exception_unauthorized_error(self): from Infoblox import parse_demisto_exception json_err = "Expecting value: line 1 column 1 (char 0)" api_err = "Error in API call [401] - Authorization Required" parsed_err = parse_demisto_exception(DemistoException(api_err, json_err)) assert str(parsed_err) == str(DemistoException("Authorization error, check your credentials.")) def test_parse_demisto_exception_json_parse_error(self): from Infoblox import parse_demisto_exception json_err = "Expecting value: line 1 column 1 (char 0)" api_err = f"Failed to parse json object from response: {SSL_ERROR}" parsed_err = parse_demisto_exception(DemistoException(api_err, json_err)) assert str(parsed_err) == str(DemistoException("Cannot connect to Infoblox server, check your proxy and connection.")) def test_parse_demisto_exception_api_error(self): from Infoblox import parse_demisto_exception api_err = f"Error in API call [400] - Bad Request\n {json.dumps(API_ERROR_OBJ)}" parsed_err = parse_demisto_exception(DemistoException(api_err)) assert str(parsed_err) == str(DemistoException("Duplicate object 'test123.com' of type zone exists in the database.")) def test_transform_ext_attrs_2_attrs(self): """ Test transform_ext_attrs with 2 comma-separated values. Given: - An input. When: - The input has 2 comma-separated key-value pairs. Then: - A list of 2 dictionaries is returned with the key-value pairs as expected. """ input = "IB Discovery Owned=EMEA,Site=Tel-Aviv" actual = transform_ext_attrs(input) expected = [{"*IB Discovery Owned": "EMEA"}, {"*Site": "Tel-Aviv"}] assert actual == expected def test_transform_ext_attrs_2_attrs_whitespace(self): """ Test transform_ext_attrs with 2 comma-separated values and whitespace in the key/value. Given: - An input. When: - The input has 2 comma-separated key-value pairs. - The input includes spaces in the key - The input includes spaces in the value Then: - A list of 2 dictionaries is returned with the key-value pairs as expected. """ input = " IB Discovery Owned=EMEA,Site= Tel-Aviv" actual = transform_ext_attrs(input) expected = [{"*IB Discovery Owned": "EMEA"}, {"*Site": "Tel-Aviv"}] assert actual == expected def test_transform_ext_attrs_2_attrs_comma_attr_end(self): """ Test transform_ext_attrs with 2 comma-separated values and comma in the end of value. Given: - An input. When: - The input has 2 comma-separated key-value pairs. - The input includes a comma in the value. Then: - A list of 2 dictionaries is returned with the key-value pairs as expected. """ input = "IB Discovery Owned=EMEA,Site=Tel-Aviv, Yafo" with pytest.raises( DemistoException, match=f"Unable to parse provided ext_attrs='{input}'. Expected format is 'ExtKey1=ExtVal1,ExtKeyN=ExtValN'", ): transform_ext_attrs(input) def test_transform_ext_attrs_2_attrs_comma_attr_beginning(self): """ Test transform_ext_attrs with 2 comma-separated values and comma in the beginning of value. Given: - An input. When: - The input has 2 comma-separated key-value pairs. - The input includes a comma in the value. Then: - A list of 2 dictionaries is returned with the key-value pairs as expected. """ input = "IB Discovery Owned=EMEA,Site=,Tel-Aviv" with pytest.raises( DemistoException, match=f"Unable to parse provided ext_attrs='{input}'. Expected format is 'ExtKey1=ExtVal1,ExtKeyN=ExtValN'", ): transform_ext_attrs(input) def test_transform_ext_attrs_no_delimiter(self): """ Test transform_ext_attrs when the input has no delimiter (comma). Given: - An input. When: - The input has no delimiter. Then: - Return a list with 1 entry. """ input = "Site=Tel-Aviv" actual = transform_ext_attrs(input) expected = [{"*Site": "Tel-Aviv"}] assert actual == expected def test_transform_ext_attrs_no_delimiter_no_equal_sign(self): """ Test transform_ext_attrs when the input has no delimiter (comma) and no equal sign. Given: - An input. When: - The input has no delimiter and no equal sign. Then: - Return an empty list. """ input = "SiteTel-Aviv" actual = transform_ext_attrs(input) assert not actual def test_transform_ipv4_range(self): from_address = "192.168.1.0" to_address = "192.168.1.254" actual = transform_ipv4_range(from_address, to_address) expected = {"ip_address>": "192.168.1.0", "ip_address<": "192.168.1.254"} assert actual == expected assign_params(actual) def test_transform_network_info_context(self): """ Test the output of the `transform_network_info_context` helper command when provided with only extattr """ input = json.loads( ( Path(__file__).parent.resolve() / "test_data" / "TestNetworkInfoOperations" / "get_network_return_fields_extattrs.json" ).read_text() ).get("result") actual = transform_network_info_context(input) assert len(actual) == 1 assert INTEGRATION_COMMON_REFERENCE_CONTEXT_KEY in actual[0] assert INTEGRATION_COMMON_NAME_CONTEXT_KEY in actual[0] assert INTEGRATION_COMMON_NETWORKVIEW_CONTEXT_KEY in actual[0] assert INTEGRATION_COMMON_EXTENSION_ATTRIBUTES_CONTEXT_KEY in actual[0] assert INTEGRATION_COMMON_ADDITIONAL_FIELDS_CONTEXT_KEY not in actual[0] def test_transform_network_info_context_additional_fields(self): """ Test the output of the `transform_network_info_context` helper command when provided with additional fields specified """ input = json.loads( ( Path(__file__).parent.resolve() / "test_data" / "TestNetworkInfoOperations" / "get_networks_return_fields_options_extattrs.json" ).read_text() ).get("result") # noqa: E501 actual = transform_network_info_context(input) assert len(actual) == 2 assert INTEGRATION_COMMON_REFERENCE_CONTEXT_KEY in actual[1] assert INTEGRATION_COMMON_NAME_CONTEXT_KEY in actual[1] assert INTEGRATION_COMMON_NETWORKVIEW_CONTEXT_KEY in actual[1] assert INTEGRATION_COMMON_EXTENSION_ATTRIBUTES_CONTEXT_KEY in actual[1] assert INTEGRATION_COMMON_ADDITIONAL_FIELDS_CONTEXT_KEY in actual[1] def test_transform_host_records_context(self): """ Test the output of the `transform_network_info_context` helper command when provided with additional fields specified """ input = json.loads( (Path(__file__).parent.resolve() / "test_data" / "TestHostRecordsOperations" / "get_records.json").read_text() ).get("result") # noqa: E501 actual = transform_host_records_context(input) assert len(actual) == 4 assert INTEGRATION_COMMON_REFERENCE_CONTEXT_KEY in actual[0] assert INTEGRATION_HOST_RECORDS_IPV4ADDRESS_CONTEXT_KEY in actual[0] assert INTEGRATION_HOST_RECORDS_CONFIGURE_FOR_DHCP_KEY_CONTEXT_KEY in actual[0] assert INTEGRATION_COMMON_NAME_CONTEXT_KEY in actual[0] def test_get_extended_attributes_context_valid_extattrs(self): """Test get_extended_attributes_context with valid extattrs""" input = ( json.loads( ( Path(__file__).parent.resolve() / "test_data" / "TestHostRecordsOperations" / "get_record_extattrs.json" ).read_text() ) .get("result")[0] .get("extattrs") ) # noqa: E501 actual = get_extended_attributes_context(input) expected = {"IB Discovery Owned": "EMEA", "Site": "Tel-Aviv"} assert actual == expected def test_get_extended_attributes_context_invalid_extattrs(self): """Test get_extended_attributes_context with invalid extattrs""" input = {"invalid": "attribute"} actual = get_extended_attributes_context(input) expected = {"invalid": "N/A"} assert actual == expected def test_get_extended_attributes_context_empty_extattrs(self): """Test get_extended_attributes_context with invalid extattrs""" actual = get_extended_attributes_context({}) assert not actual class TestZonesOperations: def test_create_response_policy_zone_command(self, mocker, requests_mock): from Infoblox import create_response_policy_zone_command mocker.patch.object(demisto, "params", return_value={}) requests_mock.post(f"{BASE_URL}zone_rp{REQUEST_PARAM_ZONE}", json=POST_NEW_ZONE_RESPONSE) args = {"FQDN": "test.com", "rpz_policy": "GIVEN", "rpz_severity": "WARNING", "substitute_name": "", "rpz_type": ""} human_readable, context, raw_response = create_response_policy_zone_command(client, args) assert ( human_readable == "### Infoblox Integration - Response Policy Zone: test.com has been created\n" "|Disable|FQDN|Reference ID|Rpz Policy|Rpz Severity|Rpz Type|View|\n" "|---|---|---|---|---|---|---|\n" "| false | test.com | zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50ZXN0:test.com/default " "| GIVEN | WARNING | LOCAL | default |\n" ) assert context == { "Infoblox.ResponsePolicyZones(val.FQDN && val.FQDN === obj.FQDN)": { "ReferenceID": "zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50ZXN0:test.com/default", "Disable": False, "FQDN": "test.com", "RpzPolicy": "GIVEN", "RpzSeverity": "WARNING", "RpzType": "LOCAL", "View": "default", } } assert raw_response == { "result": { "_ref": "zone_rp/ZG5zLnpvbmUkLl9kZWZhdWx0LmNvbS50ZXN0:test.com/default", "disable": False, "fqdn": "test.com", "rpz_policy": "GIVEN", "rpz_severity": "WARNING", "rpz_type": "LOCAL", "view": "default", } } class TestIPOperations: CONTEXT_PATH = f"{INTEGRATION_CONTEXT_NAME}.{INTEGRATION_IP_CONTEXT_NAME}" # noqa: E501 VALID_IP_ADDRESS = "192.168.1.1" VALID_NETMASK = "192.168.1.0/24" VALID_IPV6_ADDRESS = "2001:db8::1" BASE_URL = f"{client._base_url}ipv4address?{InfoBloxNIOSClient.REQUEST_PARAMS_RETURN_AS_OBJECT_KEY}=1" # noqa: E501 BASE_URL_IPV6 = f"{client._base_url}ipv6address?{InfoBloxNIOSClient.REQUEST_PARAMS_RETURN_AS_OBJECT_KEY}=1" # noqa: E501 def test_get_ip_command_too_many_arguments(self): """ Test the command argument input when too many arguments are specified. Given: - The execution of the `get_ip_command` When: - The `ip`, `network`, `from_ip` and `to_ip` arguments are all provided. Then: - Ensure that a validation error is raised. """ with pytest.raises(ValueError, match="Please specify only one of the `ip`, `network` or `from_ip`/`to_ip` arguments"): get_ip_command( client, { "ip": self.VALID_IP_ADDRESS, "network": self.VALID_NETMASK, "from_ip": self.VALID_IP_ADDRESS, "to_ip": self.VALID_IP_ADDRESS, }, ) def test_get_ip_command_no_valid_argument_specified(self): """ Test the command argument input when no valid argument is specified. Given: - The execution of the `get_ip_command` When: - The `ip` argument is not provided. - The `network` argument is not provided. - The `from_ip` argument is not provided. - The `to_ip` argument is not provided. Then: - Ensure that a validation error is raised. """ with pytest.raises(ValueError, match=("Please specify either the `ip`, `network` or `from_ip`/`to_ip` argument")): get_ip_command(client, {"status": IPv4AddressStatus.ACTIVE.value, "extended_attrs": "attr1=val1,attr2=val2"}) def test_get_ip_command_to_ip_defined_from_ip_not_defined(self): """ Test the command argument input when the `to_ip` argument is specified without the `from_ip` argument. Given: - The execution of the `get_ip_command` When: - The `ip` argument is not provided. - The `network` argument is not provided. - The `from_ip` argument is not provided. - The `to_ip` argument is provided. Then: - Ensure that a validation error is raised. """ with pytest.raises(ValueError, match=("Please specify either the `ip`, `network` or `from_ip`/`to_ip` argument")): get_ip_command(client, {"to_ip": self.VALID_IP_ADDRESS, "extended_attrs": "attr1=val1,attr2=val2"}) def test_get_ip_command_from_ip_not_to_ip(self): """ Test the command argument input when `from_ip` is specified but not `to_ip`. Given: - The execution of the `get_ip_command` When: - The `from_ip` argument is provided but `to_ip` is not. Then: - Ensure that a validation error is raised. """ with pytest.raises(ValueError, match="Please specify either the `ip`, `network` or `from_ip`/`to_ip` argument"): get_ip_command(client, {"from_ip": "1.1.1.1"}) def test_get_ip_command_from_ip_address_no_status_no_extattr(self, requests_mock): """ Test retrieval of an IP address in case it's provided. Given: - A mock response. When: - The IP address is provided. - No status is specified. - No extended attributes are specified. Then: - The human readable includes the input IP address. - The context includes the IP address object with the input IP address. """ ip = self.VALID_IP_ADDRESS mock_response = ( Path(__file__).parent.resolve() / "test_data" / self.__class__.__name__ / "get_ipv4_address_from_ip_address.json" ).read_text() requests_mock.get( f"{client._base_url}ipv4address?{InfoBloxNIOSClient.REQUEST_PARAMS_RETURN_AS_OBJECT_KEY}=1&ip_address={self.VALID_IP_ADDRESS}", # noqa: E501 json=json.loads(mock_response), ) actual_hr, actual_context, actual_raw_response = get_ip_command(client, {"ip": ip}) actual_hr_lines = actual_hr.splitlines() assert "Infoblox Integration" in actual_hr_lines[0] assert self.VALID_IP_ADDRESS in actual_hr_lines[3] actual_output = cast(list, actual_context.get(self.CONTEXT_PATH)) assert len(actual_output) == 1 assert actual_output[0].get("IpAddress") == self.VALID_IP_ADDRESS assert actual_raw_response == json.loads(mock_response) def test_get_ip_command_from_ip_address_status_defined_no_extattr(self, requests_mock): """ Test retrieval of an IP address in case it's provided alongside the status. Given: - A mock response. When: - The IP address is provided. - The status is specified. - No extended attributes are specified. Then: - The human readable includes the input IP address. - The context includes the IP address object with the input IP address. """ ip = self.VALID_IP_ADDRESS mock_response = ( Path(__file__).parent.resolve() / "test_data" / self.__class__.__name__ / "get_ipv4_address_from_ip_address.json" ).read_text() requests_mock.get( f"{client._base_url}ipv4address?{InfoBloxNIOSClient.REQUEST_PARAMS_RETURN_AS_OBJECT_KEY}=1&ip_address={self.VALID_IP_ADDRESS}&status={IPv4AddressStatus.USED.value}", # noqa: E501 json=json.loads(mock_response), ) actual_hr, actual_context, actual_raw_response = get_ip_command( client, {"ip": ip, "status": IPv4AddressStatus.USED.value} ) actual_hr_lines = actual_hr.splitlines() assert "Infoblox Integration" in actual_hr_lines[0] assert self.VALID_IP_ADDRESS in actual_hr_lines[3] assert self.CONTEXT_PATH in actual_context actual_output = cast(list, actual_context.get(self.CONTEXT_PATH)) assert len(actual_output) == 1 assert actual_output[0].get("Status") == IPv4AddressStatus.USED.value assert actual_raw_response == json.loads(mock_response) def test_get_ip_command_ip_range(self, requests_mock): """ Test the output of the `get_ip_command` when supplied a valid IP range. Given: - A mock response with a range of IPs. When: - The `from_ip` argument is set and valid. - The `to_ip` argument is set and valid. Then: - 10 IP addresses are returned. """ from_ip = self.VALID_IP_ADDRESS to_ip = self.VALID_IP_ADDRESS[:-1] + "9" mock_response = ( Path(__file__).parent.resolve() / "test_data" / self.__class__.__name__ / "get_ipv4_addresses_from_network.json" ).read_text() requests_mock.get( f"{self.BASE_URL}&ip_address>={from_ip}&ip_address<={to_ip}&_max_results={INTEGRATION_MAX_RESULTS_DEFAULT}", json=json.loads(mock_response), ) actual_hr, actual_context, actual_raw_response = get_ip_command(client, {"from_ip": from_ip, "to_ip": to_ip}) assert "Infoblox Integration" in actual_hr.splitlines()[0] assert self.CONTEXT_PATH in actual_context actual_output = cast(list, actual_context.get(self.CONTEXT_PATH)) assert len(actual_output) == 9 assert from_ip == actual_output[0].get("IpAddress") assert to_ip == actual_output[-1].get("IpAddress") assert INTEGRATION_COMMON_REFERENCE_ID_CONTEXT_KEY in actual_output[0] assert INTEGRATION_COMMON_REFERENCE_ID_CONTEXT_KEY in actual_output[0] assert actual_raw_response == json.loads(mock_response) # TODO def test_get_ip_command_from_ip_status_defined_extattr_defined(self): """ Test retrieval of an IP address in case it's provided alongside the status and extended attributes. Given: - A mock response. When: - The IP address is provided. - The status is specified. - Extended attributes are specified. Then: - The human readable includes the input IP address. - The context includes the IP address object with the input IP address and specified status and extended attributes. """ # TODO def test_get_ip_command_from_ip_invalid_extattr(self, requests_mock): """ Test retrieval of an IP address with invalid extended attributes. Given: - A mock response. When: - The IP address is provided. - The status is not specified. - Invalid extended attributes are specified. Then: - Ensure a validation error is raised. """ def test_get_ip_command_from_netmask(self, requests_mock): """ Test retrieval of an IP address in case netmask is provided. Given: - A mock response. When: - The netmask is provided. - No status is specified. - No extended attributes are specified. Then: - The human readable includes the input netmask. - The context includes the IP address object with the input netmask. """ network = self.VALID_NETMASK mock_response = ( Path(__file__).parent.resolve() / "test_data" / self.__class__.__name__ / "get_ipv4_addresses_from_network.json" ).read_text() requests_mock.get( f"{client._base_url}ipv4address?{InfoBloxNIOSClient.REQUEST_PARAMS_RETURN_AS_OBJECT_KEY}=1&network={self.VALID_NETMASK}&status={IPv4AddressStatus.USED.value}", # noqa: E501 json=json.loads(mock_response), ) actual_hr, actual_context, actual_raw_response = get_ip_command(client, {"network": network}) actual_hr_lines = actual_hr.splitlines() assert "Infoblox Integration" in actual_hr_lines[0] assert self.CONTEXT_PATH in actual_context actual_output = cast(list, actual_context.get(self.CONTEXT_PATH)) assert len(actual_output) == 9 def test_transform_ip_context_known_keys(self): """ Test for a scenario when the `infoblox-get-ip` command returns a expected/known response keys/. Given: - A mock response from InfoBlox API. When: - The response has all expected attributes. Then: - The transformation keys are as expected. """ mock_response = ( Path(__file__).parent.resolve() / "test_data" / self.__class__.__name__ / "get_ipv4_address_from_ip_address.json" ).read_text() res: dict[str, list] = json.loads(mock_response) ip: list[dict[str, Any]] = res.get("result") actual_transformation = transform_ip_context(ip) assert len(actual_transformation) == 1 for k, v in IP_MAPPING.items(): assert actual_transformation[0].get(v) == ip[0].get(k) def test_transform_ip_context_unknown_key(self): """ Test for a scenario when the `infoblox-get-ip` command returns an unexpected/unknown key and the program doesn't raise an exception. See https://jira-dc.paloaltonetworks.com/browse/XSUP-35724. Given: - A mock response from InfoBlox API. When: - The response has an attribute, lease_state="active" that is unknown. Then: - The context output includes the transformed unknown key "LeaseState". """ mock_response = ( Path(__file__).parent.resolve() / "test_data" / self.__class__.__name__ / "get_ipv4_address_from_ip_address.json" ).read_text() unknown_key = "lease_state" unknown_key_value = "active" res: dict[str, list] = json.loads(mock_response) res["result"][0][unknown_key] = unknown_key_value ip = res.get("result") actual_transformation = transform_ip_context(ip) assert len(actual_transformation) == 1 for k, v in IP_MAPPING.items(): assert actual_transformation[0].get(v) == ip[0].get(k) assert actual_transformation[0]["LeaseState"] == unknown_key_value def test_get_ip_command_from_ipv6(self, requests_mock): """ Test retrieval of an IP address in case it's provided alongside the status and extended attributes. Given: - A mock response. When: - The IP address is provided. - The status is specified. - Extended attributes are specified. Then: - The human readable includes the input IP address. - The context includes the IP address object with the input IP address and specified status and extended attributes. """ ip = self.VALID_IPV6_ADDRESS mock_response = ( Path(__file__).parent.resolve() / "test_data" / self.__class__.__name__ / "get_ipv6_address_from_ip_address.json" ).read_text() requests_mock.get( f"{client._base_url}ipv6address?{InfoBloxNIOSClient.REQUEST_PARAMS_RETURN_AS_OBJECT_KEY}=1&ip_address={self.VALID_IPV6_ADDRESS}", # noqa: E501 json=json.loads(mock_response), ) actual_hr, actual_context, actual_raw_response = get_ip_command(client, {"ip": ip}) actual_hr_lines = actual_hr.splitlines() assert "Infoblox Integration" in actual_hr_lines[0] assert self.VALID_IPV6_ADDRESS in actual_hr_lines[3] actual_output = cast(list, actual_context.get(self.CONTEXT_PATH)) assert len(actual_output) == 1 assert actual_output[0].get("IpAddress") == self.VALID_IPV6_ADDRESS assert actual_raw_response == json.loads(mock_response) class TestHostRecordsOperations: CONTEXT_KEY = f"{INTEGRATION_CONTEXT_NAME}.{INTEGRATION_HOST_RECORDS_CONTEXT_NAME}" GET_HOST_RECORDS_ENDPOINT = "record:host" def test_get_all_records(self, requests_mock): """ Test to get all records. Given: - Mock response for get all host records API call. When: - Get all host records API call is made. Then: - Ensure records are returned as expected. """ mock_response = (Path(__file__).parent.resolve() / "test_data" / self.__class__.__name__ / "get_records.json").read_text() requests_mock.get( f"{client._base_url}{self.GET_HOST_RECORDS_ENDPOINT}?{InfoBloxNIOSClient.REQUEST_PARAMS_RETURN_AS_OBJECT_KEY}=1", json=json.loads(mock_response), ) hr, records, _ = get_host_records_command(client, {}) assert len(cast(list, records.get(self.CONTEXT_KEY))) == 4 assert "Host records" in hr assert "extattrs" not in hr def test_get_records_from_hostname(self, requests_mock): """ Test to get host records by hostname. Given: - Mock response for get host records by hostname API call. When: - Get host records by hostname API call is made with hostname "host1". Then: - Ensure only matching record is returned. """ mock_response = ( Path(__file__).parent.resolve() / "test_data" / self.__class__.__name__ / "get_record_by_hostname.json" ).read_text() host_name = "ciac-3607.test" requests_mock.get( client._base_url + self.GET_HOST_RECORDS_ENDPOINT + f"?{InfoBloxNIOSClient.REQUEST_PARAMS_RETURN_AS_OBJECT_KEY}=1&name={host_name}", json=json.loads(mock_response), ) hr, records, _ = get_host_records_command(client, {"host_name": host_name}) assert len(cast(list, records.get(self.CONTEXT_KEY))) == 1 assert "Host records" in hr assert "extattrs" not in hr def test_get_records_from_extattr(self, requests_mock): """ Test to get host records by extension attribute. Given: - Mock response for get host records by hostname API call. When: - An extension attribute is specified. Then: - Ensure only matching record is returned. """ mock_response = ( Path(__file__).parent.resolve() / "test_data" / self.__class__.__name__ / "get_record_extattrs.json" ).read_text() input = "Site=Tel-Aviv" requests_mock.get( client._base_url + self.GET_HOST_RECORDS_ENDPOINT + f"?_return_fields%2B=extattrs&*{input}", json=json.loads(mock_response), ) hr, records, _ = get_host_records_command(client, {"extattrs": input}) assert len(cast(list, records.get(self.CONTEXT_KEY))) == 1 assert "Host records" in hr assert INTEGRATION_COMMON_EXTENSION_ATTRIBUTES_CONTEXT_KEY in hr def test_get_rerords_with_extattrs_aliases(self, requests_mock): """ Test to get host records with extended attributes and additional fields. Given: - Mock response for get host records by. When: - We specify extattrs and aliases as additional fields. Then: - 4 records are returned. - The 3 records don't include an AdditionalFields key. - The last record includes an AdditionalFields key. """ input = "extattrs,aliases" mock_response = ( Path(__file__).parent.resolve() / "test_data" / self.__class__.__name__ / "get_records_extattrs_aliases.json" ).read_text() requests_mock.get( client._base_url + self.GET_HOST_RECORDS_ENDPOINT + f"?_return_fields%2B={input}", json=json.loads(mock_response) ) actual_hr, actual_records, actual_raw_response = get_host_records_command(client, {"additional_return_fields": input}) assert "Host records" in actual_hr assert self.CONTEXT_KEY in actual_records actual_output = cast(list, actual_records.get(self.CONTEXT_KEY)) assert len(actual_output) == 4 first_record = actual_output[0] assert INTEGRATION_COMMON_REFERENCE_CONTEXT_KEY in first_record assert INTEGRATION_COMMON_EXTENSION_ATTRIBUTES_CONTEXT_KEY in first_record assert INTEGRATION_HOST_RECORDS_IPV4ADDRESS_CONTEXT_KEY in first_record assert first_record[INTEGRATION_HOST_RECORDS_IPV4ADDRESS_CONTEXT_KEY] == "192.168.10.10" assert INTEGRATION_HOST_RECORDS_CONFIGURE_FOR_DHCP_KEY_CONTEXT_KEY in first_record assert not first_record[INTEGRATION_HOST_RECORDS_CONFIGURE_FOR_DHCP_KEY_CONTEXT_KEY] assert INTEGRATION_COMMON_NAME_CONTEXT_KEY in first_record assert INTEGRATION_COMMON_ADDITIONAL_FIELDS_CONTEXT_KEY not in first_record second_record = actual_output[1] assert INTEGRATION_COMMON_REFERENCE_CONTEXT_KEY in second_record assert INTEGRATION_COMMON_EXTENSION_ATTRIBUTES_CONTEXT_KEY in second_record assert INTEGRATION_HOST_RECORDS_IPV4ADDRESS_CONTEXT_KEY in second_record assert second_record[INTEGRATION_HOST_RECORDS_IPV4ADDRESS_CONTEXT_KEY] == "192.168.100.100" assert INTEGRATION_HOST_RECORDS_CONFIGURE_FOR_DHCP_KEY_CONTEXT_KEY in second_record assert second_record[INTEGRATION_HOST_RECORDS_CONFIGURE_FOR_DHCP_KEY_CONTEXT_KEY] assert INTEGRATION_COMMON_NAME_CONTEXT_KEY in second_record assert INTEGRATION_COMMON_ADDITIONAL_FIELDS_CONTEXT_KEY not in second_record third_record = actual_output[2] assert INTEGRATION_COMMON_REFERENCE_CONTEXT_KEY in third_record assert INTEGRATION_COMMON_EXTENSION_ATTRIBUTES_CONTEXT_KEY in third_record assert INTEGRATION_HOST_RECORDS_IPV4ADDRESS_CONTEXT_KEY in third_record assert INTEGRATION_HOST_RECORDS_CONFIGURE_FOR_DHCP_KEY_CONTEXT_KEY in third_record assert INTEGRATION_COMMON_NAME_CONTEXT_KEY in third_record assert INTEGRATION_COMMON_ADDITIONAL_FIELDS_CONTEXT_KEY not in third_record fourth_record = actual_output[3] assert INTEGRATION_COMMON_REFERENCE_CONTEXT_KEY in fourth_record assert INTEGRATION_COMMON_EXTENSION_ATTRIBUTES_CONTEXT_KEY in fourth_record assert INTEGRATION_HOST_RECORDS_IPV4ADDRESS_CONTEXT_KEY in fourth_record assert INTEGRATION_HOST_RECORDS_CONFIGURE_FOR_DHCP_KEY_CONTEXT_KEY in fourth_record assert INTEGRATION_COMMON_NAME_CONTEXT_KEY in fourth_record assert INTEGRATION_COMMON_ADDITIONAL_FIELDS_CONTEXT_KEY in fourth_record assert actual_raw_response == json.loads(mock_response) def test_get_host_records_command_non_existing_additional_return_fields(self, requests_mock): """ Test running `get_host_records_command` with a non-existing return field. Given: - An `additional_return_fields` is specified. When: - The `additional_return_fields` doesn't exist. Then: - A `DemistoException` is raised. """ additional_return_fields = "none" mock_response = ( Path(__file__).parent.resolve() / "test_data" / self.__class__.__name__ / "unknown_argument.json" ).read_text() requests_mock.get( client._base_url + self.GET_HOST_RECORDS_ENDPOINT + f"?_return_fields%2B={additional_return_fields}", json=json.loads(mock_response), ) with pytest.raises(DemistoException, match="Unknown argument/field: 'none'"): get_host_records_command(client, {"additional_return_fields": additional_return_fields}) def test_get_host_records_command_no_additional_fields(self, requests_mock): """ Given: - Running `get_host_records_command`. When: - No `additional_fields` are provided. Then: - The `extattrs` should appended and returned. """ mock_response = ( Path(__file__).parent.resolve() / "test_data" / self.__class__.__name__ / "get_records_extattrs.json" ).read_text() requests_mock.get( client._base_url + self.GET_HOST_RECORDS_ENDPOINT + f"?_return_fields%2B={INTEGRATION_COMMON_RAW_RESULT_EXTENSION_ATTRIBUTES_KEY}", # noqa: E501 json=json.loads(mock_response), ) actual_hr, actual_context, actual_raw_response = get_host_records_command(client, {}) assert INTEGRATION_COMMON_EXTENSION_ATTRIBUTES_CONTEXT_KEY in actual_hr.splitlines()[1] assert self.CONTEXT_KEY in actual_context actual_output = actual_context.get(self.CONTEXT_KEY) for o in actual_output: assert INTEGRATION_COMMON_EXTENSION_ATTRIBUTES_CONTEXT_KEY in o def test_get_host_records_command_extattrs_set_additional_fields(self, requests_mock): """ Given: - Running `get_host_records_command`. When: - `additional_fields` is set to `extattrs`. Then: - The `extattrs` should appended and returned. """ mock_response = ( Path(__file__).parent.resolve() / "test_data" / self.__class__.__name__ / "get_records_extattrs.json" ).read_text() requests_mock.get( client._base_url + self.GET_HOST_RECORDS_ENDPOINT + f"?_return_fields%2B={INTEGRATION_COMMON_RAW_RESULT_EXTENSION_ATTRIBUTES_KEY}&*Site=ciac-5843", # noqa: E501 json=json.loads(mock_response), ) actual_hr, actual_context, actual_raw_response = get_host_records_command( client, { "additional_return_fields": INTEGRATION_COMMON_RAW_RESULT_EXTENSION_ATTRIBUTES_KEY, INTEGRATION_COMMON_RAW_RESULT_EXTENSION_ATTRIBUTES_KEY: "Site=ciac-5843", }, ) assert INTEGRATION_COMMON_EXTENSION_ATTRIBUTES_CONTEXT_KEY in actual_hr.splitlines()[1] assert self.CONTEXT_KEY in actual_context actual_output = actual_context.get(self.CONTEXT_KEY) for o in actual_output: assert INTEGRATION_COMMON_EXTENSION_ATTRIBUTES_CONTEXT_KEY in o class TestNetworkInfoOperations: CONTEXT_KEY = f"{INTEGRATION_CONTEXT_NAME}.{INTEGRATION_NETWORK_INFO_CONTEXT_KEY}" BASE_URL = f"{client._base_url}network?{InfoBloxNIOSClient.REQUEST_PARAMS_RETURN_AS_OBJECT_KEY}=1" # noqa: E501 def test_get_network_info_command(self, requests_mock): """ Test when no arguments are supplied to the `get_network_info_command` method. Given: - A mock response of 2 networks. When: - No arguments are provided. Then: - 50 limit is applied. - output has 2 networks. - raw response is equal to the mock response. - No additional fields context key is set. """ mock_response = ( Path(__file__).parent.resolve() / "test_data" / self.__class__.__name__ / "get_networks.json" ).read_text() requests_mock.get(self.BASE_URL, json=json.loads(mock_response)) actual_hr, actual_context, actual_raw_response = get_network_info_command(client, {}) assert "Network information" in actual_hr assert self.CONTEXT_KEY in actual_context actual_output = cast(list, actual_context.get(self.CONTEXT_KEY)) assert len(actual_output) == 2 assert INTEGRATION_COMMON_EXTENSION_ATTRIBUTES_CONTEXT_KEY in actual_output[0] assert INTEGRATION_COMMON_NAME_CONTEXT_KEY in actual_output[0] assert INTEGRATION_COMMON_REFERENCE_CONTEXT_KEY in actual_output[0] assert INTEGRATION_COMMON_NETWORKVIEW_CONTEXT_KEY in actual_output[0] assert INTEGRATION_COMMON_ADDITIONAL_FIELDS_CONTEXT_KEY not in actual_output[0] assert actual_raw_response == json.loads(mock_response) def test_get_network_pattern_specified_return_fields_extattrs(self, requests_mock): """ Test when an argument is supplied to the `get_network_info_command` method. Given: - A mock response of 1 network. When: - The `pattern` argument is supplied. Then: - 50 limit is applied. - output has 1 networks. - raw response is equal to the mock response. - No additional fields context key is set. """ mock_response = ( Path(__file__).parent.resolve() / "test_data" / self.__class__.__name__ / "get_network_return_fields_extattrs.json" ).read_text() pattern = "192.168." requests_mock.get( f"{self.BASE_URL}&_max_results=50&_return_fields%2B=extattrs&network~={pattern}", json=json.loads(mock_response) ) actual_hr, actual_context, actual_raw_response = get_network_info_command(client, {"pattern": pattern}) assert "Network information" in actual_hr assert self.CONTEXT_KEY in actual_context actual_output = cast(list, actual_context.get(self.CONTEXT_KEY)) assert len(actual_output) == 1 assert INTEGRATION_COMMON_EXTENSION_ATTRIBUTES_CONTEXT_KEY in actual_output[0] assert INTEGRATION_COMMON_NAME_CONTEXT_KEY in actual_output[0] assert INTEGRATION_COMMON_REFERENCE_CONTEXT_KEY in actual_output[0] assert INTEGRATION_COMMON_NETWORKVIEW_CONTEXT_KEY in actual_output[0] assert INTEGRATION_COMMON_ADDITIONAL_FIELDS_CONTEXT_KEY not in actual_output[0] assert actual_raw_response == json.loads(mock_response) def test_get_networks_return_fields_options_extattrs(self, requests_mock): """ Test when an arguments is supplied to the `get_network_info_command` method. Given: - A mock response of 2 networks. When: - `additional_return_fields` argument is set. - `max_results` argument is set. Then: - 10 limit is applied. - output has 1 networks. - raw response is equal to the mock response. - The additional fields context key is set. """ limit = 10 mock_response = ( Path(__file__).parent.resolve() / "test_data" / self.__class__.__name__ / "get_networks_return_fields_options_extattrs.json" ).read_text() requests_mock.get(self.BASE_URL, json=json.loads(mock_response)) actual_hr, actual_context, actual_raw_response = get_network_info_command( client, {"additional_return_fields": "extattrs,options", "max_results": limit} ) assert "Network information" in actual_hr assert self.CONTEXT_KEY in actual_context actual_output = cast(list, actual_context.get(self.CONTEXT_KEY)) assert len(actual_output) == 2 assert INTEGRATION_COMMON_EXTENSION_ATTRIBUTES_CONTEXT_KEY in actual_output[0] assert INTEGRATION_COMMON_EXTENSION_ATTRIBUTES_CONTEXT_KEY in actual_output[1] assert INTEGRATION_COMMON_NAME_CONTEXT_KEY in actual_output[0] assert INTEGRATION_COMMON_NAME_CONTEXT_KEY in actual_output[1] assert INTEGRATION_COMMON_REFERENCE_CONTEXT_KEY in actual_output[0] assert INTEGRATION_COMMON_REFERENCE_CONTEXT_KEY in actual_output[1] assert INTEGRATION_COMMON_NETWORKVIEW_CONTEXT_KEY in actual_output[0] assert INTEGRATION_COMMON_NETWORKVIEW_CONTEXT_KEY in actual_output[1] assert INTEGRATION_COMMON_ADDITIONAL_FIELDS_CONTEXT_KEY in actual_output[0] assert INTEGRATION_COMMON_ADDITIONAL_FIELDS_CONTEXT_KEY in actual_output[1] assert actual_raw_response == json.loads(mock_response) class TestUpdateRpzRuleCommand: """Test class for update_rpz_rule_command function.""" def test_update_rpz_rule_passthru_success(self, requests_mock): """ Test successful update of a Passthru RPZ rule. Given: - Valid arguments for updating a Passthru rule - Mock response from the API When: - update_rpz_rule_command is called Then: - Rule is updated successfully - Correct context and human readable output are returned """ from Infoblox import update_rpz_rule_command reference_id = "record:rpz:cname/1234:test.test.com/default" mock_response = util_load_json(f"{self.__class__.__name__}/update_rpz_rule_passthru_success.json") requests_mock.put(f"{BASE_URL}{reference_id}", json=mock_response) args = { "reference_id": reference_id, "rule_type": "Passthru", "name": "test", "rp_zone": "test.com", "comment": "Updated passthru rule", "view": "default", } expected_hr = util_load_text_data(f"{self.__class__.__name__}/update_rpz_rule_passthru_success_hr.md") hr, context, raw_response = update_rpz_rule_command(client, args) # Verify human readable output assert hr == expected_hr # Verify context expected_context_key = f"{INTEGRATION_CONTEXT_NAME}.ModifiedResponsePolicyZoneRules(val.Name && val.Name === obj.Name)" assert expected_context_key in context rule_context = context[expected_context_key] assert rule_context["Name"] == "test.test.com" assert rule_context["Zone"] == "test.com" assert rule_context["Comment"] == "Updated passthru rule" assert rule_context["ReferenceID"] == reference_id # Verify raw response assert raw_response == mock_response def test_update_rpz_rule_block_no_data_success(self, requests_mock): """ Test successful update of a Block (No data) RPZ rule. Given: - Valid arguments for updating a Block (No data) rule - Mock response from the API When: - update_rpz_rule_command is called Then: - Rule is updated successfully with canonical set to "*" """ from Infoblox import update_rpz_rule_command reference_id = "record:rpz:cname/1234:malicious.test.com/default" mock_response = util_load_json(f"{self.__class__.__name__}/update_rpz_rule_block_no_data_success.json") requests_mock.put(f"{BASE_URL}{reference_id}", json=mock_response) args = { "reference_id": reference_id, "rule_type": "Block (No data)", "name": "malicious.test.com", "rp_zone": "test.com", "comment": "Block malicious domain", } expected_hr = util_load_text_data(f"{self.__class__.__name__}/update_rpz_rule_block_no_data_success_hr.md") hr, context, raw_response = update_rpz_rule_command(client, args) # Verify the rule was updated correctly assert hr == expected_hr expected_context_key = f"{INTEGRATION_CONTEXT_NAME}.ModifiedResponsePolicyZoneRules(val.Name && val.Name === obj.Name)" rule_context = context[expected_context_key] assert rule_context["Name"] == "malicious.test.com" assert rule_context["Comment"] == "Block malicious domain" assert mock_response == raw_response def test_update_rpz_rule_block_no_domain_success(self, requests_mock): """ Test successful update of a Block (No such domain) RPZ rule. Given: - Valid arguments for updating a Block (No such domain) rule - Mock response from the API When: - update_rpz_rule_command is called Then: - Rule is updated successfully with canonical set to empty string """ from Infoblox import update_rpz_rule_command reference_id = "record:rpz:cname/1234:blocked.test.com/default" mock_response = util_load_json(f"{self.__class__.__name__}/update_rpz_rule_block_no_domain_success.json") requests_mock.put(f"{BASE_URL}{reference_id}", json=mock_response) args = { "reference_id": reference_id, "rule_type": "Block (No such domain)", "name": "blocked", "rp_zone": "test.com", "comment": "Block domain completely", } expected_hr = util_load_text_data(f"{self.__class__.__name__}/update_rpz_rule_block_no_domain_success_hr.md") hr, context, raw_response = update_rpz_rule_command(client, args) # Verify the rule was updated correctly assert hr == expected_hr expected_context_key = f"{INTEGRATION_CONTEXT_NAME}.ModifiedResponsePolicyZoneRules(val.Name && val.Name === obj.Name)" rule_context = context[expected_context_key] assert rule_context["Name"] == "blocked.test.com" def test_update_rpz_rule_substitute_success(self, requests_mock): """ Test successful update of a Substitute (domain name) RPZ rule. Given: - Valid arguments for updating a Substitute rule with substitute_name - Mock response from the API When: - update_rpz_rule_command is called Then: - Rule is updated successfully with canonical set to substitute_name """ from Infoblox import update_rpz_rule_command reference_id = "record:rpz:cname/1234:redirect.test.com/default" mock_response = util_load_json(f"{self.__class__.__name__}/update_rpz_rule_substitute_success.json") requests_mock.put(f"{BASE_URL}{reference_id}", json=mock_response) args = { "reference_id": reference_id, "rule_type": "Substitute (domain name)", "name": "redirect.test.com", "rp_zone": "test.com", "comment": "Redirect to safe domain", "substitute_name": "safe.example.com", } hr, context, raw_response = update_rpz_rule_command(client, args) # Verify the rule was updated correctly assert "redirect.test.com has been updated" in hr expected_context_key = f"{INTEGRATION_CONTEXT_NAME}.ModifiedResponsePolicyZoneRules(val.Name && val.Name === obj.Name)" rule_context = context[expected_context_key] assert rule_context["Name"] == "redirect.test.com" assert rule_context["Comment"] == "Redirect to safe domain" def test_update_rpz_rule_substitute_missing_substitute_name_error(self): """ Test error when updating Substitute rule without substitute_name. Given: - Arguments for Substitute rule without substitute_name When: - update_rpz_rule_command is called Then: - DemistoException is raised with appropriate error message """ from Infoblox import update_rpz_rule_command args = { "reference_id": "record:rpz:cname/test", "rule_type": "Substitute (domain name)", "name": "test.test.com", "rp_zone": "test.com", "comment": "Test substitute rule", } with pytest.raises(DemistoException) as exc_info: update_rpz_rule_command(client, args) assert "Substitute (domain name) rules requires a substitute name argument" in str(exc_info.value) class TestListResponsePolicyZonesCommand: """Test class for list_response_policy_zones_command function.""" def test_list_zones_with_fqdn_filter(self, requests_mock): """ Test listing response policy zones with FQDN filter. Given: - FQDN filter argument provided - Mock response with single matching zone When: - list_response_policy_zones_command is called Then: - Only matching zone is returned """ from Infoblox import list_response_policy_zones_command mock_response = util_load_json(f"{self.__class__.__name__}/list_zones_with_fqdn_filter.json") requests_mock.get( f"{BASE_URL}zone_rp?_return_as_object=1&_return_fields%2B=fqdn%2Crpz_policy%2Crpz_severity%2Crpz_type%2Csubstitute_name%2Ccomment%2Cdisable&_max_results=50&fqdn=test.com", json=mock_response, ) args = {"fqdn": "test.com"} expected_hr = util_load_text_data(f"{self.__class__.__name__}/list_zones_with_fqdn_filter_hr.md") hr, context, raw_response = list_response_policy_zones_command(client, args) # Verify only one zone is returned expected_context_key = f"{INTEGRATION_CONTEXT_NAME}.ResponsePolicyZones(val.FQDN && val.FQDN === obj.FQDN)" zones_context = context[expected_context_key] assert len(zones_context) == 1 assert zones_context[0]["FQDN"] == "test.com" assert hr == expected_hr def test_list_zones_with_view_filter(self, requests_mock): """ Test listing response policy zones with view filter. Given: - View filter argument provided - Mock response with zone in specified view When: - list_response_policy_zones_command is called Then: - Only zones in specified view are returned """ from Infoblox import list_response_policy_zones_command mock_response = util_load_json(f"{self.__class__.__name__}/list_zones_with_view_filter.json") requests_mock.get( f"{BASE_URL}zone_rp?_return_as_object=1&_return_fields%2B=fqdn%2Crpz_policy%2Crpz_severity%2Crpz_type%2Csubstitute_name%2Ccomment%2Cdisable&_max_results=50&view=external", json=mock_response, ) args = {"view": "external"} expected_hr = util_load_text_data(f"{self.__class__.__name__}/list_zones_with_view_filter_hr.md") hr, context, raw_response = list_response_policy_zones_command(client, args) # Verify zone with external view is returned expected_context_key = f"{INTEGRATION_CONTEXT_NAME}.ResponsePolicyZones(val.FQDN && val.FQDN === obj.FQDN)" zones_context = context[expected_context_key] assert len(zones_context) == 1 assert zones_context[0]["View"] == "external" assert zones_context[0]["RpzPolicy"] == "SUBSTITUTE" assert hr == expected_hr def test_list_zones_multiple_filters(self, requests_mock): """ Test listing response policy zones with multiple filter arguments. Given: - Multiple filter arguments (fqdn, view, comment) - Mock response with matching zone When: - list_response_policy_zones_command is called Then: - Filters are properly applied and matching zone is returned """ from Infoblox import list_response_policy_zones_command mock_response = util_load_json(f"{self.__class__.__name__}/list_zones_multiple_filters.json") requests_mock.get( f"{BASE_URL}zone_rp?_return_as_object=1&_return_fields%2B=fqdn%2Crpz_policy%2Crpz_severity%2Crpz_type%2Csubstitute_name%2Ccomment%2Cdisable&_max_results=25&view=default", json=mock_response, ) args = { "max_results": "25", "view": "default", } expected_hr = util_load_text_data(f"{self.__class__.__name__}/list_zones_multiple_filters_hr.md") hr, context, raw_response = list_response_policy_zones_command(client, args) # Verify zone matching all filters is returned expected_context_key = f"{INTEGRATION_CONTEXT_NAME}.ResponsePolicyZones(val.FQDN && val.FQDN === obj.FQDN)" zones_context = context[expected_context_key] assert len(zones_context) == 3 assert zones_context[0]["View"] == "default" assert zones_context[0]["Comment"] == "Test response policy zone" assert hr == expected_hr class TestCreateHostRecordCommand: """Test class for create_host_record_command function.""" def test_create_host_record_success(self, requests_mock): """ Test successful creation of a host record with both IPv4 and IPv6 addresses. Given: - Valid arguments for creating a host record - Mock response from the API When: - create_host_record_command is called Then: - Host record is created successfully - Correct context and human readable output are returned """ from Infoblox import create_host_record_command mock_response = util_load_json(f"{self.__class__.__name__}/create_host_record_success.json") # Construct URL with query parameters using quote base_endpoint = "record:host" return_fields = ( "aliases,allow_telnet,cli_credentials,cloud_info,comment,configure_for_dns,ddns_protected," "device_description,device_location,device_type,device_vendor,disable,disable_discovery," "dns_aliases,dns_name,extattrs,ipv4addrs,ipv6addrs,ms_ad_user_data,name,network_view," "rrset_order,snmp3_credential,snmp_credential,ttl,use_cli_credentials,use_snmp3_credential," "use_snmp_credential,use_ttl,view,zone" ) url = f"{BASE_URL}{base_endpoint}?_return_as_object=1&_return_fields%2B={quote(return_fields)}" requests_mock.post( url, json=mock_response, ) args = { "name": "example", "ipv4_address": '[{"ipv4addr": "0.0.0.1"}]', "ipv6_address": '[{"ipv6addr": "0000:000:0000::0000:000:001", "configure_for_dhcp": false}]', "configure_for_dns": "false", } expected_hr = util_load_text_data(f"{self.__class__.__name__}/create_host_record_success_hr.md") hr, context, raw_response = create_host_record_command(client, args) # Verify human readable output assert hr == expected_hr # Verify context expected_context_key = f"{INTEGRATION_CONTEXT_NAME}.Host(val.Name && val.Name === obj.Name)" assert expected_context_key in context host_context = context[expected_context_key] assert host_context["Name"] == "example" assert host_context["ReferenceID"] == "record:host/45678:example/ " assert host_context["Type"] == "record:host" assert not host_context["ConfigureForDNS"] assert host_context["IPV4Addresses"][0]["IPV4Address"] == "0.0.0.1" assert host_context["IPV6Addresses"][0]["IPV6Address"] == "0000:000:0000::0000:000:001" # Verify raw response assert raw_response == mock_response def test_create_host_record_ipv4_only_success(self, requests_mock): """ Test successful creation of a host record with IPv4 address only. Given: - Valid arguments for creating a host record with IPv4 only - Mock response from the API When: - create_host_record_command is called Then: - Host record is created successfully with IPv4 address """ from Infoblox import create_host_record_command mock_response = util_load_json(f"{self.__class__.__name__}/create_host_record_ipv4_only_success.json") # Construct URL with query parameters using quote base_endpoint = "record:host" return_fields = ( "aliases,allow_telnet,cli_credentials,cloud_info,comment,configure_for_dns,ddns_protected," "device_description,device_location,device_type,device_vendor,disable,disable_discovery," "dns_aliases,dns_name,extattrs,ipv4addrs,ipv6addrs,ms_ad_user_data,name,network_view," "rrset_order,snmp3_credential,snmp_credential,ttl,use_cli_credentials,use_snmp3_credential," "use_snmp_credential,use_ttl,view,zone" ) url = f"{BASE_URL}{base_endpoint}?_return_as_object=1&_return_fields%2B={quote(return_fields)}" requests_mock.post( url, json=mock_response, ) args = { "name": "testhost", "ipv4_address": '[{"ipv4addr": "192.168.1.2", "configure_for_dhcp": true}]', "comment": "Test host record", "configure_for_dns": "true", } expected_hr = util_load_text_data(f"{self.__class__.__name__}/create_host_record_ipv4_only_success_hr.md") hr, context, raw_response = create_host_record_command(client, args) # Verify the host was created correctly assert hr == expected_hr expected_context_key = f"{INTEGRATION_CONTEXT_NAME}.Host(val.Name && val.Name === obj.Name)" host_context = context[expected_context_key] assert host_context["Name"] == "testhost" assert host_context["Comment"] == "Test host record" assert host_context["ConfigureForDNS"] assert host_context["IPV4Addresses"][0]["IPV4Address"] == "192.168.1.2" assert raw_response == mock_response class TestDhcpLeaseLookupCommand: """Test class for dhcp_lease_lookup_command function.""" def test_dhcp_lease_lookup_success(self, requests_mock): """ Test successful DHCP lease lookup with limit parameter. Given: - Valid arguments for DHCP lease lookup - Mock response from the API with multiple leases When: - dhcp_lease_lookup_command is called Then: - Multiple DHCP leases are returned successfully - Correct context and human readable output are returned """ from Infoblox import dhcp_lease_lookup_command mock_response = util_load_json(f"{self.__class__.__name__}/dhcp_lease_lookup_success.json") # Construct URL with query parameters using quote base_endpoint = "lease" return_fields = "address,billing_class,binding_state,client_hostname,cltt,discovered_data,ends,hardware,ipv6_duid,ipv6_iaid,ipv6_preferred_lifetime,ipv6_prefix_bits,is_invalid_mac,ms_ad_user_data,network,network_view,never_ends,never_starts,next_binding_state,on_commit,on_expiry,on_release,option,protocol,remote_id,served_by,server_host_name,starts,tsfp,tstp,uid,username,variable,fingerprint" # noqa: E501 url = f"{BASE_URL}{base_endpoint}?_return_as_object=1&_return_fields%2B={quote(return_fields)}&_max_results=3" requests_mock.get( url, json=mock_response, ) args = {"limit": "3"} expected_hr = util_load_text_data(f"{self.__class__.__name__}/dhcp_lease_lookup_success_hr.md") hr, context, raw_response = dhcp_lease_lookup_command(client, args) # Verify human readable output assert hr == expected_hr # Verify context expected_context_key = f"{INTEGRATION_CONTEXT_NAME}.DHCPLease(val.Address && val.Address === obj.Address)" assert expected_context_key in context leases_context = context[expected_context_key] assert len(leases_context) == 3 assert leases_context[0]["Address"] == "0.0.0.5" assert leases_context[0]["BindingState"] == "FREE" assert leases_context[1]["Address"] == "0.0.0.3" assert leases_context[1]["BindingState"] == "ACTIVE" # Verify raw response assert raw_response == mock_response def test_dhcp_lease_lookup_by_ip_success(self, requests_mock): """ Test successful DHCP lease lookup by specific IP address. Given: - Valid IP address argument for DHCP lease lookup - Mock response from the API with single lease When: - dhcp_lease_lookup_command is called Then: - Single DHCP lease is returned successfully """ from Infoblox import dhcp_lease_lookup_command mock_response = util_load_json(f"{self.__class__.__name__}/dhcp_lease_lookup_by_ip_success.json") # Construct URL with query parameters using quote base_endpoint = "lease" return_fields = "address,billing_class,binding_state,client_hostname,cltt,discovered_data,ends,hardware,ipv6_duid,ipv6_iaid,ipv6_preferred_lifetime,ipv6_prefix_bits,is_invalid_mac,ms_ad_user_data,network,network_view,never_ends,never_starts,next_binding_state,on_commit,on_expiry,on_release,option,protocol,remote_id,served_by,server_host_name,starts,tsfp,tstp,uid,username,variable,fingerprint" # noqa: E501 url = f"{BASE_URL}{base_endpoint}?_return_as_object=1&_return_fields%2B={quote(return_fields)}&address=0.0.0.3" requests_mock.get( url, json=mock_response, ) args = {"ip_address": "0.0.0.3"} expected_hr = util_load_text_data(f"{self.__class__.__name__}/dhcp_lease_lookup_by_ip_success_hr.md") hr, context, raw_response = dhcp_lease_lookup_command(client, args) # Verify the lease was found correctly assert hr == expected_hr expected_context_key = f"{INTEGRATION_CONTEXT_NAME}.DHCPLease(val.Address && val.Address === obj.Address)" leases_context = context[expected_context_key] assert len(leases_context) == 1 assert leases_context[0]["Address"] == "0.0.0.3" assert leases_context[0]["ClientHostname"] == "CE" assert leases_context[0]["Hardware"] == "00:00:00:00:00:03" assert raw_response == mock_response