Layer7 API Management

  • 1.  using restman to update policies and services

    Posted Jan 29, 2016 03:40 PM

    When using restman to update services and policies I get the following error:

     

              Resource validation failed due to 'INVALID_VALUES' Unable to update policy: Entity 1d88b077a7a2639a34c68b06f1fc7630: version mismatch.

     

    I'm able to create services/policies using PUT but updating via PUT gives me the error.

     

    Anyone else have this problem or know the correct way to migrate updates via restman?

     

    Thanks,

    Mike

     

     

     

     



  • 2.  Re: using restman to update policies and services

    Broadcom Employee
    Posted Feb 01, 2016 10:54 AM

    Hi,

    I had the same issue,

    you cannot migrate a policy or service with a  source version <= target version. You need to get policy revision from target using rest first and set your source policy version as target_version +1.



  • 3.  Re: using restman to update policies and services

    Posted Feb 08, 2016 06:08 PM

    okaoz01, Thanks for the suggestion but the source policy is > target. Here's what I'm trying to migrate:

     

    Source:

    <?xml version="1.0" encoding="utf-8"?>

      <l7:Policy xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management" guid="97157be5-edde-4d3d-b166-6b5ad45b6249" id="1d88b077a7a2639a34c68b06f1f7d538" version="1">

      <l7:PolicyDetail folderId="1d88b077a7a2639a34c68b06f1f64fa1" guid="97157be5-edde-4d3d-b166-6b5ad45b6249" id="1d88b077a7a2639a34c68b06f1f7d538" version="1">

      <l7:Name>testDeployer</l7:Name>

      <l7:PolicyType>Include</l7:PolicyType>

      <l7:Properties>

    <l7:Property key="revision">

      <l7:LongValue>2</l7:LongValue>

      </l7:Property>

      <l7:Property key="soap">

      <l7:BooleanValue>false</l7:BooleanValue>

      </l7:Property>

      </l7:Properties>

      </l7:PolicyDetail>

      <l7:Resources>

      <l7:ResourceSet tag="policy">

      <l7:Resource type="policy">&lt;?xml version="1.0" encoding="UTF-8"?&gt;

    &lt;wsp:Policy xmlns:L7p="http://www.layer7tech.com/ws/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy"&gt;

      &lt;wsp:All wsp:Usage="Required"&gt;

      &lt;L7p:AuditDetailAssertion&gt;

      &lt;L7p:Detail stringValue="Policy Fragment: testDeployer"/&gt;

      &lt;/L7p:AuditDetailAssertion&gt;

      &lt;L7p:CommentAssertion&gt;

      &lt;L7p:Comment stringValue="UPDATED"/&gt;

      &lt;/L7p:CommentAssertion&gt;

      &lt;/wsp:All&gt;

    &lt;/wsp:Policy&gt;

    </l7:Resource>

      </l7:ResourceSet>

      </l7:Resources>

      </l7:Policy>

     

     

    Target:

    <?xml version="1.0" encoding="utf-8"?>

      <l7:Policy xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management" guid="97157be5-edde-4d3d-b166-6b5ad45b6249" id="1d88b077a7a2639a34c68b06f1f7d538" version="0">

      <l7:PolicyDetail folderId="1d88b077a7a2639a34c68b06f1f64fa1" guid="97157be5-edde-4d3d-b166-6b5ad45b6249" id="1d88b077a7a2639a34c68b06f1f7d538" version="0">

      <l7:Name>testDeployer</l7:Name>

      <l7:PolicyType>Include</l7:PolicyType>

      <l7:Properties>

      <l7:Property key="revision">

      <l7:LongValue>1</l7:LongValue>

      </l7:Property>

      <l7:Property key="soap">

      <l7:BooleanValue>false</l7:BooleanValue>

      </l7:Property>

      </l7:Properties>

      </l7:PolicyDetail>

      <l7:Resources>

      <l7:ResourceSet tag="policy">

      <l7:Resource type="policy">&lt;?xml version="1.0" encoding="UTF-8"?&gt;

    &lt;wsp:Policy xmlns:L7p="http://www.layer7tech.com/ws/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy"&gt;

      &lt;wsp:All wsp:Usage="Required"&gt;

      &lt;L7p:AuditDetailAssertion&gt;

      &lt;L7p:Detail stringValue="Policy Fragment: testDeployer"/&gt;

      &lt;/L7p:AuditDetailAssertion&gt;

      &lt;/wsp:All&gt;

    &lt;/wsp:Policy&gt;

    </l7:Resource>

      </l7:ResourceSet>

      </l7:Resources>

      </l7:Policy>

     

     

    Any other suggestions?

     

    Thanks,

    Mike



  • 4.  Re: using restman to update policies and services
    Best Answer

    Posted Feb 15, 2016 12:57 PM

    Found my issue, I was missing the version attribute on the Resource element.



  • 5.  Re: using restman to update policies and services

    Posted Feb 27, 2016 06:49 AM

    @lyonm

    Can you please elaborate? I'm having the same issue.  adding the version attribute to the <l7:resource> element, didn't resolve it for me. snippet below.

     

    <l7:ResourceSet tag="policy">

                  <l7:Resource type="policy" version="2">

                    &lt;?xml version="1.0" encoding="UTF-8" ?&gt;

    ...

    ...



  • 6.  Re: using restman to update policies and services

    Posted Mar 07, 2016 05:30 PM

    This looks correct, <l7:Resource type="policy" version="2"> , you just have to be sure that the version is greater than the target policy where you are deploying to.

     

    Are you getting an error or is the policy just not getting updated?