Layer7 API Management

  • 1.  Retrieve policy details

    Posted May 15, 2015 06:40 AM

    Is there any way / method to retrieve data wrt policy defined in layer 7 from console mode.

    Ex : policy name and unique id assigned to it.



  • 2.  Re: Retrieve policy details

    Posted May 15, 2015 07:18 AM

    Hi Ankush

     

    You can use the RESTMAN interface from 8.2 and above.  From policy manager, right click on the policy tree control and select 'Publish Internal Service'.  From this wizard  select Gateway REST Management Service , and the service is created and exposed.  You can access the documentation and download a WADL via:-

     

    https://<GatewayHostName>:<port>/<GatewayRESTRoutingURI>/1.0/doc/ home.html

     

    Once you have the WADL, create a SoapUI project based upon this and you can review all the services available and understand how it works. For your question I was able to obtain a list of policies via:-

     

    GET https://myserver:8443/restman/1.0/services

     

    The returned XML document was quite verbose with lots of information but it did include policy name and id.  You can run the same from the command line using curl or wget:-

     

    wget https://clach05-ssg83.ca.com:8443/restman/1.0/services --http-user=admin --http-password=7layer  --no-check-certificate --auth-no-challenge

    curl -u admin:7layer --insecure https://clach05-ssg83.ca.com:8443/restman/1.0/services

     

    I had to use the --no-check-certificate and --insecure as my lab gateway does not have a signed certificate.  Once you have the XML you would have parse it to obtain the information you are interested in.  Does this help?

     

    Christopher Clark

    CA Support



  • 3.  Re: Retrieve policy details

    Posted May 15, 2015 07:58 AM

    Hi Christopher,

     

    Thanks a lot, this was very useful information. In addition to it ,is it possible to retrieve data from database being used by layer7 with help of some query.

     

    Thanks in advance,

    Ankush



  • 4.  Re: Retrieve policy details

    Posted May 15, 2015 09:43 AM

    Hi Ankush

     

    DB Schema is not documented and it is not recommended to query this directly, as it could cause unforeseen errors with the gateway, especially when under a high load, and could be incompatible with future schema changes.  Having said that I did have a quick look at my 8.3 lab Gateway and used the following query:-

     

    select name, hex(goid), routing_uri, hex(policy_goid) from published_service;

     

    Regards

    Christopher Clark

    CA Support 



  • 5.  Re: Retrieve policy details

    Posted May 17, 2015 11:00 AM

    Hi Christoper,

     

    Thanks again for info, yes running query is not recommended method. I have a doubt on whether it is possible to print policy id ( which is unique for each policy )  and policy name for a given request in logs. If yes then which variables should we use for that.

     

    Thanks & Regards,

    Ankush



  • 6.  Re: Retrieve policy details

    Posted May 18, 2015 04:24 AM

    Hi Ankush

     

    The Policy Manager's help tool (Press F1) has a great section on context variables available in the policy. Once you have loaded the help in the browser search for 'Context variables' and choose the top ranked result.  This is one of the most useful pages of documentation shipped with the Gateway.  From this page I can see the following variables that can be used with audit log messages:-

     

    ${policy.guid} Returns the GUID of the current policy. When not part of a policy fragment, this is the same as ${service.policy.guid}.

    ${policy.name} Returns the name of the current policy.

    ${policy.version} Returns the active revision of the current policy. When not part of a policy fragment, this is the same as ${service.policy.version}.

    ${service.name} Returns the name of the protected service (i.e., the service published on the Gateway).

    ${service.oid} Returns the entity ID of the service policy. This entity ID is also displayed on the [General] tab of the Published Service Properties dialog. For more information, see Service Properties.

    ${service.policy.guid} Returns the GUID of the service policy. This GUID is also displayed on the [General] tab of the Published Service Properties dialog. For more information, see Service Properties.

    ${service.policy.version} Returns the active revision of the service policy.

     

    Are you after anything else regarding the policy?

     

    Regards

    Christopher Clark

    CA Support



  • 7.  Re: Retrieve policy details

    Posted May 25, 2015 02:04 PM

    Hi Christopher,

     

    Thanks for information, I will test out the details which you have shared and will let you know in case if I need further information.

     

    Thanks in Advance,

    Ankush