Add, Delete, Enable, Disable Assertions

This topic describes how to perform common tasks with assertions in the Policy Manager.
gateway93
This topic describes how to perform common tasks with assertions in the Policy Manager.
Add an Assertion
You can add an assertion to a service as follows:
  1. Ensure the policy window for the service is visible. You can open this window by doing one of the following:
    • Right-click the service name in the Services and Policies list and then select
      Active Policy Assertions
      , or
    • Double-click the service name in the Services and Policies list
  2. Locate the assertion to add using either of these methods:
    • Browse for the assertion by expanding each category under the [
      Assertions
      ] tab.
    • Type a few characters of the assertion's name in the Search box and then select a match to jump directly to the assertion.
  3. Add the assertion to the policy by doing one of the following:
    • Drag and drop the assertion from the [
      Assertions
      ] tab into the policy development window.
    • Select the assertion in the [
      Assertions
      ] tab and click the image2014-11-13 10:29:49.png (Add Assertion) button in the Assertions Tool Bar.
    • Use keyboard shortcut
      Ctrl + Right
      to insert an assertion into an Active Policy editor tab. The assertion is added after the highlighted assertion.
      Note:
      • This shortcut allows you to insert the highlighted assertion into the Active Policy editor tab when:
        • A policy is open in an editor and an assertion is highlighted in the Assertion Palette.
        • A policy is open in an editor tab and an assertion is highlighted in the Assertion Palette search results combo box.
      • This shortcut does not work for the following scenarios:
        • when no assertion is highlighted
        • when there is no active policy editor tab
 
Depending on which
Layer7 API Gateway
product you have installed, not all the assertions that are listed are available. See Features by Product for a list of which features are available for each product.
 
After adding, some assertions may require extra configuration. Please refer to the documentation for the specific assertion for more details. The following table lists all the predefined assertions their categories under the [
Assertions
] tab.
The encapsulated assertions feature also allows you to populate any category with custom created assertions based on policy fragments. For more information, see Encapsulated Assertions. When adding an encapsulated assertion to a policy, it is recommended that you manually open the assertion properties to review the required inputs, if the properties dialog does not display automatically.
Delete an Assertion
You can delete an assertion that you no longer need in a policy.
 
Removing an assertion may affect the integrity of a policy. Be sure to check the messages in the Policy Validation Messages window after deleting.
If you only need remove an assertion from a policy temporarily, consider disabling the assertion instead.
 
To delete an assertion
:
  1. In the policy window, right-click the assertion to remove and then select
    Delete Assertion
    or select the assertion to remove and then click Delete.
    You can delete several assertions simultaneously by using [
    Ctrl
    ]-click to select them first.
  2. Click [
    Yes
    ] to confirm the deletion.
Disable an Assertion
You can disable specific assertions in a published policy or policy fragment. This has the same effect as deleting the assertion, while preserving the assertion's properties and structure of the policy. Disabling an assertion can help you troubleshoot or test a policy. Disabled assertions are ignored by the
Layer7 API Gateway
during policy consumption and by the policy validator.
Disabling an assertion may affect the integrity of a policy. Be sure to check the messages in the Policy Validation Messages window after disabling.
Disabled assertions will stand out in the policy development window as follows:
image2014-11-13 11:0:59.png
  • Red "
    X
    " over the assertion icon
  • Assertion name that is shown as italicized gray text
A disabled assertion can be enabled at any time.
Note the following when using the disabling feature with the composite assertions ("All assertions must evaluate to true", "At least one assertion must evaluate to true", Run All Assertions Concurrently):
  • Disabling a composite assertion will disable all child assertions contained within it.
  • Disabling all child assertions does not disable the parent composite assertion. The result is the same as a composite assertion with no child assertions.
  • If a composite assertion is disabled, enabling any child assertion within it will also enable all parent composite assertions.
  • Any assertion added to a disabled composite parent will be disabled, regardless of its original state. Any assertion added to an enabled composite parent retains its previous state.
  • New assertions added from the palette to a composite assertion will assume the state of the parent composite assertion.
 
To select multiple assertions for disabling, hold down the [
Ctrl
] key while clicking the assertion.
 
To disable an assertion
:
  • In the policy window, right-click the assertion to disable and then select
    Disable Assertion
    Or:
    In the policy window, select one or more assertions to disable, then click image2014-11-13 11:3:36.png.
The assertion is removed from the  policy logic.
Enable an Assertion
You can manually re-enable any disabled assertion individually in a policy. Enabling the assertion restores the assertion properties that were in effect at the time of disabling.
In general, enabling an assertion has the same effect as adding an assertion to a policy. For the composite assertions ("All assertions must evaluate to true", "At least one assertion must evaluate to true", Run All Assertions Concurrently), note the following:
  • If a composite assertion is disabled, enabling a child assertion within it automatically enables all parent composite assertions.
  • Enabling a disabled composite assertion does not automatically enable all its child assertions - they will be restored to the state they were in when the composite assertion was disabled.
  • Child assertions that were disabled at the time of disabling the composite assertion will remain disabled. You need to manually enable the appropriate assertions.
 
To select multiple assertions for enabling, hold down the [
Ctrl
] key while clicking the assertion.
 
 
To enable an assertion
:
  1. In the policy window, right-click the assertion to enable and then select
    Enable Assertion.
    Or: 
  2. In the policy window, select one or more assertions to enable, then click image2014-11-13 11:6:53.png.
    You should now validate the policy.
 
To enable all child assertions under a parent assertion
:
  • In the policy window, right-click the parent assertion and then select
    Enable All Assertions
    .
    Or: 
    In the policy window, select one or more child assertions and then click image2014-11-13 11:13:11.png.
Reorder an Assertion
You can reorder an assertion using a mouse (Up and Down buttons) or the keyboard shortcuts in the Policy editor. Use the following keyboard shortcuts to reorder assertions in the Active Policy editor tab:
  • Ctrl
     + K
  • Ctrl + J
Follow these steps: 
  1. In a policy window, select an assertion.
  2. Use 
    Ctrl
     + K
    to move the highlighted assertion to the immediate preceding assertion.
  3. Use 
    Ctrl + J
    to move the highlighted assertion to the immediate below assertion.
Note:
 
  • The shortcut behavior applies similarly to a selection of multiple assertions.
  • The shortcut is similar to that of the existing Up and Down buttons in the Policy Editor.
  • This shortcut does not work for the following scenarios:
    • When no assertion is highlighted.
    • When there is no active policy editor tab.