@@ -16,25 +16,25 @@ import (
1616)
1717
1818// GenericCiscoHandler function handles generic Cisco style sessions
19- func GenericCiscoHandler (myFakeDevice * fakedevices.FakeDevice ) ssh.Handler {
20- return genericCiscoSession (myFakeDevice , nil )
19+ func GenericCiscoHandler (fd * fakedevices.FakeDevice ) ssh.Handler {
20+ return genericCiscoSession (fd , nil )
2121}
2222
2323// GenericCiscoScenarioHandler returns an ssh.Handler that plays back a scenario sequence.
24- func GenericCiscoScenarioHandler (myFakeDevice * fakedevices.FakeDevice , sequence []transcript.SequenceStep ) ssh.Handler {
25- return genericCiscoSession (myFakeDevice , sequence )
24+ func GenericCiscoScenarioHandler (fd * fakedevices.FakeDevice , sequence []transcript.SequenceStep ) ssh.Handler {
25+ return genericCiscoSession (fd , sequence )
2626}
2727
28- func genericCiscoSession (myFakeDevice * fakedevices.FakeDevice , sequence []transcript.SequenceStep ) ssh.Handler {
28+ func genericCiscoSession (fd * fakedevices.FakeDevice , sequence []transcript.SequenceStep ) ssh.Handler {
2929 return func (s ssh.Session ) {
3030
3131 // Exec mode: client sent a command directly (e.g., ssh host "show version")
3232 if cmd := s .RawCommand (); cmd != "" {
3333 log .Printf ("exec: %s" , cmd )
34- match , matchedCommand , multipleMatches := cmdmatch .Match (cmd , myFakeDevice .SupportedCommands )
34+ match , matchedCommand , multipleMatches := cmdmatch .Match (cmd , fd .SupportedCommands )
3535 if match && ! multipleMatches {
3636 output , err := fakedevices .TranscriptReader (
37- myFakeDevice .SupportedCommands [matchedCommand ], myFakeDevice ,
37+ fd .SupportedCommands [matchedCommand ], fd ,
3838 )
3939 if err == nil {
4040 io .WriteString (s , output )
@@ -46,8 +46,8 @@ func genericCiscoSession(myFakeDevice *fakedevices.FakeDevice, sequence []transc
4646
4747 // Interactive shell mode — sequence pointer resets per session
4848 seqIdx := 0
49- contextState := myFakeDevice .ContextSearch ["base" ]
50- t := term .NewTerminal (s , devicePrompt (myFakeDevice , contextState ))
49+ contextState := fd .ContextSearch ["base" ]
50+ t := term .NewTerminal (s , devicePrompt (fd , contextState ))
5151
5252 for {
5353 userInput , err := t .ReadLine ()
@@ -56,7 +56,7 @@ func genericCiscoSession(myFakeDevice *fakedevices.FakeDevice, sequence []transc
5656 }
5757 log .Println (userInput )
5858
59- done := handleShellInput (t , userInput , myFakeDevice , & contextState , sequence , & seqIdx )
59+ done := handleShellInput (t , userInput , fd , & contextState , sequence , & seqIdx )
6060 if done {
6161 break
6262 }
0 commit comments