cltk編程及應(yīng)用簡(jiǎn)介_(kāi)第1頁(yè)
cltk編程及應(yīng)用簡(jiǎn)介_(kāi)第2頁(yè)
cltk編程及應(yīng)用簡(jiǎn)介_(kāi)第3頁(yè)
cltk編程及應(yīng)用簡(jiǎn)介_(kāi)第4頁(yè)
cltk編程及應(yīng)用簡(jiǎn)介_(kāi)第5頁(yè)
已閱讀5頁(yè),還剩48頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

TclandtheTkToolkitChenTaoApril,2010cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第1頁(yè)!OutlinesTcl/TkAroundUsTcl/TkOverviewBasicTclSyntaxIntroductionforTkIntroductionforExpectHomebrewTestAutomationFrameworkTheSURofTAOProjectResourcescltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第2頁(yè)!Tcl/TkAroundUscltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第3頁(yè)!FromWorkPlaceInWCS…InITE/8610UsingExpecttomunicatewithWCS:sendCLImandsandgetresponse.InCiscoIOSRouter>enableRouter#tclshRouter(tcl)#puts$tcl_version8.3

TestAutomationforTelemunicationandNetworkEquipmentscltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第4頁(yè)!Tcl/TkOverview--Say“tickletee-kay”cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第5頁(yè)!What’sTcl(cont’)Un-typedandastring-basedmandlanguageDatatypesarenotusedwhenvariablesaredefined.Youneedn’tspecifyavariableasinteger,floatorastring.ThebasicmechanismsareallrelatedtostringsandstringsubstitutionsAllvariablesarestoredasstrings.automatictypeconversionincontextsetx10;#createavariable“x”andgiveavalue“10”toitsety20;#createavariable“y”andgiveavalue“20”toitsetz[expr$x+$y];#xplusyandsaveresultin“z”sety“I’mastringnow.IndeedI’malwaysstring:-)”puts“Expressionresultis:$z”;#printresultonstandardoutputs“Ybeesas:\”$y\””setaArray“JackboyMerrygirl”;#defineanarrayputs“I’manarray,butastringindeed:\n$aArray”cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第6頁(yè)!What’sTkTkATcl-basedtoolkitforprogramminggraphicaluserinterfacesQuickandeasytobuildpowerfuluserinterfaces.Portable,onecopyofscriptcanworkunchangedonUNIX,Windows,andtheMacintosh.cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第7頁(yè)!TclnotsogoodnewsInterpretedlanguagesrunslowerandusemoreprocessingtimeoroverheadWithoutaplier,syntaxerrorscan’tbefounduntilthescriptisexecutedUn-typedlanguagesdonotallowforthemostefficienttranslationofcodecltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第8頁(yè)!TclCommands’FormatATclscriptconsistsofoneormoremandsCommandsareseparatedbynewlinesorsemi-colonsAscriptwithtwomandsseparatedbyanewlinecharacter:seta24setb25Abovescriptcouldbewrittenonasinglelineusingasemi-colonseparator:seta24;setb25BasicallyeachmandconsistsofoneormorewordsFirstwordisthenameofamandAdditionalwordsareargumentstothatmandWordsareseparatedbyspacesandtabs<Command>[var1[var2[…]]]cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第9頁(yè)!CommentsCommentissetinashellway,leadingbya“#”seta(“john”)boy;#Setvalueofelement“john”ofarray“a”as“boy”#Orwecandoasarrayseta“johnboy”;#Ifyoulik,youcan\mentusingmulti-linesBecarefulwhenaddmentstoa“switch”expressionswitchvar{“go”{tohandlego}#Ifitdoesnotsupportfollowingvalue,mentitlater:=>Wrong!“pause{…}..}cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第10頁(yè)!MathandLogicalExpressionexprexpr<mathexpression>expr1+2;setx10;sety20;expr$x+$y=>30exprabs(-10)=>10expr10*rand()=>9.06197207004855;#resultisdouble,0<value<10exprint(8*rand())=>5;#inrangeof0~7incrsetx1incrx=>2incrx3=>5incrx-2=>3logic“and”

“or”...cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第11頁(yè)!List,Array&Operation“l(fā)ist”representalistofstringCommandsforlistlist,lindex,lrange,lappend,lreplacesplit,joinArrayissimilarasthe“associate”arrayorhashdatainperlorphp.%setlst1“JackboyblueMerrygirlred”;#or%setlst2[listRedWhiteYellowBlue]%foreachx$lst{puts“$x\n”}%foreach

{xyz}$lst1{puts"studentname:$x,a$y,wholikes$z"}studentname:Jack,aboy,wholikesbluestudentname:Merry,agirl,wholikesredputs[lindex$lst22]=>Whiteputs[lindex$lst20]=>Red%%arraysetaArr[listJackboyMerrygirl]%parrayaArraArr(Jack)=boyaArr(Merry)=girl%arraygetaArrJackboyMerrygirl%arraynamesaArrJackMerry%arraysizeaArr2%foreach{xy}[arraygetaArr]{puts"Name:$x,a$y"}Name:Jack,aboyName:Merry,agirlcltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第12頁(yè)!ProcandReturnProcedureintclsimilarasfunctioninC,perl,php,c{[arg1][arg2]...[args]}{procbody}return[string]proccalc1{opa“opb10”}{return[expr$opa+$opb]}calc123=>5calc12=>12proccalc2{args}{;#Varyargumentlistsetopa[lindex$args0]setopb[lindex$args1]return[expr$opa+$opb]}globalvariableInaprocedure,use“global<varname>”tomakeaglobalvariablevisiblefrominsideofprocedurecltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第13頁(yè)!Socket&FileEventsocket?-myaddraddr??-myportmyport??-async?hostportsocket-servermand?-myaddraddr?portNOTE:“port”specifiedhereisthe“l(fā)istening”portwhichcan’tbeusedtotransferdata.Astheconnectionrequestisaccepted,anewsocketwillbecreatedfortransportdata.

procAccept{newSockaddrport}{ globalsock_arr puts"Accepted$newSockfrom$addrport$port" setsock_arr(addr,$newSock)[list$addr$port]

fconfigure$newSock-blocking0–bufferingnone

fileevent$newSockreadable[listEcho$newSock]}setstatus[catch{socket-serverAccept$SERVER_PORT}ss]if{!$status}{ setsock_arr(main)$ss puts"Createserversocketsuccess.Server'ssocketis$ss"}else{ error"Createserver'ssocketfailed:$ss"}procEcho{sock}{ globalsock_arr if{[eof$sock]||[catch{gets$sockline}]}{ return } puts$sock[stringtoupper$line] flush$sock}cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第14頁(yè)!ErrorHandling&DiagnosticMulti-linemandsetx[listNanjingBeijing\[listShenYang]\Dalian]Shouldnospecialcharacterexceptforcarriage-return/newlineShouldnotputmentafter\the“catch”mandcatch{mand}<variable>catcherrors,butwouldnotbreaktheprocesserrorinformationtobesavedas<variable>the“errorInfo”globalvariableStoreerrorinformationthe“error”manderrormandcancauseanerror,error“l(fā)ine50brokenformismatchedvalue”=>Thiserrorcanbecapturedby“catch”mandandreturn1,anderrorstringwillbesettoerrorInfo.cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第15頁(yè)!RegularExpressionSyntax-BasicMatchingcharactersMostcharacterssimplymatchthemselvestheperiod,“.”,matchesanysinglecharacterabmatchesab;“a.”matchanafollowedbyanycharactor.Charactersets[][a-z]matchesanycharacterinthisrange[^a-z]matchesanycharacterisn’tinthisrange,^=not[][]matches]or[Quantifiers*forzeroormore:a*matcheszeroormorea’s.“.*”matchesanything+foronceormore:a+matchesa,aa,aa...a?zeroorone:a?matcheszerooroneaAlternation(orbranch)(H|h)ellomatchesHelloandhello,sameashello|HelloAnchor^:matchesthebeginningofastring$:matchestotheendofastring:^.*$matchesawholelinewithanything,evenemptylineBachslashQuotingToturnoffspecialmeansoffollowingcharacter:.*?+[]()^$|\Capturingsub-patternsgroupedwithparentheses

“^I’m.*IPaddress(\[0-9]+\.\[0-9]+\.\[0-9]+\.\[0-9]+)$”

NOTE:sub-patternswillbecapturedandsaveinspecificvariables.Ifuse(?:pattern),patternwillbecapturedbutnotsaved,mandwillbefastercltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第16頁(yè)!SignalSIGHUPHangupSIGINTInterruptSIGQUITquitSIGKILLkillSIGPIPESIGTERMSIGSTOPSIGTSTPSIGCONTSIGHLDSIGWINCHwindowsizechangeSIGUSR1SIGUSR2trap{callbackscripts}sig_nametrap{puts“byebye”;exit}SIGINTcltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第17頁(yè)!IntroductionforTkcltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第18頁(yè)!DisplayWidgets

Putanddisplaywidgetsinmainwindow:.fBut:aFrameworkcontainsasinglelinetextinputentry.fText:aFrameworkcontainsatextwillscrollbar.fBut.eEnt:TheentrysetbBut.fBut.bHello:AbuttonsettTr.fText.text:Textbody.fText.yscroll:Xscrollbar(horizontal).fText.xscroll:Yscrollbar(vertical)

Threemaingeometrymanagerpack:constraint-basedgeometrymanagergrid:controlindetailplace:placeawidgetinanotheronepack.fBut.fText-sideleft-fillboth-expandtruegrid.fBut.eEnt-stickynewsgrid$bBut-stickynewsgrid$tTr.fText.yscroll-stickynewsgrid.fText.xscroll-stickyewgridrowconfigure.fText0-weight1gridcolumnconfigure.fText0-weight1gridpropagate.fTextfalsecltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第19頁(yè)!IntroductionforExpectcltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第20頁(yè)!user_spawn_iduser_spawn_idfifoinoutspawn_iduser_spawn_iduser_spawn_idfifoinoutspawn_idNo.1spawn_idNo.2inoutExpectExpectfifoinoutfifostandardI/Ocltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第21頁(yè)!TestAutomationwithTcl/TkandExpectcltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第22頁(yè)!ExampleTestScenarioInstallpatchesConfigureSystemSpecificConfigurationChangeSpecificconfigCleanupConfigurationPatchfallbackInvokeTestToolVerifyresult?CallingTestToolVerifyresult?Pass/FailPass/failcltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第23頁(yè)!ThinkingAboutAutomation:MethodsTestHarnessEditorExecutionExecutetestscriptsinspecificflow/sequenceConfigurationStart/Pause/StopStatusmonitor:pass/failureTCnumberandlistLogReportCompatibleTest-caselanguageindependent[Additional:Testrequirementmgmt]TestScriptandDataMethodLinedscript--datahardcodewithscript,scriptcan’tbesharedCapture-Playback--datahardcodewithscript,scriptcan’tbesharedSharedscriptData-driven(fewdatadrivesscripts)Table-driven(hugedatadrivessamescripts)TrytodetachdatafromscriptsKey-worddriven...cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第24頁(yè)!WhyTclMultisolutionstocontrolequipmentsSocketExpectSNMPSerialport(Dialup)...ManyTestEquipmentprovidesTcldrivenAPIlibraryEasyforlearningandmaintenanceEasytoextendpcap,libnet-->Tcl-->homebrewEthernettestAPITotallyfreecltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第25頁(yè)!SUR--SwitchUtilizationReportcltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第26頁(yè)!Usagesur.exp<configurationfile>Theconfigurationfile:#switchname,1stSAM,2ndSAM,Interval,user,password[,pegactive:activate_peg|none_peg]EOOSU,0,,30,root,"slaris"#ATCA7,40,,30,root,alcel,activate_pegATCA449,8,8,30,root,44atca2#R44_SHA_A,24,,30,root,"slaris",none_pegExecutionMode:

XTERMRuninaspecificxtermforeveryswitchDTTERMuseDtermBACKGROUNDRun@backgroundFORGROUNDRun@forground,alloutputswillbeprintonsameternialAutorecorverProtocolauto-selecting:SSHorRSHSpecificdatafilecreatedforeveryWCScltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第27頁(yè)!DownloadandInstallDownloadActiveTcl.tcl.tk/or.activestate.CurrentVersionis8.5Thistrainingisbasedonversion8.4,InstallTclDoubleclickinstallationpackageNote:ThelogohasbeenchangedfromfeathertoActiveState’sfrogfrom8.5cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第28頁(yè)!ToOurDailyLifeIt’seasytodesignhandyprogramsbasedonTcltofulfilldifferenttasksAfishscreensaveprogram…Ae-pianoAPaintingpadcltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第29頁(yè)!What’sTclTclstandsforToolCommandLanguageJohOusterhout,UniversityofCalifornia.Firstreleasewasin1989.Asimplescriptinglanguage:Crossplatformsupport.Tclcanrunonmostpopularoperationsystemsuchasunix/linux,Windows,MacintoshandsoforthScriptsareinterpretedatruntime.Whichmakesthedevelopmentcyclefasterthanpiledlanguages,nowaitingforlongpilationsThecapabilitytocallC/C++routinesSimilartoothershelllanguagessuchasUNIXCshell,Perl,VB.“Easy”tostudyExcellenttextanalysispetencecltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第30頁(yè)!What’sTcl(cont’)EasytoextendTherearenumerousfreeextensionsbuiltontopofTcl/TkforspecificfunctionsavailableontheInternet.Tclx:HandlingsignaleventsNet-Snmp:supportsnmpmuninicationBWidget/IWidgetetc.:TkextensionsprovidesspecialandpowerfulwidgetsHttp&ncgi:forhttpserverprogrammingItiseasytoaddnewTclprimitivesbywritingCproceduresTcl/TkisPureCOpen-Sourcecode,newTclmandscanbeimplementedbyspecificextensionsprogrammedinC,fairlyeasywithoutchangingTclcore.TotallyFree!cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第31頁(yè)!What’sExpectExpectATcl-basedToolkitforAutomatingInteractiveProgramsTheprograminteractivelypromptandexpectusertoenterkeystrokesinresponseAdefaultmandinsomeoperationsystemsThere’salsoanExpectextensionfortclwhichcanalsobeloadedtotclshellcltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第32頁(yè)!BasicTclSyntaxcltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第33頁(yè)!VariableNeedn’tdeclarethetypeofvariable,automaticconversionincontextsetx“10.99”;#thisisastringputs“[exprint($x)]”;#outputwouldbe10NeedtobedeclaredandassignedavaluebeforeuseVariablenameiscase-sensitiveAssignmentexpression:set<varname><value:astringindeed>Tousevalueofavariable,puta“$”aheadofitas$<varname>Ifyouwanttoappendextracharacterstoavariable,usebracesaroundvariablenameas:setx“Hello”puts“$xJack!”;#Thisiswrong,itwouldtreatxJackasvariablenameputs“${x}Jack!”;#Thisisright!DspaceprocedureTouseglobaltovisitglobalvariableschildreninterpretercltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第34頁(yè)!StandardOutput&InputI/Ooperationforstandardinputandoutput,normallytheterminalinfrontofus.Printoutonterminal:puts“abcdefgNoThanks.”Formatthestringbyusing“format”mandSimilarasCsetstr[format“%-2d%20s%9d”,193{isnotequalto}0133];#octalnumber“193isnotequalto91”Getinput:puts-nonewline

“Yournameplease:”getsstdinsNamecltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第35頁(yè)!Control:BranchandLoopIf..[elseif...[else..]]if{Booleanexpression}{}if{xxx}{}else{}if{xxx}{}elseif

{}{}else{}Forsetsum0;for{seti0;sety10}{$i<10}{incri}{setsum[expr$sum+$i*$y]}puts“sumis$sum”=>450Whilewhile{[gets$fdline]>=0}{}Switchswitch-exact$xyz{“0”{…;?break?;}“1”{…}?default{…}?}Foreach(refertooperationoflist)cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第36頁(yè)!String&Operationappendformatsubststringmandstringparestringmatchstringequal(addedin8.4)stringrangestringtolower/toupperstringtrimstringparation:if{$str1==$str2}{putsequal}stringparingmandssuchas“stringmatch”stringclasscheck:stringisif{stringisinteger10}{putsok}cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第37頁(yè)!FileI/OWritefile%setfd[open

abcw+]=>filef76ec0%puts$fd"abcd\n"%puts$fd"efgt\n"%flush$fd%close$fdReadfile%setfd[openabcr]=>filef840d8Getfilecontentlinebyline%while{[gets$fdline]!=-1}{>puts-nonewline$line}=>abcdefgtReadmandread<filehandle>?chunkbytes?setstr[read$fd]while{![eof$fd]}{svetbuf[read$fd10000]...}cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第38頁(yè)!VariableinterpolationHappensindoublequote“”andnormalexpressionssetx“Hello”puts“$xJack!”sety[list$xJack]“!”Interpolationwouldbeprohibitedinmostkindsofbraces{}puts{$xJack}theresultwouldbe:$xJackIt’snotalwayssuchthingforbrace,braceinsomemandwillnotprohibitvariablereplacement:catch{}errforifcltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第39頁(yè)!RegularExpressionSyntax-Commandsregexpregexp?flags?patternstring?matchsub1sub2...?#GetIPaddressout,andlastnumberregexp{[0-9]{1,3}\.[0-9]{1,3}\.[[:digit:]]+\.([[:digit:]]{1,3})}"IPAddress:"sMatchsVar1regsubregsub?switches?patternstringsubspecvarnamecltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第40頁(yè)!RegularExpressionSyntax-Advancedcharacterclasses[[:digit:]]=[0-9]=\d[[:alpha:]]=[A-Za-z][[:space:]]=[\b\f\n\r\t\v]=\sNongreedyQuantifiersBydefaultquantifier+*?willmatchasmanycharactersaspossible.Use“?”behindthemcanprohibitsuch.+\nmatchesasmanylinesaspossibletilllastline.+?\nmatchesjustonelineBoundQuantifiers{m,n}matcheslatestmtimes,andmaximumntimesBackreferencesNOTE:regsubdoesnotsupportthefunctionofusingback-referencesoutsideofregularexpressioninperls/(\S+)\s+(\S+)/$2$1/cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第41頁(yè)!TimeEvent:theaftermandprocCircle{}{ globalswitcher if{$switcher=="off"}{

#killallafterevent,andthen return }

#dosomethingforrepeat

after1000Circle}aftermillisecondsaftermsarg?arg...?aftercancelidaftercancelmandafteridlemandafterinfo?id?

cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第42頁(yè)!CreatechildrenwidgetsWindowisorganizedinahierarchyAprimarywindow--therootofthehierarchy,isthemainwindowoftheapplicationnamedas“.”.Widgetsinprimarywindowareit’schildrenwindow,namedas“.<name>”Andchildwindowcanhasit’sownchildren...“.<name>.<name2>...”Firstcharactorof<name>shouldbeinlower-caseoradigitalnumberframe.fButframe.fText.fButconfigure-borderwidth1;.fTextconfigure-borderwidth1entry.fBut.eEnt-width20setbBut[button.fBut.bHello-text"HELLO!"].fBut.eEntconfigure-bgpink.fBut.bHelloconfigure-mand{.fBut.eEntinsertend"hello!";.fText.tTextinsertend"Hello"}settTr[text.fText.tText-yscrollmand".fText.yscrollset"-xscrollmand".fText.xscrollset"]$tTrconfigure-width40-height20-foregroundbrown-wrapwordscrollbar.fText.yscroll-mand"$tTryview"-orientverticalscrollbar.fText.xscroll-mand"$tTrxview"-orienthorizontalcltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第43頁(yè)!ASimpleMenumenubutton.mb-textFile-menu.mb.menupack.mb-padx10-pady10setm[menu.mb.menu-tearoff1]$maddmand-labelHello-mand{puts"Hello,World!"}$maddcheck-labelBoolean-variablefoo\-mand{puts"foo=$foo"}$maddseparator$maddcascade-labelFruit-menu$m.sub1setm2[menu$m.sub1-tearoff0]$m2addradio-labelapple-variablefruit-valueapple$m2addradio-labelorange-variablefruit-valueorange$m2addradio-labelkiwi-variablefruit-valuekiwi

note:toaddmenuinBsPmMonitorGuicltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第44頁(yè)!ExpectCommandsSyntaxspawnspawntelnet<ip>returnapidsavehandleinlocalvariable“spawn_id”sendaliasofexp_sendWhenusetogetherwithTk,exp_sendisprefer.expectexpect{-re“Password:”{}-re“UserName:”{...exp_continue}eof{}timeout{}}interactcloseexp_internal<-ffile>0|1log_file<filename>optionsof“send”-hsetsend_human{.1.31.052}setsend_human{.100}

send-ssetsend_slow{10,.001}timeoutcltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第45頁(yè)!Example1:ManipulateMGWautomaticallyspawn<ipofmgw>expect"Login:“send“root\r\n”expect“Password:”

send“root\n\r”expect“>”send“send13,1:connect\r\n”expect-timeout5-re“connect.*C>”send“help\r\n”expect–timeout3“C>”spawn<ipofmgw>expect{"Login:“{exp_send“root\r\n”exp_continue}

“Password:”{exp_send“root\n\r”exp_continue}-re“>”{exp_send“send13,1:connect\r\n”puts“connectok”}timeout{puts“timeout”}eof{puts“sessionbroken”}}cltk編程及應(yīng)用簡(jiǎn)介共53頁(yè),您現(xiàn)在瀏覽的是第46頁(yè)!ManulTestTestSimulatoranalyzestraffic/signalingSNMP/CLI/WEMSUTsendstraffic/signalingOtherEM...TestEngineercontrolscontrolscontrolsTestManagementDBfeedback

testresultsandupdateteststatusteststodoTestEquipment(ITE,EAST...)

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論