o x[h @sTddlmZddlmZmZmZGdddeZGdddeZGdddeZd S) ) BootProtoEnum)NicBaseStaticIpv4BaseStaticIpv6Basec@seZdZdZddZddZddZedd Zed d Z ed d Z eddZ eddZ eddZ eddZeddZdS)Niczd Holds the information about each NIC specified in the customization specification file cC||_||_dSN)_name _configFile)selfname configFilerJ/usr/lib/python3/dist-packages/cloudinit/sources/helpers/vmware/imc/nic.py__init__ z Nic.__init__cCs|j|jd|dS)N|)r getr )r whatrrr_getszNic._getcCs|j|j|Sr)r get_count_with_prefixr )r prefixrrr_get_count_with_prefixszNic._get_count_with_prefixcCs|jSr)r r rrrr szNic.namecCs|dS)NMACADDRrlowerrrrrmac$szNic.maccC*|d}|r|}|dkp|dkSdS)NPRIMARYyestrueFrr valuerrrprimary( z Nic.primarycCr)NONBOOTr r!Frr"rrronboot1r%z Nic.onbootcC|d}|r |SdS)N BOOTPROTOrr"rrr bootProto: z Nic.bootProtocCr()N IPv4_MODEr*rr"rrr ipv4_modeBr,z Nic.ipv4_modecCs|jtjkr t|gSdS)z Checks the BOOTPROTO property and returns StaticIPv4Addr configuration object if STATIC configuration is set. N)r+rSTATICStaticIpv4Addrrrrr staticIpv4Js  zNic.staticIpv4cCs>|d}|s dSg}td|dD] }|t||q|S)Nz |IPv6ADDR|)rrangeappendStaticIpv6Addr)r cntresultindexrrr staticIpv6Us zNic.staticIpv6N)__name__ __module__ __qualname____doc__rrrpropertyr rr$r'r+r.r1r9rrrrrs*        rc@<eZdZdZddZeddZeddZedd Zd S) r0zStatic IPV4 Setting.cCs ||_dSr)_nic)r nicrrrrfs zStaticIpv4Addr.__init__cC |jdS)NIPADDRr@rrrrripi zStaticIpv4Addr.ipcCrB)NNETMASKrDrrrrnetmaskmrFzStaticIpv4Addr.netmaskcCs(|jd}|rdd|dDSdS)NGATEWAYcSsg|]}|qSr)strip).0xrrr usz+StaticIpv4Addr.gateways..,)r@rsplitr"rrrgatewaysqs zStaticIpv4Addr.gatewaysN) r:r;r<r=rr>rErHrPrrrrr0cs  r0c@r?) r5zStatic IPV6 Address.cCrr)r@_index)r rAr8rrrr}rzStaticIpv6Addr.__init__cC|jdt|jS)Nz IPv6ADDR|r@rstrrQrrrrrEzStaticIpv6Addr.ipcCrR)Nz IPv6NETMASK|rSrrrrrHrUzStaticIpv6Addr.netmaskcCrR)Nz IPv6GATEWAY|rSrrrrgatewayrUzStaticIpv6Addr.gatewayN) r:r;r<r=rr>rErHrVrrrrr5zs  r5N) /cloudinit.sources.helpers.vmware.imc.boot_protor-cloudinit.sources.helpers.vmware.imc.nic_baserrrrr0r5rrrrs S