Add netscaler_lb_monitor (#26143)

This commit is contained in:
George Nikolopoulos 2017-08-01 20:30:47 +03:00 committed by Chris Alfonso
parent 17e64f876d
commit ac0c5dec2f
73 changed files with 3971 additions and 0 deletions

File diff suppressed because it is too large Load diff

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,3 @@
---
- { include: nitro.yaml, tags: ['nitro'] }

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,57 @@
---
- include: "{{ role_path }}/tests/nitro/lb_monitor_citrix_aac/setup.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/lb_monitor_citrix_aac/setup.yaml"
vars:
check_mode: no
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/lb_monitor_citrix_aac/setup.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/lb_monitor_citrix_aac/setup.yaml"
vars:
check_mode: no
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/lb_monitor_citrix_aac/remove.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/lb_monitor_citrix_aac/remove.yaml"
vars:
check_mode: no
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/lb_monitor_citrix_aac/remove.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/lb_monitor_citrix_aac/remove.yaml"
vars:
check_mode: no
- assert:
that: not result|changed

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-citrix-aac
type: CITRIX-AAC-LAS

View file

@ -0,0 +1,17 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-citrix-aac
type: CITRIX-AAC-LAS
lasversion: 7.1
logonpointname: user

View file

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

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-citrix-ag
type: CITRIX-AG

View file

@ -0,0 +1,18 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-citrix-ag
type: CITRIX-AG
username: user1
password: password1
secondarypassword: password2

View file

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

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-citrix-web-interface
type: CITRIX-WEB-INTERFACE

View file

@ -0,0 +1,16 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-citrix-web-interface
type: CITRIX-WEB-INTERFACE
sitepath: hello/

View file

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

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-citrix-xd-ddc
type: CITRIX-XD-DDC

View file

@ -0,0 +1,17 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-citrix-xd-ddc
type: CITRIX-XD-DDC
validatecred: no
domain: somedomain.com

View file

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

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-citrix-xml-service
type: CITRIX-XML-SERVICE

View file

@ -0,0 +1,17 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-citrix-xml-service
type: CITRIX-XML-SERVICE
application: app

View file

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

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-diameter
type: DIAMETER

View file

@ -0,0 +1,38 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-diameter
type: DIAMETER
originhost: origin.host
originrealm: some.realm
hostipaddress: 192.168.1.1
vendorid: 20
productname: someproduct
firmwarerevision: 10
authapplicationid:
- "100"
- "200"
inbandsecurityid: NO_INBAND_SECURITY
supportedvendorids:
- "10"
- "20"
vendorspecificvendorid: 10
vendorspecificauthapplicationids:
- "11"
- "22"
vendorspecificacctapplicationids:
- "12"
- "23"
acctapplicationid:
- "1"
- "2"

View file

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

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-dns-tcp
type: DNS-TCP

View file

@ -0,0 +1,20 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-dns-tcp
type: DNS-TCP
query: example.com
querytype: Address
ipaddress:
- 192.168.1.1
- 192.168.1.2

View file

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

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-ftp
type: FTP-EXTENDED

View file

@ -0,0 +1,15 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-ftp
type: FTP-EXTENDED
filename: somefile.txt

View file

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

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-http
type: HTTP

View file

@ -0,0 +1,16 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-http
type: HTTP
trofscode: 500

View file

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

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-http-ecv
type: HTTP-ECV

View file

@ -0,0 +1,16 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-http-ecv
type: HTTP-ECV
trofsstring: somestring

View file

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

View file

@ -0,0 +1,13 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-1
type: HTTP-INLINE

View file

@ -0,0 +1,20 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-1
type: HTTP-INLINE
action: DOWN
respcode: [ "200", "203"]
httprequest: "HEAD /file.html"
customheaders: "HEADER_CUSTOM: NONE\r\n"

View file

@ -0,0 +1,20 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-1
type: HTTP-INLINE
action: DOWN
respcode: [ "200-201"]
httprequest: "HEAD /new_file.html"
customheaders: "HEADER_CUSTOM: NONE\r\n"

View file

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

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-ldap
type: LDAP

View file

@ -0,0 +1,19 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-ldap
type: LDAP
basedn: example.com
binddn: example.com
filter: somefilter
attribute: cn

View file

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

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-load
type: LOAD

View file

@ -0,0 +1,16 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-load
type: LOAD
snmpversion: V1

View file

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

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-nntp
type: NNTP

View file

@ -0,0 +1,16 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-nntp
type: NNTP
group: somegroup.nntp

View file

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

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-radius
type: RADIUS

View file

@ -0,0 +1,20 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-radius
type: RADIUS
username: someuser
password: somepass
radkey: somekey
radnasid: someid
radnasip: 192.168.1.1

View file

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

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-radius-accounting
type: RADIUS_ACCOUNTING

View file

@ -0,0 +1,24 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-radius-accounting
type: RADIUS_ACCOUNTING
username: someuser
password: somepass
radkey: somekey
radaccounttype: 10
radframedip: 192.168.1.1
radapn: someapn
radmsisdn: someisdn
radaccountsession: sessionid

View file

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

View file

@ -0,0 +1,13 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-rtsp
type: RTSP

View file

@ -0,0 +1,38 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-rtsp
type: RTSP
rtsprequest: OPTIONS
deviation: 100
units1: MSEC
interval: 5
units3: SEC
resptimeout: 10
units4: MSEC
resptimeoutthresh: 10
retries: 5
failureretries: 3
alertretries: 2
successretries: 4
downtime: 60
units2: MSEC
destip: 10.10.10.10
destport: 1111
reverse: yes
transparent: yes
iptunnel: no
tos: yes
tosid: 20
secure: no

View file

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

View file

@ -0,0 +1,13 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-2
type: SIP-UDP

View file

@ -0,0 +1,22 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-2
type: SIP-UDP
customheaders: "HEADER_CUSTOM: NONE\r\n"
maxforwards: 5
sipmethod: REGISTER
sipuri: sip:sip.test
sipreguri: sip:sip.register
lrtm: DISABLED

View file

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

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-snmp
type: SNMP

View file

@ -0,0 +1,18 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-snmp
type: SNMP
Snmpoid: some.id
snmpcommunity: some.community
snmpthreshold: threshold

View file

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

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-storefront
type: STOREFRONT

View file

@ -0,0 +1,18 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-storefront
type: STOREFRONT
storename: store
storefrontacctservice: yes
storefrontcheckbackendservices: yes

View file

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

View file

@ -0,0 +1,13 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-tcp-ecv
type: TCP-ECV

View file

@ -0,0 +1,17 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-tcp-ecv
type: TCP-ECV
send: sendstring
recv: recvstring

View file

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

View file

@ -0,0 +1,14 @@
---
- name: remove lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
monitorname: lb-monitor-user
type: USER

View file

@ -0,0 +1,19 @@
---
- name: setup lb monitor
register: result
check_mode: "{{ check_mode }}"
delegate_to: localhost
netscaler_lb_monitor:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
monitorname: lb-monitor-user
type: USER
scriptname: myscript.sh
scriptargs: argument1 argument2
dispatcherip: 10.10.10.10
dispatcherport: 22

View file

@ -0,0 +1,513 @@
# Copyright (c) 2017 Citrix Systems
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
from ansible.compat.tests.mock import patch, Mock, MagicMock, call
from .netscaler_module import TestModule, nitro_base_patcher, set_module_args
import sys
if sys.version_info[:2] != (2, 6):
import requests
class TestNetscalerLBVServerModule(TestModule):
@classmethod
def setUpClass(cls):
class MockException(Exception):
pass
cls.MockException = MockException
m = MagicMock()
nssrc_modules_mock = {
'nssrc.com.citrix.netscaler.nitro.resource.config.lb': m,
'nssrc.com.citrix.netscaler.nitro.resource.config.lb.lbmonitor': m,
'nssrc.com.citrix.netscaler.nitro.resource.config.lb.lbmonitor.lbvmonitor': m,
}
cls.nitro_specific_patcher = patch.dict(sys.modules, nssrc_modules_mock)
cls.nitro_base_patcher = nitro_base_patcher
@classmethod
def tearDownClass(cls):
cls.nitro_base_patcher.stop()
cls.nitro_specific_patcher.stop()
def setUp(self):
self.nitro_base_patcher.start()
self.nitro_specific_patcher.start()
# Setup minimal required arguments to pass AnsibleModule argument parsing
def tearDown(self):
self.nitro_base_patcher.stop()
self.nitro_specific_patcher.stop()
def test_graceful_nitro_api_import_error(self):
# Stop nitro api patching to cause ImportError
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='present',
))
self.nitro_base_patcher.stop()
self.nitro_specific_patcher.stop()
from ansible.modules.network.netscaler import netscaler_lb_monitor
self.module = netscaler_lb_monitor
result = self.failed()
self.assertEqual(result['msg'], 'Could not load nitro python sdk')
def test_graceful_nitro_error_on_login(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='present',
))
from ansible.modules.network.netscaler import netscaler_lb_monitor
class MockException(Exception):
def __init__(self, *args, **kwargs):
self.errorcode = 0
self.message = ''
client_mock = Mock()
client_mock.login = Mock(side_effect=MockException)
m = Mock(return_value=client_mock)
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_lb_monitor',
get_nitro_client=m,
nitro_exception=MockException,
):
self.module = netscaler_lb_monitor
result = self.failed()
self.assertTrue(result['msg'].startswith('nitro exception'), msg='nitro exception during login not handled properly')
def test_graceful_no_connection_error(self):
if sys.version_info[:2] == (2, 6):
self.skipTest('requests library not available under python2.6')
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='present',
))
from ansible.modules.network.netscaler import netscaler_lb_monitor
client_mock = Mock()
attrs = {'login.side_effect': requests.exceptions.ConnectionError}
client_mock.configure_mock(**attrs)
m = Mock(return_value=client_mock)
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_lb_monitor',
get_nitro_client=m,
nitro_exception=self.MockException,
):
self.module = netscaler_lb_monitor
result = self.failed()
self.assertTrue(result['msg'].startswith('Connection error'), msg='Connection error was not handled gracefully')
def test_graceful_login_error(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='present',
))
from ansible.modules.network.netscaler import netscaler_lb_monitor
if sys.version_info[:2] == (2, 6):
self.skipTest('requests library not available under python2.6')
client_mock = Mock()
attrs = {'login.side_effect': requests.exceptions.SSLError}
client_mock.configure_mock(**attrs)
m = Mock(return_value=client_mock)
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_lb_monitor',
get_nitro_client=m,
nitro_exception=self.MockException,
):
self.module = netscaler_lb_monitor
result = self.failed()
self.assertTrue(result['msg'].startswith('SSL Error'), msg='SSL Error was not handled gracefully')
def test_save_config_called_on_state_present(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='present',
))
from ansible.modules.network.netscaler import netscaler_lb_monitor
client_mock = Mock()
m = Mock(return_value=client_mock)
lb_monitor_proxy_mock = Mock(diff_object=Mock(return_value={}))
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_lb_monitor',
get_nitro_client=m,
lbmonitor_exists=Mock(side_effect=[False, True]),
ConfigProxy=Mock(return_value=lb_monitor_proxy_mock),
ensure_feature_is_enabled=Mock(return_value=True),
):
self.module = netscaler_lb_monitor
self.exited()
self.assertIn(call.save_config(), client_mock.mock_calls)
def test_save_config_called_on_state_absent(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='absent',
))
from ansible.modules.network.netscaler import netscaler_lb_monitor
client_mock = Mock()
m = Mock(return_value=client_mock)
lb_monitor_proxy_mock = Mock(diff_object=Mock(return_value={}))
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_lb_monitor',
get_nitro_client=m,
lbmonitor_exists=Mock(side_effect=[True, False]),
ConfigProxy=Mock(return_value=lb_monitor_proxy_mock),
ensure_feature_is_enabled=Mock(return_value=True),
):
self.module = netscaler_lb_monitor
self.exited()
self.assertIn(call.save_config(), client_mock.mock_calls)
def test_save_config_not_called_on_state_present(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='present',
save_config=False,
))
from ansible.modules.network.netscaler import netscaler_lb_monitor
client_mock = Mock()
m = Mock(return_value=client_mock)
lb_monitor_proxy_mock = Mock(diff_object=Mock(return_value={}))
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_lb_monitor',
get_nitro_client=m,
lbmonitor_exists=Mock(side_effect=[False, True]),
ConfigProxy=Mock(return_value=lb_monitor_proxy_mock),
ensure_feature_is_enabled=Mock(return_value=True),
):
self.module = netscaler_lb_monitor
self.exited()
self.assertNotIn(call.save_config(), client_mock.mock_calls)
def test_save_config_not_called_on_state_absent(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='absent',
save_config=False,
))
from ansible.modules.network.netscaler import netscaler_lb_monitor
client_mock = Mock()
m = Mock(return_value=client_mock)
lb_monitor_proxy_mock = Mock(diff_object=Mock(return_value={}))
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_lb_monitor',
get_nitro_client=m,
lbmonitor_exists=Mock(side_effect=[True, False]),
ConfigProxy=Mock(return_value=lb_monitor_proxy_mock),
ensure_feature_is_enabled=Mock(return_value=True),
):
self.module = netscaler_lb_monitor
self.exited()
self.assertNotIn(call.save_config(), client_mock.mock_calls)
def test_ensure_feature_is_enabled_called(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='present',
save_config=False,
))
from ansible.modules.network.netscaler import netscaler_lb_monitor
client_mock = Mock()
lb_monitor_proxy_mock = Mock(diff_object=Mock(return_value={}))
feature_mock = Mock()
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_lb_monitor',
get_nitro_client=Mock(return_value=client_mock),
lbmonitor_exists=Mock(side_effect=[True, True]),
lbmonitor_identical=Mock(side_effect=[True, True]),
ConfigProxy=Mock(return_value=lb_monitor_proxy_mock),
ensure_feature_is_enabled=feature_mock,
):
self.module = netscaler_lb_monitor
self.exited()
feature_mock.assert_called_with(client_mock, 'LB')
def test_ensure_feature_is_enabled_nitro_exception_caught(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='present',
save_config=False,
))
from ansible.modules.network.netscaler import netscaler_lb_monitor
client_mock = Mock()
lb_monitor_proxy_mock = Mock(diff_object=Mock(return_value={}))
errorcode = 10
message = 'mock error'
class MockException(Exception):
def __init__(self):
self.errorcode = errorcode
self.message = message
feature_mock = Mock(side_effect=MockException)
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_lb_monitor',
get_nitro_client=Mock(return_value=client_mock),
lbmonitor_exists=Mock(side_effect=[True, True]),
lbmonitor_identical=Mock(side_effect=[True, True]),
ConfigProxy=Mock(return_value=lb_monitor_proxy_mock),
ensure_feature_is_enabled=feature_mock,
nitro_exception=MockException,
):
self.module = netscaler_lb_monitor
result = self.failed()
expected_msg = 'nitro exception errorcode=%s, message=%s' % (errorcode, message)
self.assertEqual(result['msg'], expected_msg, 'Failed to handle nitro exception')
def test_create_new_lb_monitor_workflow(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='present',
save_config=False,
))
from ansible.modules.network.netscaler import netscaler_lb_monitor
lb_monitor_proxy_mock = Mock(diff_object=Mock(return_value={}))
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_lb_monitor',
get_nitro_client=Mock(return_value=Mock()),
lbmonitor_exists=Mock(side_effect=[False, True]),
lbmonitor_identical=Mock(side_effect=[True]),
ConfigProxy=Mock(return_value=lb_monitor_proxy_mock),
ensure_feature_is_enabled=Mock(return_value=True),
):
self.module = netscaler_lb_monitor
result = self.exited()
lb_monitor_proxy_mock.assert_has_calls([call.add()])
self.assertTrue(result['changed'])
def test_update_lb_monitor_workflow(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='present',
save_config=False,
))
from ansible.modules.network.netscaler import netscaler_lb_monitor
lb_monitor_proxy_mock = Mock(diff_object=Mock(return_value={}))
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_lb_monitor',
get_nitro_client=Mock(return_value=Mock()),
lbmonitor_exists=Mock(side_effect=[True, True]),
lbmonitor_identical=Mock(side_effect=[False, True]),
ConfigProxy=Mock(return_value=lb_monitor_proxy_mock),
ensure_feature_is_enabled=Mock(return_value=True),
get_immutables_intersection=Mock(return_value=[]),
diff_list=Mock(return_value={}),
):
self.module = netscaler_lb_monitor
result = self.exited()
lb_monitor_proxy_mock.assert_has_calls([call.update()])
self.assertTrue(result['changed'])
def test_lb_monitor_exists_sanity_check(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='present',
))
from ansible.modules.network.netscaler import netscaler_lb_monitor
lb_monitor_proxy_mock = Mock(diff_object=Mock(return_value={}))
client_mock = Mock()
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_lb_monitor',
get_nitro_client=Mock(return_value=client_mock),
lbmonitor_exists=Mock(side_effect=[False, False]),
lbmonitor_identical=Mock(side_effect=[False, True]),
ConfigProxy=Mock(return_value=lb_monitor_proxy_mock),
ensure_feature_is_enabled=Mock(return_value=True),
nitro_exception=self.MockException,
):
self.module = netscaler_lb_monitor
result = self.failed()
self.assertEqual(result['msg'], 'lb monitor does not exist')
def test_lb_monitor_identical_sanity_check(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='present',
))
from ansible.modules.network.netscaler import netscaler_lb_monitor
lb_monitor_proxy_mock = Mock(diff_object=Mock(return_value={}))
client_mock = Mock()
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_lb_monitor',
get_nitro_client=Mock(return_value=client_mock),
lbmonitor_exists=Mock(side_effect=[True, True]),
lbmonitor_identical=Mock(side_effect=[False, False]),
ConfigProxy=Mock(return_value=lb_monitor_proxy_mock),
ensure_feature_is_enabled=Mock(return_value=True),
get_immutables_intersection=(Mock(return_value=[])),
nitro_exception=self.MockException,
diff_list=Mock(return_value={}),
):
self.module = netscaler_lb_monitor
result = self.failed()
self.assertEqual(result['msg'], 'lb monitor is not configured correctly')
def test_absent_state_workflow(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='absent',
))
from ansible.modules.network.netscaler import netscaler_lb_monitor
lb_monitor_proxy_mock = Mock(diff_object=Mock(return_value={}))
client_mock = Mock()
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_lb_monitor',
get_nitro_client=Mock(return_value=client_mock),
ConfigProxy=Mock(return_value=lb_monitor_proxy_mock),
ensure_feature_is_enabled=Mock(return_value=True),
lbmonitor_exists=Mock(side_effect=[True, False]),
):
self.module = netscaler_lb_monitor
result = self.exited()
lb_monitor_proxy_mock.assert_has_calls([call.delete()])
self.assertTrue(result['changed'])
def test_absent_state_sanity_check(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='absent',
))
from ansible.modules.network.netscaler import netscaler_lb_monitor
lb_monitor_proxy_mock = Mock(diff_object=Mock(return_value={}))
client_mock = Mock()
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_lb_monitor',
get_nitro_client=Mock(return_value=client_mock),
ConfigProxy=Mock(return_value=lb_monitor_proxy_mock),
ensure_feature_is_enabled=Mock(return_value=True),
lbmonitor_exists=Mock(side_effect=[True, True]),
nitro_exception=self.MockException,
):
self.module = netscaler_lb_monitor
result = self.failed()
lb_monitor_proxy_mock.assert_has_calls([call.delete()])
self.assertEqual(result['msg'], 'lb monitor still exists')
def test_get_immutables_failure(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='present',
))
from ansible.modules.network.netscaler import netscaler_lb_monitor
lb_monitor_proxy_mock = Mock(diff_object=Mock(return_value={}))
client_mock = Mock()
m = Mock(return_value=['some'])
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_lb_monitor',
get_nitro_client=Mock(return_value=client_mock),
ConfigProxy=Mock(return_value=lb_monitor_proxy_mock),
ensure_feature_is_enabled=Mock(),
lbmonitor_exists=Mock(side_effect=[True, True]),
lbmonitor_identical=Mock(side_effect=[False, True]),
get_immutables_intersection=m,
diff_list=Mock(return_value={}),
nitro_exception=self.MockException,
):
self.module = netscaler_lb_monitor
result = self.failed()
self.assertTrue(
result['msg'].startswith('Cannot update immutable attributes'),
msg='Did not handle immutables error correctly',
)