New module: manage Citrix Netscaler content switching policy configuration (network/netscaler/netscaler_cs_policy) (#26189)

* Add netscaler_cs_policy

* Correct version_added
This commit is contained in:
George Nikolopoulos
2017-08-01 20:35:29 +03:00
committed by John R Barker
parent 7a51c5f4df
commit 36537186e3
17 changed files with 962 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
---
testcase: "*"
test_cases: []
nitro_user: nsroot
nitro_pass: nsroot

View File

@@ -0,0 +1,5 @@
[netscaler]
netscaler01 nsip=172.18.0.2 nitro_user=nsroot nitro_pass=nsroot

View File

@@ -0,0 +1,6 @@
---
- { include: testbed.yaml, state: present }
- { include: nitro.yaml, tags: ['nitro'] }
- { include: testbed.yaml, state: absent }

View File

@@ -0,0 +1,14 @@
- name: collect all nitro test cases
find:
paths: "{{ role_path }}/tests/nitro"
patterns: "{{ testcase }}.yaml"
register: test_cases
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View File

@@ -0,0 +1,15 @@
---
- name: Setup cs action
delegate_to: localhost
netscaler_cs_action:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: "{{ state }}"
name: action-1
targetvserverexpr: '"mylb_" + HTTP.REQ.URL.SUFFIX'

View File

@@ -0,0 +1,85 @@
---
- include: "{{ role_path }}/tests/nitro/policy_domain/setup.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/policy_domain/setup.yaml"
vars:
check_mode: no
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/policy_domain/setup.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/policy_domain/setup.yaml"
vars:
check_mode: no
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/policy_domain/update.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/policy_domain/update.yaml"
vars:
check_mode: no
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/policy_domain/update.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/policy_domain/update.yaml"
vars:
check_mode: no
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/policy_domain/remove.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/policy_domain/remove.yaml"
vars:
check_mode: no
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/policy_domain/remove.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/policy_domain/remove.yaml"
vars:
check_mode: no
- assert:
that: not result|changed

View File

@@ -0,0 +1,13 @@
---
- name: Setup cs policy
delegate_to: localhost
register: result
check_mode: "{{ check_mode }}"
netscaler_cs_policy:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
policyname: somepolicy

View File

@@ -0,0 +1,14 @@
---
- name: Setup cs policy
delegate_to: localhost
register: result
check_mode: "{{ check_mode }}"
netscaler_cs_policy:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
policyname: somepolicy
domain: example.com

View File

@@ -0,0 +1,13 @@
---
- name: Update cs policy
delegate_to: localhost
register: result
check_mode: "{{ check_mode }}"
netscaler_cs_policy:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
policyname: somepolicy
domain: example2.com

View File

@@ -0,0 +1,57 @@
---
- include: "{{ role_path }}/tests/nitro/policy_rule/setup.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/policy_rule/setup.yaml"
vars:
check_mode: no
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/policy_rule/setup.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/policy_rule/setup.yaml"
vars:
check_mode: no
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/policy_rule/remove.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/policy_rule/remove.yaml"
vars:
check_mode: no
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/policy_rule/remove.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/policy_rule/remove.yaml"
vars:
check_mode: no
- assert:
that: not result|changed

View File

@@ -0,0 +1,13 @@
---
- name: Setup cs policy
delegate_to: localhost
register: result
check_mode: "{{ check_mode }}"
netscaler_cs_policy:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
policyname: somepolicy_rule

View File

@@ -0,0 +1,15 @@
---
- name: Setup cs policy
delegate_to: localhost
register: result
check_mode: "{{ check_mode }}"
netscaler_cs_policy:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
policyname: somepolicy_rule
rule: CLIENT.IP.SRC.SUBNET(24).EQ(10.217.84.0)
action: action-1

View File

@@ -0,0 +1,57 @@
---
- include: "{{ role_path }}/tests/nitro/policy_url/setup.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/policy_url/setup.yaml"
vars:
check_mode: no
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/policy_url/setup.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/policy_url/setup.yaml"
vars:
check_mode: no
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/policy_url/remove.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/policy_url/remove.yaml"
vars:
check_mode: no
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/policy_url/remove.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/policy_url/remove.yaml"
vars:
check_mode: no
- assert:
that: not result|changed

View File

@@ -0,0 +1,13 @@
---
- name: Setup cs policy
delegate_to: localhost
register: result
check_mode: "{{ check_mode }}"
netscaler_cs_policy:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
policyname: somepolicy

View File

@@ -0,0 +1,14 @@
---
- name: Setup cs policy
delegate_to: localhost
register: result
check_mode: "{{ check_mode }}"
netscaler_cs_policy:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
policyname: somepolicy
url: /example.com/basket