Giter Site home page Giter Site logo

vesposito / easyucs Goto Github PK

View Code? Open in Web Editor NEW
37.0 9.0 15.0 45.21 MB

EasyUCS is a toolbox to help deploy, manage and document Cisco UCS devices

License: GNU General Public License v2.0

Python 24.63% CSS 11.05% JavaScript 63.96% HTML 0.36%
cisco ucs ucs-manager ucs-imc ucs-central python3 ucs-device

easyucs's Introduction

EasyUCS published

EasyUCS is a toolbox to help deploy and manage Cisco UCS/Intersight devices.

It can :

  • deploy a configuration on a running UCS device / Intersight instance:
    • UCS system (UCS Manager)
    • UCS IMC (Integrated Management Controller) for standalone servers
    • UCS Central
    • Intersight (SaaS or Appliance)
  • perform the initial setup of an "out of the box" UCS device (UCSM or CIMC)
  • reset the configuration of an UCS device before configuring it
  • fetch a configuration and export it in JSON format
  • fetch an inventory and export it in JSON format
  • perform maintenance actions on a UCS device (regenerate self-signed certificate, clear user sessions, clear SEL logs)
  • claim/unclaim UCS devices to/from Intersight
  • create pictures of equipment and infrastructure schemas
  • create Technical Architecture Documentation (TAD) in Word/PDF formats

Getting Started

These instructions will get you a copy of the project up and running on your local machine.

Prerequisites

Minimum versions of UCS devices :

  • UCS Manager: 3.2(1d) or above
  • UCS IMC: 3.0(1c) or above
  • UCS Central: 2.0(1a) or above
  • Intersight SaaS (no prerequisite) & Appliance: 1.0.9-675 or above

This tool requires Python 3.8+ to work. Python 2.x is not supported.

Python can be used on Windows, Linux/Unix, Mac OS X and more.

You can download the latest version of Python 3 on the official website.

Installing

EasyUCS can be installed using any of ways below:

From GitHub

Click "Clone or Download" and "Download ZIP" on the GitHub website to download the whole project.

Uncompress the zip and put the folder on your system.

From Git command line

You need to have Git on your system (not necessarily installed by default on all types of system).

Navigate to your desired path where you want EasyUCS to be placed on and clone it through your command-line console,

git clone https://github.com/vesposito/easyucs.git

Requirements

EasyUCS requires some Python modules dependencies. The file requirements.txt contains all of these requirements.

Use Python Pip to install all of them.

  • for Max OS X, Unix, Linux:
pip install -r requirements.txt
  • for Windows:
python -m pip install -r requirements.txt

Running EasyUCS

EasyUCS can be used with command line interface or via a Web GUI.

Using the Command-Line Interface (CLI)

Push config file config_ucsm.json to UCS system

python easyucs.py config push -t ucsm -i 192.168.0.1 -u admin -p password -f configs/config_ucsm.json

Push config file config_cimc.json to UCS IMC

python easyucs.py config push -t cimc -i 192.168.0.2 -u admin -p password -f configs/config_cimc.json

Perform initial setup of UCS system using DHCP IP addresses 192.168.0.11 & 192.168.0.12 and push config file config_ucsm.json

python easyucs.py config push -t ucsm -f configs/config_ucsm.json -s 192.168.0.11 192.168.0.12

Reset UCS system, perform initial setup using DHCP IP addresses 192.168.0.11 & 192.168.0.12 and push config file config_ucsm.json

python easyucs.py config push -t ucsm -i 192.168.0.1 -u admin -p password -f configs/config_ucsm.json -r -s 192.168.0.11 192.168.0.12

Fetch config from UCS system and save it to output/configs/config_ucsm.json

python easyucs.py config fetch -t ucsm -i 192.168.0.1 -u admin -p password -o output/configs/config_ucsm.json

Fetch inventory from UCS IMC and save it to output/inventories/inventory_cimc.json

python easyucs.py inventory fetch -t cimc -i 192.168.0.2 -u admin -p password -o output/inventories/inventory_cimc.json

Create schemas from UCS system and save them to output/schemas folder

python easyucs.py schemas create -t ucsm -i 192.168.0.1 -u admin -p password -o output/schemas

Create report from UCS system and save it to output/reports folder (also creates schemas)

python easyucs.py report generate -t ucsm -i 192.168.0.1 -u admin -p password -o output/reports

Regenerate expired Self-signed Certificate of UCS system

python easyucs.py device regenerate_certificate -t ucsm -i 192.168.0.1 -u admin -p password

Clear SEL Logs of all discovered servers of UCS system

python easyucs.py device clear_sel_logs -t ucsm -i 192.168.0.1 -u admin -p password

Clear Intersight Device Connector claim status for UCS system

python easyucs.py device clear_intersight_claim_status -t ucsm -i 192.168.0.1 -u admin -p password

Using the Web Graphical User Interface (GUI) / the API

The Web GUI is hosted by your machine, in order to launch it you need to use the file easyucs_api.py.

python easyucs_api.py

Built With

Versioning

0.9.8.9

  • Add support for subnet-level configuration for IP Pools in Intersight config
  • Add support for User Labels on Chassis & Domain Profiles in Intersight config
  • Add support for Physical NIC mode in Adapter Config Policy in Intersight config
  • Add support for Hybrid Slots configuration in Storage Policy in Intersight config
  • Add support for FlexMMC in Boot Policy in Intersight config
  • Bump up minimum Intersight Appliance required version to 1.0.9-675
  • Miscellaneous bug fixes and improvements

0.9.8.8

  • Add support for regenerating SSL certificates for UCSM & CIMC devices in CLI & GUI
  • Add support for cleaning an Intersight account (removes all pools, policies, profiles & templates) in GUI
  • Add support for UCS M7 servers with Emerald Rapids CPUs
  • Add support for VIC QinQ & SRIOV in Intersight config
  • Add support for UCSM custom OUI for FC configuration
  • Bump up minimum Intersight Appliance required version to 1.0.9-655
  • Miscellaneous bug fixes and improvements

0.9.8.7

  • Add support for Organization Sharing in Intersight config
  • Add support for X410c M7 & new VIC 15000 series adapters
  • Bump up minimum Intersight Appliance required version to 1.0.9-631
  • Miscellaneous bug fixes and improvements

0.9.8.6

  • Add support for HTTP boot, Simple Placement mode for VIC 1300 in Intersight config
  • Add support for Fabric Port-Channel vHBA Reset in UCSM & Intersight config
  • Add support for BIOS Tokens up to UCS Central 2.0(1t)
  • Add support for XFM inventory/draw & Server Personality in UCSM inventory
  • Bump up minimum Intersight Appliance required version to 1.0.9-615
  • Prevent fetching Intersight config with Shared Orgs (not yet supported)
  • Miscellaneous bug fixes and improvements

0.9.8.5

Sorry for the delay in updating this tool! We were busy working on the IMM Transition Tool which uses EasyUCS as its backend.

  • HUGE rework of many parts of EasyUCS. It would be too long to list them all here!
    This also means that there are a few breaking changes in the JSON format for UCSM files. Sorry about this!
  • Fully redesigned & dynamic GUI
  • Repository backend for multi-device management (used by the GUI)
  • EasyUCS also now has an OpenAPI-based API (used by the GUI) to easily automate your tasks
  • Add support for UCS Central config fetch/push of most policies/profiles/templates/pools. UCS Central is now a first class citizen in EasyUCS.
  • Add support for Intersight config fetch/push of all Server/Chassis/Domain policies/profiles/templates/pools. You can now use EasyUCS for Intersight Managed servers! (Standalone & FI-Attached)
  • Add support for M6, M7 & X-Series (UCSM) in the schemas generation as well as the report.
  • Add support for generating reports in PDF format (on top of Word format)
  • Add support for BIOS Tokens up to UCSM 4.3(2b)
  • Add support for (un)claiming CIMC/UCSM devices to Intersight using the API/GUI
  • Add support for taking backups using the API/GUI (for UCSM and UCS Central)

0.9.7.6

  • Fix CIMC push of Admin Networking config section

0.9.7.5

  • Add support for SNMP users/traps & Syslog in CIMC config
  • Update SDK requirements to fix compatibility issues

0.9.7.4

  • Add inventory of PCIe risers for rack servers
  • Cleanup of all catalog files
  • Add flag for Intersight Managed Mode support status per equipment in UCSM inventory
  • Add support for UCS C240 M5SD
  • Add support for BIOS Tokens up to UCSM 4.1(3a)
  • Add inventory of memory errors per DIMM in UCSM inventory
  • Miscellaneous bug fixes and improvements

0.9.7.3

  • Add support for Authentication (Native & Authentication Domains) in UCSM config
  • Move Intersight Device Connector config to common structure between UCSM & IMC
  • Add missing "Storage Config. Deployment Policy" attribute in Maintenance Policies in UCSM config
  • Other small bug fixes and improvements

0.9.7.2

  • Add support for Intersight Device Connector in inventory & config for UCSM & IMC
  • Add Device Connector section in UCSM & IMC report
  • Add support for clearing Intersight Claim Status for UCSM & IMC Device Connector
  • Miscellaneous bug fixes

0.9.7

  • Add device actions in CLI ("regenerate_certificate", "clear_sel_logs", "clear_user_sessions")
  • Add "Policies" section in UCSM report with Server Policies (Boot, BIOS, Local Disk Config, Scrub, etc.)
  • Add support for System Profile & Policies settings in UCS Central config (Interfaces, DNS, Date&Time, Remote Access, Syslog)
  • Add support for System Profile & Policies settings in Domain Groups in UCS Central config (DNS, Date&Time, Remote Access, Equipment Policies, Syslog)
  • Add support for User Settings in UCS Central config (Password Profile, Local Users, Roles & Locales)
  • Add support for User Settings in Domain Groups in UCS Central config (Roles & Locales)
  • Add support for SNMP settings in UCS Central config & Domain Groups
  • Add support for Syslog & Global Fault Policy settings in UCSM config
  • Add support for Azure Stack environments
  • Add support for C4200 in UCSM report
  • Add inventory of HBA adapters in IMC inventory
  • Major reorganization of report code
  • Multiple bug fixes and improvements

0.9.6

  • Add support for UCSM 4.1(1) specific features (FI 64108 & Unified Ports, Fan Control Policy, new BIOS Tokens, Writable vMedia Mount)
  • Add support for fetching Reserved VLAN Start ID for FI 6400 (push is planned for a future release)
  • Add VLAN Port Count information in inventory and report
  • Add IMC S3260 I/O Expander in inventory
  • Add SSD stats in inventory when available
  • Memory consumption optimization for schemas generation
  • Multiple bug fixes and improvements

0.9.5

  • Add support for UCSM 4.0(4) specific features (M.2 HWRAID, Persistent Memory Policies, Alternate KVM Port)
  • Add support for configuring up to 16 Unified Ports on FI 6454
  • Add support for VSANs on UCS Central
  • Add preliminary support for upcoming FI 64108
  • Reorganization of device, config and inventory folders to clean up files
  • Bump up requirements packages versions
  • Miscellaneous bug fixes and improvements (including fix for missing dependency on tkinter package)

0.9.4

  • Add support for "comment" field in all sections of a configuration file for easily add comments to specific items of a configuration
  • Add support for Fabric Interconnect port licenses in inventory and report
  • Add support for 1st Gen Fabric Interconnects 6120XP/6140XP
  • Add support for UCS Central inventory fetch (will fetch inventories of all registered domains)
  • Support up to 32 Service Profile Templates when generating schemas
  • Bump up requirements packages versions
  • Miscellaneous bug fixes and improvements

0.9.3

  • Include Storage Enclosures & drives of S3260 in report
  • Add support for UEFI Boot Parameters in SAN Boot (Boot Policies)
  • Remove admin password from report (for security reasons)
  • Change "generate report" command argument to specify directory instead of report file name. All required files will be written in that directory
  • Automatically export config & inventory to JSON files when generating report
  • Lots of bug fixes and improvements

0.9.2

  • Include portions of Logical Configuration in Technical Architecture Documentation, including Networking, Organizations, Identities and Service Profiles
  • Add support for Dynamic vNIC Connection Policies in UCS Manager
  • Add preliminary support for S3260 in IMC for config fetch/push - works for single server node only for now
  • Add support for C4200 and C125 server node
  • Various bug fixes and improvements

0.9.1

  • Add automatic Technical Architecture Documentation creation (containing detailed inventory and architecture schemas)
  • Add support for LAN & SAN Global Policies in UCS Manager (VLAN Port Count Optimization, VLAN Org Permissions, Inband Profile)
  • Rework of NVMe drives support in inventory (now displayed in its own nvme_drives section instead of being in storage_controllers)
  • Add support for IOM 2408, HXAF220C All NVMe, C480 M5 ML
  • Various bug fixes and improvements

0.9.0

Initial release

Authors

Contributors

  • Shashank Pandey - Repository, DB, API, Intersight, ... - github account link
  • Valentin Pereira - Redesigned GUI - github account link
  • Mohamed Ismayil - Intersight support
  • Syeda Mehar Naseer - UCS Central/Manager & Intersight support
  • Anjana Devi Chilukuri - UCS Central/Manager & Intersight support
  • Ananta Surendra Babu - UCS Central/Manager & Intersight support
  • Simon Mathai - UCS Central/Manager & Intersight support
  • Kistareddy Gari Sreelatha - UCS Central/Manager & Intersight support
  • Tony Frank - PDF reporting
  • Prabhu Ganesh - Various enhancements
  • Rushab Mohanlal Jain - Various enhancements
  • Abhinav Sinha - Various enhancements
  • Jayasree Vulavala - Various enhancements

License

This project is licensed under the GPLv2 License - see the LICENSE file for details

easyucs's People

Contributors

franck-bonneau avatar pvarga avatar vesposito avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

easyucs's Issues

Error gathering memory error stats on UCSPE

Trying to gather a report from a UCSPE (Platform Emulator) instance. It appears to be failing at gathering memory DIMM error stats.
This works correctly on a proper physical UCS-M instance.

I saw:

  • Add inventory of memory errors per DIMM in UCSM inventory

is a new feature in 9.7.4. Bug perhaps?

goldel@L011124:~/git/easyucs$ python3 easyucs.py report generate -t ucsm -i 10.33.114.108 -u XXX -p YYY -o reports

EasyUCS 0.9.7.4 created by Marc Abu El Ghait, Franck Bonneau and Vincent Esposito, Copyright 2016-2021, Cisco

2021-03-10 12:52:20,082 :: INFO :: 10.33.114.108 :: device.py :: in connect :: Trying to connect to UCS System: 10.33.114.108
2021-03-10 12:52:20,520 :: INFO :: 10.33.114.108 :: device.py :: in connect :: Connected to UCSPE-10-33-114-108 running version 4.1(2c)
2021-03-10 12:52:20,521 :: WARNING :: 10.33.114.108 :: device.py :: in connect :: Version 4.1(2c) running is not yet supported by ucsmsdk!
2021-03-10 12:52:20,543 :: INFO :: 10.33.114.108 :: manager.py :: in fetch_config :: Fetching config from live device (can take several minutes)
2021-03-10 12:53:17,287 :: WARNING :: 10.33.114.108 :: admin.py :: in init :: Password of SEL Policy can't be exported
2021-03-10 12:53:17,288 :: WARNING :: 10.33.114.108 :: admin.py :: in init :: Password of Local User admin can't be exported
2021-03-10 12:53:17,594 :: INFO :: 10.33.114.108 :: manager.py :: in fetch_config :: Finished fetching config with UUID 2d2c6bf0-7b32-4dc7-9d3c-3954e45e2306 from live device
2021-03-10 12:53:17,612 :: INFO :: 10.33.114.108 :: manager.py :: in fetch_inventory :: Fetching inventory from live device (can take several minutes)
2021-03-10 12:53:34,750 :: WARNING :: 10.33.114.108 :: manager.py :: in fetch_inventory :: Info Policy is disabled. No neighbors can be found
2021-03-10 12:53:34,833 :: INFO :: 10.33.114.108 :: memory.py :: in _find_corresponding_memory_error_stats :: Error stats of memory with id 1 for server 1 are not available.
2021-03-10 12:53:34,836 :: INFO :: 10.33.114.108 :: memory.py :: in _find_corresponding_memory_error_stats :: Error stats of memory with id 2 for server 1 are not available.
2021-03-10 12:53:34,840 :: INFO :: 10.33.114.108 :: memory.py :: in _find_corresponding_memory_error_stats :: Error stats of memory with id 3 for server 1 are not available.
2021-03-10 12:53:34,844 :: INFO :: 10.33.114.108 :: memory.py :: in _find_corresponding_memory_error_stats :: Error stats of memory with id 4 for server 1 are not available.
2021-03-10 12:53:34,911 :: INFO :: 10.33.114.108 :: memory.py :: in _find_corresponding_memory_error_stats :: Error stats of memory with id 1 for server 1 are not available.
2021-03-10 12:53:34,915 :: INFO :: 10.33.114.108 :: memory.py :: in _find_corresponding_memory_error_stats :: Error stats of memory with id 2 for server 1 are not available.
2021-03-10 12:53:34,919 :: INFO :: 10.33.114.108 :: memory.py :: in _find_corresponding_memory_error_stats :: Error stats of memory with id 3 for server 1 are not available.
2021-03-10 12:53:34,923 :: INFO :: 10.33.114.108 :: memory.py :: in _find_corresponding_memory_error_stats :: Error stats of memory with id 4 for server 1 are not available.
Traceback (most recent call last):
File "easyucs.py", line 813, in
main()
File "easyucs.py", line 806, in main
init_process(ucs_device, args, json_string)
File "easyucs.py", line 319, in init_process
ucs_device.inventory_manager.fetch_inventory()
File "/home/goldel/git/easyucs/inventory/ucs/manager.py", line 348, in fetch_inventory
inventory.chassis.append(UcsSystemChassis(parent=inventory, equipment_chassis=equipment_chassis))
File "/home/goldel/git/easyucs/inventory/ucs/chassis.py", line 172, in init
self.blades = self._get_blades()
File "/home/goldel/git/easyucs/inventory/ucs/chassis.py", line 274, in _get_blades
return self._inventory.get_inventory_objects_under_dn(dn=self.dn, object_class=UcsSystemBlade, parent=self)
File "/home/goldel/git/easyucs/inventory/ucs/inventory.py", line 142, in get_inventory_objects_under_dn
easyucs_objects_list.append(object_class(parent, sdk_object))
File "/home/goldel/git/easyucs/inventory/ucs/blade.py", line 128, in init
UcsBlade.init(self, parent=parent, compute_blade=compute_blade)
File "/home/goldel/git/easyucs/inventory/ucs/blade.py", line 36, in init
self.memory_arrays = self._get_memory_arrays()
File "/home/goldel/git/easyucs/inventory/ucs/blade.py", line 239, in _get_memory_arrays
parent=self)
File "/home/goldel/git/easyucs/inventory/ucs/inventory.py", line 142, in get_inventory_objects_under_dn
easyucs_objects_list.append(object_class(parent, sdk_object))
File "/home/goldel/git/easyucs/inventory/ucs/memory.py", line 31, in init
UcsMemoryArray.init(self, parent=parent, memory_array=memory_array)
File "/home/goldel/git/easyucs/inventory/ucs/memory.py", line 23, in init
self.memory_units = self._get_memory_units()
File "/home/goldel/git/easyucs/inventory/ucs/memory.py", line 42, in _get_memory_units
parent=self)
File "/home/goldel/git/easyucs/inventory/ucs/inventory.py", line 142, in get_inventory_objects_under_dn
easyucs_objects_list.append(object_class(parent, sdk_object))
File "/home/goldel/git/easyucs/inventory/ucs/memory.py", line 146, in init
error_stats = self._find_corresponding_memory_error_stats()
File "/home/goldel/git/easyucs/inventory/ucs/memory.py", line 174, in _find_corresponding_memory_error_stats
self.dn + " of model "" + self.model + "" with ID " + self.id)
TypeError: must be str, not NoneType

Missing catalog files for UCSB-200-M6

Since the last time the catalog was updated Cisco has released a new version of the UCSB 200 blade which is already in use has come out, but the repository is missing the UCSB-200-M6.json file to properly identify and inventory the blade.

Right now I am attempting to use a modified M5 definition, but official support for the blade would obviously be preferred

Don't force system virtual_ips change.

We do base ip setup before using easyucs.
And we want to avoid any risk of touching IP config.

+++ b/schema/ucs/ucsm/config/system.json
@@ -44,20 +44,5 @@
          "default":""
       }
    },
-   "required":[
-      "name"
-   ],
-   "anyOf":[
-      {
-         "required":[
-            "virtual_ip"
-         ]
-      },
-      {
-         "required":[
-            "virtual_ipv6"
-         ]
-      }
-   ],
    "additionalProperties":false
 }

Syslog Configuration not present and intersight status

Hi, great work on this tool! I have been testing it and thinking of several ways this can be used.

I had a couple of items that I wanted to bring up:

  1. I was going through the configuration file and I noticed syslog configuration was not present. Could this be added?

  2. I also noticed the intersight_status was not accurate for some sites (all running the same code). Some status for claimed devices showed as unclaimed or unknown but they were claimed. Could you also show the access-mode (Read-only, Allow Control)?

C++ Not recognized when using requrements.txt under msvc.py

I keep getting the following error out of the build wheel for the script.

Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module> main() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\MikeErnst\AppData\Local\Temp\pip-build-env-gzwa1pa5\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\MikeErnst\AppData\Local\Temp\pip-build-env-gzwa1pa5\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires self.run_setup() File "C:\Users\MikeErnst\AppData\Local\Temp\pip-build-env-gzwa1pa5\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup super().run_setup(setup_script=setup_script) File "C:\Users\MikeErnst\AppData\Local\Temp\pip-build-env-gzwa1pa5\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup exec(code, locals()) File "<string>", line 126, in <module> File "<string>", line 105, in uses_msvc File "C:\Users\MikeErnst\AppData\Local\Temp\pip-build-env-gzwa1pa5\overlay\Lib\site-packages\setuptools\_distutils\command\config.py", line 220, in try_compile self._compile(body, headers, include_dirs, lang) File "C:\Users\MikeErnst\AppData\Local\Temp\pip-build-env-gzwa1pa5\overlay\Lib\site-packages\setuptools\_distutils\command\config.py", line 132, in _compile self.compiler.compile([src], include_dirs=include_dirs) File "C:\Users\MikeErnst\AppData\Local\Temp\pip-build-env-gzwa1pa5\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 343, in compile self.initialize() File "C:\Users\MikeErnst\AppData\Local\Temp\pip-build-env-gzwa1pa5\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 253, in initialize vc_env = _get_vc_env(plat_spec) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\MikeErnst\AppData\Local\Temp\pip-build-env-gzwa1pa5\overlay\Lib\site-packages\setuptools\msvc.py", line 230, in msvc14_get_vc_env return _msvc14_get_vc_env(plat_spec) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\MikeErnst\AppData\Local\Temp\pip-build-env-gzwa1pa5\overlay\Lib\site-packages\setuptools\msvc.py", line 187, in _msvc14_get_vc_env raise distutils.errors.DistutilsPlatformError("Unable to find vcvarsall.bat") distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

Notes:
Windows 11
Using VSCode in administrator mode
Git installed
Python installed
C++ 14.0 installed via Build Tools

Should I modify something to allow this to continue?

Thanks!

Make callable from Python

Hello!

I am looking into calling EasyUCS from a Python module. Ideally, this would look like the existing easyucs.py script decomposed into a handful of functions that validate their arguments like the current argparse ones are validated.

This is a reasonably tall order, of course, and demands some pretty major restructuring. I think the pieces are these:

  1. Make EasyUCS into a package that can be installed with distutils/pip, so that it can be imported sanely.
  2. Adjust the easyucs.py and easyucs_gui.py tooling and documentation to be invoked as Python modules, so that both the new distutils/pip install and the existing "invoke from the current working directory" methods work as expected
    • (This would look like python -m easyucs.easyucs <cmdline_arguments> or python -m easyucs.easyucs_gui <cmdline_arguments>. Perhaps easyucs and easyucs_gui scripts could be installed to make those invocations easier.)
  3. Move the program logic and input validation in easyucs.py into one or a few high-level functions elsewhere in the package that easyucs.py can then import, and call after parsing its arguments like today.

I will submit a pull request soon that addresses most of points 1 and 2, but would appreciate your (@vesposito) input.

Missing dependency: tkinter

Installing EasyUCS on a fresh CentOS 7 host and then invoking easyucs.py yields

ModuleNotFoundError: No module named 'tkinter'

It looks like tkinter isn't available through the normal Pip installation route, though I'm not quite clear on why. I was able to resolve it on CentOS 7 by installing python3-tkinter.

Bug: AttributeError: 'ImageDraw' object has no attribute 'textsize'

I am running in an AttributeError everytime I try to generate a report:
python easyucs.py report generate -t ucsm -i 10.0.0.1 -u admin -p C1sco4L1fe -o output/reports

MacOS: 14.0 (23A344)
EasyUCS: 0.9.8.5
Python (venv): 3.8.16, 3.10.6
UCS Manager: 4.2(2d), 4.2(2aS9)

2023-09-27 13:38:59,693 :: INFO :: 10.0.0.1:: manager.py :: in export_inventory :: Exporting inventory 668d2f79-bd06-4859-9cf2-1eb34e9543590 to file: output/reports/inventory_10.0.0.1.json
2023-09-27 13:38:59,707 :: INFO :: 10.0.0.1:: manager.py :: in export_config :: Exporting config 57191a45-f95e-49c0-ad91-1eb34e9543590 to file: output/reports/config_10.0.0.1.json
Traceback (most recent call last):
  File "easyucs.py", line 883, in <module>
    main()
  File "easyucs.py", line 876, in main
    init_process(device, args, json_string)
  File "easyucs.py", line 336, in init_process
    device.inventory_manager.draw_inventory()
  File "/Users/max/git/easyucs/inventory/ucs/manager.py", line 137, in draw_inventory
    UcsSystemDrawInfraServiceProfile(draw_chassis_front_list=chassis_front_draw_list,
  File "/Users/max/git/easyucs/draw/ucs/service_profile.py", line 90, in __init__
    self.font_size_name = self._max_length_sp_name()
  File "/Users/max/git/easyucs/draw/ucs/service_profile.py", line 228, in _max_length_sp_name
    while self.draw.textsize(max_name, font=font)[0] > min_length_equipment:
AttributeError: 'ImageDraw' object has no attribute 'textsize'

I've tried multiple UCS-Manager instances with different versions.
I've tried multiple python versions.

Validation of "vlan" name in lan connectivity policy is too short.

If a "vlan" has a name longer than 16 characters and is referenced within a lan connectivity policy, the validation will throw an error because the lan connectivity policy is expecting a vlan name no longer than 16 characters. I'll be submitting a PR to adjust the length to match the validation of the underlying vlan object.

pyparsing deprecated attribute

I noticed while using easyucs for the first time ever that it would not run:

2021-12-20 15:25:02,465 :: INFO :: 10.96.111.27 :: device.py :: in connect :: Trying to connect to UCS System: 10.96.111.27
2021-12-20 15:25:03,429 :: ERROR :: 10.96.111.27 :: device.py :: in connect :: Error while trying to connect to UCS System: 10.96.111.27: module 'pyparsing' has no attribute 'operatorPrecedence'
2021-12-20 15:25:03,431 :: ERROR :: 10.96.111.27 :: easyucs.py :: in init_process :: Impossible to connect to UCS device

When I installed the requirements with pip it automatically picked the lastest version of pyparser.

As a workaround I added pyparsing<3.0.0 to the requirements.txt and then easyucs worked.

error when trying to generate report

hi

i am trying to generate a report and get the below:-

Traceback (most recent call last):
File "easyucs.py", line 775, in
main()
File "easyucs.py", line 768, in main
init_process(ucs_device, args, json_string)
File "easyucs.py", line 331, in init_process
ucs_device.inventory_manager.draw_inventory()
File "C:\Users\Documents\GitHub\easyucs\inventory\ucs\manager.py", line 166, in draw_inventory
infra = UcsSystemDrawInfraChassis(chassis=chassis_draw,
File "C:\Users\Documents\GitHub\easyucs\draw\ucs\chassis.py", line 644, in init
self.background = self._create_background(self.canvas_width, self.canvas_height, self.canvas_color)
File "C:\Users\Documents\GitHub\easyucs\draw\object.py", line 154, in _create_background
return Image.new('RGBA', (width, height), color)
File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\PIL\Image.py", line 2578, in new
return im._new(core.fill(mode, size, color))
MemoryError

thanks

Supplying --logfile produces an empty file

I'm trying to get EasyUCS to produce a logfile for another tool to ingest, rather than capturing stderr. I noticed that providing --logfile creates the target file, but doesn't put anything in it.

easyucs config push --file myconfig.json --ip 192.168.1.10 --username admin --password password --logfile easyucs.log

The above creates easyucs.log, but does not populate it with any logs.

I believe the responsible code is here

# ...
        # We use a custom named logger
        self._logger_handle = logging.getLogger(self.logger_target)
        self._logger_handle.setLevel(logging.DEBUG)
        # Format of the output
        formatter = logging.Formatter('%(asctime)s :: %(levelname)s :: %(message)s')


        # create file handler for log if a file is needed
        if self._log_file_path:
            fh = logging.FileHandler(self._log_file_path)
            fh.setLevel(logging.DEBUG)
            fh.setFormatter(formatter)
            self._logger_handle.addHandler(fh)


        # create console handler for log
        ch = logging.StreamHandler()
        ch.setLevel(logging.WARNING)
        if self._logger_handle_log_level == "debug":
            ch.setLevel(logging.DEBUG)
        elif self._logger_handle_log_level == "info":
            ch.setLevel(logging.INFO)
        ch.setFormatter(formatter)


        if self._logger_handle.hasHandlers():
            self._logger_handle.handlers = []
            self._logger_handle.addHandler(ch)
        else:
            self._logger_handle.addHandler(ch)
        # if not self._logger_handle.hasHandlers():
        #     self._logger_handle.addHandler(ch)
# ...

Specifically,

        if self._logger_handle.hasHandlers():
            self._logger_handle.handlers = []
            self._logger_handle.addHandler(ch)

seems as though it would drop the FileHandler and replace it with the StreamHandler (ch).

Typo in device -h help

Small typo in the description of 'device -h' I noticed:
clear_user_sessions
Clears all user sessions of an UCS device
clear_intersight_claim_status
Clears all user sessions of an UCS device

easyucs$ python3 easyucs.py device -h

EasyUCS 0.9.7.4 created by Marc Abu El Ghait, Franck Bonneau and Vincent Esposito, Copyright 2016-2021, Cisco

usage: easyucs.py device [-h]
{regenerate_certificate,clear_sel_logs,clear_user_sessions,clear_intersight_claim_status}
...

optional arguments:
-h, --help show this help message and exit

Action:
{regenerate_certificate,clear_sel_logs,clear_user_sessions,clear_intersight_claim_status}
Device actions
regenerate_certificate
Regenerate self-signed certificate of an UCS system
clear_sel_logs Clears all SEL logs of an UCS device
clear_user_sessions
Clears all user sessions of an UCS device
clear_intersight_claim_status
Clears all user sessions of an UCS device

Examples:
python easyucs.py device regenerate_certificate -t ucsm -i 192.168.0.1 -u admin -p password
regenerate self-signed certificate of UCS system

  python easyucs.py device clear_sel_logs -t ucsm -i 192.168.0.1 -u admin -p password
        clear SEL Logs of all discovered servers of UCS system

not an issue

hi

great code :) the report is excellent.

pretty new to json files etc. quick question pls...if i edit the exported json file with only a small piece of config left will it just apply that and not wipe anything else?

thanks

'TLSConnection' object has no attribute 'key_file' whenever I try to connect to a UCS Manager or UCS Central

Hello,

Whenever I try to connect to a UCS Manager or UCS Central to do a fetch config, inventory, etc. I get the following error:

Task: Fetch config from UCS System
Failed

Error while trying to connect to UCS System: 10.143.250.70: 'TLSConnection' object has no attribute 'key_file'

EasyUCS Version: 0.9.8.7

Debug Logs:
2024-04-03 11:50:57,327 :: debug :: 10.141.0.70 :: device.py :: in connect :: Using UCS Central SDK version 0.9.0.4 2024-04-03 11:50:57,328 :: info :: 10.141.0.70 :: device.py :: in connect :: Trying to connect to UCS Central: 10.141.0.70 2024-04-03 11:50:57,429 :: error :: 10.141.0.70 :: device.py :: in connect :: Error while trying to connect to UCS Central: 10.141.0.70: 'TLSConnection' object has no attribute 'key_file' 2024-04-03 12:15:04,522 :: debug :: 10.143.250.70 :: device.py :: in connect :: Using UCS System SDK version 0.9.16 2024-04-03 12:15:04,522 :: info :: 10.143.250.70 :: device.py :: in connect :: Trying to connect to UCS System: 10.143.250.70 2024-04-03 12:15:04,710 :: error :: 10.143.250.70 :: device.py :: in connect :: Error while trying to connect to UCS System: 10.143.250.70: 'TLSConnection' object has no attribute 'key_file'

Can you please assist? I have been unable to find any solutions via Google/Forums.

Thank you in advanced for your time and assistance.

Schema are loaded strictly based from the current directory

This affects the current master of this repository, as well as my pull request (#3). Using config push against a UCSM instance triggers a function that tries to load schema/ucs/ucsm/master.json relative to the current directory. This means that it must be run from the repository root (or the package root, in my branch).

The relevant line is

        json_file = open("schema/ucs/ucsm/master.json")

@vesposito is it reasonable to assume that schemas could be packaged with EasyUCS and not change without package updates, or is it necessary to support that users could retrieve schemas and store them somewhere that EasyUCS would subsequently use? Would it be sensible to add an optional --schema flag that is a path to a "schema root", that defaults to the one distributed with EasyUCS?

[Feature] Variables Definitions

Allow definition of variables to be reused in all the configuration.

Look at https://github.com/gazpachoking/jsonref It allow ref expansion.

ex :

{
  "easyucs": {
     "variables": {
         "password": "supersecurepassword",
         "anothervar": "myothervar",
     },
     ...
  },
...
"pasword" :  {"$ref": "#/easyucs/variables/password"}
...

for simplicity i have not encapsulated "variables" dictionary in a list.

variables can be expanded just before calling _validate_config_from_json responssible of json schema validation.

ucs - DEBUG - Unknown property lddp_transmit

Hello,

while playing with easyucs on the UCSPE emulator, I was trying to push a configuration and I got the following error:

2021-03-16 03:13:30,980 :: INFO :: 192.168.56.132 :: lan.py :: in push_object :: Pushing UDLD Link Policy configuration: default 2021-03-16 03:13:31,041 :: INFO :: 192.168.56.132 :: lan.py :: in push_object :: Pushing Link Profile configuration: default 2021-03-16 03:13:31,112 :: INFO :: 192.168.56.132 :: lan.py :: in push_object :: Pushing Appliance Network Control Policy configuration: default 2021-03-16 03:13:31,113 - ucs - DEBUG - Unknown property lddp_transmit Traceback (most recent call last): File "easyucs.py", line 813, in <module> main() File "easyucs.py", line 806, in main init_process(ucs_device, args, json_string) File "easyucs.py", line 268, in init_process ucs_device.config_manager.push_config(bypass_version_checks=bypass_version_checks) File "/home/dalbert/easyucs/config/ucs/manager.py", line 795, in push_config appliance_network_control_policy.push_object() File "/home/dalbert/easyucs/config/ucs/ucsm/lan.py", line 2238, in push_object mo_nwctrl_definition = NwctrlDefinition(parent_mo_or_dn=parent_mo, cdp=self.cdp_admin_state, File "/home/dalbert/.local/lib/python3.8/site-packages/ucsmsdk/mometa/nwctrl/NwctrlDefinition.py", line 91, in __init__ ManagedObject.__init__(self, "NwctrlDefinition", parent_mo_or_dn, **kwargs) File "/home/dalbert/.local/lib/python3.8/site-packages/ucsmsdk/ucsmo.py", line 82, in __init__ self._set_mo_prop_value(kwargs) File "/home/dalbert/.local/lib/python3.8/site-packages/ucsmsdk/ucsmo.py", line 106, in _set_mo_prop_value self.__set_prop(prop_name, prop_value) File "/home/dalbert/.local/lib/python3.8/site-packages/ucsmsdk/ucsmo.py", line 215, in __set_prop prop_meta = self.prop_meta[name] KeyError: 'lddp_transmit'
I think it's a typo in the config/ucs/ucsm/lan.py file at line 2241:

def push_object(self, commit=True):
2231 if commit:
2232 self.logger(message="Pushing " + self._CONFIG_NAME + " configuration: " + str(self.name))
2233 else:
2234 self.logger(message="Adding to the handle " + self._CONFIG_NAME + " configuration: " + str(self.name) +
2235 ", waiting for a commit")
2236
2237 parent_mo = "fabric/eth-estc"
2238 mo_nwctrl_definition = NwctrlDefinition(parent_mo_or_dn=parent_mo, cdp=self.cdp_admin_state,
2239 lldp_receive=self.lldp_receive, name=self.name,
2240 uplink_fail_action=self.action_on_uplink_fail,
2241 lddp_transmit=self.lldp_transmit, descr=self.descr,
2242 mac_register_mode=self.mac_register_mode)
2243 DpsecMac(parent_mo_or_dn=mo_nwctrl_definition, descr=self.descr, name="", forge=self.mac_security_forge)
2244
2245 self._handle.add_mo(mo=mo_nwctrl_definition, modify_present=True)
2246 if commit:
2247 if self.commit(detail=self.name) != True:
2248 return False
2249 return True

Thanks

Enhancement: Add "Comment" as a valid field to any config json object

As the configurations get more complex, it is helpful to document the rationale for a config selection right there in the json. Unfortunately, JSON does not permit line or block comments like XML or YAML. So, could we teach EasyUCS to permit "Comment" fields on any object?

Thanks! And great work! This tool is absolutely AWESOME!

support python 3.9

xml.etree.ElementTree.Element.getchildren is Deprecated since version 3.2, and removed in version 3.9: Use list(elem) or iteration.

Cant ope the GUI on Mac

I'm have all the requirements. But cant open the GUI.

Error:

python3 /Users/tjanitsc/easyucs/easyucs_gui.py
Traceback (most recent call last):
File "/Users/tjanitsc/easyucs/easyucs_gui.py", line 10, in
from flask import Flask, request, abort, jsonify
ModuleNotFoundError: No module named 'flask'
Screenshot 2023-03-01 at 10 53 38

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.