Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-29-2018, 08:28 AM
SchwabenGeiz SchwabenGeiz is offline
Registered User
 
Join Date: Aug 2017
Posts: 8
Modify the Cisco-SaveDeviceConfigToFile.py

Hi!

How could I modify the Cisco-SaveDeviceConfigToFile.py script to use "show running-config all", because it would be more suitable for me?

Consider I don't have any clue about Python...

Thanks in advance!
Reply With Quote
  #2  
Old 03-29-2018, 02:28 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi SchwabenGeiz,

I think you will need to alter line 266:

Code:
        strCmd = "show " + g_strConfigToSave + "-config\r"
to:

Code:
        strCmd = "show " + g_strConfigToSave + "-config all\r"
The script author is not available today but he will post a correction if I got it wrong (and sorry if I did).
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 04-03-2018, 07:48 AM
SchwabenGeiz SchwabenGeiz is offline
Registered User
 
Join Date: Aug 2017
Posts: 8
Quote:
Originally Posted by bgagnon View Post
Hi SchwabenGeiz,

I think you will need to alter line 266:

Code:
        strCmd = "show " + g_strConfigToSave + "-config\r"
to:

Code:
        strCmd = "show " + g_strConfigToSave + "-config all\r"
The script author is not available today but he will post a correction if I got it wrong (and sorry if I did).
Hi bgagnon,

thanks for your reply!

I have tried it out, but I can not save the config as file, because the dialogue isn't showing and I need to cancel the script manually.

Do you have an idea why? Jake, could you please help?

Thank you in advance!
Reply With Quote
  #4  
Old 04-03-2018, 08:20 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi SchwabenGeiz,

What dialog is not showing?
Quote:
I have tried it out, but I can not save the config as file, because the dialogue isn't showing and I need to cancel the script manually.
Are you referring to the Browse() function?

What error do you get when you choose Cancel from the Script menu?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 04-06-2018, 12:46 AM
SchwabenGeiz SchwabenGeiz is offline
Registered User
 
Join Date: Aug 2017
Posts: 8
Arrow

Quote:
Originally Posted by bgagnon View Post
What dialog is not showing?
The Choose where to save your running-config dialog is not popping up.

Quote:
Originally Posted by bgagnon View Post
Are you referring to the Browse() function?
I'm not reffering to anything within the Python code, because I do not have a clue about it

Quote:
Originally Posted by bgagnon View Post
What error do you get when you choose Cancel from the Script menu?
Firstly, the listed running-config is not ending with term len 38 and term width 185 like usually when I'm using the script.

After cancelling the script manually, there is error message:
Script Cancelled
File:
C:\Users...
Line: 270




Thank you in advance!

Last edited by SchwabenGeiz; 04-06-2018 at 01:19 AM. Reason: Image not showing
Reply With Quote
  #6  
Old 04-06-2018, 07:51 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi SchwabenGeiz,

So that is this line:
Code:
            objTab.Screen.WaitForString("Current configuration : ")
When you do this manually, after running the command show running-config all, what do the last lines of output look like?

That's what you will want to change the WaitForString() to.

The line following is used to mark the end of info that is not written to the file:
Code:
            nBytes = objTab.Screen.ReadString(" bytes\r\n")
If, because you are showing all the configs, you want to capture everything to the file from the time you run the show command until the resulting output is done, then you might just comment out that entire block from line 269 to 278.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #7  
Old 04-06-2018, 11:31 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi SchwabenGeiz,

There have been some updates made to the original script here that should help you accomplish your objective.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #8  
Old 04-09-2018, 03:06 AM
SchwabenGeiz SchwabenGeiz is offline
Registered User
 
Join Date: Aug 2017
Posts: 8
Hi bgagnon,

it's working as a charm right now!

The script looks like this right now (line 269+270):
Code:
        if g_strConfigToSave == "running":
            objTab.Screen.WaitForString("Current configuration with default configurations exposed : ")
Everything else remained unchanged.

Of course I will try the new version with additional arguments.
Thanks for your help!
Reply With Quote
Reply

Tags
python , script

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 06:15 AM.