<commit_before>---

- name: Issue 01545 - Create published policy
  bigip_policy:
    name: issue-01545

- name: Issue 01545 - Change condition is_any
  bigip_policy_rule:
    policy: issue-01545
    name: rule1
    conditions:
      - type: ssl_extension
        server_name_is_any:
          - foo.bar.com
          - cat.dog.com
        event: ssl_client_hello
  register: result

- name: Issue 01545 - Assert Change condition is_any
  assert:
    that:
      - result is changed
      - result is success

- name: Issue 01545 - Change condition is_any - Idempotent check
  bigip_policy_rule:
    policy: issue-01545
    name: rule1
    conditions:
      - type: ssl_extension
        server_name_is_any:
          - foo.bar.com
          - cat.dog.com
        event: ssl_client_hello
  register: result

- name: Issue 01545 - Assert Change condition is_any - Idempotent check
  assert:
    that:
      - result is not changed
      - result is success

- name: Issue 01545 - Add value condition is_any
  bigip_policy_rule:
    policy: issue-01545
    name: rule1
    conditions:
      - type: ssl_extension
        server_name_is_any:
          - foo.bar.com
          - baz.bar.com
          - cat.dog.com
        event: ssl_client_hello
  register: result

- name: Issue 01545 - Assert Add value condition is_any
  assert:
    that:
      - result is changed
      - result is success

- name: Issue 01545 - Add value condition is_any - Idempotent check
  bigip_policy_rule:
    policy: issue-01545
    name: rule1
    conditions:
      - type: ssl_extension
        server_name_is_any:
          - foo.bar.com
          - baz.bar.com
          - cat.dog.com
        event: ssl_client_hello
  register: result

- name: Issue 01545 - Assert Add value condition is_any - Idempotent check
  assert:
    that:
      - result is not changed
      - result is success

- name: Issue 01545 - Remove value condition is_any
  bigip_policy_rule:
    policy: issue-01545
    name: rule1
    conditions:
      - type: ssl_extension
        server_name_is_any:
          - foo.bar.com
          - baz.bar.com
        event: ssl_client_hello
  register: result

- name: Issue 01545 - Assert Remove value condition is_any
  assert:
    that:
      - result is changed
      - result is success

- name: Issue 01545 - Remove value condition is_any - Idempotent check
  bigip_policy_rule:
    policy: issue-01545
    name: rule1
    conditions:
      - type: ssl_extension
        server_name_is_any:
          - foo.bar.com
          - baz.bar.com
        event: ssl_client_hello
  register: result

- name: Issue 01545 - Assert Remove value condition is_any - Idempotent check
  assert:
    that:
      - result is not changed
      - result is success

- name: Issue 01545 - Change Event to ssl_server_hello
  bigip_policy_rule:
    policy: issue-01545
    name: rule1
    conditions:
      - type: ssl_extension
        server_name_is_any: foo.bar.com
        event: ssl_server_hello
  register: result

- name: Issue 01545 - Assert Change Event to ssl_server_hello
  assert:
    that:
      - result is changed
      - result is success

- name: Issue 01545 - Change Event to ssl_server_hello - Idempotent check
  bigip_policy_rule:
    policy: issue-01545
    name: rule1
    conditions:
      - type: ssl_extension
        server_name_is_any: foo.bar.com
        event: ssl_server_hello
  register: result

- name: Issue 01545 - Change Event to ssl_server_hello - Idempotent check
  assert:
    that:
      - result is not changed
      - result is success

- name: Issue 01545 - Remove published policy
  bigip_policy:
    name: issue-01545
    state: absent<commit_msg>added note to existing tests, changed tests for 1545 to accommodate (#1733)<commit_after>---

# Due to ID742057  on TMOS 13 and up, it is not possible to change event type for the ssl_extension condition after it has actions attached
# this is true for TMSH and GUI. A workaround is to manipulate ordinals in the policy, but this is something module could not do reliably with idempotency.

- name: Issue 01545 - Create published policy
  bigip_policy:
    name: issue-01545

- name: Issue 01545 - Create VS
  bigip_virtual_server:
    name: issue-01545-vs
    destination: 1.1.1.1
    port: 80

- name: Issue 01545 - Change condition is_any
  bigip_policy_rule:
    policy: issue-01545
    name: rule1
    conditions:
      - type: ssl_extension
        server_name_is_any:
          - foo.bar.com
          - cat.dog.com
        event: ssl_client_hello
    actions:
      - type: forward
        virtual: "/Common/issue-01545-vs"
  register: result

- name: Issue 01545 - Assert Change condition is_any
  assert:
    that:
      - result is changed
      - result is success

- name: Issue 01545 - Change condition is_any - Idempotent check
  bigip_policy_rule:
    policy: issue-01545
    name: rule1
    conditions:
      - type: ssl_extension
        server_name_is_any:
          - foo.bar.com
          - cat.dog.com
        event: ssl_client_hello
    actions:
      - type: forward
        virtual: "/Common/issue-01545-vs"
  register: result

- name: Issue 01545 - Assert Change condition is_any - Idempotent check
  assert:
    that:
      - result is not changed
      - result is success

- name: Issue 01545 - Add value condition is_any
  bigip_policy_rule:
    policy: issue-01545
    name: rule1
    conditions:
      - type: ssl_extension
        server_name_is_any:
          - foo.bar.com
          - baz.bar.com
          - cat.dog.com
        event: ssl_client_hello
  register: result

- name: Issue 01545 - Assert Add value condition is_any
  assert:
    that:
      - result is changed
      - result is success

- name: Issue 01545 - Add value condition is_any - Idempotent check
  bigip_policy_rule:
    policy: issue-01545
    name: rule1
    conditions:
      - type: ssl_extension
        server_name_is_any:
          - foo.bar.com
          - baz.bar.com
          - cat.dog.com
        event: ssl_client_hello
  register: result

- name: Issue 01545 - Assert Add value condition is_any - Idempotent check
  assert:
    that:
      - result is not changed
      - result is success

- name: Issue 01545 - Remove value condition is_any
  bigip_policy_rule:
    policy: issue-01545
    name: rule1
    conditions:
      - type: ssl_extension
        server_name_is_any:
          - foo.bar.com
          - baz.bar.com
        event: ssl_client_hello
  register: result

- name: Issue 01545 - Assert Remove value condition is_any
  assert:
    that:
      - result is changed
      - result is success

- name: Issue 01545 - Remove value condition is_any - Idempotent check
  bigip_policy_rule:
    policy: issue-01545
    name: rule1
    conditions:
      - type: ssl_extension
        server_name_is_any:
          - foo.bar.com
          - baz.bar.com
        event: ssl_client_hello
  register: result

- name: Issue 01545 - Assert Remove value condition is_any - Idempotent check
  assert:
    that:
      - result is not changed
      - result is success

- name: Issue 01545 - Remove published policy - first time
  bigip_policy:
    name: issue-01545
    state: absent

# Due to ID742057  on TMOS 13 and up, it is not possible to change event type for the ssl_extension condition after it has actions attached
# this is true for TMSH and GUI. The same error also occurs when trying to create or modify published policy with event ssl_server_hello
# and action forward.

- name: Issue 01545 - Create published policy - second time
  bigip_policy:
    name: issue-01545

- name: Issue 01545 - Create rule with event ssl_server_hello
  bigip_policy_rule:
    policy: issue-01545
    name: rule1
    conditions:
      - type: ssl_extension
        server_name_is_any: foo.bar.com
        event: ssl_server_hello
  register: result

- name: Issue 01545 - Create rule with event ssl_server_hello
  assert:
    that:
      - result is changed
      - result is success

- name: Issue 01545 - Create rule with event ssl_server_hello - Idempotent check
  bigip_policy_rule:
    policy: issue-01545
    name: rule1
    conditions:
      - type: ssl_extension
        server_name_is_any: foo.bar.com
        event: ssl_server_hello
  register: result

- name: Issue 01545 - Create rule with event ssl_server_hello - Idempotent check
  assert:
    that:
      - result is not changed
      - result is success

- name: Issue 01545 - Remove published policy - second time
  bigip_policy:
    name: issue-01545
    state: absent

- name: Issue 01545 - Remove VS
  bigip_virtual_server:
    name: issue-01545-vs
    state: absent
{'fraction_non_alphanumeric': 0.06243472206104213, 'fraction_numerical': 0.043634675641174424, 'mean_word_length': 2.2496229260935143, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2276371', 'n_tokens_mistral': 2932, 'n_tokens_neox': 2688, 'n_words': 854}