Test nat-policy rules API

L0 Member

Test nat-policy rules API

Hi all,

I want to use the APIs to test if the source, destination, protocol and port that I've inserted, match with one of my NAT policy rules. 

The complete request of the API that I've implemented is:

https://192.168.111.192/api/?type=op&cmd=<test><nat-policy-match><source>10.226.163.81</source><destination>10.227.248.113</destination><protocol>6</protocol><destination-port>123</destination-port></nat-policy-match></test>&key=<myKey>

and the Nat policy rule for the API request is: 

rules.png

 

Below, the same request via CLI:

user@ic-f-bih-1(active)> test nat-policy-match source 10.226.163.81 destination 10.227.248.113 protocol 6 destination-port 123

Destination-NAT: Rule matched: Rule24
10.227.248.113:123 => 10.10.1.85:123

In the CLI the request is successfull, but with API the result is the follow:

 

<response cmd="status" status="success">
  <result>
    <rules>
      <entry/>
    </rules>
  </result>
</response>

This happens only with rules that have Destination Translation filled. If the nat rule has Source translation filled, the response of the API query is successfull.

What I wrong with this API query? Thanks 

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the Live Community as a whole!

The Live Community thanks you for your participation!