1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

aci_static_binding_to_epg: Add description parameter (#42244)

* aci_static_binding_to_epg: Add description parameter

This PR adds the description parameter to this module.

Tis fixes #42154

* Fix added_version
This commit is contained in:
Dag Wieers 2018-07-05 18:01:28 +02:00 committed by GitHub
parent 30688fecf3
commit b90ae65e5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 22 deletions

View file

@ -38,6 +38,11 @@ options:
description:
- The name of the end point group.
aliases: [ epg_name ]
description:
description:
- Description for the static path to EPG binding.
aliases: [ descr ]
version_added: '2.7'
encap_id:
description:
- The encapsulation ID associating the C(epg) with the interface path.
@ -263,6 +268,7 @@ def main():
tenant=dict(type='str', aliases=['tenant_name']), # Not required for querying all objects
ap=dict(type='str', aliases=['app_profile', 'app_profile_name']), # Not required for querying all objects
epg=dict(type='str', aliases=['epg_name']), # Not required for querying all objects
description=dict(type='str', aliases=['descr']),
encap_id=dict(type='int', aliases=['vlan', 'vlan_id']),
primary_encap_id=dict(type='int', aliases=['primary_vlan', 'primary_vlan_id']),
deploy_immediacy=dict(type='str', choices=['immediate', 'lazy']),
@ -289,6 +295,7 @@ def main():
tenant = module.params['tenant']
ap = module.params['ap']
epg = module.params['epg']
description = module.params['description']
encap_id = module.params['encap_id']
primary_encap_id = module.params['primary_encap_id']
deploy_immediacy = module.params['deploy_immediacy']
@ -383,6 +390,7 @@ def main():
aci.payload(
aci_class='fvRsPathAtt',
class_config=dict(
descr=description,
encap=encap_id,
primaryEncap=primary_encap_id,
instrImedcy=deploy_immediacy,

View file

@ -8,7 +8,7 @@
msg: 'Please define the following variables: aci_hostname, aci_username and aci_password.'
when: aci_hostname is not defined or aci_username is not defined or aci_password is not defined
- name: ensure static path to epg is deleted for test kick off
- name: Ensure static path to epg is deleted for test kick off
aci_static_binding_to_epg: &aci_static_binding_to_epg_absent
host: '{{ aci_hostname }}'
username: '{{ aci_username }}'
@ -26,7 +26,7 @@
interface: '1/7'
state: absent
- name: ensure tenant exists for tests to kick off
- name: Ensure tenant exists for tests to kick off
aci_tenant: &aci_tenant_present
host: "{{ aci_hostname }}"
username: "{{ aci_username }}"
@ -35,23 +35,23 @@
use_ssl: '{{ aci_use_ssl | default(true) }}'
use_proxy: '{{ aci_use_proxy | default(true) }}'
output_level: debug
state: present
tenant: anstest
state: present
register: tenant_present
- name: ensure ap exists
- name: Ensure ap exists
aci_ap: &aci_ap_present
<<: *aci_tenant_present
ap: anstest
register: ap_present
- name: ensure epg exists
- name: Ensure epg exists
aci_epg: &aci_epg_present
<<: *aci_ap_present
epg: anstest
register: epg_present
- name: bind static-binding to epg - check mode works
- name: Bind static-binding to epg - check mode works
aci_static_binding_to_epg: &aci_static_binding_to_epg_present
<<: *aci_epg_present
encap_id: 222
@ -64,30 +64,54 @@
check_mode: yes
register: provide_present_check_mode
- name: bind static-binding to epg - provide works (creation w/o check-mode)
- name: Bind static-binding to epg - provide works (creation w/o check-mode)
aci_static_binding_to_epg:
<<: *aci_static_binding_to_epg_present
ignore_errors: yes
register: provide_present
- name: bind static-binding to epg - primary_encap_id works
- name: Bind static-binding to epg - primary_encap_id works
aci_static_binding_to_epg: &primary_encap_id_present
<<: *aci_static_binding_to_epg_present
primary_encap_id: 50
register: primary_ecap_id_present
- name: bind contract to epg - idempotency works again
- name: Bind contract to epg - idempotency works again
aci_static_binding_to_epg:
<<: *primary_encap_id_present
register: idempotent_present
- name: missing required param - failure message works
- name: Bind contract to epg - update description (check mode)
aci_static_binding_to_epg:
<<: *primary_encap_id_present
description: Binding description
register: description_cm
- name: Bind contract to epg - update description (run mode)
aci_static_binding_to_epg:
<<: *primary_encap_id_present
description: Binding description
register: description
- name: Bind contract to epg - update description (check mode)
aci_static_binding_to_epg:
<<: *primary_encap_id_present
description: Binding description
register: idempotent_description_cm
- name: Bind contract to epg - update description (run mode)
aci_static_binding_to_epg:
<<: *primary_encap_id_present
description: Binding description
register: idempotent_description
- name: Missing required param - failure message works
aci_static_binding_to_epg:
<<: *aci_tenant_present
ignore_errors: yes
register: missing_required_present
- name: present assertions
- name: Present assertions
assert:
that:
- provide_present_check_mode.changed == true
@ -97,25 +121,29 @@
- provide_present.previous == []
- primary_ecap_id_present.changed == true
- 'primary_ecap_id_present.sent == {"fvRsPathAtt": {"attributes": {"primaryEncap": "vlan-50"}}}'
- description_cm.changed == true
- description.changed == true
- idempotent_description_cm.changed == false
- idempotent_description.changed == false
- missing_required_present.failed == true
- 'missing_required_present.msg == "missing required arguments: interface_type"'
- missing_required_present.failed == true
- name: get binding
- name: Get binding
aci_static_binding_to_epg:
<<: *primary_encap_id_present
state: query
register: query_static_binding
- name: missing required param - failure message works
- name: Missing required param - failure message works
aci_static_binding_to_epg:
<<: *aci_tenant_present
state: query
ignore_errors: yes
register: missing_required_query
- name: query assertions
- name: Query assertions
assert:
that:
- query_static_binding.changed == false
@ -128,26 +156,26 @@
- 'missing_required_query.msg == "missing required arguments: interface_type"'
- name: delete provide binding - deletion works
- name: Delete provide binding - deletion works
aci_static_binding_to_epg:
<<: *primary_encap_id_present
state: absent
register: provide_absent
- name: delete provide binding - idempotency works
- name: Delete provide binding - idempotency works
aci_static_binding_to_epg:
<<: *primary_encap_id_present
state: absent
register: provide_absent_idempotent
- name: missing param - failure message works
- name: Missing param - failure message works
aci_static_binding_to_epg:
<<: *aci_tenant_present
state: absent
ignore_errors: yes
register: missing_param_absent
- name: absent assertions
- name: Absent assertions
assert:
that:
- provide_absent.changed == true
@ -158,21 +186,21 @@
- missing_param_absent.failed == true
- 'missing_param_absent.msg == "missing required arguments: interface_type"'
- name: cleanup binding
- name: Cleanup binding
aci_static_binding_to_epg:
<<: *aci_static_binding_to_epg_absent
- name: cleanup epg
- name: Cleanup epg
aci_epg:
<<: *aci_epg_present
state: absent
- name: cleanup ap
- name: Cleanup ap
aci_ap:
<<: *aci_ap_present
state: absent
- name: cleanup tenant
- name: Cleanup tenant
aci_tenant:
<<: *aci_tenant_present
state: absent