ó C…#Wc@s‚dZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z m Z ddlmZdd lmZmZmZmZmZmZdd lmZmZmZmZdd lmZdd lmZdd l m!Z!ddl"m#Z#ddl$m%Z%da'defd„ƒYZ(defd„ƒYZ)defd„ƒYZ*d„Z+d„Z,dS(s network selection screens iÿÿÿÿN(tDataObjectDict(t InstallEngine(tINSTALL_LOGGER_NAME(tSystemConfiguration(t_tSCI_HELP(t IPAddress(t _human_keyt find_netmaskt find_gatewayt findlinkstget_default_nictNO_LEADING_ZEROS(t BaseScreent QuitExceptiont SkipExceptiont UIMessage(t EditField(t textwidth(tListItem(t ScrollWindow(t WindowAreatNetworkTypeScreencBsõeZdZedƒZedƒZedƒZedƒZedƒZedƒZ edƒZ edƒZ ed ƒZ ed ƒZ d d d dgZdZdZeedZededƒfZd„Zd„Zd„Zd„Zd„ZRS(sG Let the user select network type (Automatic, Manual, or None) s?Select how the wired ethernet network connection is configured.t Automaticallys&Automatically configure the connectiontManuallys-Enter the information on the following screentNones)Do not configure the network at this timesKNo wired network interfaces found. Additional device drivers may be needed.sSNo configurable network interfaces found. They are all controlled from global zone.sFinding network links on systems\t|t/t-iiis/%s/network.txttNetworkcCsétdkr"tjtdƒantt|ƒj|ƒ|jtj |_ i|_ d|_ d|_ d|_d|_tdƒ|_tjƒj|_|jjdtdtƒd|_d|j_t|_tƒ|_t|_dS(Ns .sysconfigRt class_typetnot_found_is_erri(tLOGGERRtloggingt getLoggerRtsuperRt__init__t win_size_xtITEM_DESC_OFFSETtmenu_item_desc_maxt net_type_dictt automatictmanualt none_optiontnetwork_info_typeRt header_textRt get_instancetdoctget_descendantsRtTruetsct sc_networkthave_nicR tfindlinks_proctFalsetfindlinks_done(tselftmain_win((s network.pyR$Ls$          cCsã|jr dS|jjjtjdƒ|jjjtjdƒ|jjjtjdƒ|jj ƒ|j j t j dd|jdƒ|jjƒtt j ƒd}d}|j jjdƒx”|jjsW|jjƒ}|tjkr|jƒrt‚qn|j j t j|d|ƒ|j jƒ|jjƒ|dtt jƒ}qÄW|j jjdƒ|j jƒt|_|jj\}}|s½t|_ |dkr½d |_!q½nt"d |ƒ}|j#j$j%|ƒdS( s^ create a spinner window to show the user progress as dladm commands are run. NiiiiiiúiÿÿÿÿtfromgzR (&R7R9tactionstpoptcursestKEY_F2RtKEY_F3tKEY_F6t show_actionst center_wintadd_textRtLINK_SEEK_TEXTR%t do_updateRtwindowttimeoutR5tdonetgetchtKEY_F9t confirm_quitRtSPINNERt no_ut_refreshtlentclearR1tresultR6R4R,RR/t persistenttinsert_children(R8toffsett spin_indext input_keytnet_ether_nicst net_fromgzt nic_doc_dict((s network.pytwait_for_findlinksys@           cCs„|jƒ|jjƒ|jjƒd}|jsz|jdkr^|jjtj |dƒq€|jjtj |dƒn||jjtj |ƒ7}|d7}t dtj |tjƒ}t|d|jdtjƒ|_d|j_|j|j|jj<|jjtj|tj|jƒ|d7}||_t|d|jdtjƒ|_d|j_|j|j|jj<|jjtj|tj|jƒ|d7}||_t|d|jdtjƒ|_d|j_|j|j|jj<|jjtj|tj|jƒ|jjƒ|j j!d krE|jj#|jƒn;|j j!d krm|jj#|jƒn|jj#|jƒd S( sC Create an EditField for listing each of the network types iR:RFttextR)iR*tnonet Automatict DefaultFixedN(NR\($RYR9t reset_actionsRAR4R,RBt add_paragraphRtALL_NICS_FROMGZt NO_NICS_FOUNDt NET_TYPE_TEXTRtITEM_MAX_WIDTHt ITEM_OFFSETRt AUTO_TEXTR)titem_keyR(RCt AUTO_DETAILR&R'ty_loct MANUAL_TEXTR*t MANUAL_DETAILt NONE_TEXTR+t NONE_DETAILRER2R3Rtactivate_object(R8Rht item_area((s network.pyt_show§sX                  cCsŒ|jrˆ|jjƒj|_|jdkr<d|j_n6|jdkrfd|j_d|j_n d|j_t j d|jƒndS(s8Save hostname and selected network type on change screenR)R\R*R]tstaticsConfiguring NIC as: %sN( R4RBtget_active_objectRfR,R2R3t sc_ipv4_typeRR tinfo(R8((s network.pyton_change_screenìs   cCsF|jrB|jjƒj}||jkrBttdƒƒ‚qBndS(saEnsure hostname is set and a network type is chosen (unless no NICs are present) sISelect the wired network configuration: Automatically, Manually, or None.N(R4RBRqRfR(RR(R8Rf((s network.pytvalidateüs (t__name__t __module__t__doc__RRbReRgRiRjRkRlRaR`RDRLRdRcR&Rt HELP_DATAR$RYRoRtRu(((s network.pyR3s*           - . E t NICConfigurecBsóeZdZedƒZedƒZedƒZedƒZedƒZedƒZ edƒZ edƒZ ed ƒZ ed ƒZ ed ƒZed ed ƒfZdZdZdZedƒZd„Zd„Zd„Zd„Zd„ZRS(s< Manually configure a single NIC to use a static IP sManually Configure: %ssƒEnter the configuration for this network connection. All entries must contain four sets of numbers, 0 to 255, separated by periods.s IP Address:sMust be unique for this networksNetmask:s,Your subnet use may require a different masksRouter:s+The IP address of the router on this subnetsDomain:sNIC:s*Settings will be applied to this interfaces/%s/network_manual.txtsManually Configure: NICs %siis2%s may not have leading zeros in address segments.cCsVtdkr"tjtdƒantt|ƒj|ƒd|_d|_ t t tj ƒt tj ƒt tjƒt tjƒƒ}|d7}|tj}td|dtjƒ|_tdtjd|ƒ|_d|_d|_d|_tjƒj|_|jjdtdtƒd|_d|j_d|j_ d|_!d|_"d|_#dS(Ns .sysconfigiiRR($R RR!R"RR#RzR$tdns_descriptiontdomain_descriptiontmaxRNtIP_LABELt NETMASK_LABELt GATEWAY_LABELt DOMAIN_LABELtEDIT_FIELD_LENRRdt list_areat edit_areatip_fieldt netmask_fieldt gateway_fieldRR.R/R0RR1R2tsc_ipv4_addresst sc_ipv4_routet ip_addresstnic_nametgateway(R8R9t item_lengtht list_width((s network.pyR$&s2               c Csä|jjdkrt‚n|jj|_|jj|_|jj|_|j j t j |jƒ|j d}|jd}d}||jjt j|d|ƒ7}d}t jd|jj}|d7}||j_t|jdt jdt jd|jd tƒ}t|jd|d|jd td |j jdt jjd ƒƒ|jjt j||d||d |ƒ||7}||j_t|jdt jdt jd|jd t ƒ}t|jd|d|jdkrà|jn|jj"dƒdd td |j jdddgƒ|_#|jjt j$||d||d |ƒ||7}||j_t|jdt j%dt j%d|jd t ƒ}t|jd|dt&|jj'j(ƒd td |j jddgƒ|_)|jjt j*||d||d |ƒ||7}||j_t|jdt j+dt j+d|jd t ƒ}t|jd|d|jrd|jnt,|jj'j(ƒd td |j jdddgƒ|_-|jjt j.||d||d |ƒ|j j/ƒ|jj0ƒdS(shCreate the editable fields for IP address, netmask, router, dns address and dns domain R]iitmax_yiRZtdata_objRFtadd_objRut error_wint:tmax_xRis IP AddressRˆtNetmasks Default RouteR‰N(1R2R3Rt sc_ipv4_nameR‹RˆRŠR‰RŒR9tset_header_textRzt HEADER_TEXTt win_size_yR%RBR_t PARAGRAPHRdRƒtcolumnsRhRtNIC_NAME_LABELR6RR„tincremental_validate_ipt error_linetrstriptNIC_DESCRIPTIONR~R1RtsplitR…tIP_DESCRIPTIONRRt nic_ifacetlinkR†tNETMASK_DESCRIPTIONR€R R‡tGATEWAY_DESCRIPTIONRERm(R8RR”Rhtdescription_startt list_item((s network.pyRoPs~                      cCs|j|j|jg}x|D]}t|ƒqW|jjƒsWttdƒƒ‚n|jjƒs{ttdƒƒ‚n‚y&|jjƒ}tj|dt ƒWnYt k rü}|dt krãtt j |jjdƒ‚nttdƒ|ƒ‚nXdS(s8Verify the syntactical validity of the IP Address fieldssIP Address must not be emptysNetmask must not be emptyt check_netmaskis'%s' is not a valid netmaskN(R…R†R‡t validate_iptget_textRRRtconvert_addressR1t ValueErrorR RztMSG_NO_LEADING_ZEROSR(R8t ip_fieldstfieldtnetmaskterr((s network.pyRu»s  cCs|jjƒr|jjƒ}|jjƒ}t||ƒ}d||jƒf}||j_|jjƒ|j_|jjƒrš|jjƒ|j_ n d|j_ t j d|jj ƒ|jj jdddƒ|j_d|j_d|j_d|j_ndS( s#Preserve all data on screen changess%s/%dsSetting network to: %stv4tv6itaddrconftyesN(R…R«R†Rtnetmask_prefixR2RˆR±R‡R‰RR tdebugR–treplacet sc_ipv6_namet sc_ipv6_typetsc_ipv6_statelesstsc_ipv6_stateful(R8tipR±RŠtfullip((s network.pyt on_continueÑs  !  cCsC|jjƒ|j_|jjƒ|j_|jjƒ|j_dS(sWhen going back, just store whatever raw character input is there. It will be validated when the user goes forward in the on_continue method.N(R…R«R2RˆR†R±R‡R‰(R8((s network.pyton_prevës(RvRwRxRR˜RšR~R¢RR¥R€R¦RRœR RRyt HELP_FORMATRdR‚R®R$RoRuRÀRÁ(((s network.pyRzs.             * k  t NICSelectcBsieZdZdZedƒZedƒZededƒfZdZ dZ d„Z d„Z d „Z RS( sDAllow user to choose which ethernet connection to manually configureisManual Network ConfigurationsLSelect the one wired network connection to be configured during installations/%s/network_manual.txts %sicCs²tdkr"tjtdƒantt|ƒj|ƒtdddtj ƒ|_ d|_ d|_ d|_ tjƒj|_|jjdtdtƒd|_d|j_dS(Ns .sysconfigiiRR(R RR!R"RR#RÃR$Rt LIST_OFFSETRƒt ether_nicstnict default_nicRR.R/R0RR1R2R£(R8R9((s network.pyR$s    c Cs‹|jjdkrt‚n|jjjddƒj|_|jsKt‚nt|jƒ|_ t |jƒdkr|jj ƒd|j_ |jj ƒdd|j_|jj ƒd}|jrãtjd|jj|jƒntjd|jjƒt‚n|jjdkrE|j |jkr<|j|j j}qyd }n4|jjjdƒrm|jjd }n |jj}d}||jjtj|ƒ7}d}|d7}ttj|jjj|ƒ}t |jƒ|krS|jtj}td |d |d |dtjdt |jƒdƒ}t|d|jƒ|_ |j |_!d}nd|_ |j|_!|jj ƒ}|j"dt#ƒx«|D]£} ||j$_%|j| }|jrÌd| |jf} n| } t | ƒd|j$_&t'|j$d|j!d| d| |fƒ} | |kr'| }n|d7}qŽW|j(j)ƒ|j rw|jj*|j ƒ|j j+|dt,ƒn|jj*|ƒdS(sCreate a list of NICs to choose from. If more than 15 NICs are found, create a scrolling region to put them in R]tnameR iis/v4s*Selecting %s (%s) for manual configurations%Selecting %s for manual configurationtiýÿÿÿtlinesR›Rhtx_loctscrollable_linesRFtkeys%s (%s)RZRt force_to_topN(-R2R3RR/RQtget_first_childt data_dictRÅR RÇRNtvaluesR£tkeysR–tdeviceR RsRtendswithRBR_RÃRštmintMAX_NICStareaRÊR%RÄRRt scroll_regiont list_regiontsortRRƒRhR›RR9RERmtactivate_object_forceR1( R8tvanitytselected_nic_nameRht selected_nictmax_nicsR›twin_areaRÅRÆtlist_item_textR¨((s network.pyRosv                        cCs@|jjƒjd|j_|jjƒjdd|j_dS(s,Save the highlighted NIC as the selected NICiis/v4N(RÙRqRR2R£R–(R8((s network.pyRt|s(RvRwRxRÖRR˜RšRRyRÂRÄR$RoRt(((s network.pyRÃõs    bcCs‹|jƒ}|stSytj|ƒWn]tk r†}|dtkrfttj|j dƒ‚ntt dƒ|j dƒ‚nXtS(sZWrap a call to check_address and raise a UIMessage with appropriate message text is&%s must be of the form xxx.xxx.xxx.xxx( R«R1RR¬R­R RRzR®RR(t edit_fieldRŠR²((s network.pyRªƒs   cCs‹|jƒ}|stSytj|ƒWn]tk r†}|dtkrfttj|j dƒ‚ntt dƒ|j dƒ‚nXtS(s;Incrementally validate the IP Address as the user enters itis&%s must be of the form xxx.xxx.xxx.xxx( R«R1Rtincremental_checkR­R RRzR®RR(RâRŠR²((s network.pyR–s   (-RxR=R!t%solaris_install.data_object.data_dictRtsolaris_install.engineRtsolaris_install.loggerRt!solaris_install.sysconfig.sc_specRtsolaris_install.sysconfig.utilRRt!solaris_install.sysconfig.ip_utilRt&solaris_install.sysconfig.network_utilRRR R R R t&solaris_install.terminalui.base_screenR RRRt%solaris_install.terminalui.edit_fieldRtsolaris_install.terminalui.i18nRt$solaris_install.terminalui.list_itemRt(solaris_install.terminalui.scroll_windowRt&solaris_install.terminalui.window_areaRRR RRzRÃRªR(((s network.pyts*  ."ÕíŽ