
    Vh9              	           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mZ  eddddddd      Z edddd      ZddddZd Zedk(  r e        yy)    )absolute_importdivisionprint_functionz1.1preview	certified)metadata_versionstatussupported_bya  
---
module: aci_domain
short_description: Manage physical, virtual, bridged, routed or FC domain profiles (phys:DomP, vmm:DomP, l2ext:DomP, l3ext:DomP, and fc:DomP)
description:
- Manage physical, virtual, bridged, routed or FC domain profiles on Cisco ACI fabrics.
options:
  domain:
    description:
    - Name of the physical, virtual, bridged routed or FC domain profile.
    type: str
    aliases: [ domain_name, domain_profile, name ]
  domain_type:
    description:
    - The type of domain profile.
    - 'C(fc): The FC domain profile is a policy pertaining to single FC Management domain'
    - 'C(l2dom): The external bridged domain profile is a policy for managing L2 bridged infrastructure bridged outside the fabric.'
    - 'C(l3dom): The external routed domain profile is a policy for managing L3 routed infrastructure outside the fabric.'
    - 'C(phys): The physical domain profile stores the physical resources and encap resources that should be used for EPGs associated with this domain.'
    - 'C(vmm): The VMM domain profile is a policy for grouping VM controllers with similar networking policy requirements.'
    type: str
    required: true
    choices: [ fc, l2dom, l3dom, phys, vmm ]
    aliases: [ type ]
  dscp:
    description:
    - The target Differentiated Service (DSCP) value.
    - The APIC defaults to C(unspecified) when unset during creation.
    type: str
    choices: [ AF11, AF12, AF13, AF21, AF22, AF23, AF31, AF32, AF33, AF41, AF42, AF43, CS0, CS1, CS2, CS3, CS4, CS5, CS6, CS7, EF, VA, unspecified ]
    aliases: [ target ]
  encap_mode:
    description:
    - The layer 2 encapsulation protocol to use with the virtual switch.
    type: str
    choices: [ unknown, vlan, vxlan ]
  add_infra_pg:
    description:
    - Configure port groups for infra VLAN (e.g. Virtual APIC).
    type: bool
    aliases: [ infra_pg ]
  tag_collection:
    description:
    - Enables Cisco APIC to collect VMs that have been assigned tags in VMware vCenter for microsegmentation.
    type: bool
  multicast_address:
    description:
    - The multicast IP address to use for the virtual switch.
    type: str
  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
  vm_provider:
    description:
    - The VM platform for VMM Domains.
    - Support for Kubernetes was added in ACI v3.0.
    - Support for CloudFoundry, OpenShift and Red Hat was added in ACI v3.1.
    type: str
    choices: [ cloudfoundry, kubernetes, microsoft, openshift, openstack, redhat, vmware ]
  vswitch:
    description:
    - The virtual switch to use for vmm domains.
    - The APIC defaults to C(default) when unset during creation.
    type: str
    choices: [ avs, default, dvs, unknown ]
  access_mode:
    description:
    - Access mode for vmm domains
    - This parameter cannot be changed after a domain is created
    type: str
    choices: [ read-only, read-write ]
  enable_vm_folder:
    description:
    - Enable VM folder data retrieval
    type: bool
extends_documentation_fragment:
- cisco.aci.aci
- cisco.aci.annotation
- cisco.aci.owner

seealso:
- module: cisco.aci.aci_aep_to_domain
- module: cisco.aci.aci_domain_to_encap_pool
- module: cisco.aci.aci_domain_to_vlan_pool
- name: APIC Management Information Model reference
  description: More information about the internal APIC classes B(phys:DomP),
               B(vmm:DomP), B(l2ext:DomP), B(l3ext:DomP) and B(fc:DomP)
  link: https://developer.cisco.com/docs/apic-mim-ref/
author:
- Dag Wieers (@dagwieers)
a  
- name: Add a new physical domain
  cisco.aci.aci_domain:
    host: apic
    username: admin
    password: SomeSecretPassword
    domain: phys_dom
    domain_type: phys
    state: present

- name: Remove a physical domain
  cisco.aci.aci_domain:
    host: apic
    username: admin
    password: SomeSecretPassword
    domain: phys_dom
    domain_type: phys
    state: absent

- name: Add a new VMM domain
  cisco.aci.aci_domain:
    host: apic
    username: admin
    password: SomeSecretPassword
    domain: hyperv_dom
    domain_type: vmm
    vm_provider: microsoft
    state: present
  delegate_to: localhost

- name: Remove a VMM domain
  cisco.aci.aci_domain:
    host: apic
    username: admin
    password: SomeSecretPassword
    domain: hyperv_dom
    domain_type: vmm
    vm_provider: microsoft
    state: absent
  delegate_to: localhost

- name: Query a specific physical domain
  cisco.aci.aci_domain:
    host: apic
    username: admin
    password: SomeSecretPassword
    domain: phys_dom
    domain_type: phys
    state: query
  delegate_to: localhost
  register: query_result

- name: Query all domains
  cisco.aci.aci_domain:
    host: apic
    username: admin
    password: SomeSecretPassword
    domain_type: phys
    state: query
  delegate_to: localhost
  register: query_result
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_specaci_owner_specCloudFoundry
Kubernetes	Microsoft	OpenShift	OpenStackRedhatVMwarecloudfoundry
kubernetes	microsoft	openshift	openstackredhatvmwaren1kvdefaultunknownavsr    dvsr!   yesnoN)TFNc                  
   t               } | j                  t                      | j                  t                      | j                  t	        ddg ddg      t	        dg d      t	        dg dd	g
      t	        dg d      t	        ddg      t	        d      t	        d      t	        ddg d      t	        dg d      t	        dg d      t	        d      t	        dddg      t	        d             t        | ddddggddddggddddggg      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d       }t        |j                  j                  d!         }t        |j                  j                  d"         }|j                  j                  d#      }|j                  j                  d      }	|j                  j                  d$      }
|
t        j                  |
      }
|j                  j                  d%      }t        |j                  j                  d&         }|j                  j                  d      }|j                  j                  d'      }|dk7  r|	!|j                  d(j                  |      )       |!|j                  d*j                  |      )       |!|j                  d+j                  |      )       |
!|j                  d,j                  |      )       |!|j                  d-j                  |      )       |!|j                  d.j                  |      )       ||d/vr|j                  d0)       |d1k(  r%d2}d3j                  |      }d4j                  |      }n|d5k(  r%d6}d7j                  |      }d8j                  |      }n|d9k(  r%d:}d;j                  |      }d<j                  |      }n{|d=k(  r%d>}d?j                  |      }d@j                  |      }nQ|dk(  rLdA}dBj                  t        j                  |	      |      }dCj                  t        j                  |	      |      }|d }t        |      }|j                  t	        dD|iE      F       |j                          |dk(  rI|j!                  |t	        |||||
|||||G
      H       |j#                  |I       |j%                          n|dk(  r|j'                          |j)                          y )JNstrT)fcl2doml3domphysvmmtype)r.   requiredchoicesaliases)domain_namedomain_profilename)r.   r1   )AF11AF12AF13AF21AF22AF23AF31AF32AF33AF41AF42AF43CS0CS1CS2CS3CS4CS5CS6CS7EFVAunspecifiedtarget)r.   r0   r1   )r!   vlanvxlan)r.   r0   boolinfra_pg)r.   present)absentrQ   query)r.   r    r0   r   r"   z
read-writez	read-only)domain_typedomaindscp
encap_modeadd_infra_pgtag_collectionmulticast_addressstatevm_providervswitch
name_aliasaccess_modeenable_vm_folderrT   r-   r\   r[   rR   rU   )argument_specsupports_check_moderequired_ifrV   rW   rX   rY   rZ   r]   r_   r`   r^   z5Domain type '{0}' cannot have parameter 'vm_provider')msgz4Domain type '{0}' cannot have parameter 'encap_mode'z;Domain type '{0}' cannot have parameter 'multicast_address'z1Domain type '{0}' cannot have parameter 'vswitch'z5Domain type '{0}' cannot have parameter 'access_mode'z:Domain type '{0}' cannot have parameter 'enable_vm_folder')r*   r+   z>DSCP values can only be assigned to 'l2ext and 'l3ext' domainsr)   fcDomPz
uni/fc-{0}zfc-{0}r*   	l2extDomPzuni/l2dom-{0}z	l2dom-{0}r+   	l3extDomPzuni/l3dom-{0}z	l3dom-{0}r,   physDomPzuni/phys-{0}zphys-{0}vmmDomPzuni/vmmp-{0}/dom-{1}zvmmp-{0}/dom-{1}r4   )	aci_classaci_rnmodule_objecttarget_filter)
root_class)
	encapMode	mcastAddrconfigInfraPg	enableTagmoder4   
targetDscp	nameAlias
accessModeenableVmFolder)rj   class_config)rj   )r   updater   r   dictr   paramsgetBOOL_TO_ACI_MAPPINGVSWITCH_MAPPING	fail_jsonformatVM_PROVIDER_MAPPINGr   construct_urlget_existingpayloadget_diffpost_configdelete_config	exit_json)ra   modulerV   rU   rT   rW   rX   rY   rZ   r\   r]   r_   r`   r[   r^   domain_class	domain_mo	domain_rnacis                      h/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/cisco/aci/plugins/modules/aci_domain.pymainr   /  s!   %'M,./)*ed<cntmuv(QR2 J7
: U,HIv
|<(E*y:XYe  .G  H%)MNU#elK-HI6*S  *X # EM?3h= 9:i(M!:;
F ==V$D]]x(F--##M2K""<0J&v}}'8'8'HIL():):;K)LMN))*=>--##M2Kmm	*G!%%g.--##M2K*6==+<+<=O+PQMMg&E""<0Je"!X!_!_`k!lm!!W!^!^_j!kl(!^!e!efq!rs!T![![\g!hi"!X!_!_`k!lm'!]!d!dep!qrK/AA]^ d ''/	OOF+			"#**62	&&v.			"#**62	&&v.			!"))&1	%%f-			 *112E2I2I+2VX^_	&--.A.E.Ek.RTZ[	 ~	
F
C"#!6*	
   	"$+*($&/ 	 	
  	|,	(	MMO    __main__)
__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   r   rz   r   r~   r}   r   __name__ r   r   <module>r      s    A @(-)Vab bH=~g
R 5 E  E  	 #4t< Yx zF r   