Config Export for XRv
Moderator: mike
-
- Posts: 11
- Joined: Mon Apr 24, 2017 2:14 pm
Config Export for XRv
Forgive me if this has been asked before, but I didn't get any hits with the forum search.
I am trying to export configs for XRv appliances so that other users copying my lab will have the starting configs instead of the default base disk image.
I am getting an error saying that the config export is not supported. I assume this is some sort of limitation of the XRv appliance. However I wanted to double check and see if there's a way to get this to work like the IOS and NX-OS appliances.
Thanks!
I am trying to export configs for XRv appliances so that other users copying my lab will have the starting configs instead of the default base disk image.
I am getting an error saying that the config export is not supported. I assume this is some sort of limitation of the XRv appliance. However I wanted to double check and see if there's a way to get this to work like the IOS and NX-OS appliances.
Thanks!
-
- Posts: 5176
- Joined: Wed Mar 15, 2017 4:44 pm
- Location: London
- Contact:
Re: Config Export for XRv
you have re watch our video sir:
http://www.eve-ng.net/index.php/documen ... figuations
steps are:
1. load config in node and SAY WR !!!! (XR is commit)
2. do export cfg to startup
3. set node boot from exported
4. stop and WIPE node
your node will boot from exported cfg..
XRv is supported
http://www.eve-ng.net/index.php/documen ... figuations
steps are:
1. load config in node and SAY WR !!!! (XR is commit)
2. do export cfg to startup
3. set node boot from exported
4. stop and WIPE node
your node will boot from exported cfg..
XRv is supported
-
- Posts: 21
- Joined: Mon Mar 20, 2017 5:24 pm
Re: Config Export for XRv
I have the same issue with XRv and vMX nodes.
I have the nvram configuration on these nodes and when i'm trying to export it i get error - RR1: Failed to export config (16).
If i shutdown the nodes, do wipe and then "set nodes ctartup cfg to exported" they boot and configured correctly but i can do export cfg from vMX nodes just once (from second attempt Failed to export config (16) again) and can't do export cfg from XRv at all (Failed to export config (16)).
What i do wrong?
I have the nvram configuration on these nodes and when i'm trying to export it i get error - RR1: Failed to export config (16).
If i shutdown the nodes, do wipe and then "set nodes ctartup cfg to exported" they boot and configured correctly but i can do export cfg from vMX nodes just once (from second attempt Failed to export config (16) again) and can't do export cfg from XRv at all (Failed to export config (16)).
What i do wrong?
-
- Posts: 11
- Joined: Mon Apr 24, 2017 2:14 pm
Re: Config Export for XRv
UD,
Thank you for the quick reply! I was out of pocket for a few days, but I watched the video and reattempted the export on the XRv devices. I am still having an issue with this. Here are some more details.
With an XRv appliance selected, I choose the export config option. I get a notification saying the export has started. If I have a console open on the device, I see a "show running-config" command is issued to dump the config, then after a short period of time, the console gets a "quit" command to drop back to the initial console login. The notification that comes back on the EVE web console is the "(Failed to export config (16))" error.
I have installed this as bare metal, so perhaps this is an issue related to that. I wonder if there's a particular log file I need to look at for more clues. Since the config is actually getting dumped on the console of the appliance, I am suspicious that there may be a permission issue writing to wherever the exported configurations are saved.
I have no problem with exporting configurations on IOS or NX-OS appliances.
Thanks again!
Thank you for the quick reply! I was out of pocket for a few days, but I watched the video and reattempted the export on the XRv devices. I am still having an issue with this. Here are some more details.
With an XRv appliance selected, I choose the export config option. I get a notification saying the export has started. If I have a console open on the device, I see a "show running-config" command is issued to dump the config, then after a short period of time, the console gets a "quit" command to drop back to the initial console login. The notification that comes back on the EVE web console is the "(Failed to export config (16))" error.
I have installed this as bare metal, so perhaps this is an issue related to that. I wonder if there's a particular log file I need to look at for more clues. Since the config is actually getting dumped on the console of the appliance, I am suspicious that there may be a permission issue writing to wherever the exported configurations are saved.
I have no problem with exporting configurations on IOS or NX-OS appliances.
Thanks again!
-
- Posts: 11
- Joined: Mon Apr 24, 2017 2:14 pm
Re: Config Export for XRv
Actually, I was able to do a bit of digging and found this in the unl_wrapper.txt log.
Based on my reading of the log, it's waiting for the keyword "end" in the output of the "show running-config". I do see the word "end" printed on the console if I'm monitoring it while I export the config. I watched the /tmp/ directory where the script was dumping the file, but I never saw that file created in that folder.
I hope this helps provide some insight into the issue I'm seeing. Thank you for your time and assistance!
Code: Select all
May 02 21:08:13 INFO: exporting /opt/unetlab/scripts/config_xrv.py -a get -p 32899 -f /tmp/unl_cfg_3_DpCyE0 -t 15
May 02 21:08:13 ERROR: Failed to export (80060).
May 02 21:08:13 ERROR: error waiting for "end" marker.
ERROR: failed to retrieve config.
May 02 21:08:13 May 02 21:08:13 ERROR: Failed to export config (16).
I hope this helps provide some insight into the issue I'm seeing. Thank you for your time and assistance!
-
- Posts: 11
- Joined: Mon Apr 24, 2017 2:14 pm
Re: Config Export for XRv
I've done some more troubleshooting. Here's what I found.
If I start out with an XRv appliance with a minimal config, I can export it as expected. I kept adding additional configuration until I ran into the same export error. What I found is if I have a configuration that displays with no exclamation point between "end" and the previous line, then it breaks.
Working Example
Broken Example
I'm not a coder by any means, but I think I pinpointed the location in the phython code in the Git repository where this breaks. It looks like it's line 198 in the config_xrv.py file (part of the config_get function).
I went ahead and edited this file on my server to drop the exclamation point from the regex, and now all my XRv appliances are exporting the config successfully. I don't know how to submit this as a bug, but hopefully the correct people will see this post and respond accordingly.
I don't know if it's of any benefit, but I've been getting used to displaying the running config on these devices via "show running-config formal" to display the fully qualified commands (for most of it anyway). I think it helps since console buffering issues don't lead to commands being entered in the incorrect context. Just a thought in case this might be useful from a scripting perspective.
If I start out with an XRv appliance with a minimal config, I can export it as expected. I kept adding additional configuration until I ran into the same export error. What I found is if I have a configuration that displays with no exclamation point between "end" and the previous line, then it breaks.
Working Example
Code: Select all
RP/0/0/CPU0:ios(config)#do show run
Thu May 4 19:10:43.063 UTC
Building configuration...
!! IOS XR Configuration 5.3.3
!! Last configuration change at Thu May 4 19:10:07 2017 by ios
!
interface GigabitEthernet0/0/0/0
ipv4 address 10.10.10.10 255.255.255.0
shutdown
!
end
Code: Select all
RP/0/0/CPU0:ios(config)#do show run
Thu May 4 19:10:53.712 UTC
Building configuration...
!! IOS XR Configuration 5.3.3
!! Last configuration change at Thu May 4 19:10:47 2017 by ios
!
interface GigabitEthernet0/0/0/0
ipv4 address 10.10.10.10 255.255.255.0
shutdown
!
ssh server v2
end
Code: Select all
# Getting the config
handler.sendline('show running-config')
try:
handler.expect('!\r\nend\r\n', timeout = longtimeout)
except:
print('ERROR: error waiting for "end" marker.')
node_quit(handler)
return False
config = handler.before.decode()
I don't know if it's of any benefit, but I've been getting used to displaying the running config on these devices via "show running-config formal" to display the fully qualified commands (for most of it anyway). I think it helps since console buffering issues don't lead to commands being entered in the incorrect context. Just a thought in case this might be useful from a scripting perspective.
-
- Posts: 21
- Joined: Mon Mar 20, 2017 5:24 pm
Re: Config Export for XRv
Could you pls show how exactly did you edit the script? I'm totally 0 in python and programming.
And btw did you face with saving cfg's on vMX nodes? How to sovle it? Thank you
And btw did you face with saving cfg's on vMX nodes? How to sovle it? Thank you
-
- Posts: 11
- Joined: Mon Apr 24, 2017 2:14 pm
Re: Config Export for XRv
horseinthesky,
I don't have any Juniper appliances loaded up at the moment. It might be awhile before I could give that a try.
As far as the XRv export issue, did you confirm that the "end" keyword appears in the running config without an exclamation point in the preceding line?
As far as editing the script I'd advise you to proceed at your own risk, but so far I'm happy with the results myself. It might be advisable to back up the file prior to trying to making any manual changes. I could probably come up with a one line bash script that would do this, but I'll describe manual process in case there are an differences in the scripts on your server compared to what I have running.
1. Open the script located at "/opt/unetlab/scripts/config_xrv.py" with whatever editor you prefer. Find the following section.
2. Simply delete the exclamation point in line 198 so it looks like the section below and save the file.
Config exports started working for the appliances where I had a configuration where there was no exclamation point in the line preceding "end".
I don't have any Juniper appliances loaded up at the moment. It might be awhile before I could give that a try.
As far as the XRv export issue, did you confirm that the "end" keyword appears in the running config without an exclamation point in the preceding line?
As far as editing the script I'd advise you to proceed at your own risk, but so far I'm happy with the results myself. It might be advisable to back up the file prior to trying to making any manual changes. I could probably come up with a one line bash script that would do this, but I'll describe manual process in case there are an differences in the scripts on your server compared to what I have running.
1. Open the script located at "/opt/unetlab/scripts/config_xrv.py" with whatever editor you prefer. Find the following section.
Code: Select all
195 # Getting the config
196 handler.sendline('show running-config')
197 try:
198 handler.expect('!\r\nend\r\n', timeout = longtimeout)
Code: Select all
195 # Getting the config
196 handler.sendline('show running-config')
197 try:
198 handler.expect('\r\nend\r\n', timeout = longtimeout)
-
- Posts: 21
- Joined: Mon Mar 20, 2017 5:24 pm
Re: Config Export for XRv
Yes!
Fixed XRv script works perfectly fine now.
And i also fixed vMX. It was timeout issue cuz of the script was waiting for
try:
handler.expect(['root>', 'root@.*>'], timeout = longtimeout)
And i was using custom username. Thank you! Now every node export works =)
Fixed XRv script works perfectly fine now.
And i also fixed vMX. It was timeout issue cuz of the script was waiting for
try:
handler.expect(['root>', 'root@.*>'], timeout = longtimeout)
And i was using custom username. Thank you! Now every node export works =)