
    VhNJ                         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 d dlm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_l3out
short_description: Manage Layer 3 Outside (L3Out) objects (l3ext:Out)
description:
- Manage Layer 3 Outside (L3Out) on Cisco ACI fabrics.
options:
  tenant:
    description:
    - Name of an existing tenant.
    type: str
    aliases: [ tenant_name ]
  l3out:
    description:
    - Name of L3Out being created.
    type: str
    aliases: [ l3out_name, name ]
  vrf:
    description:
    - Name of the VRF being associated with the L3Out.
    - SR-MPLS Infra L3out requires the VRF to be 'overlay-1'.
    type: str
    aliases: [ vrf_name ]
  domain:
    description:
    - Name of the external L3 domain being associated with the L3Out.
    type: str
    aliases: [ ext_routed_domain_name, routed_domain ]
  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 ]
  route_control:
    description:
    - Route Control enforcement direction. The only allowed values are export or import,export.
    - The APIC defaults to C(export) when unset during creation.
    type: list
    elements: str
    choices: [ export, import ]
    aliases: [ route_control_enforcement ]
  mpls:
    description:
    - Indicate whether MPLS (Multi-Protocol Label Switching) is enabled or not.
    - The APIC defaults to C(no) when unset during creation.
    - SR-MPLS is only supported in APIC v5.0 and above.
    - The child classes C(mplsExtP), C(mplsRsLabelPol) and C(l3extProvLbl) will be displayed in output only when C(yes).
    type: str
    choices: [ "no", "yes" ]
  l3protocol:
    description:
    - Routing protocol for the L3Out.
    - Protocols already associated with an l3out must be provided again when the l3out is modified if the associated protocols are to be kept.
    - The Protocols are otherwise deleted if not provided each time an l3out is modified.
    - First example, to add BGP protocol to an l3out with OSPF protocol, the user must enter C([ bgp, ospf ]) even though "ospf" was provided before.
    - Second example, to change the protocol from OSPF to EIGRP, the user must simply enter C([ eigrp ]) and the previous OSPF protocol will be deleted.
    - To remove all existing protocols, the user must enter C([ static ]).
    - SR-MPLS Infra L3out requires the l3protocol to be 'bgp'.
    type: list
    elements: str
    choices: [ bgp, eigrp, ospf, pim, static ]
  ospf:
    description:
    - Parameters for the OSPF protocol.
    type: dict
    suboptions:
      area_cost:
        description:
        - The OSPF area cost.
        - The APIC defaults to C(1) when unset during creation.
        type: int
      area_ctrl:
        description:
        - The controls of redistribution and summary LSA generation into NSSA and Stub areas.
        - The APIC defaults to C(redistribute,summary) when unset during creation.
        type: list
        elements: str
        choices: [ redistribute, summary, suppress-fa, unspecified ]
      area_id:
        description:
        - The OSPF Area ID.
        - An area is a logical collection of OSPF networks, routers, and links that have the same area identification.
        - A router within an area must maintain a topological database for the area to which it belongs.
        - The router doesn't have detailed information about network topology outside of its area, thereby reducing the size of its database.
        - Areas limit the scope of route information distribution. It is not possible to do route update filtering within an area.
        - The link-state database (LSDB) of routers within the same area must be synchronized and be exactly the same.
        - However, route summarization and filtering is possible between different areas.
        - The main benefit of creating areas is a reduction in the number of routes to propagate-by the filtering and the summarization of routes.
        - Areas are identified by an area ID.
        - Cisco IOS software supports area IDs expressed in IP address format or decimal format, for example, area 0.0.0.0 is equal to area 0.
        - The APIC defaults to C(1) when unset during creation.
        type: str
      area_type:
        description:
        - The OSPF area type.
        - The APIC defaults to C(nssa) when unset during creation.
        type: str
        choices: [ nssa, regular, stub ]
      description:
        description:
        - Specifies the description of a policy component.
        type: str
        aliases: [ descr ]
      multipod_internal:
        description:
        - Start OSPF in WAN instance instead of default.
        - The APIC defaults to C(no) when unset during creation.
        type: str
        choices: [ "no", "yes" ]
      name_alias:
        description:
        - The alias for the current object. This relates to the nameAlias field in ACI.
        type: str
  asn:
    description:
    - The AS number for the L3Out.
    - Only applicable when using 'eigrp' as the l3protocol.
    type: int
    aliases: [ as_number ]
  description:
    description:
    - Description for the L3Out.
    type: str
    aliases: [ descr ]
  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
- cisco.aci.owner

notes:
- The C(tenant) and C(domain) and C(vrf) used must exist before using this module in your playbook.
- The M(cisco.aci.aci_tenant) and M(cisco.aci.aci_domain) and M(cisco.aci.aci_vrf) modules can be used for this.
seealso:
- module: cisco.aci.aci_tenant
- module: cisco.aci.aci_domain
- module: cisco.aci.aci_vrf
- name: APIC Management Information Model reference
  description: More information about the internal APIC class B(l3ext:Out).
  link: https://developer.cisco.com/docs/apic-mim-ref/
author:
- Rostyslav Davydenko (@rost-d)
- Gaspard Micol (@gmicol)
- Akini Ross (@akinross)
a6  
- name: Add a new L3Out
  cisco.aci.aci_l3out:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    name: prod_l3out
    description: L3Out for Production tenant
    domain: l3dom_prod
    vrf: prod
    l3protocol: ospf
    ospf:
      area_cost: 1
      area_ctrl: [summary, redistribute]
      area_id: 0.0.0.1
      area_type: regular
      multipod_internal: 'no'
    state: present
  delegate_to: localhost

- name: Delete L3Out
  cisco.aci.aci_l3out:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    name: prod_l3out
    state: absent
  delegate_to: localhost

- name: Query L3Out information
  cisco.aci.aci_l3out:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    name: prod_l3out
    state: query
  delegate_to: localhost
  register: query_result

- name: Query all L3Outs
  cisco.aci.aci_l3out:
    host: apic
    username: admin
    password: SomeSecretPassword
    state: query
  delegate_to: localhost
  register: query_all_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)	ospf_specc                  `   t               } | j                  t                      | j                  t                      | j                  t	        ddg      t	        dddg      t	        dddg      t	        ddg      t	        dd	g      t	        d
dddgdg      t	        dddg      t	        dg ddg      t	        d
dg d      t	        dt                     t	        ddg      t	        ddg d      t	        d             t        | d d!d"d#d$g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                  d,      }	|j                  j                  d-      }
|j                  j                  d.      }|j                  j                  d/      }|j                  j                  d!      }|j                  j                  d$      }|j                  j                  d0      }|
rFd1|
v r||j                  d23       d1|
vr||j                  d4       d.|
vr||j                  d5       d }|9t        |      d6k(  r|d7   dk(  r|j                  d8       nd9j                  |      }g d:}t	        t	        t	        d;j                  |      <      =      >      t	        t	        t	        |	?      =      @      g}|dAk(  r|dk(  r|
dBgk7  r|dk(  r|j                  dC3       |	dDk7  r|dk(  r|j                  dE3       |g dFz  }|j                  t	        t	        t	               t	        t	        t	        dG<      =      H      gI      J             |j                  t	        t	        t	        |K      =      L             |j!                  t	        dMdNj                  |      |d|iO      t	        dPdQj                  |      |d|iO      |R       |j#                          |dk(  rx|
/t%        |j&                  t(              rat        |j&                        d7kD  rH|j&                  d7   j                  dPi       j                  dSi       D ]  }|j                  dT      r3dB|
vr/|j                  t	        t	        t	        dUV      =      W             |j                  dX      r3d1|
vr/|j                  t	        t	        t	        dUV      =      Y             |j                  dZ      r3d.|
vr/|j                  t	        t	        t	        dUV      =      [             |j                  d\      sd]|
vs|j                  t	        t	        t	        dUV      =      ^              |
D ]  }|dBk(  r0|j                  t	        t	        t	        d_`      =      W             9|d1k(  r0|j                  t	        t	        t	        |a      =      Y             n|d.k(  rt%        |t              rd9j                  |j                  db            |db<   |j                  t	        t	        t	        |j                  dc      |j                  db      |j                  dd      |j                  de      |j                  d)      |j                  df      |j                  d0      g      =      [             G|j                  t	        t	        t	        d_`      =      [             x|d]k(  s|j                  t	        t	        t	        d_`      =      ^              |j+                  dPt	        ||||||h      |i       |j-                  dPj       |j/                          n|d"k(  r|j1                          |j3                          y )kNstrtenant_name)typealiases
l3out_namenameext_routed_domain_namerouted_domainvrf_namedescrlistexportimportroute_control_enforcement)r   elementschoicesr   noyes)r   r!   )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   r!   r   )bgpeigrpospfpimstatic)r   r    r!   dict)r   optionsint	as_numberpresent)absentrE   query)r   defaultr!   )r   )tenantl3outdomainvrfdescriptionroute_controlmplsdscp
l3protocolr>   asnstate
name_aliasTrS   rF   rJ   rI   )rJ   rI   rK   rL   )argument_specsupports_check_moderequired_ifrK   rP   rM   rN   rO   rL   rQ   r>   rR   rT   r=   z6Parameter 'asn' is required when l3protocol is 'eigrp')msgzVParameter 'asn' is only applicable when l3protocol is 'eigrp'. The ASN will be ignoredzfParameter 'ospf' is only applicable when l3protocol is 'ospf'. The OPSF specifications will be ignored   r   zXThe route_control parameter is invalid: allowed options are export or import,export only,)l3extRsL3DomAttl3extRsEctxbgpExtPospfExtP	eigrpExtPpimExtPzuni/l3dom-{0})tDn)
attributes)r[   )tnFvCtxName)r\   infrar<   zOThe l3protocol parameter must be 'bgp' when tenant is 'infra' and mpls is 'yes'z	overlay-1zNThe vrf parameter must be 'overlay-1' when tenant is 'infra' and mpls is 'yes')mplsExtPmplsRsLabelPoll3extProvLblz!uni/tn-infra/mplslabelpol-default)rf   )rb   children)re   )r   )rg   fvTenantztn-{0})	aci_classaci_rnmodule_objecttarget_filterl3extOutzout-{0})
root_class
subclass_1child_classesrh   r]   deleted)r	   )r]   r_   )r_   r^   )r^   r`   r?   )r`    )r   )rR   	area_ctrl	area_costarea_id	area_typemultipod_internal)areaCostareaCtrlareaIdareaTyper   multipodInternal	nameAlias)r   r   enforceRtctrlmplsEnabled
targetDscpr~   )rj   class_configchild_configs)rj   )r   updater   r   rA   r   r   r   paramsget	fail_jsonwarnlenjoinformatappendconstruct_urlget_existing
isinstanceexistingr   payloadget_diffpost_configdelete_config	exit_json)rU   moduleacirJ   rK   rP   rM   rN   rO   rL   rQ   r>   rR   rS   rI   rT   enforce_ctrlrq   r   childprotocols                        g/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/cisco/aci/plugins/modules/aci_l3out.pymainr   W  s4   %'M,./)*8f'=>)A?(STej\2egY7x(01	
 utUm42 J7
: =

 vy{3ek]3y:XYU#e  3j # h( 34i!EF
F F
CMMg&E]]x(F==V$D--##M2KMM%%o6M==V$D
--

E
"C""<0J==V$D
--

E
"CMMg&E]]x(F""<0Jj S[!YZ*$KKpq#(8KK  A  BL }"}Q'78'CMMtu88M2LM 	TTo6L6LV6T-UVW#)>?@M
 TU]% Ui%7!rs+%9"4!qrGG$$&DPT`d  jM  aN  QO  =P  <Q  R  S	
 	Ttt?O/PQR ??6* !6*	
  ##E*!5/	
 $    	!#,,-#cll2Ca2G \\!_00R@DDZQST dEyy+Z0G%,,T$$V_J`:a-bcyy-'2K%,,TDDXaLb<c-deyy,z1I%,,T44W`Ka;b-cdyy+Z0G%,,T$$V_J`:a-bcd ' Xu$!((ddQSn6U)VW(!((QT8V)WX'!$-,/HHTXXk5J,K[)%,, )-/315+1F15+1F/3xx	/B15+1F.2hh}.E9=BU9V26((<2H0&
*"  &,,T44VX>;Z-[\&!((ddQSn6U)VW5X8 	 !* $ ( 	 	
 	z*	(	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   r   r   r   __name__ r   r   <module>r      sr    A @ k \|2hg
R 5  MIX zF r   