Earlier, I had written a blog on Cisco UCS automation using Python SDK. At that time, I used real UCS system to test my scripts. Cisco UCS PE(Platform Emulator) emulates UCSM(UCS Manager) software and we can run this as a VM. Different types of hardware(Fabric Interconnect, FEX/IOM, Servers, adapters, power supply) can be added to create a complex UCS system. We can do majority of the configurations and can trigger different conditions to see how UCSM reacts. Obviously, traffic related testing cannot be done with this. For scripting, UCS PE is a perfect solution. In this blog, I will cover what I did to get UCS PE up and running.
VMWare Player 6.05 running on Windows 7.
Download the PE zip files. I used version 2.2(3a). Unzip them and import into VMplayer. Choose the default configurations, 3 NAT interfaces are created by default.
- 2 types of login are provided. 1 login is with “config”, “config” which is used to change PE settings like HA, DB change etc. 2nd login is with “cliuser”, “cliuser” which is used for UCSM cli.
- Emulator settings and UCSM GUI can also be accessed from the browser by pointing the browser to 1 of the 3 NAT interfaces IP address.
- “connect local-mgmt” and “connect nxos” are not supported. Only 1 CLI session can be opened.
- Before starting the UCSM session, we need to setup the inventory. The inventory can include different types of servers(including blade and rack), adapters, power supply, fan etc. We can also choose the inventory from templates so that we dont have to add each component seperately. I had some intermittent issue with UCSM not showing the inventory I selected from emulator, not clear about it.
Connecting to Emulator using Python SDK:
After setting up the inventory, restarting the emulator, I connected to the PE from UCSM. I used my simple inventory script to check if I am able to talk to the PE properly. Following is the successful script execution output.
C:\sreeni\general\controller\devops\devops>python getUcsProp_newsdk.py -i 192.168.241.132 -u <username> -p <password> hamode cluster ethmode end-host version 2.2(3a) fia-model UCS-FI-6248UP fib-model UCS-FI-6248UP Blade chassis: N20-C6508 Blade servers: UCSB-B200-M3 UCSB-B200-M3 UCSB-B200-M3 UCSB-B200-M3 Rack servers: UCSC-C240-M3S UCSC-C240-M3S UCSC-C240-M3S UCSC-C240-M3S
Before executing the script, Python UCS sdk 0.8.3 needs to be installed and PATH needs to be setup correctly. I have installed the sdk both in Linux as well as Windows.