Software Development Kit (SDK) and API Discussions

no luck creating export-policy rules.

liesc
2,321 Views
xin = NaElement("export-rule-create")    
xin.child_add_string("policy-name", "Test")
xin.child_add_string("client-match", "0.0.0.0/0)

rwrule = NaElement("rw-rule")
secflavor = NaElement("security-flavor")
secflavor.child_add_string("flavor", "any")
rwrule.child_add(secflavor)
xin.child_add(rwrule)


rorule = NaElement("ro-rule")
secflavor = NaElement("security-flavor")
secflavor.child_add_string("flavor", "any")
rorule.child_add(secflavor)
xin.child_add(rorule)

out = s.invoke_elem(xin)
print out.results_reason()

 

I'm not having much luck creating rules for export policies with python.  The 8.3 API docs don't specifically define "flavor" for the child_add_string portion so I am basing that off of old docs, that is the only way I can get the script to actually execute.  I'm sure things are going wrong at the security-flavor portion but the error reason isnt much help....

 

The value "zapi field: ro-rule" is invalid for field "- <>"

 

The odd thing is, I dont get this error for the rw-rule.

1 REPLY 1

MIKEMWALK
2,208 Views

I think the rule sections should look the same as the response to export-rule-get-iter

 

e.g.

 

<ro-rule>
    <security-flavor>any</security-flavor>
</ro-rule>

Public