mirror of https://github.com/ansible/ansible.git
cs_network: implement support acl (#35706)
parent
02b28d4584
commit
588cd749ac
@ -0,0 +1,2 @@
|
||||
cloud/cs
|
||||
posix/ci/cloud/group1/cs
|
@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- cs_common
|
@ -0,0 +1,3 @@
|
||||
---
|
||||
|
||||
- include_tasks: vpc_network_tier.yml
|
@ -0,0 +1,298 @@
|
||||
---
|
||||
- name: setup cleanup vpc network tier
|
||||
cs_network:
|
||||
name: vpc tier 1
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
vpc: vpc_network_test
|
||||
state: absent
|
||||
ignore_errors: yes
|
||||
|
||||
- name: setup cleanup existing vpc
|
||||
cs_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
|
||||
cs_vpc:
|
||||
name: vpc_network_test
|
||||
cidr: 10.43.0.0/16
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
network_domain: cs2sandbox.simulator.example.com
|
||||
register: vpc
|
||||
- name: verify setup vpc
|
||||
assert:
|
||||
that:
|
||||
- vpc is successful
|
||||
|
||||
- name: setup network acl
|
||||
cs_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
|
||||
cs_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
|
||||
cs_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
|
||||
cs_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: yes
|
||||
register: network
|
||||
ignore_errors: yes
|
||||
- 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
|
||||
cs_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: yes
|
||||
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
|
||||
cs_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
|
||||
cs_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
|
||||
cs_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: yes
|
||||
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
|
||||
cs_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
|
||||
cs_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
|
||||
cs_network:
|
||||
name: vpc tier 1
|
||||
zone: "{{ cs_common_zone_adv }}"
|
||||
vpc: vpc_network_test
|
||||
state: absent
|
||||
register: network
|
||||
check_mode: yes
|
||||
- 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
|
||||
cs_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
|
||||
cs_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
|
||||
cs_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
|
Loading…
Reference in New Issue