cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
9486
Views
17
Helpful
4
Comments
dsoper
Cisco Employee
Cisco Employee

Here is a brief introduction to the new 3.1(1ePE1) UCS Platform Emulator showing how to perform backup and restore(import) of the current UCSM configuration.  Backup/restore of the configuration is a good practice in general and is necessary with the new Platform Emulator since UCSM configuration state is lost on Platform Emulator resets.

 

The UCSM GUI, CLI, PowerTool for UCS, and/or the PythonSDK can be used to perform backup/restore operations.  This video uses the PythonSDK, which is in beta and currently available on GitHub.

 

Backup operations in the video are done with backup_ucs().  Here's a code snippet:

 

from ucsmsdk import ucshandle

from ucsmsdk.utils.ucsbackup import backup_ucs

<snip>

        handle = ucshandle.UcsHandle(settings.ip, settings.user, settings.pw, secure=settings.secure)

        handle.login()

        fname = raw_input('Enter filename for backup (current directory): ')

        backup_ucs(handle, backup_type="config-all", file_dir="./", file_name=fname)

 

Restore (import) operations are done with import_ucs_backup():

 

from ucsmsdk import ucshandle

from ucsmsdk.utils.ucsbackup import import_ucs_backup

<snip>

        handle = ucshandle.UcsHandle(settings.ip, settings.user, settings.pw, secure=settings.secure)

        handle.login()

        fname = raw_input('Enter filename for import (current directory): ')

        import_ucs_backup(handle, file_dir="./", file_name=fname)

4 Comments
dpdatastrat
Level 1
Level 1

Why is the video so blurry expanded? Can you share the command to run using the ucsbackup.py file since the video is either too tiny to watch (visible text) or too blurry?

dsoper
Cisco Employee
Cisco Employee

Hi Dominic,

Sorry about the poor video quality.  You can backup and import configs in the UCSM GUI, or using the script above the command line is the following:

python ucsbackup.py

Note that for the above command line to work, you will want to edit this line:

handle = ucshandle.UcsHandle(settings.ip, settings.user, settings.pw, secure=settings.secure)

to use the ip, username, and password of your emulator instance.  Here's an example:

handle = ucshandle.UcsHandle('10.0.1.100', 'ucspe', 'ucspe', secure=True)

Let me know of other questions.

CiscoAP
Cisco Employee
Cisco Employee

Great Script and procedure.  It works great.

Thanks for posting it!

Thank you.

dschelt
Level 1
Level 1

# I had to make some changes running RHEL 8.2 and Python3

# First, python directory did not exist. I had to make symlink:

sudo ln -s /usr/bin/python3.6 /usr/bin/python

#pip3 instead of pip

pip3 install ucsmsdk


To Backup:

python

from ucsmsdk import ucshandle

from ucsmsdk.utils.ucsbackup import backup_ucs

#replace n.n.n.n with your UCSPE VIP

handle = ucshandle.UcsHandle('n.n.n.n', 'ucspe', 'ucspe', secure=True)

handle.login()

# raw_input was depreciated

fname = input('Enter filename for backup (current directory): ')

#Enter filename at the prompt..

backup_ucs(handle, backup_type="config-all", file_dir="./", file_name=fname)

 


To restore:

python

from ucsmsdk import ucshandle

from ucsmsdk.utils.ucsbackup import import_ucs_backup

handle = ucshandle.UcsHandle('n.n.n.n', 'ucspe', 'ucspe', secure=True)

handle.login()

fname = input('Enter filename for import (current directory): ')

#Enter filename at the prompt..

import_ucs_backup(handle, file_dir="./", file_name=fname)

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: