ansible/test/integration/targets/cs_router/tasks/main.yml
Matt Clay cf1337ca9a Update ansible-test sanity command. (#31958)
* Use correct pip version in ansible-test.
* Add git fallback for validate-modules.
* Run sanity tests in a docker container.
* Use correct python version for sanity tests.
* Pin docker completion images and add default.
* Split pylint execution into multiple contexts.
* Only test .py files in use-argspec-type-path test.
* Accept identical python interpeter name or binary.
* Switch cloud tests to default container.
* Remove unused extras from pip install.
* Filter out empty pip commands.
* Don't force running of pip list.
* Support delegation for windows and network tests.
* Fix ansible-test python version usage.
* Fix ansible-test python version skipping.
* Use absolute path for log in ansible-test.
* Run vyos_command test on python 3.
* Fix windows/network instance persistence.
* Add `test/cache` dir to classification.
* Enable more python versions for network tests.
* Fix cs_router test.
2017-10-26 00:21:46 -07:00

183 lines
4.5 KiB
YAML

---
- name: setup network
cs_network:
name: "net_router"
zone: "{{ cs_common_zone_adv }}"
network_offering: DefaultSharedNetworkOffering
network_domain: example.com
vlan: 1234
start_ip: 10.100.12.11
end_ip: 10.100.12.250
gateway: 10.100.12.1
netmask: 255.255.255.0
register: net
- name: verify setup network
assert:
that:
- net|success
- net.name == "net_router"
- name: setup instance
cs_instance:
name: "instance-vm"
template: "{{ cs_common_template }}"
service_offering: "{{ cs_common_service_offering }}"
zone: "{{ cs_common_zone_adv }}"
network: "net_router"
state: started
register: instance
- name: verify setup instance
assert:
that:
- instance|success
- instance.name == "instance-vm"
- instance.state == "Running"
- name: setup instance starts a router
cs_instance:
name: "instance-vm"
template: "{{ cs_common_template }}"
service_offering: "{{ cs_common_service_offering }}"
zone: "{{ cs_common_zone_adv }}"
network: "net_router"
state: started
register: instance
- name: verify setup instance
assert:
that:
- instance|success
- instance.name == "instance-vm"
- instance.state == "Running"
- name: setup find the routers name
shell: cs listRouters listall=true networkid="{{ net.id }}" zone="{{ cs_common_zone_adv }}"
args:
chdir: "{{ playbook_dir }}"
register: router
- debug:
var: router.stdout
- set_fact:
router_json: "{{ router.stdout | from_json }}"
- set_fact:
router_name: "{{ router_json.router[0].name }}"
- name: test router started
cs_router:
name: "{{ router_name }}"
zone: "{{ cs_common_zone_adv }}"
state: started
register: router
- name: verify test router started
assert:
that:
- router|success
- name: test stop router in check mode
cs_router:
name: "{{ router_name }}"
zone: "{{ cs_common_zone_adv }}"
state: stopped
check_mode: true
register: router
- name: verify test stop router in check mode
assert:
that:
- router|changed
- router.state == "Running"
- router.service_offering == "System Offering For Software Router"
- name: test stop router
cs_router:
name: "{{ router_name }}"
zone: "{{ cs_common_zone_adv }}"
state: stopped
register: router
- name: verify test stop router
assert:
that:
- router|changed
- router.state == "Stopped"
- router.service_offering == "System Offering For Software Router"
- name: test stop router idempotence
cs_router:
name: "{{ router_name }}"
zone: "{{ cs_common_zone_adv }}"
state: stopped
register: router
- name: verify test stop router idempotence
assert:
that:
- not router|changed
- router.state == "Stopped"
- router.service_offering == "System Offering For Software Router"
- name: test start router in check mode
cs_router:
name: "{{ router_name }}"
zone: "{{ cs_common_zone_adv }}"
state: started
register: router
check_mode: true
- name: verify test start router in check mode
assert:
that:
- router|changed
- router.state == "Stopped"
- router.service_offering == "System Offering For Software Router"
- name: test start router
cs_router:
name: "{{ router_name }}"
zone: "{{ cs_common_zone_adv }}"
state: started
register: router
- name: verify test start router
assert:
that:
- router|changed
- router.state == "Running"
- router.service_offering == "System Offering For Software Router"
- name: test start router idempotence
cs_router:
name: "{{ router_name }}"
zone: "{{ cs_common_zone_adv }}"
state: started
register: router
- name: verify test start router idempotence
assert:
that:
- not router|changed
- router.state == "Running"
- router.service_offering == "System Offering For Software Router"
- name: test restart router in check mode
cs_router:
name: "{{ router_name }}"
zone: "{{ cs_common_zone_adv }}"
state: restarted
register: router
check_mode: true
- name: verify test restart router in check mode
assert:
that:
- router|changed
- router.state == "Running"
- router.service_offering == "System Offering For Software Router"
- name: test restart router
cs_router:
name: "{{ router_name }}"
zone: "{{ cs_common_zone_adv }}"
state: restarted
register: router
- name: verify test restart router
assert:
that:
- router|changed
- router.state == "Running"
- router.service_offering == "System Offering For Software Router"