5 Replies Latest reply on Dec 22, 2011 6:34 PM by Steve Welsh

    Custom Device doesn't load

    sharky1337

      Hello,

      I'm trying to create my own device '.custom' script file.

      I am able to create my own device. It works fine. But I need to add some code so I try to follow the documentation.

      I  copied these files to the scripts folder:

       

      Cisco.Router.general.txt.custom            was Custom.Device.Template.txt.custom

      Client.Custom.Activity.Cisco2911.txt     was Client.Custom.Activity.Template.txt

      Main.Custom.Activity.Cisco2911.txt       was Main.Custom.Activity.Template.txt

       

      I can start my own activity until it should load the Cisco.Router.general.txt.custom

      The documention says a level 4 debug appears:

      "Loading custom activities for device"

      But instead  


      "Client script error: Type Mismatch: [activity name] on line: [line number]" appears. 

      I checked the docu and found this.


      the device you have selected to run your custom activity against does not have a .custom file defined for it, or
      the .custom file for the device does not contain a function which has been defined in your custom activity client script, or

      a function defined in the .custom file contains an error within the code

       

      I cannot allocate my failure. I hope someone can help me. I didn't change any code in the three files above. 

      regards sharky

        • Re: Custom Device doesn't load
          Steve Welsh

          Hi sharky,

          By creating a Cisco.Router.general.txt.custom file, this extends the 'out-the-box' Cisco.Router.general.txt file with your custom activity.

          The scripts are then combined at run-time to create a single script, which is used by the client thread allocated to the device.

          It sounds like a coding issue in your custom activity.

          Any chance you can attach your scripts and I'll take a quick look?

          Thanks,

          Steve

            • Re: Custom Device doesn't load
              sharky1337

              Hello sparta,

              thank you for your super fast reply!

              I does not add any code, because the function customCustom_Activity_Template(sAltCommand)

              returns an prio errror "client script error"

               

              I also tried to call Custom_Activity_NotSupported(sAltCommand)

              But I does receive a prio 1 error and not the warning message "has not this functionality added".

              I think I did a failure with the custom.router.general.txt.custom . :/

               

              Calling any function from the custom device file works great. 

               

              http://imageshack.us/photo/my-images/707/errorlogb.png/

              My custom activity http://pastebin.com/rUs1sVEF

                • Re: Custom Device doesn't load
                  Steve Welsh

                  I've noticed a couple of things which may be causing a problem.

                   

                  1) In your Function Client() code in your custom activity Client script, you have a function call to the  'Activity_UpdatePassword' function (just after your 'Test' log message).

                  Is this supposed to be there?

                  This is an out-the-box activity which sends a message back to the client script, so you should be making the function call using:

                      CmdResults = Activity_UpdatePassword()

                  You'd normally then use the CmdResults message text and send it to the Info Log using:

                      Call cl.Log(3, "Password change results: " & CmdResults)

                   

                  2) The second thing possibly causing a problem may be a mismatch between the custom activity function call in the Cisco.Router.general.txt.custom device extension file and the custom Client script.  

                  Is the function name for your custom activity in the Cisco.Router.general.txt.custom file still:

                      Function Custom_Activity_Template(sAltCommand)

                   

                  If not, then this is your problem.

                  Looking at your client script (just after the 'Activity_UpdatePassword' function call) you are making a call to a function Custom_Activity_Template.

                      sResults = Custom_Activity_Template(sAltCommand)

                  If this function does not exist in your Cisco.Router.general.txt.custom file, you will get an error.

                  You probably need to rename the function call in your Client script file to match the one in your Cisco.Router.general.txt.custom file.

                   

                  Steve

                    • Re: Custom Device doesn't load
                      sharky1337

                      Hey sparta, 

                      1)

                      I only add the UpdatePassword() to see if I get the warning message. And it works.

                      2)

                      The Custom_Activiy_Template(sAltCommand) is also only a test if I can call any function in my Cisco.Router.general.txt.custom .Both function from the templatefile aren't working. 

                      Maybe my Templatefile is corrupt?

                       

                      http://pastebin.com/hjt5gR8x .custom

                        • Re: Custom Device doesn't load
                          Steve Welsh

                          Hi sharkey,

                          I think I may have spotted the problem.

                          First, please remove the call to the UpdatePassword function (which you say you used as a test), so that CatTools calls your custom activity.

                          Now, in the Info Log, when you run the activity do you see this Warning level message (from within your Cisco.Router.general.txt.custom activity)?

                          • "Running custom activity example in custom device template script"

                          If so, then do you see this Debug level one too?

                          • "Parsing [SCRIPT_NAME] version information"

                           

                          My guess would be you see the first, but not the second message.

                          If this is correct, then the problem is a known issue which relates to the calling of the 'SendCommandSingle' method within some of the older CatTools device scripts in that function parameter signatures do not match the custom script samples.

                          For the Cisco.Router.general device type, you need to use:

                          • SendCommandSingle(CmdToSend, YesToConfirm, SuppressMess)

                          CmdToSend is the command textstring

                          YesToConfirm is 1 or 0 (1 will send answer 'yes' to Yes/No type prompts)

                          SuppressMess is 1 or 0.  If SuppressMess is set to 0, then if an error message is detected in the device response, then you will see the following warning message:

                          • The following command caused an error: [CmdToSend]"

                          Hope this helps!
                          Steve