Hi All,
I have a requirement to pull few declared cluster wide properties names from policy.
I am able to retrieve the policy XML with the below query, but the cluster wide declaration values are encrypted in the output XML. Could you please help me to find out the declared cluster wide property names from the policy XML.
Query:
select p.xml from policy p INNER JOIN published_service s ON p.goid = s.policy_goid where s.routing_uri like '%/test%';
Output:
| <?xml version="1.0" encoding="UTF-8"?><wsp:Policy xmlns:L7p="http://www.layer7tech.com/ws/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy"> <wsp:All wsp:Usage="Required"> <L7p:AuditAssertion/> <L7p:SetVariable> <L7p:Base64Expression stringValue="JHtnYXRld2F5LmFiYy54bWx9"/> <L7p:VariableToSet stringValue="inputurl"/> </L7p:SetVariable> <L7p:SetVariable> <L7p:Base64Expression stringValue="JHtnYXRld2F5LnRlc3QueG1sfQ=="/> <L7p:VariableToSet stringValue="uri"/> </L7p:SetVariable> <L7p:HardcodedResponse> <L7p:Base64ResponseBody stringValue="aGVsbG8="/> </L7p:HardcodedResponse> <L7p:AuditAssertion/> </wsp:All></wsp:Policy>
Thanks in advance
Mustaq
Hi Mustaq,
I know way to do this is and I have implemented it. You need to get the policy XML out from the ssg database and parse and decrypt the base64 encoded value to do this. You can build a parser quite easily with java or any other programming language. Reach out to me if you need more information.
Thanks,
Anand Rudran
is this what you're looking for?
select p.name, c.propkey from policy p, cluster_properties c where p.xml like concat(concat('%gateway.',c.propkey),'%');
This should do it in one line query:
select p.name, c.propkey from policy p, cluster_properties c where p.xml like concat(concat('%gateway.',c.propkey),'%') OR p.xml like concat(concat('%',TO_BASE64(concat('gateway.',c.propkey)),'%');
You could also use an XPATH assertion along with an Encode/Decode assertion.
The XPath can match as follows (a small sample is attached here). When multiple results are expected you will need to use the .results variable and iterate through with a 'Run All Assertions Concurrently' assertion.
A bit of overhead here but if may satisfy your requirement if used sparingly
Ref:
Encode/Decode Data Assertion - CA API Gateway - 9.2 - CA Technologies Documentation
Evaluate Request XPath Assertion - CA API Gateway - 9.2 - CA Technologies Documentation
Regards,
Joe
Attachment(s)