
    Vh4                     v    d dl mZmZmZ eZddgddZdZdZdZ	d d	l
mZ d d
lmZmZmZ d Zedk(  r e        yy)    )absolute_importdivisionprint_functionz1.1preview	certified)metadata_versionstatussupported_byaS  
---
module: aci_epg
short_description: Manage End Point Groups (EPG) objects (fv:AEPg)
description:
- Manage End Point Groups (EPG) on Cisco ACI fabrics.
options:
  tenant:
    description:
    - Name of an existing tenant.
    type: str
    aliases: [ tenant_name ]
  ap:
    description:
    - Name of an existing application network profile, that will contain the EPGs.
    type: str
    aliases: [ app_profile, app_profile_name ]
  epg:
    description:
    - Name of the end point group.
    type: str
    aliases: [ epg_name, name ]
  bd:
    description:
    - Name of the bridge domain being associated with the EPG.
    type: str
    aliases: [ bd_name, bridge_domain ]
  priority:
    description:
    - The QoS class.
    - The APIC defaults to C(unspecified) when unset during creation.
    type: str
    choices: [ level1, level2, level3, unspecified ]
  intra_epg_isolation:
    description:
    - The Intra EPG Isolation.
    - The APIC defaults to C(unenforced) when unset during creation.
    type: str
    choices: [ enforced, unenforced ]
  description:
    description:
    - Description for the EPG.
    type: str
    aliases: [ descr ]
  fwd_control:
    description:
    - The forwarding control used by the EPG.
    - The APIC defaults to C(none) when unset during creation.
    type: str
    choices: [ none, proxy-arp ]
  preferred_group:
    description:
    - Whether or not the EPG is part of the Preferred Group and can communicate without contracts.
    - This is very convenient for migration scenarios, or when ACI is used for network automation but not for policy.
    - The APIC defaults to C(false) when unset during creation.
    type: bool
  monitoring_policy:
    description:
    - The name of the monitoring policy.
    type: str
  custom_qos_policy:
    description:
    - The name of the custom Quality of Service policy.
    type: str
  useg:
    description:
    - Use C(yes) to create uSeg EPG and C(no) is used to create Application EPG.
    type: str
    choices: [ 'yes', 'no' ]
  match:
    description:
    - The match type of the default Block Statement (fv:Crtrn).
    - The APIC defaults to C(any) when unset during creation.
    type: str
    choices: [ any, all ]
  precedence:
    description:
    - The Block Statement(fv:Crtrn) Precedence to resolve equal matches between micro segmented EPGs.
    - The APIC defaults to C(0) when unset during creation.
    type: int
  state:
    description:
    - Use C(present) or C(absent) for adding or removing.
    - Use C(query) for listing an object or multiple objects.
    type: str
    choices: [ absent, present, query ]
    default: present
  name_alias:
    description:
    - The alias for the current object. This relates to the nameAlias field in ACI.
    type: str
extends_documentation_fragment:
- cisco.aci.aci
- cisco.aci.annotation

notes:
- The C(tenant) and C(app_profile) used must exist before using this module in your playbook.
  The M(cisco.aci.aci_tenant) and M(cisco.aci.aci_ap) modules can be used for this.
seealso:
- module: cisco.aci.aci_tenant
- module: cisco.aci.aci_ap
- name: APIC Management Information Model reference
  description: More information about the internal APIC class B(fv:AEPg).
  link: https://developer.cisco.com/docs/apic-mim-ref/
author:
- Swetha Chunduri (@schunduri)
- Shreyas Srish (@shrsr)
- Christian Kolrep (@Christian-Kolrep)
- Akini Ross (@akinross)
a  
- name: Add a new EPG
  cisco.aci.aci_epg:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    ap: intranet
    epg: web_epg
    description: Web Intranet EPG
    bd: prod_bd
    monitoring_policy: default
    preferred_group: true
    state: present
  delegate_to: localhost

- name: Add a new uSeg EPG
  cisco.aci.aci_epg:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    ap: intranet
    epg: web_epg
    description: Web Intranet EPG
    bd: prod_bd
    monitoring_policy: default
    preferred_group: true
    useg: 'yes'
    state: present
  delegate_to: localhost

- name: Add a uSeg EPG with block statement match and precedence
  cisco.aci.aci_epg:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    ap: intranet
    epg: web_epg
    description: Web Intranet EPG
    bd: prod_bd
    monitoring_policy: default
    preferred_group: true
    useg: 'yes'
    match: all
    precedence: 1
    state: present
  delegate_to: localhost

- name: Query an EPG
  cisco.aci.aci_epg:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    ap: ticketing
    epg: web_epg
    state: query
  delegate_to: localhost
  register: query_result

- name: Query all EPGs
  cisco.aci.aci_epg:
    host: apic
    username: admin
    password: SomeSecretPassword
    state: query
  delegate_to: localhost
  register: query_result

- name: Query all EPGs with a Specific Name
  cisco.aci.aci_epg:
    host: apic
    username: admin
    password: SomeSecretPassword
    validate_certs: false
    epg: web_epg
    state: query
  delegate_to: localhost
  register: query_result

- name: Query all EPGs of an App Profile
  cisco.aci.aci_epg:
    host: apic
    username: admin
    password: SomeSecretPassword
    validate_certs: false
    ap: ticketing
    state: query
  delegate_to: localhost
  register: query_result

- name: Remove an EPG
  cisco.aci.aci_epg:
    host: apic
    username: admin
    password: SomeSecretPassword
    validate_certs: false
    tenant: production
    app_profile: intranet
    epg: web_epg
    monitoring_policy: default
    state: absent
  delegate_to: localhost
a
  
current:
  description: The existing configuration from the APIC after the module has finished
  returned: success
  type: list
  sample:
    [
        {
            "fvTenant": {
                "attributes": {
                    "descr": "Production environment",
                    "dn": "uni/tn-production",
                    "name": "production",
                    "nameAlias": "",
                    "ownerKey": "",
                    "ownerTag": ""
                }
            }
        }
    ]
error:
  description: The error information as returned from the APIC
  returned: failure
  type: dict
  sample:
    {
        "code": "122",
        "text": "unknown managed object class foo"
    }
raw:
  description: The raw output returned by the APIC REST API (xml or json)
  returned: parse error
  type: str
  sample: '<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"><error code="122" text="unknown managed object class foo"/></imdata>'
sent:
  description: The actual/minimal configuration pushed to the APIC
  returned: info
  type: list
  sample:
    {
        "fvTenant": {
            "attributes": {
                "descr": "Production environment"
            }
        }
    }
previous:
  description: The original configuration from the APIC before the module has started
  returned: info
  type: list
  sample:
    [
        {
            "fvTenant": {
                "attributes": {
                    "descr": "Production",
                    "dn": "uni/tn-production",
                    "name": "production",
                    "nameAlias": "",
                    "ownerKey": "",
                    "ownerTag": ""
                }
            }
        }
    ]
proposed:
  description: The assembled configuration from the user-provided parameters
  returned: info
  type: dict
  sample:
    {
        "fvTenant": {
            "attributes": {
                "descr": "Production environment",
                "name": "production"
            }
        }
    }
filter_string:
  description: The filter string used for the request
  returned: failure or debug
  type: str
  sample: ?rsp-prop-include=config-only
method:
  description: The HTTP method used for the request to the APIC
  returned: failure or debug
  type: str
  sample: POST
response:
  description: The HTTP response from the APIC
  returned: failure or debug
  type: str
  sample: OK (30 bytes)
status:
  description: The HTTP status from the APIC
  returned: failure or debug
  type: int
  sample: 200
url:
  description: The HTTP url used for the request to the APIC
  returned: failure or debug
  type: str
  sample: https://10.11.12.13/api/mo/uni/tn-production.json
)AnsibleModule)	ACIModuleaci_argument_specaci_annotation_specc                  	   t               } | j                  t                      | j                  t        dddg      t        dddg      t        dddg      t        dd	g      t        dd
g      t        dg d      t        ddg      t        dddg      t        d      t        ddg d      t        d      t        d      t        d      t        dddg      t        dddg      t        d             t	        | dddg d gddg d gg!      }t        |      }|j                  j                  d"      }|j                  j                  d#      }|j                  j                  d$      }|j                  j                  d%      }|j                  j                  d&      }|j                  j                  d'      }|j                  |j                  j                  d(      d)d*      }	|j                  j                  d      }
|j                  j                  d+      }|j                  j                  d,      }|j                  j                  d-      }|j                  j                  d.      }|j                  j                  d/      }|j                  j                  d0      }|j                  j                  d1      }|j                  j                  d2      }t        t        t        |3      4      5      t        t        t        |6      4      7      g}|/|j                  t        t        t        |8      4      9             |j                  t        d:d;j                  |      |d|i<      t        d=d>j                  |      |d|i<      t        d?d@j                  |      |d|i<      g dAB       |j                          |
dk(  r|9|j                  r-|j                  dC   d?   dD   dE   |k7  r|j                  dFG       |dk(  r1|j                  t        t        t        dH||I      4      J             |j                  d?t        ||||||	||K      |L       |j!                  d?M       |j#                          n|
dk(  r|j%                          |j'                          y )NNstrepg_namename)typealiasesbd_namebridge_domainapp_profileapp_profile_nametenant_namedescr)level1level2level3unspecified)r   choicesenforced
unenforced)r   nonez	proxy-arpbool)r   present)absentr$   query)r   defaultr   yesnoallanyint)epgbdaptenantdescriptionpriorityintra_epg_isolationfwd_controlpreferred_groupstate
name_aliasmonitoring_policycustom_qos_policyusegmatch
precedenceTr6   r%   )r/   r-   r0   )argument_specsupports_check_moderequired_ifr-   r.   r1   r2   r3   r4   r5   includeexcluder0   r/   r7   r8   r9   r:   r;   r<   )
tnFvBDName)
attributes)fvRsBd)tnMonEPGPolName)fvRsAEPgMonPol)tnQosCustomPolName)fvRsCustQosPolfvTenantztn-{0})	aci_classaci_rnmodule_objecttarget_filterfvApzap-{0}fvAEPgzepg-{0})rD   rF   rH   fvCrtrn)
root_class
subclass_1
subclass_2child_classesr   rC   isAttrBasedEPgz9Changing attribute useg on existing EPG is not supported.)msgr'   )r   r;   prec)rP   )r   r   prio	pcEnfPreffwdCtrl
prefGrMemb	nameAliasrU   )rJ   class_configchild_configs)rJ   )r   updater   dictr   r   paramsgetbooleanappendconstruct_urlformatget_existingexisting	fail_jsonpayloadget_diffpost_configdelete_config	exit_json)r=   moduleacir-   r.   r1   r2   r3   r4   r5   r6   r0   r/   r7   r8   r9   r:   r;   r<   r^   s                       e/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/cisco/aci/plugins/modules/aci_epg.pymainrr   U  sN   %'M,./ej&%9:UY$@AU]4F$GH8egY75*WX *l)CDefk-BC&)y:XYU#E*E*uudm4u~6U#!  & # h 78i!89
F F
C
--

E
"C			4	 B--##M2K}}  ,H --++,AB--##M2Kkk&--"3"34E"F	S\]OMMg&E]]x(F			4	 B""<0J))*=>))*=>==V$DMMg&E""<0J1D!EF\`lp  BS  mT  ]U  IV  WM$TYjAk1lmn ??6* !6*	
 ??2&!2,	
 ##C(!3-	
 P'  , 	a1J<1XYi1jnr1r!\]5=  dd	Y^eo>p.q!rs!-#*$#	 ( 	 	
 	x(	(	MMO    __main__N)
__future__r   r   r   r   __metaclass__ANSIBLE_METADATADOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   6ansible_collections.cisco.aci.plugins.module_utils.acir   r   r   rr   __name__ rs   rq   <module>r      sd    A @(-)Vab m^iVg
R 5 t tk\ zF rs   