Skip to content

Commit

Permalink
add ssh_key, network, network_offering
Browse files Browse the repository at this point in the history
  • Loading branch information
resmo committed Nov 24, 2024
1 parent 4e20691 commit 1f14a5c
Show file tree
Hide file tree
Showing 10 changed files with 1,091 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/integration/targets/network/aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cloud/cs
cs/group1
cs/group3
3 changes: 3 additions & 0 deletions tests/integration/targets/network/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
dependencies:
- cs_common
3 changes: 3 additions & 0 deletions tests/integration/targets/network/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---

- include_tasks: vpc_network_tier.yml
299 changes: 299 additions & 0 deletions tests/integration/targets/network/tasks/vpc_network_tier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,299 @@
---
- name: setup cleanup vpc network tier
ngine_io.cloudstack.network:
name: vpc tier 1
zone: "{{ cs_common_zone_adv }}"
vpc: vpc_network_test
state: absent
ignore_errors: true

- name: setup cleanup existing vpc
ngine_io.cloudstack.vpc:
name: vpc_network_test
zone: "{{ cs_common_zone_adv }}"
state: absent
register: vpc
- name: verify cleanup existing vpc
assert:
that:
- vpc is successful

- name: setup vpc
ngine_io.cloudstack.vpc:
name: vpc_network_test
cidr: 10.43.0.0/16
zone: "{{ cs_common_zone_adv }}"
vpc_offering: Redundant VPC offering
network_domain: cs2sandbox.simulator.example.com
register: vpc
- name: verify setup vpc
assert:
that:
- vpc is successful

- name: setup network acl
ngine_io.cloudstack.network_acl:
name: my_network_acl1
vpc: vpc_network_test
zone: "{{ cs_common_zone_adv }}"
register: acl
- name: verify setup network acl
assert:
that:
- acl is successful

- name: setup network acl rule
ngine_io.cloudstack.network_acl_rule:
network_acl: my_network_acl1
rule_position: 1
vpc: vpc_network_test
traffic_type: ingress
action_policy: allow
port: 80
cidr: 0.0.0.0/0
zone: "{{ cs_common_zone_adv }}"
register: acl_rule
- name: verify setup network acl rule
assert:
that:
- acl_rule is successful

- name: setup vpc network tier
ngine_io.cloudstack.network:
name: vpc tier 1
zone: "{{ cs_common_zone_adv }}"
vpc: vpc_network_test
state: absent
register: network
- name: verify setup vpc network tier
assert:
that:
- network is successful

- name: test fail vpc network tier if vpc not given
ngine_io.cloudstack.network:
name: vpc tier 1
zone: "{{ cs_common_zone_adv }}"
network_domain: cs2sandbox.simulator.example.com
network_offering: DefaultIsolatedNetworkOfferingForVpcNetworks
gateway: 10.43.0.1
netmask: 255.255.255.0
acl: my_network_acl1
check_mode: true
register: network
ignore_errors: true
- name: verify test fail vpc network tier if vpc not given
assert:
that:
- network is failed
- "network.msg == 'Missing required params: vpc'"

- name: test create a vpc network tier in check mode
ngine_io.cloudstack.network:
name: vpc tier 1
zone: "{{ cs_common_zone_adv }}"
network_domain: cs2sandbox.simulator.example.com
vpc: vpc_network_test
network_offering: DefaultIsolatedNetworkOfferingForVpcNetworks
gateway: 10.43.0.1
netmask: 255.255.255.0
check_mode: true
register: network
- name: verify test create a vpc network tier in check mode
assert:
that:
- network is changed

- name: test create a vpc network tier
ngine_io.cloudstack.network:
name: vpc tier 1
zone: "{{ cs_common_zone_adv }}"
network_domain: cs2sandbox.simulator.example.com
vpc: vpc_network_test
network_offering: DefaultIsolatedNetworkOfferingForVpcNetworks
gateway: 10.43.0.1
netmask: 255.255.255.0
register: network
- name: verify test create a vpc network tier
assert:
that:
- network is changed
- network.acl_type == 'Account'
- not network.acl
- network.broadcast_domain_type == 'Vlan'
- network.cidr == '10.43.0.0/24'
- network.gateway == '10.43.0.1'
- network.display_text == 'vpc tier 1'
- network.network_offering == 'DefaultIsolatedNetworkOfferingForVpcNetworks'
- network.vpc == 'vpc_network_test'
- network.network_domain == 'cs2sandbox.simulator.example.com'

- name: test create a vpc network tier idempotence
ngine_io.cloudstack.network:
name: vpc tier 1
zone: "{{ cs_common_zone_adv }}"
network_domain: cs2sandbox.simulator.example.com
vpc: vpc_network_test
network_offering: DefaultIsolatedNetworkOfferingForVpcNetworks
gateway: 10.43.0.1
netmask: 255.255.255.0
register: network
- name: verify test create a vpc network tier idempotence
assert:
that:
- network is not changed
- network.acl_type == 'Account'
- not network.acl
- network.broadcast_domain_type == 'Vlan'
- network.cidr == '10.43.0.0/24'
- network.gateway == '10.43.0.1'
- network.display_text == 'vpc tier 1'
- network.network_offering == 'DefaultIsolatedNetworkOfferingForVpcNetworks'
- network.vpc == 'vpc_network_test'
- network.network_domain == 'cs2sandbox.simulator.example.com'

- name: test update a vpc network tier in check mode
ngine_io.cloudstack.network:
name: vpc tier 1
display_text: vpc tier 1 description
zone: "{{ cs_common_zone_adv }}"
network_domain: cs2sandbox.simulator.example.com
vpc: vpc_network_test
network_offering: DefaultIsolatedNetworkOfferingForVpcNetworks
gateway: 10.43.0.1
netmask: 255.255.255.0
acl: my_network_acl1
check_mode: true
register: network
- name: verify test update a vpc network tier in check mode
assert:
that:
- network is changed
- network.acl_type == 'Account'
- network.acl == 'my_network_acl1'
- network.broadcast_domain_type == 'Vlan'
- network.cidr == '10.43.0.0/24'
- network.gateway == '10.43.0.1'
- network.display_text == 'vpc tier 1'
- network.network_offering == 'DefaultIsolatedNetworkOfferingForVpcNetworks'
- network.vpc == 'vpc_network_test'
- network.network_domain == 'cs2sandbox.simulator.example.com'

- name: test update a vpc network tier
ngine_io.cloudstack.network:
name: vpc tier 1
display_text: vpc tier 1 description
zone: "{{ cs_common_zone_adv }}"
network_domain: cs2sandbox.simulator.example.com
vpc: vpc_network_test
network_offering: DefaultIsolatedNetworkOfferingForVpcNetworks
gateway: 10.43.0.1
netmask: 255.255.255.0
acl: my_network_acl1
register: network
- name: verify test update a vpc network tier
assert:
that:
- network is changed
- network.acl_type == 'Account'
- network.acl == 'my_network_acl1'
- network.broadcast_domain_type == 'Vlan'
- network.cidr == '10.43.0.0/24'
- network.gateway == '10.43.0.1'
- network.display_text == 'vpc tier 1 description'
- network.network_offering == 'DefaultIsolatedNetworkOfferingForVpcNetworks'
- network.vpc == 'vpc_network_test'
- network.network_domain == 'cs2sandbox.simulator.example.com'

- name: test update a vpc network tier idempotence
ngine_io.cloudstack.network:
name: vpc tier 1
display_text: vpc tier 1 description
zone: "{{ cs_common_zone_adv }}"
network_domain: cs2sandbox.simulator.example.com
vpc: vpc_network_test
network_offering: DefaultIsolatedNetworkOfferingForVpcNetworks
gateway: 10.43.0.1
netmask: 255.255.255.0
acl: my_network_acl1
register: network
- name: verify test update a vpc network tier idempotence
assert:
that:
- network is not changed
- network.acl_type == 'Account'
- network.acl == 'my_network_acl1'
- network.broadcast_domain_type == 'Vlan'
- network.cidr == '10.43.0.0/24'
- network.gateway == '10.43.0.1'
- network.display_text == 'vpc tier 1 description'
- network.network_offering == 'DefaultIsolatedNetworkOfferingForVpcNetworks'
- network.vpc == 'vpc_network_test'
- network.network_domain == 'cs2sandbox.simulator.example.com'

- name: test absent a vpc network tier in check mode
ngine_io.cloudstack.network:
name: vpc tier 1
zone: "{{ cs_common_zone_adv }}"
vpc: vpc_network_test
state: absent
register: network
check_mode: true
- name: verify test absent a vpc network tier in check mode
assert:
that:
- network is changed
- network.acl_type == 'Account'
- network.acl == 'my_network_acl1'
- network.broadcast_domain_type == 'Vlan'
- network.cidr == '10.43.0.0/24'
- network.gateway == '10.43.0.1'
- network.display_text == 'vpc tier 1 description'
- network.network_offering == 'DefaultIsolatedNetworkOfferingForVpcNetworks'
- network.vpc == 'vpc_network_test'
- network.network_domain == 'cs2sandbox.simulator.example.com'

- name: test absent a vpc network tier
ngine_io.cloudstack.network:
name: vpc tier 1
zone: "{{ cs_common_zone_adv }}"
vpc: vpc_network_test
state: absent
register: network
- name: verify test absent a vpc network tier
assert:
that:
- network is changed
- network.acl_type == 'Account'
- network.acl == 'my_network_acl1'
- network.broadcast_domain_type == 'Vlan'
- network.cidr == '10.43.0.0/24'
- network.gateway == '10.43.0.1'
- network.display_text == 'vpc tier 1 description'
- network.network_offering == 'DefaultIsolatedNetworkOfferingForVpcNetworks'
- network.vpc == 'vpc_network_test'
- network.network_domain == 'cs2sandbox.simulator.example.com'

- name: test absent a vpc network tier idempotence
ngine_io.cloudstack.network:
name: vpc tier 1
zone: "{{ cs_common_zone_adv }}"
vpc: vpc_network_test
state: absent
register: network
- name: verify test absent a vpc network tier idempotence
assert:
that:
- network is not changed

- name: cleanup vpc
ngine_io.cloudstack.vpc:
name: vpc_network_test
cidr: 10.43.0.0/16
zone: "{{ cs_common_zone_adv }}"
state: absent
register: vpc
- name: verify cleanup vpc
assert:
that:
- vpc is successful
3 changes: 3 additions & 0 deletions tests/integration/targets/network_offering/aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cloud/cs
cs/group1
cs/group3
3 changes: 3 additions & 0 deletions tests/integration/targets/network_offering/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
dependencies:
- cs_common
Loading

0 comments on commit 1f14a5c

Please sign in to comment.