Layer7 API Management

 View Only
  • 1.  How to evaluate embedded variable

    Posted May 14, 2020 08:04 AM
    I have a context variable which has embedded Cluster Wide Property. How can I can evaluate it and display the value of CWP. 

    I have a policy ( List of policies and their targets? ) which will find out the targets/routes for the policy. Here the routes of the policy are parsed and recorded in multi-valued context variable "hostnames". 


    My routing assertion as a cluster-wide-property. So the hostname.results has the cluster-wide-property. When I display using the hostname.results or backend_url (which is a join of the hostnames.results), the cluster-wide-property is getting displayed as it is without its value. How can I print backend_url,  with the value of the embedded cluster-wide-property. 

    Note:- I tried "Look Up Context Variable" giving ${backend_url} as the expression , but it did not work.


  • 2.  RE: How to evaluate embedded variable

    Posted May 14, 2020 08:56 AM
    Srinivasa

    To reference clusterwide properties in policies, you need to prepend 'gateway' - so in your case, if I understand your question correctly, you would need to use ${gateway.backend_url} to reference to the clusterwide property.

    KR
    Robbert

    ------------------------------
    Solution Architect
    HCL Technologies
    ------------------------------



  • 3.  RE: How to evaluate embedded variable

    Posted May 14, 2020 12:10 PM
    From the example above, I local context variable, backend_url, has the value/content is "${gateway.property1}, https://hostname.${gateway.env}/${gateway.property2}"
    Now when I print backend_url I am see whatever content that it has, but I want the see the CWP properties values that are embedded with the the variable.

    For clarity:
    Actual: Now when I print backend_url i see: "${gateway.property1} https://hostname.${gateway.env}/${gateway.property2}"
    Expecting: "property1_value https://hostname.env_value/property2_value"


  • 4.  RE: How to evaluate embedded variable
    Best Answer

    Posted May 18, 2020 03:38 AM
    Srinivasa,

    You can use the lookup context variable assertion for this:
    https://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-enterprise-software/layer7-api-management/api-gateway/9-4/policy-assertions/assertion-palette/policy-logic-assertions/look-up-context-variable-assertion.html