├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── LICENSE ├── README.md ├── README.rst ├── build.bat ├── build.sh ├── catalog-info.yaml ├── clean.bat ├── docs ├── Makefile ├── OMSDK API Reference Guide.pdf ├── conf.py ├── idrac.rst ├── index.rst ├── intro.rst └── make.bat ├── omdrivers ├── CMC.py ├── CMC │ └── CMC.Monitor ├── Compellent.py ├── Compellent │ └── Compellent.Monitor ├── EqualLogic.py ├── EqualLogic │ └── EqualLogic.Monitor ├── F10.py ├── F10 │ ├── F10.Monitor │ └── __init__.py ├── F10NG.py ├── F10NG │ ├── F10NG.Monitor │ └── __init__.py ├── FileList.py ├── MDArray.py ├── MDArray │ └── MDArray.Monitor ├── ME4.py ├── ME4 │ └── ME4.Monitor ├── NGM.py ├── NGM │ └── NGM.Monitor ├── NSeries.py ├── NSeries │ └── NSeries.Monitor ├── Nagios.py ├── Nagios │ └── Nagios.Monitor ├── OME.py ├── OME │ └── OME.Monitor ├── Printer.py ├── Printer │ └── Printer.Monitor ├── __DellDrivers__.py ├── __init__.py ├── emcScaleIO.py ├── emcViper.py ├── enums │ ├── __init__.py │ └── iDRAC │ │ ├── BIOS.py │ │ ├── FCHBA.py │ │ ├── NIC.py │ │ ├── PCIeSSD.py │ │ ├── RAID.py │ │ ├── __init__.py │ │ ├── iDRAC.py │ │ └── iDRACEnums.py ├── helpers │ ├── __init__.py │ └── iDRAC │ │ ├── CollectInventory.py │ │ ├── CompareInventory.py │ │ ├── RepoBuilder.py │ │ ├── UpdateHelper.py │ │ └── __init__.py ├── iDRAC.py ├── iDRAC │ ├── Config │ │ ├── BIOS.json │ │ ├── EventFilters.json │ │ ├── FCHBA.json │ │ ├── Firmware.json │ │ ├── NIC.json │ │ ├── OS.json │ │ ├── PCIeSSD.json │ │ ├── RAID.json │ │ ├── iDRAC.comp_spec │ │ └── iDRAC.json │ ├── MOF │ │ ├── DCIM_CPUView.mof │ │ ├── DCIM_ControllerBatteryView.mof │ │ ├── DCIM_ControllerView.mof │ │ ├── DCIM_EnclosureEMMView.mof │ │ ├── DCIM_EnclosurePSUView.mof │ │ ├── DCIM_EnclosureView.mof │ │ ├── DCIM_FCView.mof │ │ ├── DCIM_FanView.mof │ │ ├── DCIM_MemoryView.mof │ │ ├── DCIM_NICView.mof │ │ ├── DCIM_PCIDeviceView.mof │ │ ├── DCIM_PhysicalDiskView.mof │ │ ├── DCIM_PowerSupplyView.mof │ │ ├── DCIM_SystemView.mof │ │ ├── DCIM_VFlashView.mof │ │ ├── DCIM_VideoView.mof │ │ ├── DCIM_VirtualDiskView.mof │ │ └── DCIM_iDRACCardView.mof │ ├── __init__.py │ ├── iDRAC.Monitor │ └── xml │ │ ├── BIOS.xml │ │ ├── EventFilters.xml │ │ ├── FCHBA.xml │ │ ├── Firmware.xml │ │ ├── NIC.xml │ │ ├── OS.xml │ │ ├── PCIeSSD.xml │ │ ├── RAID.xml │ │ └── iDRAC.xml ├── lifecycle │ ├── F10 │ │ ├── F10Config.py │ │ └── __init__.py │ ├── __init__.py │ └── iDRAC │ │ ├── RAIDHelper.py │ │ ├── SCPParsers.py │ │ ├── __init__.py │ │ ├── iDRACConfig.py │ │ ├── iDRACCredsMgmt.py │ │ ├── iDRACJobs.py │ │ ├── iDRACLicense.py │ │ ├── iDRACLogs.py │ │ ├── iDRACSecurity.py │ │ ├── iDRACStreaming.py │ │ ├── iDRACUpdate.py │ │ └── rebootOptions.py └── types │ ├── __init__.py │ └── iDRAC │ ├── BIOS.py │ ├── FCHBA.py │ ├── JobOptions.py │ ├── NIC.py │ ├── PCIeSSD.py │ ├── RAID.py │ ├── SystemConfiguration.py │ ├── __init__.py │ ├── iDRAC.py │ └── rebootOptions.py ├── omsdk ├── README ├── __init__.py ├── catalog │ ├── __init__.py │ ├── pdkcatalog.py │ ├── sdkhttpsrc.py │ ├── sdkupdatemgr.py │ └── updaterepo.py ├── http │ ├── __init__.py │ ├── sdkhttpep.py │ ├── sdkredfish.py │ ├── sdkredfishbase.py │ ├── sdkredfishpdu.py │ ├── sdkrest.py │ ├── sdkrestbase.py │ ├── sdkrestpdu.py │ ├── sdkwmi.py │ ├── sdkwsman.py │ ├── sdkwsmanbase.py │ └── sdkwsmanpdu.py ├── idracmsgdb.py ├── lifecycle │ ├── __init__.py │ ├── sdkconfig.py │ ├── sdkconfigapi.py │ ├── sdkcredentials.py │ ├── sdkentry.py │ ├── sdkjobs.py │ ├── sdklicenseapi.py │ ├── sdklogapi.py │ ├── sdksecurityapi.py │ └── sdkupdate.py ├── listener │ └── sdktrapreceiver.py ├── omlogs │ ├── Logger.py │ ├── __init__.py │ └── config │ │ └── logging.yaml ├── profiling │ ├── __init__.py │ └── sdklist.py ├── reflection │ ├── __init__.py │ └── sdkapi.py ├── sdkbase.py ├── sdkcenum.py ├── sdkconnfactory.py ├── sdkconsole.py ├── sdkcreds.py ├── sdkcunicode.py ├── sdkdelta.py ├── sdkdevice.py ├── sdkentitymib.py ├── sdkenum.py ├── sdkfile.py ├── sdkftp.py ├── sdkgroup.py ├── sdkinfra.py ├── sdklist.py ├── sdkprint.py ├── sdkproto.py ├── sdkprotobase.py ├── sdkprotopref.py ├── sdkps.py ├── sdkservices.py ├── sdksnmp.py ├── sdksnmptrap.py ├── sdkstore.py ├── sdktime.py ├── sdkunits.py ├── sdkvisitor.py ├── services │ ├── __init__.py │ └── sdkhttpserver.py ├── simulator │ ├── __init__.py │ └── devicesim.py ├── typemgr │ ├── ArrayType.py │ ├── BuiltinTypes.py │ ├── ClassType.py │ ├── FieldType.py │ ├── TypeState.py │ └── __init__.py └── version │ ├── __init__.py │ └── sdkversion.py ├── requirements-python2x.txt ├── requirements-python3x.txt ├── setup-omdrivers.py ├── setup-omsdk.py ├── setup.cfg ├── setup.py ├── tools └── build_arspec.py └── uninstall.py /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at OpenManageSDK@Dell.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # QwikContext 2 | A single line summary of the problem 3 | 4 | # Details 5 | Detailed description of the issue. Include screenshots or API examples if needed. 6 | 7 | # Repro Steps 8 | Steps to reproduce the problem 9 | 10 | # Impact 11 | What areas, configurations and use cases does this issue impact 12 | Is there a data loss? 13 | 14 | # NeedBy 15 | When do you need this issue fixed 16 | 17 | # Severity 18 | What is the severity of the issue. 19 | 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Dell OpenManage Python SDK 3 | 4 | Dell OpenManage Python SDK (OMSDK) is a python library that helps developers and customers to automate the lifecycle management of PowerEdge Servers. OMSDK module leverages the iDRAC's REST APIs based on [DMTF Redfish standards](https://www.dmtf.org/standards/redfish) as well as [WS-Man](https://www.dmtf.org/standards/ws-man) and SNMP protocols for configuration, deployment, updates and monitoring of PowerEdge Servers. In addition, OMSDK also supports monitoring and querying inventory information for PowerEdge Modular Infrastructure (M1000e, VRTX and FX2). 5 | 6 | ## Supported Systems 7 | 8 | All Dell PowerEdge 12th and above Generation of PowerEdge Servers, and Chassis Management Controllers of Dell PowerEdge M1000e, Dell PowerEdge VRTX and Dell PowerEdge FX2 Chassis 9 | 10 | * iDRAC7 and iDRAC8 with Firmware Versions 2.41.40.40 or above 11 | * iDRAC9 with Firmware Versions 3.00.00.00 or above 12 | 13 | 14 | # Prerequisites 15 | Dell OpenManage Python SDK is supported for python 2.7 and above. 16 | 17 | * Install the prerequisites using the requirements file on python 2.x as: 18 | 19 | ``` pip install -r requirements-python2x.txt ``` 20 | 21 | * Install the prerequisites using the requirements file on python 3.x as: 22 | 23 | ``` pip3 install -r requirements-python3x.txt ``` 24 | 25 | # Installation 26 | * This branch contains the build version 1.2.518 27 | * Install the latest development version from github: 28 | 29 | ``` 30 | git clone https://github.com/dell/omsdk.git 31 | cd omsdk 32 | sh build.sh 1.2 518 33 | cd dist 34 | pip install omsdk-1.2.518-py2.py3-none-any.whl 35 | ``` 36 | * If omsdk build creation fails due to `python` command error, configure 37 | `python` to launch either `python2` or `python3`. Accordingly configure the `pip` command. 38 | * Upgrading to latest version of python setuptools and wheel is 39 | recommended. 40 | * omsdk installation may fail with pip version 10.0 and above, follow one of the following steps in such scenario 41 | 42 | * Downgrade pip version to lower than 10.0 and then install omsdk 43 | * Force install omsdk using: 44 | ```pip install --ignore-installed omsdk-1.2.518-py2.py3-none-any.whl``` 45 | 46 | # Uninstallation 47 | * Uninstall this module as follows: 48 | 49 | ``` 50 | pip uninstall omsdk 51 | ``` 52 | 53 | # Documentation 54 | Refer to the [documentation](./docs) for details on how to use this SDK 55 | 56 | # Licensing 57 | Licensed under the Apache Software License, version 2.0 (the "License"); you may not use this file except in compliance with the License. 58 | 59 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 60 | 61 | # Support 62 | * Dell OpenManage Python SDK is supported by OpenManage developers team. 63 | * If you want to report any issue, then please report it by creating a new issue [here](https://github.com/dell/omsdk/issues) 64 | * If you have any requirements that is not currently addressed, then please let us know by creating a new issue [here](https://github.com/dell/omsdk/issues) 65 | * If you want to provide any feedback to the development team, then you can do so by sending an email to OpenManageSDK@Dell.com 66 | 67 | # Authors 68 | OpenManageSDK (OpenManageSDK@Dell.com) 69 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | Dell OpenManage Python SDK 2 | ============================== 3 | 4 | Dell OpenManage Python Software Development Kit (SDK) is a pythonic library for programatically managing Dell Servers and Chassis. Using this library a user can perform lifecycle operations on Dell PowerEdge Servers and Blade Enclosure Chassis in Pythonic way. 5 | 6 | The Dell OpenManage Python SDK leverages DMTF's Web Services Management standard (WS-Man) and IETF's Simple Network Management Protocol (SNMP) for managing and monitoring the Dell PowerEdge branded hardware. 7 | 8 | ---- 9 | 10 | Dell, OpenManage, PowerEdge, and other trademarks are trademarks of 11 | Dell Inc. or its subsidiaries. Other trademarks may be trademarks of their 12 | respective owners. 13 | 14 | ---- 15 | Licensed under the GNU General Public License v3.0 (the "License"); you may not use this file except in compliance with the License. 16 | 17 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 18 | 19 | ---- 20 | Please note that Dell OpenManage Python SDK is still in development and therefore no support is provided at present. However, if you want to report any issues or provide any feedback, then please send an email to OpenManageAnsible@dell.com. 21 | -------------------------------------------------------------------------------- /build.bat: -------------------------------------------------------------------------------- 1 | attrib -r /s *.Monitor 2 | attrib -r /s *.json 3 | attrib -r setup.cfg 4 | rmdir /s/q build 5 | rmdir /s/q dist 6 | rmdir /s/q omsdk.egg-info 7 | python setup-omdrivers.py bdist_wheel --universal 8 | rmdir /s/q build 9 | rmdir /s/q omdrivers.egg-info 10 | python setup-omsdk.py bdist_wheel --universal 11 | rmdir /s/q build 12 | rmdir /s/q omsdk.egg-info 13 | rem python setup.py bdist_wheel --universal 14 | python setup-linux.py bdist_egg 15 | rmdir /s/q build 16 | rmdir /s/q omsdk.egg-info 17 | rem python setup.py sdist --formats=gztar 18 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | rm -fr build dist omsdk.egg-info 3 | #cp setup-linux.py setup.py 4 | #python setup.py sdist --formats=gztar 5 | echo "$1.$2" > /tmp/_version.txt 6 | python setup-omdrivers.py bdist_wheel --universal 7 | python setup-omsdk.py bdist_wheel --universal 8 | rm -Rf /tmp/_version.txt 9 | rm -Rf build 10 | rm -Rf omsdk.egg-info 11 | #python setup.py bdist_egg 12 | -------------------------------------------------------------------------------- /catalog-info.yaml: -------------------------------------------------------------------------------- 1 | # nonk8s 2 | apiVersion: backstage.io/v1alpha1 3 | kind: Component 4 | metadata: 5 | name: python-omsdk 6 | description: "Dell OpenManage Python SDK" 7 | tags: 8 | - ansible 9 | - devops 10 | - automation 11 | - storage 12 | - server 13 | - dell 14 | - infrastructure-as-code 15 | - openmanage 16 | - idrac 17 | annotations: 18 | backstage.io/techdocs-ref: dir:. 19 | github.com/project-slug: dell/omsdk 20 | links: 21 | - url: 'https://pypi.org/project/omsdk/' 22 | title: 'PyPI' 23 | icon: 'web' 24 | - url: 'https://github.com/dell/omsdk/issues' 25 | title: 'Contact Technical Support' 26 | icon: 'help' 27 | spec: 28 | type: service 29 | lifecycle: production 30 | owner: user:default/sachin_apagundi 31 | visibility: all 32 | -------------------------------------------------------------------------------- /clean.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rmdir /s/q omsdk.egg-info 3 | rmdir /s/q omdrivers.egg-info 4 | rmdir /s/q dist 5 | rmdir /s/q build 6 | for /F %%i in ('dir /s/b __pycache__') do @( 7 | echo rmdir %%i 8 | rmdir /s/q %%i 9 | ) 10 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = python -msphinx 7 | SPHINXPROJ = DellEMCOpenManageSDK 8 | SOURCEDIR = . 9 | BUILDDIR = omsdkbuild 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /docs/OMSDK API Reference Guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dell/omsdk/c5fd7c12d03d949a665088bd777db5b252f31316/docs/OMSDK API Reference Guide.pdf -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. DellEMC OpenManage SDK documentation master file, created by 2 | sphinx-quickstart on Mon Jun 12 16:45:34 2017. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to DellEMC OpenManage SDK's documentation! 7 | ================================================== 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | :caption: Contents: 12 | 13 | intro 14 | idrac 15 | 16 | 17 | 18 | Indices and tables 19 | ================== 20 | 21 | * :ref:`genindex` 22 | * :ref:`modindex` 23 | * :ref:`search` 24 | -------------------------------------------------------------------------------- /docs/intro.rst: -------------------------------------------------------------------------------- 1 | Introduction 2 | ============ 3 | 4 | .. contents:: 5 | :local: 6 | :depth: 1 7 | :backlinks: entry 8 | 9 | DellEMC OpenManage SDK 10 | ---------------------- 11 | 12 | DellEMC OpenManage Software Development Kit is a pythonic library 13 | for programatically managing DellEMC Servers and Chassis. Using 14 | this library a user can perform lifecycle operations on DellEMC 15 | PowerEdge servers and chassis in Pythonic way. The DellEMC OpenManage 16 | SDK leverages DMTF's Web Services Management standard (WS-Man), 17 | IETF's Simple Network Management Protocol (SNMP) and the 18 | DMTF Redfish standard for managing and monitoring the DellEMC 19 | PowerEdge servers and chassis. 20 | 21 | Supported Systems 22 | ----------------- 23 | 24 | * All DellEMC PowerEdge 12th and 13th Generation Servers, Blades and Sleds 25 | * Chassis Management Controllers of DellEMC PowerEdge M1000e, DellEMC PowerEdge VRTX and DellEMC PowerEdge FX2 26 | 27 | * iDRAC Firmware Versions 2.00.00 and above 28 | * CMC Firmware Versions 5.00.00 and above 29 | 30 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=python -msphinx 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=omsdkbuild 12 | set SPHINXPROJ=DellEMCOpenManageSDK 13 | 14 | if "%1" == "" goto help 15 | 16 | %SPHINXBUILD% >NUL 2>NUL 17 | if errorlevel 9009 ( 18 | echo. 19 | echo.The Sphinx module was not found. Make sure you have Sphinx installed, 20 | echo.then set the SPHINXBUILD environment variable to point to the full 21 | echo.path of the 'sphinx-build' executable. Alternatively you may add the 22 | echo.Sphinx directory to PATH. 23 | echo. 24 | echo.If you don't have Sphinx installed, grab it from 25 | echo.http://sphinx-doc.org/ 26 | exit /b 1 27 | ) 28 | 29 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 30 | goto end 31 | 32 | :help 33 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 34 | 35 | :end 36 | popd 37 | -------------------------------------------------------------------------------- /omdrivers/EqualLogic/EqualLogic.Monitor: -------------------------------------------------------------------------------- 1 | { 2 | "System" : { 3 | "Key": [ "_SNMPIndex" ], 4 | "ConfigState": [ ], 5 | "MainHealth": [ ], 6 | "BasicInventory": [ 7 | "GroupName", 8 | "GroupIP", 9 | "MemberCount", 10 | "VolumeCount", 11 | "GroupURL", 12 | "RAIDPolicy", 13 | "StoragePool", 14 | "SysName", 15 | "DeviceType" 16 | ], 17 | "Metrics": [] 18 | }, 19 | "Member" : { 20 | "Key": [ "_SNMPIndex" ], 21 | "ConfigState": [ ], 22 | "MainHealth": [ "PrimaryStatus" ], 23 | "BasicInventory": [ 24 | "Name", 25 | "ProductFamily", 26 | "ServiceTag", 27 | "Model", 28 | "ChassisType", 29 | "DiskCount", 30 | "RaidStatus", 31 | "ControllerMajorVersion", 32 | "ControllerMinorVersion", 33 | "RAIDPolicy", 34 | "GroupName", 35 | "GroupIP", 36 | "ControllerMaintenanceVersion", 37 | "StoragePool", 38 | "EqlDriveGroupStoragePoolIndex" 39 | ], 40 | "Metrics": [ "Capacity", "UsedStorage" ], 41 | "PrimaryStatus" : { 42 | "0" : "Unknown", 43 | "1" : "Healthy", 44 | "2" : "Warning", 45 | "3" : "Critical" 46 | }, 47 | "ChassisType" : { 48 | "0" : "unknown", 49 | "1" : "t1403", 50 | "2" : "t1603", 51 | "3" : "t4835", 52 | "4" : "tDELLSBB2u1235", 53 | "5" : "tDELLSBB2u2425", 54 | "6" : "tDELLSBB4u2435", 55 | "7" : "tDELL2WB1425V1", 56 | "8" : "tDELLSBB5u6035", 57 | "9" : "tDELLQAR5u8435" 58 | }, 59 | "RaidStatus" : { 60 | "1" : "Ok", 61 | "2" : "Degraded", 62 | "3" : "Verifying", 63 | "4" : "Reconstructing", 64 | "5" : "Failed", 65 | "6" : "CatastrophicLoss", 66 | "7" : "Expanding", 67 | "8" : "Mirroring" 68 | }, 69 | "RaidPolicy" : { 70 | "0" : "Unconfigured", 71 | "1" : "RAID 50", 72 | "2" : "RAID 10", 73 | "3" : "RAID 5", 74 | "4" : "RAID 50-nospares", 75 | "5" : "RAID 10-nospares", 76 | "6" : "RAID 5-nospares", 77 | "7" : "RAID 6", 78 | "8" : "RAID 6-nospares", 79 | "9" : "RAID 6-accelerated", 80 | "10" : "Hvs-storage" 81 | } 82 | }, 83 | "Volume": { 84 | "Key": [ "_SNMPIndex" ], 85 | "ConfigState": [], 86 | "MainHealth": [ "PrimaryStatus" ], 87 | "BasicInventory": [ 88 | "Name", 89 | "TotalSize", 90 | "AssociatedPool" 91 | ], 92 | "Metrics": [] 93 | }, 94 | "PhysicalDisk": { 95 | "Key": [ 96 | "_SNMPIndex" 97 | ], 98 | "MainHealth": [ "Status" ], 99 | "BasicInventory": [ 100 | "Slot", 101 | "Model", 102 | "SerialNumber", 103 | "FirmwareVersion", 104 | "TotalSize" 105 | ], 106 | "ConfigState": [], 107 | "Metrics": [], 108 | "Status" : { 109 | "1" : "online", 110 | "2" : "spare", 111 | "3" : "failed", 112 | "4" : "offline", 113 | "5" : "alt-sig", 114 | "6" : "too-small", 115 | "7" : "history-of-failures", 116 | "8" : "unsupported-version", 117 | "9" : "unhealthy", 118 | "10" : "replacement", 119 | "11" : "encrypted", 120 | "12" : "notApproved", 121 | "13" : "preempt-failed" 122 | }, 123 | "PrimaryStatus" : { 124 | "1" : "Healthy", 125 | "2" : "Healthy", 126 | "3" : "Critical", 127 | "4" : "Warning", 128 | "5" : "Healthy", 129 | "6" : "Critical", 130 | "7" : "Warning", 131 | "8" : "Critical", 132 | "9" : "Warning", 133 | "10" : "Healthy", 134 | "11" : "Healthy", 135 | "12" : "Warning", 136 | "13" : "Critical" 137 | } 138 | }, 139 | "StoragePool": { 140 | "Key": [ "_SNMPIndex" ], 141 | "MainHealth": [ ], 142 | "BasicInventory": [ 143 | "StorageName", 144 | "MemberCount", 145 | "VolumeCount" 146 | ], 147 | "ConfigState": [], 148 | "Metrics": [] 149 | }, 150 | "InetAddr" : { 151 | "Key": [ "_SNMPIndex" ], 152 | "MainHealth": [ ], 153 | "BasicInventory": [ 154 | "EntityName" 155 | ], 156 | "ConfigState": [], 157 | "Metrics": [] 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /omdrivers/F10/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | def main(): 24 | print("Welcome to OpenManage SDK - Drivers") 25 | -------------------------------------------------------------------------------- /omdrivers/F10NG/F10NG.Monitor: -------------------------------------------------------------------------------- 1 | { 2 | "System": { 3 | "Key": ["ServiceTag"], 4 | "ConfigState": [], 5 | "MainHealth": ["PrimaryStatus"], 6 | "BasicInventory": [ 7 | "SysObjectID", 8 | "Model", 9 | "Location", 10 | "Description", 11 | "NetwUMACAddress", 12 | "NetwUPartNo", 13 | "PPID", 14 | "ExpressServiceCode", 15 | "Hostname" 16 | ], 17 | "Metrics": ["SwitchUptime"] 18 | }, 19 | "FanTray": { 20 | "ConfigState": [], 21 | "Health": [ 22 | "OperStatus" 23 | ], 24 | "Inventory": [ 25 | "ExpressServiceCode", 26 | "PiecePartID", 27 | "ServiceTag", 28 | "Type", 29 | "FanDeviceIndex" 30 | ], 31 | "Key": [ 32 | "_SNMPIndex", 33 | "Name" 34 | ], 35 | "Metrics": [] 36 | }, 37 | "Fan": { 38 | "ConfigState": [], 39 | "Health": [ 40 | "OperStatus" 41 | ], 42 | "Inventory": [ 43 | "Index" 44 | ], 45 | "Key": [ 46 | "_SNMPIndex" 47 | ] 48 | }, 49 | "Port": { 50 | "Key": [ 51 | "ifIndex", 52 | "Description" 53 | ], 54 | "Health": ["Status"], 55 | "Inventory": [ 56 | "Type", 57 | "Address", 58 | "SysIfName", 59 | "Class" 60 | ], 61 | "Metrics": [ 62 | "ifInOctets", 63 | "ifOutOctets", 64 | "ifInDiscards", 65 | "ifOutDiscards", 66 | "ifInErrors", 67 | "ifOutErrors", 68 | "ifInUnknownProtos", 69 | "ifSpeed" 70 | ] 71 | }, 72 | 73 | "PowerSupply": { 74 | "ConfigState": [], 75 | "Health": [ 76 | "OperStatus" 77 | ], 78 | "Inventory": [ 79 | "Index" 80 | ], 81 | "Key": [ 82 | "_SNMPIndex" 83 | ] 84 | }, 85 | "Subsystem" : { 86 | "Key" : ["Key"], 87 | "MainHealth" : [ "PrimaryStatus" ], 88 | "OtherHealth" : [ ] 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /omdrivers/F10NG/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Sachin Apagundi 22 | # 23 | def main(): 24 | print("Welcome to OpenManage SDK - Drivers") 25 | -------------------------------------------------------------------------------- /omdrivers/MDArray.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from omsdk.sdkdevice import iDeviceDiscovery, iDeviceRegistry, iDeviceDriver 24 | from omsdk.sdkcenum import EnumWrapper 25 | from omsdk.sdkproto import PSNMP 26 | import sys 27 | 28 | PY2 = sys.version_info[0] == 2 29 | PY3 = sys.version_info[0] == 3 30 | 31 | try: 32 | from pysnmp.hlapi import * 33 | from pysnmp.smi import * 34 | from pysnmp.smi.rfc1902 import ObjectIdentity 35 | 36 | PySnmpPresent = True 37 | except ImportError: 38 | PySnmpPresent = False 39 | 40 | MDArrayCompEnum = EnumWrapper('MDArrayCompEnum', { 41 | "System": "System", 42 | }).enum_type 43 | 44 | if PySnmpPresent: 45 | MDArraySNMPViews = { 46 | MDArrayCompEnum.System: { 47 | 'SysObjectID': ObjectIdentity('SNMPv2-MIB', 'sysObjectID'), 48 | 'Name': ObjectIdentity('1.3.6.1.4.1.674.10893.2.31.500.1.1'), 49 | 'WWID': ObjectIdentity('1.3.6.1.4.1.674.10893.2.31.500.1.2'), 50 | 'ServiceTag': ObjectIdentity('1.3.6.1.4.1.674.10893.2.31.500.1.3'), 51 | 'ProductID': ObjectIdentity('1.3.6.1.4.1.674.10893.2.31.500.1.5'), 52 | 'Status': ObjectIdentity('1.3.6.1.4.1.674.10893.2.31.500.1.7'), 53 | 'SysName': ObjectIdentity('1.3.6.1.2.1.1.5') 54 | } 55 | } 56 | MDArraySNMPClassifier = { 57 | MDArrayCompEnum.System: { 58 | 'SysObjectID': 'SNMPv2-SMI::enterprises\\.674\\.10893\\.2\\.31|1\\.3\\.6\\.1\\.4\\.1\\.674\\.10893\\.2\\.31' 59 | } 60 | } 61 | 62 | MDArrayComponentTree = { 63 | "Full": [ 64 | MDArrayCompEnum.System 65 | ] 66 | } 67 | else: 68 | MDArraySNMPViews = {} 69 | MDArrayComponentTree = {} 70 | MDArraySNMPClassifier = {} 71 | 72 | 73 | class MDArray(iDeviceDiscovery): 74 | def __init__(self, srcdir): 75 | if PY2: 76 | super(MDArray, self).__init__(iDeviceRegistry("MDArray", srcdir, MDArrayCompEnum)) 77 | else: 78 | super().__init__(iDeviceRegistry("MDArray", srcdir, MDArrayCompEnum)) 79 | if PySnmpPresent: 80 | self.protofactory.add(PSNMP( 81 | views=MDArraySNMPViews, 82 | classifier=MDArraySNMPClassifier, 83 | useSNMPGetFlag=True 84 | )) 85 | self.protofactory.addCTree(MDArrayComponentTree) 86 | self.protofactory.addClassifier([MDArrayCompEnum.System]) 87 | 88 | def my_entitytype(self, pinfra, ipaddr, creds, protofactory): 89 | return iDeviceDriver(self.ref, protofactory, ipaddr, creds) 90 | -------------------------------------------------------------------------------- /omdrivers/MDArray/MDArray.Monitor: -------------------------------------------------------------------------------- 1 | { 2 | "System" : { 3 | "ConfigState" : [], 4 | "Health" : ["Status"], 5 | "Inventory" : [ "ProductID", "WWID", "Name", "SysName" ], 6 | "Key" : ["ServiceTag"], 7 | "Metrics" : [], 8 | "Status" : { 9 | "0" : "Healthy", 10 | "1" : "Warning" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /omdrivers/NSeries/NSeries.Monitor: -------------------------------------------------------------------------------- 1 | { 2 | "System": { 3 | "Key": ["ServiceTag"], 4 | "MainHealth": ["PrimaryStatus"], 5 | "BasicInventory": [ 6 | "SysObjectID", 7 | "Model", 8 | "Location", 9 | "Description", 10 | "FirmwareVersion", 11 | "NetwUMACAddress", 12 | "NetwUSerialNo", 13 | "PPID", 14 | "ExpressServiceCode", 15 | "Hostname", 16 | "ManagementIP", 17 | "SwitchType", 18 | "SwitchIPv6", 19 | "SwitchIPv4" 20 | ], 21 | "Metrics": ["SwitchUptime"] 22 | }, 23 | "FanTray": { 24 | "Key": [ 25 | "_SNMPIndex" 26 | ], 27 | "Health": [ 28 | "OperStatus" 29 | ], 30 | "Inventory": [ 31 | "Type", 32 | "Speed", 33 | "FanDeviceIndex" 34 | ] 35 | }, 36 | "Fan": { 37 | "Key": [ 38 | "_SNMPIndex", 39 | "Description" 40 | ], 41 | "Health": [ 42 | "OperStatus" 43 | ], 44 | "Inventory": [ 45 | "Index", 46 | "Speed" 47 | ] 48 | }, 49 | "Port": { 50 | "Key": [ 51 | "ifIndex", 52 | "Description" 53 | ], 54 | "Health": ["Status"], 55 | "Inventory": [ 56 | "Type", 57 | "Class", 58 | "Address", 59 | "SysIfName" 60 | ], 61 | "Metrics": [ 62 | "ifInOctets", 63 | "ifOutOctets", 64 | "ifInDiscards", 65 | "ifOutDiscards", 66 | "ifInErrors", 67 | "ifOutErrors", 68 | "ifInUnknownProtos", 69 | "ifSpeed" 70 | ] 71 | }, 72 | "PowerSupply": { 73 | "Key": [ 74 | "Index", 75 | "Description" 76 | ], 77 | "Health": [ 78 | "OperStatus" 79 | ], 80 | "Inventory": [ 81 | "Source" 82 | ] 83 | }, 84 | "PowerSupplyTray": { 85 | "Key": [ 86 | "PowerDeviceIndex" 87 | ], 88 | "Health": [ 89 | "OperStatus" 90 | ], 91 | "Inventory": [ 92 | "PowerDeviceType" 93 | ] 94 | }, 95 | "Processor": { 96 | "Key": [ 97 | "_SNMPIndex" 98 | ], 99 | "Inventory": [ 100 | "AvailableMemSize" 101 | ] 102 | }, 103 | "Subsystem" : { 104 | "Key" : ["Key"], 105 | "MainHealth" : [ "PrimaryStatus" ] 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /omdrivers/Nagios/Nagios.Monitor: -------------------------------------------------------------------------------- 1 | { 2 | "System" : { 3 | "ConfigState" : [ "PowerStatus" ], 4 | "Health" : ["GlobalStatus"], 5 | "Inventory" : [ "Name", "Hostname", "ServiceTag"], 6 | "Multiple" : "False" 7 | }, 8 | "Memory" : { 9 | "ConfigState" : [ "PowerStatus" ], 10 | "Health" : ["GlobalStatus"], 11 | "Inventory" : [ "name", "id", "type"], 12 | "Multiple" : "True", 13 | "type" : { 14 | "4" : "ddr-4", 15 | "6" : "ddr-6" 16 | } 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /omdrivers/OME.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import json 24 | import os 25 | import logging 26 | from omsdk.sdkproto import PCONSOLE 27 | from omsdk.sdkconsole import iConsoleRegistry, iConsoleDriver, iConsoleDiscovery 28 | 29 | import sys 30 | 31 | PY2 = sys.version_info[0] == 2 32 | PY3 = sys.version_info[0] == 3 33 | 34 | logger = logging.getLogger(__name__) 35 | 36 | 37 | class OME(iConsoleDiscovery): 38 | def __init__(self, srcdir): 39 | if PY2: 40 | super(OME, self).__init__(iConsoleRegistry("OME", srcdir, None)) 41 | else: 42 | super().__init__(iConsoleRegistry("OME", srcdir, None)) 43 | self.protofactory.add(PCONSOLE(obj=self)) 44 | 45 | def my_entitytype(self, pinfra, ipaddr, creds, protofactory): 46 | return OMEEntity(self.ref, protofactory, ipaddr, creds) 47 | 48 | 49 | class OMEEntity(iConsoleDriver): 50 | def __init__(self, ref, protofactory, ipaddr, creds): 51 | if PY2: 52 | super(OMEEntity, self).__init__(ref, protofactory, ipaddr, creds) 53 | else: 54 | super().__init__(ref, protofactory, ipaddr, creds) 55 | 56 | def my_connect(self, pOptions): 57 | status = False 58 | try: 59 | if os.path.isfile("d\\" + self.ipaddr + "\\topology"): 60 | status = True 61 | except: 62 | status = False 63 | logger.debug(self.ref.name + '::connect(' + self.ipaddr + ', ' + str(self.creds) + ")=" + str(status)) 64 | return status 65 | 66 | def my_get_entityjson(self): 67 | logger.debug("Loading entity") 68 | # https://100.96.20.115:2607/api/OME.svc/DeviceGroups 69 | with open("d\\" + self.ipaddr + "\\topology") as idrac_data: 70 | self.entityjson["topology"] = json.load(idrac_data) 71 | # https://100.96.20.115:2607/api/OME.svc/Devices 72 | # https://100.96.20.115:2607/api/OME.svc/Devices/187 73 | with open("d\\" + self.ipaddr + "\\devices") as idrac_data: 74 | self.entityjson["devices"] = json.load(idrac_data) 75 | return True 76 | 77 | def get_service_tag(self): 78 | return self.ipaddr 79 | 80 | def get_device_identifier(self, device): 81 | retval = None 82 | if not device is None and "System" in device: 83 | if "ServiceTag" in device["System"]: 84 | retval = device["System"]["ServiceTag"] 85 | return retval 86 | 87 | def add_device_props(self, device): 88 | retval = self.get_device_identifier(device) 89 | if not retval is None: 90 | retval = "10.94.44." + retval 91 | device["doc.prop"] = {} 92 | device["doc.prop"]["ipaddr"] = retval 93 | device["doc.prop"]["creds"] = "" 94 | return retval 95 | -------------------------------------------------------------------------------- /omdrivers/OME/OME.Monitor: -------------------------------------------------------------------------------- 1 | { 2 | "System" : { 3 | "ConfigState" : [ "PowerState" ], 4 | "Health" : ["GlobalStatus"], 5 | "Inventory" : [ "Name", "Hostname", "ServiceTag"], 6 | "Multiple" : "False", 7 | "GlobalStatus" : { 8 | "1" : "Healthy", 9 | "2" : "Warning", 10 | "16" : "Critical" 11 | }, 12 | "PowerState" : { 13 | "1" : "Enabled", 14 | "2" : "Disabled" 15 | } 16 | }, 17 | "Memory" : { 18 | "ConfigState" : [ ], 19 | "Health" : ["GlobalStatus"], 20 | "Inventory" : [ "name", "id", "type"], 21 | "Multiple" : "True", 22 | "type" : { 23 | "4" : "ddr-4", 24 | "6" : "ddr-6" 25 | } 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /omdrivers/Printer/Printer.Monitor: -------------------------------------------------------------------------------- 1 | { 2 | "Interface": { 3 | "ConfigState": [], 4 | "Health": [], 5 | "Inventory": [ 6 | "ifPhysAddress" 7 | ], 8 | "Key": [ 9 | "ifIndex" 10 | ], 11 | "Multiple": true 12 | }, 13 | "PrinterConsoleDisplayBuffer": { 14 | "ConfigState": [], 15 | "Health": [], 16 | "Inventory": [ 17 | "prtConsoleDisplayBufferText" 18 | ], 19 | "Key": [ 20 | "prtConsoleDisplayBufferIndex" 21 | ], 22 | "Multiple": true 23 | }, 24 | "PrinterCover": { 25 | "ConfigState": [], 26 | "Health": [ 27 | "prtCoverStatus" 28 | ], 29 | "Inventory": [ 30 | "prtCoverDescription" 31 | ], 32 | "Key": [ 33 | "prtCoverIndex" 34 | ], 35 | "Multiple": true 36 | }, 37 | "PrinterInput": { 38 | "ConfigState": [], 39 | "Health": [ 40 | "prtInputStatus" 41 | ], 42 | "Inventory": [ 43 | "prtInputDescription", 44 | "prtInputCurrentLevel", 45 | "prtInputName", 46 | "prtInputMaxCapacity", 47 | "prtInputSerialNumber", 48 | "prtInputMediaName", 49 | "prtInputType", 50 | "prtInputModel", 51 | "prtInputVersion", 52 | "prtInputVendorName", 53 | "prtInputCapacityUnit" 54 | ], 55 | "Key": [ 56 | "prtInputIndex" 57 | ], 58 | "Multiple": true 59 | }, 60 | "PrinterMarker": { 61 | "ConfigState": [], 62 | "Health": [ 63 | "prtMarkerStatus" 64 | ], 65 | "Inventory": [ 66 | "prtMarkerPowerOnCount", 67 | "prtMarkerLifeCount" 68 | ], 69 | "Key": [ 70 | "prtMarkerIndex" 71 | ], 72 | "Multiple": true 73 | }, 74 | "PrinterMarkerColorant": { 75 | "ConfigState": [], 76 | "Health": [], 77 | "Inventory": [ 78 | "prtMarkerColorantValue" 79 | ], 80 | "Key": [ 81 | "prtMarkerColorantIndex" 82 | ], 83 | "Multiple": true 84 | }, 85 | "PrinterMarkerSupplies": { 86 | "ConfigState": [], 87 | "Health": [], 88 | "Inventory": [ 89 | "prtMarkerSuppliesLevel", 90 | "prtMarkerSuppliesDescription", 91 | "prtMarkerSuppliesMaxCapacity", 92 | "prtMarkerSuppliesClass", 93 | "prtMarkerSuppliesType" 94 | ], 95 | "Key": [ 96 | "prtMarkerSuppliesIndex" 97 | ], 98 | "Multiple": true 99 | }, 100 | "PrinterMediaPath": { 101 | "ConfigState": [], 102 | "Health": [ 103 | "prtMediaPathStatus" 104 | ], 105 | "Inventory": [ 106 | "prtMediaPathMediaSizeUnit", 107 | "prtMediaPathType", 108 | "prtMediaPathDescription" 109 | ], 110 | "Key": [ 111 | "prtMediaPathIndex" 112 | ], 113 | "Multiple": true 114 | }, 115 | "PrinterOutput": { 116 | "ConfigState": [], 117 | "Health": [ 118 | "prtOutputStatus" 119 | ], 120 | "Inventory": [ 121 | "prtOutputSerialNumber", 122 | "prtOutputDescription", 123 | "prtOutputMaxCapacity", 124 | "prtOutputVersion", 125 | "prtOutputVendorName", 126 | "prtOutputRemainingCapacity", 127 | "prtOutputName", 128 | "prtOutputModel" 129 | ], 130 | "Key": [ 131 | "prtOutputIndex" 132 | ], 133 | "Multiple": true 134 | }, 135 | "System": { 136 | "ConfigState": [ 137 | "hrPrinterDetectedErrorState" 138 | ], 139 | "Health": [ 140 | "hrPrinterStatus" 141 | ], 142 | "Inventory": [ 143 | "prtGeneralPrinterName", 144 | "prtGeneralSerialNumber", 145 | "hrDeviceID", 146 | "hrDeviceDescr" 147 | ], 148 | "Key": [ 149 | "hrDeviceIndex" 150 | ], 151 | "Multiple": true 152 | } 153 | } -------------------------------------------------------------------------------- /omdrivers/__DellDrivers__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | def main(): 24 | print("Welcome to OpenManage SDK - Drivers") 25 | -------------------------------------------------------------------------------- /omdrivers/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | def main(): 24 | print("Welcome to OpenManage SDK - Drivers") 25 | -------------------------------------------------------------------------------- /omdrivers/emcScaleIO.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import os 24 | import sys 25 | import logging 26 | 27 | sys.path.append(os.getcwd()) 28 | from omsdk.sdkproto import PCONSOLE 29 | from omsdk.sdkdevice import iDeviceRegistry, iDeviceDriver, iDeviceDiscovery 30 | from omsdk.sdkcenum import EnumWrapper 31 | from omsdk.sdkcreds import UserCredentials, ProtocolCredentialsFactory, CredentialsEnum 32 | 33 | import sys 34 | import traceback 35 | 36 | logger = logging.getLogger(__name__) 37 | 38 | try: 39 | from scaleiopy.scaleio import ScaleIO 40 | 41 | OMScaleIOPresent = True 42 | except ImportError: 43 | OMScaleIOPresent = False 44 | 45 | PY2 = sys.version_info[0] == 2 46 | PY3 = sys.version_info[0] == 3 47 | 48 | emcScaleIOCompEnum = EnumWrapper('emcScaleIOCompEnum', { 49 | "System": "System", 50 | "SDC": "SDC", 51 | "SDS": "SDS", 52 | "Volume": "Volume", 53 | "ProtectionDomain": "ProtectionDomain", 54 | "StoragePool": "StoragePool" 55 | }).enum_type 56 | 57 | 58 | class emcScaleIO(iDeviceDiscovery): 59 | def __init__(self, srcdir): 60 | if PY2: 61 | super(emcScaleIO, self).__init__(iDeviceRegistry("emcScaleIO", srcdir, emcScaleIOCompEnum)) 62 | else: 63 | super().__init__(iDeviceRegistry("emcScaleIO", srcdir, emcScaleIOCompEnum)) 64 | self.protofactory.add(PCONSOLE(obj=self)) 65 | 66 | def my_entitytype(self, pinfra, ipaddr, creds, protofactory): 67 | return emcScaleIOEntity(self.ref, protofactory, ipaddr, creds) 68 | 69 | 70 | class emcScaleIOProtoOptions: 71 | def __init__(self, verify_ssl=False, debugLevel=None): 72 | self.verify_ssl = verify_ssl 73 | self.debugLevel = debugLevel 74 | 75 | 76 | class emcScaleIOEntity(iDeviceDriver): 77 | def __init__(self, ref, protofactory, ipaddr, creds): 78 | if PY2: 79 | super(emcScaleIOEntity, self).__init__(ref, protofactory, ipaddr, creds) 80 | else: 81 | super().__init__(ref, protofactory, ipaddr, creds) 82 | 83 | def my_connect(self, pOptions): 84 | status = False 85 | try: 86 | if pOptions is None or not isinstance(pOptions, emcScaleIOProtoOptions): 87 | pOptions = emcScaleIOProtoOptions() 88 | creds = None 89 | if isinstance(self.creds, UserCredentials): 90 | creds = self.creds 91 | if isinstance(self.creds, ProtocolCredentialsFactory): 92 | creds = self.creds.get(CredentialsEnum.User) 93 | if OMScaleIOPresent and creds: 94 | self.sio = ScaleIO("https://" + self.ipaddr + "/api", creds.username, 95 | creds.password, pOptions.verify_ssl, pOptions.debugLevel) 96 | status = True 97 | except: 98 | traceback.print_exc() 99 | status = False 100 | logger.debug(self.ref.name + '::connect(' + self.ipaddr + ', ' + str(creds) + ")=" + str(status)) 101 | return status 102 | 103 | def my_get_entityjson(self): 104 | if not OMScaleIOPresent: 105 | return False 106 | 107 | entityjson["System"] = self.sio.system 108 | entityjson["SDC"] = self.sio.sdc 109 | entityjson["SDS"] = self.sio.sds 110 | entityjson["Volume"] = self.sio.volumes 111 | entityjson["ProtectionDomain"] = self.sio.protection_domains 112 | entityjson["StoragePool"] = self.sio.storage_pools 113 | return True 114 | -------------------------------------------------------------------------------- /omdrivers/enums/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | def main(): 24 | print("Welcome to OpenManage SDK - Drivers") 25 | -------------------------------------------------------------------------------- /omdrivers/enums/iDRAC/FCHBA.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from omsdk.sdkcenum import EnumWrapper 24 | import sys 25 | import logging 26 | 27 | PY2 = sys.version_info[0] == 2 28 | PY3 = sys.version_info[0] == 3 29 | 30 | logger = logging.getLogger(__name__) 31 | 32 | BootScanSelectionTypes = EnumWrapper("BootScanSelectionTypes", { 33 | "Disabled": "Disabled", 34 | "FabricDiscovered": "FabricDiscovered", 35 | "FirstLUN": "FirstLUN", 36 | "FirstLUN0": "FirstLUN0", 37 | "FirstNOTLUN0": "FirstNOTLUN0", 38 | "SpecifiedLUN": "SpecifiedLUN", 39 | }).enum_type 40 | 41 | FCTapeTypes = EnumWrapper("FCTapeTypes", { 42 | "Disabled": "Disabled", 43 | "Enabled": "Enabled", 44 | }).enum_type 45 | 46 | FramePayloadSizeTypes = EnumWrapper("FramePayloadSizeTypes", { 47 | "Auto": "Auto", 48 | "T_1024": "1024", 49 | "T_2048": "2048", 50 | "T_2112": "2112", 51 | "T_512": "512", 52 | }).enum_type 53 | 54 | HardZoneTypes = EnumWrapper("HardZoneTypes", { 55 | "Disabled": "Disabled", 56 | "Enabled": "Enabled", 57 | }).enum_type 58 | 59 | PortSpeedTypes = EnumWrapper("PortSpeedTypes", { 60 | "Auto": "Auto", 61 | "T_16G": "16G", 62 | "T_1G": "1G", 63 | "T_2G": "2G", 64 | "T_32G": "32G", 65 | "T_4G": "4G", 66 | "T_8G": "8G", 67 | }).enum_type 68 | -------------------------------------------------------------------------------- /omdrivers/enums/iDRAC/PCIeSSD.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from omsdk.sdkcenum import EnumWrapper 24 | import sys 25 | import logging 26 | 27 | PY2 = sys.version_info[0] == 2 28 | PY3 = sys.version_info[0] == 3 29 | 30 | logger = logging.getLogger(__name__) 31 | 32 | BusProtocolTypes = EnumWrapper("BusProtocolTypes", { 33 | "PCIe": "PCIe", 34 | }).enum_type 35 | 36 | BusProtocolVersionTypes = EnumWrapper("BusProtocolVersionTypes", { 37 | "T_2_0": "2.0", 38 | "T_2_1": "2.1", 39 | "T_3_0": "3.0", 40 | "T_3_1": "3.1", 41 | "Unknown": "Unknown", 42 | }).enum_type 43 | 44 | CapableSpeedTypes = EnumWrapper("CapableSpeedTypes", { 45 | "T_2_5_GT_s": "2.5 GT/s", 46 | "T_5_0_GT_s": "5.0 GT/s", 47 | "T_8_0_GT_s": "8.0 GT/s", 48 | "Unknown": "Unknown", 49 | }).enum_type 50 | 51 | CryptographicEraseTypes = EnumWrapper("CryptographicEraseTypes", { 52 | "No": "No", 53 | "Yes": "Yes", 54 | }).enum_type 55 | 56 | DeviceProtocolTypes = EnumWrapper("DeviceProtocolTypes", { 57 | "NVMe_1_1": "NVMe 1.1", 58 | "Nvme1_0": "Nvme1.0", 59 | "Unknown": "Unknown", 60 | }).enum_type 61 | 62 | FailurePredictedTypes = EnumWrapper("FailurePredictedTypes", { 63 | "No": "No", 64 | "Yes": "Yes", 65 | }).enum_type 66 | 67 | PcieMaxLinkWidthTypes = EnumWrapper("PcieMaxLinkWidthTypes", { 68 | "Unknown": "Unknown", 69 | "x1": "x1", 70 | "x2": "x2", 71 | "x4": "x4", 72 | "x8": "x8", 73 | }).enum_type 74 | 75 | PcieNegotiatedLinkSpeedTypes = EnumWrapper("PcieNegotiatedLinkSpeedTypes", { 76 | "T_2_5_GT_s": "2.5 GT/s", 77 | "T_5_0_GT_s": "5.0 GT/s", 78 | "T_8_0_GT_s": "8.0 GT/s", 79 | "Unknown": "Unknown", 80 | }).enum_type 81 | 82 | PcieNegotiatedLinkWidthTypes = EnumWrapper("PcieNegotiatedLinkWidthTypes", { 83 | "Unknown": "Unknown", 84 | "x1": "x1", 85 | "x2": "x2", 86 | "x4": "x4", 87 | "x8": "x8", 88 | }).enum_type 89 | 90 | SecureEraseTypes = EnumWrapper("SecureEraseTypes", { 91 | "No": "No", 92 | "Yes": "Yes", 93 | }).enum_type 94 | 95 | SmartStatusTypes = EnumWrapper("SmartStatusTypes", { 96 | "Disabled": "Disabled", 97 | "Enabled": "Enabled", 98 | }).enum_type 99 | 100 | StateTypes = EnumWrapper("StateTypes", { 101 | "Failed": "Failed", 102 | "Not_Ready_Locked": "Not Ready/Locked", 103 | "Overheat": "Overheat", 104 | "ReadOnly": "ReadOnly", 105 | "Ready": "Ready", 106 | "Unknown": "Unknown", 107 | }).enum_type 108 | -------------------------------------------------------------------------------- /omdrivers/enums/iDRAC/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | def main(): 24 | print("Welcome to OpenManage SDK - Drivers") 25 | -------------------------------------------------------------------------------- /omdrivers/helpers/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | def main(): 24 | print("Welcome to OpenManage SDK - Drivers") 25 | -------------------------------------------------------------------------------- /omdrivers/helpers/iDRAC/CollectInventory.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from argparse import ArgumentParser 24 | from omsdk.sdkfile import LocalFile 25 | from omsdk.sdkcenum import TypeHelper 26 | from omsdk.catalog.sdkupdatemgr import UpdateManager 27 | from omdrivers.helpers.iDRAC.UpdateHelper import UpdateHelper 28 | from omsdk.sdkinfra import sdkinfra 29 | from omsdk.sdkcreds import UserCredentials 30 | from omsdk.sdkprint import PrettyPrint 31 | import sys 32 | 33 | 34 | def CollectInventory(arglist): 35 | parser = ArgumentParser(description='Inventory Collector') 36 | parser.add_argument('-u', '--user', 37 | action="store", dest="user", type=str, nargs='?', 38 | default='username', help="Username to use for iDRAC") 39 | parser.add_argument('-p', '--password', 40 | action="store", dest="password", type=str, 41 | default='pword', help="Password to use for iDRAC") 42 | parser.add_argument('-i', '--ipaddress', 43 | action="store", dest="idrac_ip", nargs='+', 44 | help="ipaddress of iDRAC") 45 | parser.add_argument('-f', '--folder', 46 | action="store", dest="folder", type=str, 47 | help="folder from where inventory is serialized") 48 | 49 | options = parser.parse_args(arglist) 50 | 51 | if options.password is None: 52 | print("password must be provided") 53 | return -1 54 | if options.user is None: 55 | print("user must be provided") 56 | return -1 57 | if options.folder is None: 58 | print("Folder must be provided") 59 | return -1 60 | if options.idrac_ip is None or len(options.idrac_ip) <= 0: 61 | print("iDRAC ip addresses must be provided") 62 | return -1 63 | 64 | updshare = LocalFile(local=options.folder, isFolder=True) 65 | if not updshare.IsValid: 66 | print("Folder is not writable!") 67 | return -2 68 | 69 | print("Configuring Update Share...") 70 | UpdateManager.configure(updshare) 71 | 72 | sd = sdkinfra() 73 | sd.importPath() 74 | creds = UserCredentials(options.user, options.password) 75 | for ipaddr in options.idrac_ip: 76 | try: 77 | print("Connecting to " + ipaddr + " ... ") 78 | idrac = sd.get_driver(sd.driver_enum.iDRAC, ipaddr, creds) 79 | if idrac: 80 | print(" ... saving firmware!") 81 | UpdateHelper.save_firmware_inventory(idrac) 82 | idrac.disconnect() 83 | else: 84 | print(" failed to connect to iDRAC") 85 | except Exception as ex: 86 | print(str(ex)) 87 | 88 | 89 | if __name__ == "__main__": 90 | CollectInventory(sys.argv[1:]) 91 | -------------------------------------------------------------------------------- /omdrivers/helpers/iDRAC/CompareInventory.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from argparse import ArgumentParser 24 | from omsdk.sdkfile import LocalFile 25 | from omsdk.sdkcenum import TypeHelper 26 | from omsdk.catalog.sdkupdatemgr import UpdateManager 27 | from omdrivers.helpers.iDRAC.UpdateHelper import UpdateHelper 28 | from omsdk.sdkinfra import sdkinfra 29 | from omsdk.sdkcreds import UserCredentials 30 | from omsdk.sdkprint import PrettyPrint 31 | import sys 32 | 33 | 34 | def CompareInventory(arglist): 35 | parser = ArgumentParser(description='Compare Inventory') 36 | # parser.add_argument('-u', '--user', 37 | # action="store", dest="user", type=str, nargs='?', 38 | # default='tempuser', help="Username to use for iDRAC") 39 | # parser.add_argument('-p', '--password', 40 | # action="store", dest="password", type=str, 41 | # default='temppwd', help="Password to use for iDRAC") 42 | # parser.add_argument('-i', '--ipaddress', 43 | # action="store", dest="idrac_ip", nargs='+', 44 | # help="ipaddress of iDRAC") 45 | parser.add_argument('-f', '--folder', 46 | action="store", dest="folder", type=str, 47 | help="folder from where inventory is serialized") 48 | parser.add_argument('-C', '--catalog', 49 | action="store", dest="catalog", type=str, nargs='?', 50 | default='Catalog', help="Catalog to load") 51 | 52 | parser.add_argument('-o', '--output', 53 | action="store", dest="output", type=str, nargs='?', 54 | default='csv', help="Catalog to load") 55 | 56 | options = parser.parse_args(arglist) 57 | 58 | # if options.password is None: 59 | # print("password must be provided") 60 | # return -1 61 | # if options.user is None: 62 | # print("user must be provided") 63 | # return -1 64 | # if options.idrac_ip is None or len(options.idrac_ip) <= 0: 65 | # print("iDRAC ip addresses must be provided") 66 | # return -1 67 | if options.folder is None: 68 | print("Folder must be provided") 69 | return -1 70 | if options.catalog is None: 71 | options.catalog = 'Catalog' 72 | if options.output is None: 73 | options.output = 'csv' 74 | 75 | updshare = LocalFile(local=options.folder, isFolder=True) 76 | if not updshare.IsValid: 77 | print("Folder is not writable!") 78 | return -2 79 | 80 | UpdateManager.configure(updshare) 81 | rjson = UpdateHelper.get_firmware_inventory() 82 | dev_fw = {} 83 | if rjson['Status'] == 'Success': 84 | dev_fw = rjson['retval'] 85 | 86 | updmgr = UpdateManager.get_instance() 87 | (ignore, cache_cat) = updmgr.getCatalogScoper(options.catalog) 88 | devcompare = {} 89 | for dev in dev_fw: 90 | swidentity = dev_fw[dev] 91 | devcompare[dev] = cache_cat.compare(swidentity['Model_Hex'], swidentity) 92 | print('{0},{1},{2},{3},{4},{5},{6},"{7}"'.format( 93 | 'Device', 'Component', 'UpdateNeeded', 'UpdatePackage', 94 | 'UpdateType', 'Server.Version', 'Catalog.Version', 95 | 'Reboot Required')) 96 | for fqdd in devcompare[dev]: 97 | for fw in devcompare[dev][fqdd]: 98 | print('{0},"{1}",{2},{3},{4},"{5}","{6}",{7}'.format( 99 | str(dev), 100 | str(fw.get('ElementName')), 101 | str(TypeHelper.resolve(fw.get('UpdateNeeded'))), 102 | str(TypeHelper.resolve(fw.get('UpdatePackage'))), 103 | str(TypeHelper.resolve(fw.get('UpdateType'))), 104 | str(fw.get('Server.Version')), 105 | str(fw.get('Catalog.Version', 'Not Available')), 106 | str(fw.get('Catalog.rebootRequired', '')))) 107 | # print(PrettyPrint.prettify_json(devcompare)) 108 | 109 | 110 | if __name__ == "__main__": 111 | CompareInventory(sys.argv[1:]) 112 | -------------------------------------------------------------------------------- /omdrivers/helpers/iDRAC/UpdateHelper.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import sys 24 | import glob 25 | import json 26 | import logging 27 | import os 28 | 29 | from omsdk.catalog.sdkupdatemgr import UpdateManager 30 | from omdrivers.enums.iDRAC.iDRACEnums import * 31 | 32 | PY2 = sys.version_info[0] == 2 33 | PY3 = sys.version_info[0] == 3 34 | 35 | logger = logging.getLogger(__name__) 36 | 37 | 38 | class UpdateHelper(object): 39 | # Save the firmware inventory of the representative servers 40 | # to the \_inventory folder 41 | @staticmethod 42 | def save_firmware_inventory(devices): 43 | if not isinstance(devices, list): 44 | devices = [devices] 45 | if not UpdateManager.get_instance(): 46 | return {'Status': 'Failed', 47 | 'Message': 'Update Manager is not initialized'} 48 | myshare = UpdateManager.get_instance().getInventoryShare() 49 | mydevinv = myshare.new_file('%ip_firmware.json') 50 | for device in devices: 51 | device.update_mgr.serialize_inventory(mydevinv) 52 | return {'Status': 'Success'} 53 | 54 | @staticmethod 55 | def build_repo_catalog(*components): 56 | UpdateHelper.build_repo('Catalog', True, *components) 57 | 58 | @staticmethod 59 | def build_repo_catalog_model(): 60 | UpdateHelper.build_repo('Catalog', False) 61 | 62 | @staticmethod 63 | def build_repo(catalog, scoped, *components): 64 | updmgr = UpdateManager.get_instance() 65 | if not updmgr: 66 | return {'Status': 'Failed', 67 | 'Message': 'Update Manager is not initialized'} 68 | myshare = updmgr.getInventoryShare() 69 | (catshare, catscope) = updmgr.getCatalogScoper(catalog) 70 | fwfiles_path = os.path.join(myshare.local_full_path, '*_firmware.json') 71 | for fname in glob.glob(fwfiles_path): 72 | fwinventory = None 73 | with open(fname) as firmware_data: 74 | fwinventory = json.load(firmware_data) 75 | if not fwinventory: 76 | logger.debug(' no data found in ' + fname) 77 | continue 78 | flist = [] 79 | for comp in components: 80 | if comp in fwinventory['ComponentMap']: 81 | flist.extend(fwinventory['ComponentMap'][comp]) 82 | 83 | swidentity = fwinventory 84 | if not scoped: swidentity = None 85 | catscope.add_to_scope(fwinventory['Model_Hex'], swidentity, *flist) 86 | 87 | catscope.save() 88 | return {'Status': 'Success'} 89 | 90 | @staticmethod 91 | def get_firmware_inventory(): 92 | updmgr = UpdateManager.get_instance() 93 | if not updmgr: 94 | return {'Status': 'Failed', 95 | 'Message': 'Update Manager is not initialized'} 96 | myshare = updmgr.getInventoryShare() 97 | fwfiles_path = os.path.join(myshare.local_full_path, '*_firmware.json') 98 | device_fw = {} 99 | for fname in glob.glob(fwfiles_path): 100 | fwinventory = None 101 | with open(fname) as firmware_data: 102 | fwinventory = json.load(firmware_data) 103 | if not fwinventory: 104 | logger.debug(' no data found in ' + fname) 105 | continue 106 | device_fw[fwinventory['ServiceTag']] = fwinventory 107 | 108 | return {'Status': 'Success', 'retval': device_fw} 109 | -------------------------------------------------------------------------------- /omdrivers/helpers/iDRAC/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | def main(): 24 | print("Welcome to OpenManage SDK - Drivers") 25 | -------------------------------------------------------------------------------- /omdrivers/iDRAC/Config/Firmware.json: -------------------------------------------------------------------------------- 1 | { 2 | "$ref": "#/definitions/Firmware", 3 | "$schema": "omdrivers\\iDRAC\\xml\\Firmware.xml", 4 | "definitions": { 5 | "Firmware": { 6 | "config_groups": { 7 | "Update Source": [ 8 | "UpdateSource" 9 | ] 10 | }, 11 | "properties": { 12 | "UpdateSource": { 13 | "description": "Update Source", 14 | "longDescription": "Specify whether SPMA or FPMA addressing will be used for FCoE transactions.", 15 | "name": "UpdateSource", 16 | "qualifier": "Update Source", 17 | "readonly": "false" 18 | } 19 | }, 20 | "type": "object" 21 | } 22 | }, 23 | "title": "omdrivers\\iDRAC\\xml\\Firmware.xml" 24 | } -------------------------------------------------------------------------------- /omdrivers/iDRAC/MOF/DCIM_ControllerBatteryView.mof: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Dell Inc. All rights reserved. 2 | // ================================================================== 3 | // DCIM_ControllerBatteryView 4 | // ================================================================== 5 | 6 | [Description( 7 | "DCIM_ControllerBatteryView is a derivation of DCIM_View " 8 | "with controller specific data.") ] 9 | class DCIM_ControllerBatteryView : DCIM_View { 10 | 11 | [Key, Description ( 12 | "A string containing the Fully Qualified Device Description " 13 | "A user-friendly name for the object. This property allows each " 14 | "instance to define a user-friendly name in addition to its key " 15 | "properties, identity data, and description information. " 16 | )] 17 | string InstanceID; 18 | 19 | [Description ( 20 | "A string containing the Fully Qualified Device Description " 21 | "A user-friendly name for the object. This property allows each " 22 | " instance to define a user-friendly name in addition to its key " 23 | " properties, identity data, and description information. " 24 | )] 25 | string FQDD; 26 | 27 | [Description ( 28 | "A string containing the friendly Fully Qualified Device Description " 29 | "A property that describes the device and its location" 30 | )] 31 | string DeviceDescription; 32 | 33 | [Description ( 34 | "PrimaryStatus provides a high level status value, intended to " 35 | "align with Red-Yellow-Green type representation of status. " 36 | "It should be used to " 37 | "provide high level and detailed health status of the " 38 | "controller and its subcomponents. PrimaryStatus consists " 39 | "of one of the following values: Unknown, OK, Degraded or Error. " 40 | "\"Unknown\" indicates the implementation is in general capable " 41 | "of returning this property, but is unable to do so at this time. " 42 | "\"OK\" indicates the controller is functioning normally. " 43 | "\"Degraded\" indicates the controller is functioning below " 44 | "normal. \"Error\" indicates the controller is in an Error " 45 | " condition. " ), 46 | ValueMap { "0", "1", "2", "3", "0x8000", "0xFFFF" }, 47 | Values { "Unknown", "OK", "Degraded", "Error", "DMTF Reserved", "Vendor Reserved"}] 48 | uint32 PrimaryStatus; 49 | 50 | [Description ( 51 | "RAIDState provides the current battery status. The state " 52 | "can have one of the following values."), 53 | ValueMap { "0", "1", "6", "7", "9", "10", "12" }, 54 | Values { "Unknown", "Ready", "Failed", "Degraded", "Missing", "Charging", "Below Threshold"}] 55 | uint16 RAIDState; 56 | 57 | }; 58 | -------------------------------------------------------------------------------- /omdrivers/iDRAC/MOF/DCIM_EnclosureEMMView.mof: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Dell Inc. All rights reserved. 2 | // ================================================================== 3 | // DCIM_EnclosureEMMView 4 | // ================================================================== 5 | 6 | [Description( 7 | "DCIM_EnclosureEMMView is a derivation of DCIM_View " 8 | "with controller specific data.") ] 9 | class DCIM_EnclosureEMMView : DCIM_View { 10 | 11 | [Key, Description ( 12 | "A string containing the Fully Qualified Device Description " 13 | "A user-friendly name for the object. This property allows each " 14 | "instance to define a user-friendly name in addition to its key " 15 | "properties, identity data, and description information. " 16 | )] 17 | string InstanceID; 18 | 19 | [Description ( 20 | "A string containing the Fully Qualified Device Description " 21 | "A user-friendly name for the object. This property allows each " 22 | " instance to define a user-friendly name in addition to its key " 23 | " properties, identity data, and description information. " 24 | )] 25 | string FQDD; 26 | 27 | [Description ( 28 | "A string containing the friendly Fully Qualified Device Description " 29 | "A property that describes the device and its location" 30 | )] 31 | string DeviceDescription; 32 | 33 | [Description ( 34 | "A string containing the friendly Fully Qualified Device Description " 35 | "A property that describes the device and its location" 36 | )] 37 | string DeviceDescription; 38 | 39 | [Description ( 40 | "PrimaryStatus provides a high level status value, intended to " 41 | "align with Red-Yellow-Green type representation of status. " 42 | "It should be used to " 43 | "provide high level and detailed health status of the " 44 | "controller and its subcomponents. PrimaryStatus consists " 45 | "of one of the following values: Unknown, OK, Degraded or Error. " 46 | "\"Unknown\" indicates the implementation is in general capable " 47 | "of returning this property, but is unable to do so at this time. " 48 | "\"OK\" indicates the controller is functioning normally. " 49 | "\"Degraded\" indicates the controller is functioning below " 50 | "normal. \"Error\" indicates the controller is in an Error " 51 | " condition. " ), 52 | ValueMap { "0", "1", "2", "3", "0x8000", "0xFFFF" }, 53 | Values { "Unknown", "OK", "Degraded", "Error", "DMTF Reserved", "Vendor Reserved" }] 54 | uint32 PrimaryStatus; 55 | 56 | [Description ( 57 | "This property is the Enclosure EMM PartNumber ")] 58 | string PartNumber; 59 | 60 | [Description ( 61 | "This property is the Enclosure EMM Revision ")] 62 | string Revision; 63 | }; 64 | -------------------------------------------------------------------------------- /omdrivers/iDRAC/MOF/DCIM_EnclosurePSUView.mof: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Dell Inc. All rights reserved. 2 | // ================================================================== 3 | // DCIM_EnclosurePSUView 4 | // ================================================================== 5 | 6 | [Description( 7 | "DCIM_EnclosurePSUView is a derivation of DCIM_View " 8 | "with controller specific data.") ] 9 | class DCIM_EnclosurePSUView : DCIM_View { 10 | 11 | [Key, Description ( 12 | "A string containing the Fully Qualified Device Description " 13 | "A user-friendly name for the object. This property allows each " 14 | "instance to define a user-friendly name in addition to its key " 15 | "properties, identity data, and description information. " 16 | )] 17 | string InstanceID; 18 | 19 | [Description ( 20 | "A string containing the Fully Qualified Device Description " 21 | "A user-friendly name for the object. This property allows each " 22 | " instance to define a user-friendly name in addition to its key " 23 | " properties, identity data, and description information. " 24 | )] 25 | string FQDD; 26 | 27 | [Description ( 28 | "A string containing the friendly Fully Qualified Device Description " 29 | "A property that describes the device and its location" 30 | )] 31 | string DeviceDescription; 32 | 33 | [Description ( 34 | "PrimaryStatus provides a high level status value, intended to " 35 | "align with Red-Yellow-Green type representation of status. " 36 | "It should be used to " 37 | "provide high level and detailed health status of the " 38 | "controller and its subcomponents. PrimaryStatus consists " 39 | "of one of the following values: Unknown, OK, Degraded or Error. " 40 | "\"Unknown\" indicates the implementation is in general capable " 41 | "of returning this property, but is unable to do so at this time. " 42 | "\"OK\" indicates the controller is functioning normally. " 43 | "\"Degraded\" indicates the controller is functioning below " 44 | "normal. \"Error\" indicates the controller is in an Error " 45 | " condition. " ), 46 | ValueMap { "0", "1", "2", "3", "0x8000", "0xFFFF" }, 47 | Values { "Unknown", "OK", "Degraded", "Error", "DMTF Reserved", "Vendor Reserved" }] 48 | uint32 PrimaryStatus; 49 | 50 | [Description ( 51 | "This property is the Enclosure EMM PartNumber ")] 52 | string PartNumber; 53 | }; 54 | 55 | -------------------------------------------------------------------------------- /omdrivers/iDRAC/MOF/DCIM_EnclosureView.mof: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009 Dell Inc. All rights reserved. 2 | // ================================================================== 3 | // DCIM_EnclosureView 4 | // ================================================================== 5 | 6 | [Description( 7 | "DCIM_EnclosureView is a derivation of DCIM_View " 8 | "with storage enclosure specific data.") ] 9 | class DCIM_EnclosureView : DCIM_View { 10 | [Key, Description ( 11 | "A string containing the Fully Qualified Device Description " 12 | "A user-friendly name for the object. This property allows each " 13 | "instance to define a user-friendly name in addition to its key " 14 | "properties, identity data, and description information. " 15 | )] 16 | string InstanceID; 17 | 18 | [Description ( 19 | "A string containing the Fully Qualified Device Description " 20 | "A user-friendly name for the object. This property allows each " 21 | " instance to define a user-friendly name in addition to its key " 22 | " properties, identity data, and description information. " 23 | )] 24 | string FQDD; 25 | 26 | [Description ( 27 | "A string containing the friendly Fully Qualified Device Description " 28 | "A property that describes the device and its location" 29 | )] 30 | string DeviceDescription; 31 | 32 | [Description ( 33 | "PrimaryStatus provides a high level status value, intended to " 34 | "align with Red-Yellow-Green type representation of status. " 35 | "It should be used to provide " 36 | "high level and detailed health status of the enclosure and " 37 | "its subcomponents. PrimaryStatus consists of one of the following " 38 | "values: Unknown, OK, Degraded or Error. \"Unknown\" indicates the " 39 | "implementation is in general capable of returning this property, " 40 | "but is unable to do so at this time. \"OK\" indicates the " 41 | "enclosure is functioning normally. \"Degraded\" indicates the " 42 | "enclosure is functioning below normal. \"Error\" indicates the " 43 | "enclosure is in an Error condition. " ), 44 | ValueMap { "0", "1", "2", "3", "0x8000", "0xFFFF" }, 45 | Values { "Unknown", "OK", "Degraded", "Error", "DMTF Reserved", "Vendor Reserved" }] 46 | uint32 PrimaryStatus; 47 | 48 | [Description ( 49 | "RollupStatus provides a high level status value, intended to " 50 | "align with Red-Yellow-Green type representation of status. " 51 | "It should be used to provide " 52 | "high level and detailed health status of the enclosure and " 53 | "its subcomponents. PrimaryStatus consists of one of the following " 54 | "values: Unknown, OK, Degraded or Error. \"Unknown\" indicates the " 55 | "implementation is in general capable of returning this property, " 56 | "but is unable to do so at this time. \"OK\" indicates the " 57 | "enclosure is functioning normally. \"Degraded\" indicates the " 58 | "enclosure is functioning below normal. \"Error\" indicates the " 59 | "enclosure is in an Error condition. " ), 60 | ValueMap { "0", "1", "2", "3", "0x8000", "0xFFFF" }, 61 | Values { "Unknown", "OK", "Degraded", "Error", "DMTF Reserved", "Vendor Reserved" }] 62 | uint32 RollupStatus; 63 | 64 | [Description ( 65 | "This is the Enclosure port number ")] 66 | uint8 Connector; 67 | 68 | [Description ( 69 | "This is the position of the Enclosure ")] 70 | uint8 WiredOrder; 71 | 72 | [Description ( 73 | "This is the service Tag on the Enclosure ")] 74 | string ServiceTag; 75 | 76 | [Description ( 77 | "This is the asset Tag on the Enclosure ")] 78 | string AssetTag; 79 | 80 | [Description ( 81 | "This is the revision of the Enclosure ")] 82 | string Version; 83 | 84 | [Description ( 85 | "This is the number of slots on the Enclosure ")] 86 | uint8 SlotCount; 87 | 88 | [Description ( 89 | "This is the number of management module of the Enclosure ")] 90 | uint8 EMMCount; 91 | 92 | [Description ( 93 | "This is the number of power supplies of the Enclosure ")] 94 | uint8 PSUCount; 95 | 96 | [Description ( 97 | "This is the number of fans on the Enclosure ")] 98 | uint8 FanCount; 99 | 100 | [Description ( 101 | "This is the number of temperature probes of the Enclosure ")] 102 | uint8 TempProbeCount; 103 | 104 | [Description ( 105 | "This is the marketing name of the Enclosure ")] 106 | string ProductName; 107 | }; 108 | -------------------------------------------------------------------------------- /omdrivers/iDRAC/MOF/DCIM_VFlashView.mof: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Dell Inc. All rights reserved. 2 | // ================================================================== 3 | // DCIM_VFlashView 4 | // ================================================================== 5 | [Version ( "1.0.0" ), Description( 6 | "DCIM_VFlashView is a derivation of " 7 | "CIM_View with VFlash related data. ") ] 8 | class DCIM_VFlashView : DCIM_View { 9 | 10 | [Key, 11 | Description ( 12 | "This property represents the ID of the VFlash view. ")] 13 | string InstanceID; 14 | 15 | [Description ( 16 | "This property represents the FQDD of the VFlash view. " )] 17 | string FQDD; 18 | 19 | [Description ( 20 | "A string containing the friendly Fully Qualified Device Description " 21 | "A property that describes the device and its location" 22 | )] 23 | string DeviceDescription; 24 | 25 | [Description ( 26 | "This property represents the media. " )] 27 | string ComponentName; 28 | 29 | [Description ( 30 | "The EnabledState property indicates whether VFlash is " 31 | "enabled. " ) ] 32 | boolean VFlashEnabledState; 33 | 34 | [Description ( 35 | "This property specifies the total size on the media " ), 36 | ModelCorrespondence { "DCIM_VFlashComponent.AvailableSize" }] 37 | uint64 Capacity; 38 | 39 | [Description ( 40 | "This property specifies the avaible size on the media " ), 41 | ModelCorrespondence { "DCIM_VFlashView.Capacity" }] 42 | uint64 AvailableSize; 43 | 44 | [Description ( 45 | "The HealthStatus property represents the health status " 46 | "of the virtual flash media. " )] 47 | string HealthStatus; 48 | 49 | [Description ( 50 | "The InitializedState property represents the initialization state " 51 | "of the virtual flash media. " )] 52 | string InitializedState; 53 | 54 | [Description ( 55 | "This property represents whether the virtue flash media " 56 | "is licensed or not." ) ] 57 | boolean Licensed; 58 | 59 | [Description ( 60 | "This property indicates whether the virtue flash media " 61 | "is write protected(latch is on) or not." ) ] 62 | boolean WriteProtected; 63 | 64 | 65 | }; 66 | -------------------------------------------------------------------------------- /omdrivers/iDRAC/MOF/DCIM_VideoView.mof: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Dell Inc. All rights reserved. 2 | // ================================================================== 3 | // DCIM_VideoView 4 | // ================================================================== 5 | [Version ( "1.0.0" ), Description( 6 | "DCIM_VideoView is a derivation of CIM_View " 7 | "with Video specific data" )] 8 | class DCIM_VideoView : DCIM_View { 9 | [Key, Description ( 10 | "A string containing the Fully Qualified Device Description " 11 | "A user-friendly name for the object. This property allows each " 12 | " instance to define a user-friendly name in addition to its key " 13 | " properties, identity data, and description information." )] 14 | string InstanceID; 15 | 16 | [Description ( 17 | "A string containing the Fully Qualified Device Description " 18 | "A user-friendly name for the object. This property allows each " 19 | " instance to define a user-friendly name in addition to its key " 20 | " properties, identity data, and description information." )] 21 | string FQDD; 22 | 23 | [Description ( 24 | "A string containing the friendly Fully Qualified Device Description " 25 | "A property that describes the device and its location" 26 | )] 27 | string DeviceDescription; 28 | 29 | [Description ("The bus number where this Video device resides")] 30 | uint32 BusNumber; 31 | 32 | [Description ("The device number assigned to this Video for this bus.")] 33 | uint32 DeviceNumber; 34 | 35 | [Description ("The function number for this Video device.")] 36 | uint32 FunctionNumber; 37 | 38 | [Description ("Register that contains a value assigned by the Video SIG" 39 | "used to identify the manufacturer of the device.")] 40 | string PCIVendorID; 41 | 42 | [Description ("Register that contains a value assigned by the device" 43 | "manufacturer used to identify the type of device.")] 44 | string PCIDeviceID; 45 | 46 | [Description ("Subsystem vendor ID.")] 47 | string PCISubVendorID; 48 | 49 | [Description ("Register that contains a value assigned by the vendor" 50 | "manufacturer used to identify the type of device.")] 51 | string PCISubDeviceID; 52 | 53 | [Description ( 54 | "A string containing the Manufacturer name" 55 | "The name of the organization responsible for producing the Video device."), 56 | MaxLen ( 256 ) ] 57 | string Manufacturer; 58 | 59 | [Description ("Gives the description of the video device")] 60 | string Description; 61 | 62 | [Description ("Data-bus width of the PCI device."), 63 | ValueMap { "0001", "0002", "0003", "0004", "0005", "0006", 64 | "0007", "0008", "0009", "000A", "000B", "000C", 65 | "000D", "000E"}, 66 | Values { "Other", "Unknown", "8 bit", "16 bit", "32 bit", "64 bit", 67 | "128 bit", "1x or x1", "2x or x2", " 4x or x4", "8x or x8", 68 | "12x or x12", " 16x or x16", " 32x or x32"}] 69 | string DataBusWidth; 70 | 71 | [Description ("Slot length of the PCI device"), 72 | ValueMap { "0001", "0002", "0003", "0004"}, 73 | Values { "Other", "Unknown", " Short Length", " Long Length"}] 74 | string SlotLength; 75 | 76 | [Description ("Slot type of the PCI device."), 77 | ValueMap { "0001", "0002", "0003", "0004", "0005", "0006", 78 | "0007", "0008", "0009", "000A", "000B", "000C", 79 | "000D", "000E", "000F", "0010", "0011", "0012", 80 | "0013", "00A0", "00A1", "00A2", "00A3", "00A4", 81 | "00A5", "00A6", "00A7", "00A8", "00A9", "00AA", 82 | "00AB", "00AC", "00AD", "00AE", "00AF", "00B0", 83 | "00B1", "00B2", "00B3", "00B4", "00B5", "00B6"}, 84 | Values { "Other", "Unknown", "ISA", "MCA", "EISA", "PCI", 85 | "PC Card (PCMCIA)", "VL-VESA", "Proprietary", 86 | "Processor Card Slot", 87 | "Proprietary Memory Card Slot", "I/O Riser Card Slot", "NuBus", 88 | "PCI - 66MHz Capable", 89 | "AGP", "AGP 2X", "AGP 4X", "PCI-X", "AGP 8X", "PC-98/C20", 90 | "PC-98/C24", "PC-98/E", "PC-98/Local Bus", "PC-98/Card", 91 | "PCI Express", 92 | "PCI Express x1", "PCI Express x2", "PCI Express x4", 93 | "PCI Express x8", "PCI Express x16", "PCI Express Gen 2", 94 | "PCI Express Gen 2 x1", "PCI Express Gen 2 x2", "PCI Express Gen 2 x4", 95 | "PCI Express Gen 2 x8", "PCI Express Gen 2 x16", 96 | "PCI Express Gen 3", 97 | "PCI Express Gen 3 x1", "PCI Express Gen 3 x2", "PCI Express Gen 3 x4", 98 | "PCI Express Gen 3 x8", "PCI Express Gen 3 x16" } ] 99 | string SlotType; 100 | }; 101 | -------------------------------------------------------------------------------- /omdrivers/iDRAC/MOF/DCIM_iDRACCardView.mof: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Dell Inc. All rights reserved. 2 | // ================================================================== 3 | // DCIM_IDRACCardView 4 | // ================================================================== 5 | [Version ( "1.0.0" ), Description( 6 | "DCIM_IDRACCardView is a derivation of CIM_View " 7 | "with iDRAC Card specific data" )] 8 | class DCIM_iDRACCardView : DCIM_View { 9 | [Key, Description ( 10 | "A string containing the Fully Qualified Device Description" 11 | "A user-friendly name for the object. This property allows each" 12 | " instance to define a user-friendly name in addition to its key" 13 | " properties, identity data, and description information." 14 | )] 15 | string InstanceID; 16 | 17 | [Description ( 18 | "A string containing the Fully Qualified Device Description" 19 | "A user-friendly name for the object. This property allows each" 20 | " instance to define a user-friendly name in addition to its key" 21 | " properties, identity data, and description information." 22 | )] 23 | string FQDD; 24 | 25 | [Description ( 26 | "A string containing the friendly Fully Qualified Device Description " 27 | "A property that describes the device and its location" 28 | )] 29 | string DeviceDescription; 30 | 31 | [Description ( 32 | "A string containing the IPMI Version")] 33 | string IPMIVersion; 34 | 35 | [Description ( 36 | "A string containing the Firmware Version")] 37 | string FirmwareVersion; 38 | 39 | [Description ( 40 | "A string containing the iDrac model.")] 41 | string Model; 42 | 43 | [Description ( 44 | "A string containing the Product Description")] 45 | string ProductDescription; 46 | 47 | [Description ( 48 | "A string containing Permanent MAC Address")] 49 | string PermanentMACAddress; 50 | 51 | [Description ( 52 | "A string containing the GUID")] 53 | string GUID; 54 | 55 | [Description ( 56 | "A string containing the URLString")] 57 | string URLString; 58 | 59 | [Description ( 60 | "LAN Enable/Disable"), 61 | ValueMap { "0", "1"}, 62 | Values {"Disabled", "Enabled"}] 63 | uint16 LANEnabledState; 64 | 65 | [Description ( 66 | "SOL Enable/Disable" ), 67 | ValueMap { "0", "1"}, 68 | Values {"Disabled", "Enabled"}] 69 | uint16 SOLEnabledState; 70 | 71 | [Description ( 72 | "A string containing the iDRAC host name")] 73 | string DNSRacName; 74 | 75 | [Description ( 76 | "A string containing the iDRAC domain name")] 77 | string DNSDomainName; 78 | 79 | }; 80 | -------------------------------------------------------------------------------- /omdrivers/iDRAC/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | def main(): 24 | print("Welcome to OpenManage SDK - Drivers") 25 | -------------------------------------------------------------------------------- /omdrivers/iDRAC/xml/Firmware.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | This Registry defines a representation of system hardware or firmware Attribute instances, such as BIOS or NIC Attributes, as defined by Dell. 10 | 11 | 12 | 13 | UpdateSource 14 | Update Source 15 | String 16 | Specify whether SPMA or FPMA addressing will be used for FCoE transactions. 17 | Update Source 18 | Update Source 19 | 100 20 | false 21 | Typical 22 | Console:UpdateSource.Name 23 | 24 | Yes 25 | No 26 | No 27 | Yes 28 | No 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /omdrivers/lifecycle/F10/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | def main(): 24 | print("Welcome to OpenManage SDK - Drivers") 25 | -------------------------------------------------------------------------------- /omdrivers/lifecycle/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | def main(): 24 | print("Welcome to OpenManage SDK - Drivers") 25 | -------------------------------------------------------------------------------- /omdrivers/lifecycle/iDRAC/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | def main(): 24 | print("Welcome to OpenManage SDK - Drivers") 25 | -------------------------------------------------------------------------------- /omdrivers/lifecycle/iDRAC/iDRACCredsMgmt.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import os 24 | import re 25 | import sys 26 | from omsdk.sdkcreds import UserCredentials 27 | from omsdk.sdkcenum import EnumWrapper, TypeHelper 28 | from omsdk.lifecycle.sdkcredentials import iBaseCredentialsApi 29 | from omdrivers.enums.iDRAC.iDRACEnums import * 30 | from omdrivers.enums.iDRAC.iDRAC import Privilege_UsersTypes 31 | 32 | PY2 = sys.version_info[0] == 2 33 | PY3 = sys.version_info[0] == 3 34 | 35 | try: 36 | from pysnmp.hlapi import * 37 | from pysnmp.smi import * 38 | 39 | PySnmpPresent = True 40 | except ImportError: 41 | PySnmpPresent = False 42 | 43 | 44 | class iDRACCredsMgmt(iBaseCredentialsApi): 45 | def __init__(self, entity): 46 | if PY2: 47 | super(iDRACCredsMgmt, self).__init__(entity) 48 | else: 49 | super().__init__(entity) 50 | self._job_mgr = entity.job_mgr 51 | self._config_mgr = entity.config_mgr 52 | self.eUserPrivilegeEnum = UserPrivilegeEnum 53 | 54 | @property 55 | def Users(self): 56 | return self._config_mgr._sysconfig.iDRAC.Users 57 | 58 | ####### 59 | # Creating a user 60 | # 61 | # user = idrac.user_mgr.Users.new( 62 | # user. = value 63 | # user. = value 64 | # user. = value 65 | # ) 66 | # idrac.user_mgr.Users.new( 67 | # UserName_Users = username, 68 | # Password_Users = password, 69 | # Privilege_Users = Privilege_UsersTypes.Operator, 70 | # IpmiLanPrivilege_Users = "Administrator", 71 | # IpmiSerialPrivilege_Users = "Administrator", 72 | # Enable_Users = "Enabled", 73 | # SolEnable_Users = "Enabled", 74 | # ProtocolEnable_Users = "Disabled", 75 | # AuthenticationProtocol_Users = "SHA", 76 | # PrivacyProtocol_Users = "AES" 77 | # ) 78 | # 79 | # idrac.config_mgr.apply_changes() 80 | # 81 | # Note: for enum types you can give enum or corresponding string value 82 | # Privilege_UsersTypes.Administrator or "511" 83 | # For details on variable types look at omdrivers.types.iDRAC.iDRAC 84 | # and possible values of enum in omdrivers.enums.iDRAC.iDRAC 85 | # 86 | # don't forget to catch for ValueEror and AttributeError exceptions! 87 | # You will get that for following reasons: 88 | # - Wrong/invalid value provided (enum, string) 89 | # - All user entries are exhausted 90 | # - Duplicate user entry 91 | # 92 | # Until you do apply_changes, they are not committed. 93 | # 94 | ####### 95 | 96 | ####### 97 | # Modifying a user 98 | # 99 | # user = idrac.user_mgr.Users.find_first(UserName_Users = username) 100 | # 101 | # user. = value 102 | # user. = value 103 | # user. = value 104 | # 105 | # value is None => treated as no change 106 | # value is '' => treated as equivalent nullifying the object 107 | # value is invalid => ValueError is thrown 108 | # idrac.config_mgr.apply_changes() 109 | # 110 | # don't forget to catch for ValueEror and AttributeError exceptions! 111 | # 112 | ####### 113 | 114 | ####### 115 | # deleting a user 116 | # 117 | # idrac.user_mgr.iDRAC.Users.remove(UserName_Users = username) 118 | # idrac.config_mgr.apply_changes() 119 | # 120 | # don't forget to catch for ValueEror and AttributeError exceptions! 121 | # 122 | ####### 123 | -------------------------------------------------------------------------------- /omdrivers/lifecycle/iDRAC/rebootOptions.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from omdrivers.enums.iDRAC.iDRACEnums import * 24 | 25 | 26 | class RebootOptions(object): 27 | # time_to_wait is in seconds 28 | def __init__(self, time_to_wait=300, host_state=HostEndPowerStateEnum.On, shutdown_type=ShutdownTypeEnum.Forced): 29 | self.time_to_wait = time_to_wait 30 | self.host_state = host_state 31 | self.shutdown_type = shutdown_type 32 | -------------------------------------------------------------------------------- /omdrivers/types/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | def main(): 24 | print("Welcome to OpenManage SDK - Drivers") 25 | -------------------------------------------------------------------------------- /omdrivers/types/iDRAC/FCHBA.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from omdrivers.enums.iDRAC.FCHBA import * 24 | from omsdk.typemgr.ClassType import ClassType 25 | from omsdk.typemgr.ArrayType import ArrayType 26 | from omsdk.typemgr.BuiltinTypes import * 27 | import sys 28 | import logging 29 | 30 | PY2 = sys.version_info[0] == 2 31 | PY3 = sys.version_info[0] == 3 32 | 33 | logger = logging.getLogger(__name__) 34 | 35 | 36 | class FCHBA(ClassType): 37 | def __init__(self, parent=None, loading_from_scp=False): 38 | if PY2: 39 | super(FCHBA, self).__init__("Component", None, parent) 40 | else: 41 | super().__init__("Component", None, parent) 42 | self.BootScanSelection = EnumTypeField(BootScanSelectionTypes.Disabled, BootScanSelectionTypes, parent=self) 43 | # readonly attribute 44 | self.BusDeviceFunction = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 45 | # readonly attribute 46 | self.ChipMdl = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 47 | # readonly attribute populated by iDRAC 48 | self.DeviceName = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 49 | # readonly attribute 50 | self.EFIVersion = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 51 | self.FCTape = EnumTypeField(FCTapeTypes.Disabled, FCTapeTypes, parent=self) 52 | self.FabricLoginRetryCount = IntField(3, parent=self) 53 | self.FabricLoginTimeout = IntField(3000, parent=self) 54 | # readonly attribute 55 | self.FamilyVersion = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 56 | self.FirstFCTargetLUN = IntField(None, parent=self) 57 | self.FirstFCTargetWWPN = WWPNAddressField(None, parent=self) 58 | self.FramePayloadSize = EnumTypeField(FramePayloadSizeTypes.Auto, FramePayloadSizeTypes, parent=self) 59 | self.HardZone = EnumTypeField(HardZoneTypes.Disabled, HardZoneTypes, parent=self) 60 | self.HardZoneAddress = IntField(0, parent=self) 61 | self.LinkDownTimeout = IntField(3000, parent=self) 62 | self.LoopResetDelay = IntField(5, parent=self) 63 | # readonly attribute 64 | self.PCIDeviceID = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 65 | self.PortDownRetryCount = IntField(None, parent=self) 66 | self.PortDownTimeout = IntField(3000, parent=self) 67 | self.PortLoginRetryCount = IntField(3, parent=self) 68 | self.PortLoginTimeout = IntField(3000, parent=self) 69 | # readonly attribute populated by iDRAC 70 | self.PortNumber = IntField(None, parent=self, modifyAllowed=False, deleteAllowed=False) 71 | self.PortSpeed = EnumTypeField(PortSpeedTypes.Auto, PortSpeedTypes, parent=self) 72 | self.SecondFCTargetLUN = IntField(None, parent=self) 73 | self.SecondFCTargetWWPN = WWPNAddressField(None, parent=self) 74 | self.VirtualWWN = WWPNAddressField(None, parent=self) 75 | self.VirtualWWPN = WWPNAddressField(None, parent=self) 76 | # readonly attribute populated by iDRAC 77 | self.WWN = WWPNAddressField(None, parent=self, modifyAllowed=False, deleteAllowed=False) 78 | # readonly attribute populated by iDRAC 79 | self.WWPN = WWPNAddressField(None, parent=self, modifyAllowed=False, deleteAllowed=False) 80 | self.commit(loading_from_scp) 81 | -------------------------------------------------------------------------------- /omdrivers/types/iDRAC/JobOptions.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | 24 | import logging 25 | 26 | DEFAULT_INTERVAL = 2 * 60 # seconds 27 | 28 | 29 | class JobOptions(object): 30 | def __init__(self, job_wait=False, wait_interval=DEFAULT_INTERVAL): 31 | self.job_wait = job_wait 32 | if wait_interval <= 0: 33 | logging.warning("Job wait interval is negative. Setting default") 34 | wait_interval = DEFAULT_INTERVAL 35 | self.wait_interval = wait_interval 36 | -------------------------------------------------------------------------------- /omdrivers/types/iDRAC/PCIeSSD.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from omdrivers.enums.iDRAC.PCIeSSD import * 24 | from omsdk.typemgr.ClassType import ClassType 25 | from omsdk.typemgr.ArrayType import ArrayType 26 | from omsdk.typemgr.BuiltinTypes import * 27 | import sys 28 | import logging 29 | 30 | PY2 = sys.version_info[0] == 2 31 | PY3 = sys.version_info[0] == 3 32 | 33 | logger = logging.getLogger(__name__) 34 | 35 | 36 | class PCIeSSD(ClassType): 37 | def __init__(self, parent=None, loading_from_scp=False): 38 | if PY2: 39 | super(PCIeSSD, self).__init__("Component", None, parent) 40 | else: 41 | super().__init__("Component", None, parent) 42 | # readonly attribute populated by iDRAC 43 | self.BusProtocol = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 44 | # readonly attribute populated by iDRAC 45 | self.BusProtocolVersion = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 46 | # readonly attribute populated by iDRAC 47 | self.CapableSpeed = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 48 | # readonly attribute populated by iDRAC 49 | self.CryptographicErase = EnumTypeField(None, CryptographicEraseTypes, parent=self, modifyAllowed=False, 50 | deleteAllowed=False) 51 | # readonly attribute populated by iDRAC 52 | self.DeviceProtocol = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 53 | # readonly attribute populated by iDRAC 54 | self.FailurePredicted = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 55 | # readonly attribute populated by iDRAC 56 | self.ModelNumber = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 57 | # readonly attribute populated by iDRAC 58 | self.Name = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 59 | # readonly attribute populated by iDRAC 60 | self.PcieMaxLinkWidth = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 61 | # readonly attribute populated by iDRAC 62 | self.PcieNegotiatedLinkSpeed = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 63 | # readonly attribute populated by iDRAC 64 | self.PcieNegotiatedLinkWidth = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 65 | # readonly attribute populated by iDRAC 66 | self.RemainingRatedWriteEndurance = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 67 | # readonly attribute populated by iDRAC 68 | self.SecureErase = EnumTypeField(None, SecureEraseTypes, parent=self, modifyAllowed=False, deleteAllowed=False) 69 | # readonly attribute populated by iDRAC 70 | self.SerialNumber = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 71 | # readonly attribute populated by iDRAC 72 | self.Size = IntField(None, parent=self, modifyAllowed=False, deleteAllowed=False) 73 | # readonly attribute populated by iDRAC 74 | self.SmartStatus = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 75 | # readonly attribute populated by iDRAC 76 | self.State = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 77 | # readonly attribute populated by iDRAC 78 | self.Version = StringField("", parent=self, modifyAllowed=False, deleteAllowed=False) 79 | self.commit(loading_from_scp) 80 | -------------------------------------------------------------------------------- /omdrivers/types/iDRAC/SystemConfiguration.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from omsdk.typemgr.ClassType import ClassType 24 | from omsdk.typemgr.ArrayType import ArrayType, FQDDHelper 25 | from omsdk.typemgr.BuiltinTypes import RootClassType 26 | from omdrivers.types.iDRAC.iDRAC import * 27 | from omdrivers.types.iDRAC.BIOS import * 28 | from omdrivers.types.iDRAC.NIC import * 29 | from omdrivers.types.iDRAC.FCHBA import * 30 | from omdrivers.types.iDRAC.RAID import * 31 | import sys 32 | import logging 33 | 34 | PY2 = sys.version_info[0] == 2 35 | PY3 = sys.version_info[0] == 3 36 | 37 | logger = logging.getLogger(__name__) 38 | 39 | 40 | class SystemConfiguration(RootClassType): 41 | def __init__(self, parent=None, loading_from_scp=False): 42 | if PY2: 43 | super(SystemConfiguration, self).__init__("SystemConfiguration", None, parent) 44 | else: 45 | super().__init__("SystemConfiguration", None, parent) 46 | self.LifecycleController = LifecycleController(parent=self, loading_from_scp=loading_from_scp) 47 | self.System = System(parent=self, loading_from_scp=loading_from_scp) 48 | self.iDRAC = iDRAC(parent=self, loading_from_scp=loading_from_scp) 49 | self.FCHBA = ArrayType(FCHBA, parent=self, index_helper=FQDDHelper(), loading_from_scp=loading_from_scp) 50 | self.NIC = ArrayType(NetworkInterface, parent=self, index_helper=FQDDHelper(), 51 | loading_from_scp=loading_from_scp) 52 | self.BIOS = BIOS(parent=self, loading_from_scp=loading_from_scp) 53 | self.Controller = ArrayType(Controller, parent=self, index_helper=FQDDHelper(), 54 | loading_from_scp=loading_from_scp) 55 | self._ignore_attribs('ServiceTag', 'Model', 'TimeStamp') 56 | self.commit(loading_from_scp) 57 | -------------------------------------------------------------------------------- /omdrivers/types/iDRAC/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | def main(): 24 | print("Welcome to OpenManage SDK - Drivers") 25 | -------------------------------------------------------------------------------- /omdrivers/types/iDRAC/rebootOptions.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from omdrivers.enums.iDRAC.iDRACEnums import * 24 | 25 | 26 | class RebootOptions(object): 27 | # time_to_wait is in seconds 28 | def __init__(self, time_to_wait=300, host_state=HostEndPowerStateEnum.On, shutdown_type=ShutdownTypeEnum.Forced): 29 | self.time_to_wait = time_to_wait 30 | self.host_state = host_state 31 | self.shutdown_type = shutdown_type 32 | -------------------------------------------------------------------------------- /omsdk/README: -------------------------------------------------------------------------------- 1 | sdkinfra.py 2 | Infrastructure for importing console and device drivers 3 | 4 | sdkbase.py 5 | Base class for all Consoles and Devices. 6 | Registry - loading registry files 7 | Discovery - discovers the 8 | Driver - driver class extended by all Consoles and Devices 9 | 10 | 11 | sdkconsole.py 12 | Base class for all Consoles. Derived from sdkbase. 13 | Registry - loading registry files 14 | Discovery - discovers the 15 | Driver - driver class extended by all Consoles and Devices 16 | 17 | get_topology() 18 | get_devmap() 19 | appy_topology() 20 | add_device() 21 | 22 | sdkdevice.py 23 | Base class for all Devices. Derived from sdkbase 24 | 25 | sdkcreds.py 26 | Represents the Credential Object 27 | 28 | 29 | sdkenum.py 30 | Enumerations 31 | 32 | sdkfile.py 33 | Provides utility for Linux-style config file processing 34 | 35 | sdkidrac.py 36 | iDRAC WSMAN/Redfish definitions 37 | 38 | sdkidracman.py 39 | Contains WSMAN/SOAP implementation 40 | sdkxml.py 41 | Parsers for WSMAN/SOAP Requests 42 | 43 | sdkprint.py 44 | Contains print classes 45 | 46 | sdkps.py 47 | Contains Powershell Commandlets 48 | 49 | Test Commands: 50 | show_cmc.py 51 | show_idrac.py 52 | show_list.py 53 | show_nagios.py 54 | show_ome.py 55 | show_windir.py 56 | show_windrac.py 57 | test_enum.py 58 | test_file.py 59 | test_windrac.py 60 | test_wsman.py 61 | main.py 62 | -------------------------------------------------------------------------------- /omsdk/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | 24 | 25 | def main(): 26 | print("Welcome to Dell OpenManage SDK") 27 | -------------------------------------------------------------------------------- /omsdk/catalog/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | 24 | 25 | def main(): 26 | print("Welcome to Dell OpenManage SDK") 27 | -------------------------------------------------------------------------------- /omsdk/catalog/pdkcatalog.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | 24 | import os 25 | import pprint 26 | import json 27 | import re 28 | import xml.etree.ElementTree as ET 29 | from xml.dom.minidom import parse 30 | import xml.dom.minidom 31 | 32 | from omsdk.sdkprint import PrettyPrint 33 | import logging 34 | 35 | logger = logging.getLogger(__name__) 36 | 37 | 38 | class DellPDKCatalog: 39 | OSTypes = { 40 | "WIN": "LWXP", 41 | } 42 | 43 | def __init__(self, source_file): 44 | self.source_file = source_file 45 | if not os.path.isfile(self.source_file): 46 | logger.debug(self.source_file + " does not exist!") 47 | self.root = ET.Element("Manifest") 48 | self.tree = ET.ElementTree(self.root) 49 | self.valid = False 50 | else: 51 | self.tree = ET.parse(self.source_file) 52 | self.root = self.tree.getroot() 53 | self.valid = True 54 | 55 | # ostype = None => all os types 56 | # ostype = "WIN" => only win32 57 | # ostype = ["WIN", "LIN"] => only win32 and Lin32 58 | def filter_bundle(self, model, ostype="WIN", tosource=None): 59 | # Find all Software Bundles for this model 60 | model = model.upper() 61 | model_path = "./SoftwareBundle/TargetSystems/Brand/Model[@systemID='{0}']/.../.../...".format(model) 62 | os_path = "./TargetOSes/OperatingSystem" 63 | if ostype: 64 | lostype = ostype 65 | if not isinstance(ostype, list): 66 | lostype = [lostype] 67 | for os in lostype: 68 | os_path += "[@osCode='{0}']".format(os) 69 | cnodes = self.root.findall(model_path) 70 | count = 0 71 | for node in cnodes: 72 | if len(node.findall(os_path)) <= 0: 73 | continue 74 | count += 1 75 | if tosource: 76 | tosource.addBundle(model, node) 77 | return count 78 | 79 | def _filter_byid(self, model, ostype, compid_path, firm, tosource): 80 | model = model.upper() 81 | model_path = "./SupportedSystems/Brand/Model[@systemID='{0}']".format(model) 82 | comp_path = "./SoftwareComponent" 83 | lostype = [""] 84 | if ostype: 85 | _ostype = ostype 86 | lostype = [] 87 | if not isinstance(ostype, list): 88 | _ostype = [_ostype] 89 | for os in _ostype: 90 | lostype.append("[@packageType='{0}']".format(self.OSTypes[os])) 91 | count = 0 92 | for oses in lostype: 93 | xpth = comp_path + oses + "/SupportedDevices/Device" + compid_path + "/.../..." 94 | cnodes = self.root.findall(xpth) 95 | for node in cnodes: 96 | if len(node.findall(model_path)) <= 0: 97 | continue 98 | count = count + 1 99 | if tosource: 100 | tosource.addComponent(model, node, firm) 101 | return count 102 | 103 | def filter_by_model(self, model, ostype="WIN", firm=None, tosource=None): 104 | model = model.upper() 105 | return self._filter_byid(model, ostype, "", firm, tosource) 106 | 107 | def filter_by_compid(self, model, cid, ostype="WIN", firm=None, tosource=None): 108 | model = model.upper() 109 | compid_path = "" 110 | if cid: 111 | compid_path = "[@componentID='{0}']".format(cid) 112 | return self._filter_byid(model, ostype, compid_path, firm, tosource) 113 | 114 | def filter_by_pci(self, model, pcispec, ostype="WIN", firm=None, tosource=None): 115 | model = model.upper() 116 | compid_path = "/PCIInfo" 117 | for field in ['deviceID', 'subDeviceID', 'subVendorID', 'vendorID']: 118 | if field not in pcispec or not pcispec[field]: 119 | logger.debug(field + " is not present or null") 120 | continue 121 | compid_path += "[@" + field + "='" + pcispec[field] + "']" 122 | compid_path += "/..." 123 | return self._filter_byid(model, ostype, compid_path, firm, tosource) 124 | -------------------------------------------------------------------------------- /omsdk/http/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | 24 | -------------------------------------------------------------------------------- /omsdk/http/sdkredfish.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import sys 24 | 25 | from omsdk.http.sdkredfishbase import RedfishProtocolBase 26 | from omsdk.http.sdkhttpep import HttpEndPoint 27 | 28 | PY2 = sys.version_info[0] == 2 29 | PY3 = sys.version_info[0] == 3 30 | 31 | 32 | class RedfishProtocol(RedfishProtocolBase): 33 | 34 | def __init__(self, ipaddr, creds, pOptions): 35 | if PY2: 36 | super(RedfishProtocol, self).__init__(ipaddr, creds, pOptions) 37 | else: 38 | super().__init__(ipaddr, creds, pOptions) 39 | headers = { 40 | 'Content-Type': '"application/json;charset=UTF-8' 41 | } 42 | self.proto = HttpEndPoint(ipaddr, creds, pOptions, headers) 43 | self.ipaddr = ipaddr 44 | self.username = creds.username 45 | self.password = creds.password 46 | 47 | def _proto_connect(self): 48 | self.proto.connect() 49 | 50 | def _proto_ship_payload(self, payload): 51 | return self.proto.ship_payload(payload) 52 | 53 | def _proto_endpoint(self): 54 | return self.proto.endpoint 55 | 56 | def _proto_reset(self): 57 | return self.proto.reset() 58 | -------------------------------------------------------------------------------- /omsdk/http/sdkredfishpdu.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import json 24 | import re 25 | import sys 26 | 27 | PY2 = sys.version_info[0] == 2 28 | PY3 = sys.version_info[0] == 3 29 | 30 | 31 | class RedfishRequest: 32 | def __init__(self): 33 | self.root = {} 34 | self.selector = None 35 | 36 | def enumerate(self, to, ruri, selectors, envSize=512000, mid=None, opTimeout=60): 37 | return self 38 | 39 | def set_header(self, to, ruri, action, envSize=512000, mid=None, opTimeout=60): 40 | return self 41 | 42 | def add_selectors(self, selectors): 43 | return self 44 | 45 | def add_body(self, ruri, action, args): 46 | self.root = {} 47 | return self 48 | 49 | def add_error(self, ex): 50 | return self 51 | 52 | def identify(self): 53 | return self 54 | 55 | def get_text(self): 56 | return json.dumps(self.root) 57 | 58 | 59 | class RedfishResponse: 60 | def __init__(self): 61 | pass 62 | 63 | def strip_ns(self, s, stripNS): 64 | return (re.sub(".*:", "", s) if stripNS else s) 65 | 66 | def execute_str(self, value, stripNS=True): 67 | return json.loads(value) 68 | 69 | def get_message(self, fault): 70 | msg = None 71 | return msg 72 | -------------------------------------------------------------------------------- /omsdk/http/sdkrest.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import sys 24 | import logging 25 | import json 26 | from omsdk.sdkcenum import EnumWrapper 27 | from omsdk.http.sdkrestpdu import RestRequest 28 | from omsdk.http.sdkhttpep import HttpEndPointOptions, AuthenticationType 29 | from omsdk.http.sdkrestbase import RestProtocolBase 30 | from omsdk.http.sdkhttpep import HttpEndPoint 31 | from omsdk.sdkprotopref import ProtocolEnum 32 | logger = logging.getLogger(__name__) 33 | PY2 = sys.version_info[0] == 2 34 | PY3 = sys.version_info[0] == 3 35 | 36 | ReturnValueMap = { 37 | 'Success': 0, 38 | 'Error': 2, 39 | 'JobCreated': 4096, 40 | 'Invalid': -1 41 | } 42 | 43 | ReturnValue = EnumWrapper('ReturnValue', ReturnValueMap).enum_type 44 | 45 | 46 | class RestOptions(HttpEndPointOptions): 47 | def __init__( 48 | self, authentication=AuthenticationType.Basic, port=443, connection_timeout=10, 49 | read_timeout=10, max_retries=1, verify_ssl=False 50 | ): 51 | if PY2: 52 | super(RestOptions, self).__init__( 53 | ProtocolEnum.REST, authentication, port, connection_timeout, 54 | read_timeout, max_retries, verify_ssl 55 | ) 56 | else: 57 | super().__init__( 58 | ProtocolEnum.REST, authentication, port, connection_timeout, 59 | read_timeout, max_retries, verify_ssl 60 | ) 61 | 62 | 63 | class RestProtocol(RestProtocolBase): 64 | def __init__(self, ipaddr, creds, pOptions): 65 | if PY2: 66 | super(RestProtocol, self).__init__(ipaddr, creds, pOptions) 67 | else: 68 | super().__init__(ipaddr, creds, pOptions) 69 | headers = {'Content-Type': 'application/json'} 70 | self.proto = HttpEndPoint(ipaddr, creds, pOptions, headers) 71 | self.ipaddr = ipaddr 72 | self.username = creds.username 73 | self.password = creds.password 74 | self._logger = logging.getLogger(__name__) 75 | 76 | def identify(self): 77 | """ Identifies the target product """ 78 | wsm = RestRequest() 79 | wsm.identify() 80 | return self._communicate(wsm) 81 | 82 | 83 | def printx(self, json_object): 84 | if json_object is None: 85 | logger.debug("") 86 | return False 87 | logger.debug(json.dumps(json_object, sort_keys=True, indent=4, 88 | separators=(',', ': '))) 89 | 90 | -------------------------------------------------------------------------------- /omsdk/http/sdkrestpdu.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import sys 24 | 25 | PY2 = sys.version_info[0] == 2 26 | PY3 = sys.version_info[0] == 3 27 | 28 | 29 | class RestRequest: 30 | envAttrs = { 31 | 'xmlns:enc': 'http://www.w3.org/2003/05/soap-encoding', 32 | 'xmlns:env': 'http://www.w3.org/2003/05/soap-envelope', 33 | 'xmlns:tns': 'http://schemas.microsoft.com/wmx/2005/06', 34 | # xmlns:a = xmlns:wsa 35 | 'xmlns:a': 'http://schemas.xmlsoap.org/ws/2004/08/addressing', 36 | 'xmlns:wse': 'http://schemas.xmlsoap.org/ws/2004/08/eventing', 37 | # xmlns:n = xmlns:wsen 38 | 'xmlns:n': 'http://schemas.xmlsoap.org/ws/2004/09/enumeration', 39 | # xmlns:w = xmlns:wsman 40 | 'xmlns:w': 'http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd', 41 | # xmlns:b = xmlns:wsmb 42 | 'xmlns:b': 'http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd', 43 | 'xmlns:wsmid': 'http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd', 44 | # xmlns:x = xmlns:wxf 45 | 'xmlns:x': 'http://schemas.xmlsoap.org/ws/2004/09/transfer', 46 | 'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema', 47 | 'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance', 48 | 'xmlns:p': 'http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd', 49 | } 50 | 51 | def __init__(self): 52 | self.root = {} 53 | self.selector = None 54 | 55 | def enumerate(self, to, ruri, selectors, envSize=512000, mid=None, opTimeout=60): 56 | return self 57 | 58 | def set_header(self, to, ruri, action, envSize=512000, mid=None, opTimeout=60): 59 | return self 60 | 61 | def add_selectors(self, selectors): 62 | return self 63 | -------------------------------------------------------------------------------- /omsdk/http/sdkwmi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import sys 24 | from omsdk.http.sdkwsmanbase import WsManProtocolBase, WsManOptions 25 | from winrm.protocol import Protocol 26 | import traceback 27 | import logging 28 | 29 | logger = logging.getLogger(__name__) 30 | 31 | PY2 = sys.version_info[0] == 2 32 | PY3 = sys.version_info[0] == 3 33 | 34 | 35 | class WmiOptions(WsManOptions): 36 | def __init__(self): 37 | if PY2: 38 | super(WmiOptions, self).__init__() 39 | else: 40 | super().__init__() 41 | self.read_timeout = 10 42 | self.connection_timeout = 9 43 | self.auth_method = 'ntlm' 44 | self.port = 5985 45 | 46 | 47 | class WmiProtocol(WsManProtocolBase): 48 | def __init__(self, ipaddr, creds, pOptions): 49 | if PY2: 50 | super(WmiProtocol, self).__init__(ipaddr, creds, pOptions) 51 | else: 52 | super().__init__(ipaddr, creds, pOptions) 53 | self.ipaddr = ipaddr 54 | self.creds = creds 55 | self.pOptions = pOptions 56 | 57 | self.endpoint = 'https://' + ipaddr + ':' + str(pOptions.port) 58 | self.protocol = None 59 | self.transport = None 60 | 61 | def _proto_connect(self, reset=False): 62 | if reset: 63 | if self.transport and self.transport.session: 64 | self.transport.session.close() 65 | self.transport = None 66 | if not self.transport: 67 | try: 68 | self.protocol = Protocol(self.endpoint, transport='plaintext', 69 | username=self.creds.username, password=self.creds.password) 70 | self.transport = self.protocol.transport 71 | except Exception as s: 72 | logger.debug(str(s)) 73 | traceback.print_exc(s) 74 | 75 | def _proto_ship_payload(self, payload): 76 | try: 77 | return self.transport.send_message(payload) 78 | except Exception as ex: 79 | logger.debug(str(ex)) 80 | traceback.print_exc(ex) 81 | 82 | def _proto_endpoint(self): 83 | return self.endpoint 84 | 85 | def _proto_reset(self): 86 | if self.transport and self.transport.session: 87 | self.transport.session.close() 88 | self.transport = None 89 | return True 90 | -------------------------------------------------------------------------------- /omsdk/http/sdkwsman.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import sys 24 | 25 | from omsdk.http.sdkwsmanbase import WsManProtocolBase 26 | from omsdk.http.sdkhttpep import HttpEndPoint 27 | 28 | PY2 = sys.version_info[0] == 2 29 | PY3 = sys.version_info[0] == 3 30 | 31 | 32 | class WsManProtocol(WsManProtocolBase): 33 | def __init__(self, ipaddr, creds, pOptions): 34 | if PY2: 35 | super(WsManProtocol, self).__init__(ipaddr, creds, pOptions) 36 | else: 37 | super().__init__(ipaddr, creds, pOptions) 38 | headers = { 39 | 'Content-Type': 'application/soap+xml;charset=UTF-8' 40 | } 41 | self.proto = HttpEndPoint(ipaddr, creds, pOptions, headers) 42 | 43 | def _proto_connect(self): 44 | self.proto.connect() 45 | 46 | def _proto_ship_payload(self, payload): 47 | return self.proto.ship_payload(payload) 48 | 49 | def _proto_endpoint(self): 50 | return self.proto.endpoint 51 | 52 | def _proto_reset(self): 53 | return self.proto.reset() 54 | -------------------------------------------------------------------------------- /omsdk/lifecycle/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | 24 | 25 | def main(): 26 | print("Welcome to Dell OpenManage SDK") 27 | -------------------------------------------------------------------------------- /omsdk/lifecycle/sdkconfigapi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import sys 24 | 25 | PY2 = sys.version_info[0] == 2 26 | PY3 = sys.version_info[0] == 3 27 | 28 | 29 | class iBaseConfigApi(object): 30 | 31 | def __init__(self, entity): 32 | self.entity = entity 33 | -------------------------------------------------------------------------------- /omsdk/lifecycle/sdkcredentials.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import sys 24 | 25 | PY2 = sys.version_info[0] == 2 26 | PY3 = sys.version_info[0] == 3 27 | 28 | 29 | class iBaseCredentialsApi(object): 30 | 31 | def __init__(self, entity): 32 | self.entity = entity 33 | -------------------------------------------------------------------------------- /omsdk/lifecycle/sdkjobs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import sys 24 | 25 | PY2 = sys.version_info[0] == 2 26 | PY3 = sys.version_info[0] == 3 27 | 28 | 29 | class iBaseJobApi(object): 30 | 31 | def __init__(self, entity, jobenum): 32 | self.entity = entity 33 | self.jobenum = jobenum 34 | self.reset() 35 | 36 | def reset(self): 37 | self.last_job = None 38 | self.jobs_json = {} 39 | 40 | def get_jobs(self): 41 | return self.entity._get_entries(self.jobs_json, self.jobenum) 42 | 43 | def delete_all_jobs(self): 44 | pass 45 | 46 | def get_job_details(self, jobid): 47 | pass 48 | 49 | def get_job_status(self, jobid): 50 | pass 51 | 52 | 53 | class iBaseLogApi(object): 54 | 55 | def __init__(self, entity, logenum, logtypesen): 56 | self.entity = entity 57 | self.logenum = logenum 58 | self.logtypesen = logtypesen 59 | 60 | def get_logs(self): 61 | return self.entity._get_entries(self.jobs_json, self.jobenum) 62 | 63 | def clear_logs(self): 64 | return self.entity._get_entries(self.jobs_json, self.jobenum) 65 | 66 | -------------------------------------------------------------------------------- /omsdk/lifecycle/sdklicenseapi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import sys 24 | 25 | PY2 = sys.version_info[0] == 2 26 | PY3 = sys.version_info[0] == 3 27 | 28 | 29 | class iBaseLicenseApi(object): 30 | 31 | def __init__(self, entity): 32 | self.entity = entity 33 | -------------------------------------------------------------------------------- /omsdk/lifecycle/sdklogapi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import sys 24 | 25 | PY2 = sys.version_info[0] == 2 26 | PY3 = sys.version_info[0] == 3 27 | 28 | 29 | class iBaseLogApi(object): 30 | 31 | def __init__(self, entity, logenum, logtypesen=None): 32 | self.entity = entity 33 | self.logenum = logenum 34 | self.logs_json = {} 35 | self.logtypesen = logtypesen 36 | 37 | def get_logs(self): 38 | return self.entity._get_entries(self.logs_json, self.logenum) 39 | 40 | def clear_logs(self): 41 | pass 42 | 43 | -------------------------------------------------------------------------------- /omsdk/lifecycle/sdksecurityapi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import sys 24 | 25 | PY2 = sys.version_info[0] == 2 26 | PY3 = sys.version_info[0] == 3 27 | 28 | 29 | class iBaseSecurityApi(object): 30 | 31 | def __init__(self, entity): 32 | self.entity = entity 33 | -------------------------------------------------------------------------------- /omsdk/listener/sdktrapreceiver.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from pysnmp.carrier.asyncio.dispatch import AsyncioDispatcher 24 | from pysnmp.carrier.asyncio.dgram import udp, udp6 25 | from pyasn1.codec.ber import decoder 26 | from pysnmp.proto import api 27 | import logging 28 | 29 | logger = logging.getLogger(__name__) 30 | 31 | 32 | def cbFun(transportDispatcher, transportDomain, transportAddress, wholeMsg): 33 | while wholeMsg: 34 | msgVer = int(api.decodeMessageVersion(wholeMsg)) 35 | if msgVer in api.protoModules: 36 | pMod = api.protoModules[msgVer] 37 | else: 38 | logger.debug('Unsupported SNMP version %s' % msgVer) 39 | return 40 | reqMsg, wholeMsg = decoder.decode( 41 | wholeMsg, asn1Spec=pMod.Message(), 42 | ) 43 | logger.debug('Notification message from %s:%s: ' % ( 44 | transportDomain, transportAddress 45 | ) 46 | ) 47 | reqPDU = pMod.apiMessage.getPDU(reqMsg) 48 | if reqPDU.isSameTypeWith(pMod.TrapPDU()): 49 | if msgVer == api.protoVersion1: 50 | logger.debug('Enterprise: %s' % ( 51 | pMod.apiTrapPDU.getEnterprise(reqPDU).prettyPrint() 52 | ) 53 | ) 54 | logger.debug('Agent Address: %s' % ( 55 | pMod.apiTrapPDU.getAgentAddr(reqPDU).prettyPrint() 56 | ) 57 | ) 58 | logger.debug('Generic Trap: %s' % ( 59 | pMod.apiTrapPDU.getGenericTrap(reqPDU).prettyPrint() 60 | ) 61 | ) 62 | logger.debug('Specific Trap: %s' % ( 63 | pMod.apiTrapPDU.getSpecificTrap(reqPDU).prettyPrint() 64 | ) 65 | ) 66 | logger.debug('Uptime: %s' % ( 67 | pMod.apiTrapPDU.getTimeStamp(reqPDU).prettyPrint() 68 | ) 69 | ) 70 | varBinds = pMod.apiTrapPDU.getVarBindList(reqPDU) 71 | else: 72 | varBinds = pMod.apiPDU.getVarBindList(reqPDU) 73 | logger.debug('Var-binds:') 74 | for oid, val in varBinds: 75 | logger.debug('%s = %s' % (oid.prettyPrint(), val.prettyPrint())) 76 | return wholeMsg 77 | 78 | 79 | transportDispatcher = AsyncioDispatcher() 80 | 81 | transportDispatcher.registerRecvCbFun(cbFun) 82 | 83 | # UDP/IPv4 84 | transportDispatcher.registerTransport( 85 | udp.domainName, udp.UdpAsyncioTransport().openServerMode(('localhost', 162)) 86 | ) 87 | 88 | # UDP/IPv6 89 | transportDispatcher.registerTransport( 90 | udp6.domainName, udp6.Udp6AsyncioTransport().openServerMode(('::1', 162)) 91 | ) 92 | 93 | transportDispatcher.jobStarted(1) 94 | 95 | try: 96 | # Dispatcher will never finish as job#1 never reaches zero 97 | transportDispatcher.runDispatcher() 98 | except: 99 | transportDispatcher.closeDispatcher() 100 | raise 101 | -------------------------------------------------------------------------------- /omsdk/omlogs/Logger.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Sachin Kumar 22 | # 23 | import os 24 | import yaml 25 | import tempfile 26 | import logging.config 27 | 28 | from enum import Enum 29 | 30 | DEFAULT_LOGGER_CONFIG_FILE = os.path.join(os.path.dirname(__file__), "config", "logging.yaml") 31 | DEFAULT_LOGGER_LOG_FILE = os.path.join(tempfile.gettempdir(), "omsdk-logs.log") 32 | LOGGER_LEVEL = None 33 | logger = logging.getLogger(__name__) 34 | 35 | # Logger Configuration Types 36 | class LoggerConfigTypeEnum(Enum): 37 | BASIC = 1 # Basic Configuration 38 | CONFIG_FILE = 2 # Configuration File based Configuration 39 | 40 | 41 | 42 | class LoggerConfiguration: 43 | @staticmethod 44 | def __load_config(path): 45 | try: 46 | with open(path, 'rt') as f: 47 | config = yaml.safe_load(f.read()) 48 | logging.config.dictConfig(config) 49 | except IOError as e: 50 | logger.error("I/O error({0}): {1}".format(e.errno, e.strerror)) 51 | 52 | def setup_logging(self, logger_config_file=DEFAULT_LOGGER_CONFIG_FILE, 53 | logger_log_file=DEFAULT_LOGGER_LOG_FILE, logger_level=LOGGER_LEVEL): 54 | logger.info("Setting up Logging") 55 | # Check if file exists 56 | if os.path.exists(logger_config_file): 57 | self.__load_config(logger_config_file) 58 | logger.info("Setting up Logging -- FINISHED") 59 | 60 | 61 | LogManager = LoggerConfiguration() 62 | -------------------------------------------------------------------------------- /omsdk/omlogs/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Karthik Prabhu 22 | # 23 | 24 | 25 | def main(): 26 | print("Welcome to Dell OpenManage SDK") 27 | -------------------------------------------------------------------------------- /omsdk/omlogs/config/logging.yaml: -------------------------------------------------------------------------------- 1 | version: 1 2 | disable_existing_loggers: False 3 | formatters: 4 | simple: 5 | format: "%(asctime)s : %(levelname)s : %(name)s : %(lineno)d : %(message)s" 6 | 7 | handlers: 8 | console: 9 | class: logging.StreamHandler 10 | level: INFO 11 | formatter: simple 12 | stream: ext://sys.stdout 13 | 14 | file_handler: 15 | class: logging.handlers.RotatingFileHandler 16 | level: INFO 17 | formatter: simple 18 | filename: /tmp/omsdk-logs.log 19 | maxBytes: 2097152 # 2MB 20 | backupCount: 10 21 | encoding: utf8 22 | 23 | root: 24 | level: DEBUG 25 | handlers: [file_handler] -------------------------------------------------------------------------------- /omsdk/profiling/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | 24 | 25 | def main(): 26 | print("Welcome to Dell OpenManage SDK") 27 | -------------------------------------------------------------------------------- /omsdk/reflection/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | 24 | 25 | def main(): 26 | print("Welcome to Dell OpenManage SDK") 27 | -------------------------------------------------------------------------------- /omsdk/sdkcunicode.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from omsdk.version.sdkversion import PY2UC 24 | import io 25 | 26 | if PY2UC: 27 | import codecs 28 | 29 | 30 | class UnicodeHelper(object): 31 | @staticmethod 32 | def is_string(ustring): 33 | return isinstance(ustring, str) or \ 34 | (PY2UC and isinstance(ustring, unicode)) 35 | 36 | @staticmethod 37 | def stringize(ustring): 38 | if PY2UC and isinstance(ustring, unicode): 39 | ustring = ustring.encode('ascii', 'ignore') 40 | return ustring 41 | 42 | 43 | class UnicodeWriter(object): 44 | def __init__(self, name): 45 | self.name = name 46 | self.output = None 47 | 48 | def __enter__(self): 49 | if PY2UC: 50 | self.output = open(self.name, "w") 51 | # self.output = codecs.open(self.name, encoding='utf-8', mode='w') 52 | else: 53 | self.output = open(self.name, "w") 54 | return self 55 | 56 | def _write_output(self, line): 57 | if PY2UC: 58 | self.output.write(unicode(line)) 59 | else: 60 | self.output.write(line) 61 | 62 | def __exit__(self, type, value, traceback): 63 | if self.output: 64 | self.output.close() 65 | return isinstance(value, TypeError) 66 | 67 | 68 | class UnicodeStringWriter(object): 69 | def __init__(self): 70 | self.output = io.StringIO() 71 | 72 | def __enter__(self): 73 | return self 74 | 75 | def _write_output(self, line): 76 | if PY2UC: 77 | self.output.write(unicode(line)) 78 | else: 79 | self.output.write(line) 80 | 81 | def getvalue(self): 82 | return self.output.getvalue() 83 | 84 | def __exit__(self, type, value, traceback): 85 | return isinstance(value, TypeError) 86 | -------------------------------------------------------------------------------- /omsdk/sdkdevice.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from omsdk.sdkbase import iBaseRegistry, iBaseDiscovery, iBaseDriver 24 | from omsdk.sdkbase import iBaseTopologyInfo 25 | import sys 26 | 27 | PY2 = sys.version_info[0] == 2 28 | PY3 = sys.version_info[0] == 3 29 | 30 | 31 | class iDeviceRegistry(iBaseRegistry): 32 | pass 33 | 34 | 35 | class iDeviceDiscovery(iBaseDiscovery): 36 | pass 37 | 38 | 39 | class iDeviceDriver(iBaseDriver): 40 | def __str__(self): 41 | return self.ipaddr 42 | 43 | def __init__(self, registry, protofactory, ipaddr, creds): 44 | if PY2: 45 | super(iDeviceDriver, self).__init__(registry, protofactory, ipaddr, creds) 46 | else: 47 | super().__init__(registry, protofactory, ipaddr, creds) 48 | self._request_device_features() 49 | self.comp_union_spec = None 50 | self.comp_merge_join_spec = None 51 | self.comp_misc_join_spec = None 52 | self.more_details_spec = None 53 | 54 | def get_json_device(self, monitorfilter=None, compScope=None): 55 | return self._get_json_for_device(self.entityjson, monitorfilter, compScope) 56 | 57 | def _get_field_device(self, compen, field, idx=0): 58 | return self._get_field(self.entityjson, compen, field, idx) 59 | 60 | def _get_field_device_for_all(self, compen, field): 61 | return self._get_field_for_all(self.entityjson, compen, field) 62 | 63 | @property 64 | def _DeviceKey(self): 65 | if ('System' in self.entityjson and 66 | len(self.entityjson['System']) >= 1 and 67 | 'Key' in self.entityjson['System'][0]): 68 | return self.entityjson['System'][0]['Key'] 69 | return "" 70 | 71 | 72 | class iDeviceTopologyInfo(iBaseTopologyInfo): 73 | def __init__(self, mytype, json): 74 | if PY2: 75 | super(iBaseTopologyInfo, self).__init__(mytype, json) 76 | else: 77 | super().__init__(mytype, json) 78 | 79 | def my_is_mytype(self, json): 80 | return ('System' in json 81 | and len(json['System']) == 1 82 | and '_Type' in json['System'][0] 83 | and json['System'][0]['_Type'] == self.mytype) 84 | 85 | def my_load(self): 86 | return self.json['System'][0] 87 | -------------------------------------------------------------------------------- /omsdk/sdkentitymib.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from omsdk.sdkcenum import EnumWrapper 24 | import sys 25 | 26 | PY2 = sys.version_info[0] == 2 27 | PY3 = sys.version_info[0] == 3 28 | 29 | try: 30 | from pysnmp.hlapi import * 31 | from pysnmp.smi import * 32 | from pysnmp.smi.rfc1902 import ObjectIdentity 33 | PySnmpPresent = True 34 | except ImportError: 35 | PySnmpPresent = False 36 | 37 | EntityCompEnum = EnumWrapper("EntityCompEnum", { 38 | "System": "System", 39 | "other": "other", 40 | "chassis": "chassis", 41 | "backplane": "backplane", 42 | "container": "container", 43 | "powerSupply": "powerSupply", 44 | "fan": "fan", 45 | "sensor": "sensor", 46 | "module": "module", 47 | "port": "port", 48 | "stack": "stack", 49 | "cpu": "cpu", 50 | "Entity": "Entity" 51 | }).enum_type 52 | 53 | if PySnmpPresent: 54 | EntityComponentTree = { 55 | "Full": [ 56 | EntityCompEnum.stack 57 | ], 58 | EntityCompEnum.stack: [ 59 | EntityCompEnum.chassis 60 | ], 61 | EntityCompEnum.chassis: [ 62 | EntityCompEnum.container 63 | ], 64 | EntityCompEnum.container: [ 65 | EntityCompEnum.module 66 | ], 67 | EntityCompEnum.module: [ 68 | EntityCompEnum.port, 69 | EntityCompEnum.fan, 70 | EntityCompEnum.powerSupply, 71 | ] 72 | } 73 | 74 | EntitySNMPViews = { 75 | EntityCompEnum.Entity: { 76 | 'FQDD': ObjectIdentity('ENTITY-MIB', 'entPhysicalIndex'), 77 | 'Name': ObjectIdentity('ENTITY-MIB', 'entPhysicalName'), 78 | 'Description': ObjectIdentity('ENTITY-MIB', 'entPhysicalDescr'), 79 | 'ContainedIn': ObjectIdentity('ENTITY-MIB', 'entPhysicalContainedIn'), 80 | 'Class': ObjectIdentity('ENTITY-MIB', 'entPhysicalClass'), 81 | 'HardwareRev': ObjectIdentity('ENTITY-MIB', 'entPhysicalHardwareRev'), 82 | 'FirmwareRev': ObjectIdentity('ENTITY-MIB', 'entPhysicalSoftwareRev'), 83 | 'ParentRelPos': ObjectIdentity('ENTITY-MIB', 'entPhysicalParentRelPos'), 84 | 'SerialNo': ObjectIdentity('ENTITY-MIB', 'entPhysicalSerialNum'), 85 | 'Manufacturer': ObjectIdentity('ENTITY-MIB', 'entPhysicalMfgName'), 86 | 'Model': ObjectIdentity('ENTITY-MIB', 'entPhysicalModelName'), 87 | 'AssetTag': ObjectIdentity('ENTITY-MIB', 'entPhysicalAssetID'), 88 | 'IsFRU': ObjectIdentity('ENTITY-MIB', 'entPhysicalIsFRU'), 89 | # 'ManufacturerDate' : ObjectIdentity('ENTITY-MIB', 'entPhysicalMfgDate'), 90 | } 91 | } 92 | else: 93 | EntityComponentTree = {} 94 | EntitySNMPViews = {} 95 | -------------------------------------------------------------------------------- /omsdk/sdklist.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import os 24 | import logging 25 | import threading 26 | import json 27 | import time 28 | import sys 29 | import logging 30 | 31 | 32 | logger = logging.getLogger(__name__) 33 | 34 | PY2 = sys.version_info[0] == 2 35 | PY3 = sys.version_info[0] == 3 36 | 37 | 38 | # logging.basicConfig(level=logging.DEBUG, 39 | # format='[%(levelname)s] (%(threadName)-10s) %(message)s',) 40 | 41 | class ListProc: 42 | def __init__(self, sd, listfile, creds): 43 | self.listfile = listfile 44 | self.myentitylistlock = threading.Lock() 45 | self.sd = sd 46 | self.creds = creds 47 | # SDK Infrastructure 48 | self.entitylist = [] 49 | self.success = {} 50 | self.failed = {} 51 | 52 | def process(self): 53 | self.threadlist = [] 54 | if not os.path.isfile(self.listfile): 55 | logger.debug("Unable to find file") 56 | return None 57 | counter = 0 58 | with open(self.listfile, "r") as mylist: 59 | for line in mylist: 60 | counter = counter + 1 61 | device = line.rstrip() 62 | thr = threading.Thread(name=device, 63 | target=self._worker, args=(device, str(counter),)) 64 | self.threadlist.append(thr) 65 | thr.start() 66 | logger.debug('Waiting for _worker threads') 67 | for t in self.threadlist: 68 | t.join() 69 | return self 70 | 71 | def printx(self): 72 | with self.myentitylistlock: 73 | for device in self.entityjson["devices"]["Devices"]: 74 | logger.debug("-======" + str(device) + "----------") 75 | if not device is None: 76 | logger.debug(device.entityjson) 77 | logger.debug("-==================-------") 78 | 79 | def _worker(self, device, counter): 80 | logger.debug("Starting") 81 | devEntity = self.sd.get_driver(self.sd.driver_enum.iDRAC, device, self.creds) 82 | with self.myentitylistlock: 83 | if not devEntity is None: 84 | self.entitylist.append(devEntity) 85 | 86 | def _run(self, entity, counter): 87 | t1 = time.time() 88 | if not entity is None: 89 | entity.get_entityjson() 90 | # entity.get_partial_entityjson(entity.ComponentEnum.System) 91 | with open('.\\output\\ff\\detailed.' + str(counter), 'w') as f: 92 | json.dump(entity.get_json_device(), f) 93 | f.flush() 94 | logger.debug("Time for " + str(counter) + " thread = " + str(time.time()-t1)) 95 | logger.debug("Exiting") 96 | 97 | def get_data(self): 98 | counter = 0 99 | for entity in self.entitylist: 100 | counter = counter + 1 101 | thr = threading.Thread(name=entity.ipaddr, 102 | target=self._run, 103 | args=(entity, counter,)) 104 | self.threadlist.append(thr) 105 | thr.start() 106 | for t in self.threadlist: 107 | t.join() 108 | -------------------------------------------------------------------------------- /omsdk/sdkprint.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import io 24 | import logging 25 | import threading 26 | import time 27 | import json 28 | from enum import Enum 29 | from json import JSONEncoder 30 | from omsdk.sdkcenum import EnumWrapper, TypeHelper, PY2Enum 31 | from pprint import pprint 32 | from datetime import datetime 33 | import xml.etree.ElementTree as ET 34 | import traceback 35 | 36 | import sys 37 | import logging 38 | 39 | 40 | logger = logging.getLogger(__name__) 41 | 42 | try: 43 | from pysnmp.hlapi import * 44 | from pysnmp.smi import * 45 | from pysnmp.proto import rfc1902 46 | PySnmpPresent = True 47 | except ImportError: 48 | PySnmpPresent = False 49 | 50 | 51 | PY2 = sys.version_info[0] == 2 52 | PY3 = sys.version_info[0] == 3 53 | 54 | if PY2Enum: 55 | from enum import EnumValue 56 | 57 | 58 | class MyEncoder(JSONEncoder): 59 | def default(self, o): 60 | if isinstance(o, Enum): 61 | return o.value 62 | if isinstance(o, str): 63 | return o 64 | if PySnmpPresent: 65 | if isinstance(o, rfc1902.Integer): 66 | return str(o) 67 | if isinstance(o, rfc1902.OctetString): 68 | return str(o) 69 | if isinstance(o, type): 70 | return str(type) 71 | if PY2Enum and isinstance(o, EnumValue): 72 | return o.key 73 | if isinstance(o, datetime): 74 | return str(datetime) 75 | return o.json_encode() 76 | 77 | 78 | class Prettifyer: 79 | def prettify_json(self, json_object): 80 | return "" if json_object is None else json.dumps(json_object, 81 | sort_keys=True, 82 | indent=4, 83 | separators=(',', ': '), 84 | cls=MyEncoder) 85 | 86 | 87 | PrettyPrint = Prettifyer() 88 | -------------------------------------------------------------------------------- /omsdk/sdkprotobase.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from datetime import datetime 24 | from omsdk.sdkcenum import TypeHelper 25 | 26 | import sys 27 | import logging 28 | 29 | PY2 = sys.version_info[0] == 2 30 | PY3 = sys.version_info[0] == 3 31 | 32 | logger = logging.getLogger(__name__) 33 | 34 | 35 | class ProtocolBase(object): 36 | def operation(self, protocmds, cmdname, *args): 37 | pass 38 | 39 | def _build_ops(self, protocmds, cmdname, *args): 40 | toargs = {} 41 | if not "Parameters" in protocmds[cmdname]: 42 | logger.debug(self.proto.ipaddr+": No parameters") 43 | elif len(protocmds[cmdname]["Parameters"]) != len(args): 44 | logger.error(self.proto.ipaddr+ ": Too many args") 45 | return {'Status': 'Failed', 'Message': 'Client Side: Too many arguments'} 46 | else: 47 | counter = 0 48 | for (var, arg, field, val, dest) in protocmds[cmdname]["Parameters"]: 49 | if (args[counter] is None): 50 | myval = "" 51 | else: 52 | args_fixed = args[counter] 53 | if PY2 and (val == str and type(args_fixed) == unicode): 54 | args_fixed = args_fixed.encode('ascii', 'ignore') 55 | if not TypeHelper.belongs_to(val, args_fixed): 56 | return {'Status': 'Failed', 'Message': 'Client Side: Argument ' + str(counter) + " got " + str( 57 | type(args_fixed)) + "! Must be: " + val.__name__} 58 | try: 59 | if (val == datetime) and args_fixed.year == 1970: 60 | myval = "TIME_NOW" 61 | elif (val == datetime): 62 | myval = datetime.strftime(args_fixed, "%Y%m%d%H%M%S") 63 | else: 64 | myval = TypeHelper.resolve(args_fixed.value) 65 | except Exception as ex: 66 | myval = args_fixed 67 | toargs[var] = myval 68 | if dest != None: 69 | toargs[var] = dest(toargs[var]) 70 | #logger.debug(self.proto.ipaddr+" : var "+var + "<=>" + str(toargs[var])) 71 | counter = counter + 1 72 | return {'Status': 'Success', 'retval': toargs} 73 | -------------------------------------------------------------------------------- /omsdk/sdkps.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import subprocess 24 | import io 25 | import xml.dom.minidom 26 | import logging 27 | 28 | logger = logging.getLogger(__name__) 29 | 30 | 31 | class PsShell: 32 | def __init__(self): 33 | pass 34 | 35 | def execute(self, cmd): 36 | logger.debug("Executing: " + cmd) 37 | proc = subprocess.Popen(["powershell", "-outputformat", "XML", "-command", "" + cmd + ""], 38 | stdout=subprocess.PIPE, stderr=subprocess.PIPE) 39 | wrapper = io.TextIOWrapper(proc.stdout, encoding="utf-8") 40 | t = wrapper.readline() 41 | 42 | output = io.StringIO() 43 | for line in wrapper: 44 | tt = line.rstrip() 45 | output.write(tt) 46 | 47 | data_json = {} 48 | if output.getvalue() == "": 49 | return data_json 50 | domtree = xml.dom.minidom.parseString(output.getvalue()) 51 | collection = domtree.documentElement 52 | counter = 0 53 | for obj in collection.childNodes: 54 | counter = counter + 1 55 | mydata = self.print_objx("", obj) 56 | name = "name" + str(counter) 57 | if "ToString" in mydata: 58 | name = mydata["ToString"] 59 | if "f2" in mydata: 60 | value = mydata["f2"] 61 | if not name in data_json: 62 | data_json[name] = [] 63 | data_json[name].append(value) 64 | for name in data_json: 65 | if len(data_json[name]) == 0: 66 | data_json[name] = None 67 | elif len(data_json[name]) == 1: 68 | data_json[name] = data_json[name][0] 69 | 70 | return data_json 71 | 72 | def print_objx(self, n, obj): 73 | tst = {} 74 | counter = 0 75 | if obj.hasAttributes(): 76 | for i in range(0, obj.attributes.length): 77 | attr = obj.attributes.item(i) 78 | tst[attr.name] = attr.value 79 | for objns in obj.childNodes: 80 | if objns.nodeType == objns.ELEMENT_NODE: 81 | # empty node 82 | if objns.firstChild == None: 83 | counter = counter + 1 84 | tst["f" + str(counter)] = objns.firstChild 85 | elif objns.firstChild.nodeType == objns.firstChild.TEXT_NODE: 86 | var = objns.getAttribute("N") 87 | if var is None or var == "": 88 | var = objns.tagName 89 | if objns.tagName == "ToString": 90 | tst[objns.tagName] = objns.firstChild.data 91 | else: 92 | tst[var] = objns.firstChild.data 93 | else: 94 | k = self.print_objx(n + " ", objns) 95 | var = objns.getAttribute("N") 96 | if var is None or var == "": 97 | counter = counter + 1 98 | var = "f" + str(counter) 99 | tst[var] = k 100 | # counter = counter - 1 101 | else: 102 | logger.debug(">>> not element>>" + str(objns.tagName)) 103 | return tst 104 | -------------------------------------------------------------------------------- /omsdk/sdkservices.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from omsdk.sdkcenum import EnumWrapper 24 | 25 | SDKServicesEnum = EnumWrapper("ServicesEnum", { 26 | "AttributeRegistryConfig": 1, 27 | "PDK_InventoryCollector": 2, 28 | }).enum_type 29 | -------------------------------------------------------------------------------- /omsdk/sdksnmptrap.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from pysnmp.carrier.asyncio.dispatch import AsyncioDispatcher 24 | from pysnmp.carrier.asyncio.dgram import udp, udp6 25 | from pyasn1.codec.ber import encoder 26 | from pysnmp.proto import api 27 | 28 | # Protocol version to use 29 | pMod = api.protoModules[api.protoVersion1] 30 | # pMod = api.protoModules[api.protoVersion2c] 31 | 32 | # Build PDU 33 | trapPDU = pMod.TrapPDU() 34 | pMod.apiTrapPDU.setDefaults(trapPDU) 35 | 36 | # Traps have quite different semantics across proto versions 37 | if pMod == api.protoModules[api.protoVersion1]: 38 | pMod.apiTrapPDU.setEnterprise(trapPDU, (1, 3, 6, 1, 4, 1, 20408, 4, 1, 1, 2)) 39 | pMod.apiTrapPDU.setGenericTrap(trapPDU, 'coldStart') 40 | 41 | # Build message 42 | trapMsg = pMod.Message() 43 | pMod.apiMessage.setDefaults(trapMsg) 44 | pMod.apiMessage.setCommunity(trapMsg, 'public') 45 | pMod.apiMessage.setPDU(trapMsg, trapPDU) 46 | 47 | transportDispatcher = AsyncioDispatcher() 48 | 49 | # UDP/IPv4 50 | transportDispatcher.registerTransport( 51 | udp.domainName, udp.UdpAsyncioTransport().openClientMode() 52 | ) 53 | transportDispatcher.sendMessage( 54 | encoder.encode(trapMsg), udp.domainName, ('localhost', 162) 55 | ) 56 | 57 | # UDP/IPv6 58 | transportDispatcher.registerTransport( 59 | udp6.domainName, udp6.Udp6AsyncioTransport().openClientMode() 60 | ) 61 | transportDispatcher.sendMessage( 62 | encoder.encode(trapMsg), udp6.domainName, ('::1', 162) 63 | ) 64 | 65 | # Dispatcher will finish as all scheduled messages are sent 66 | transportDispatcher.runDispatcher() 67 | 68 | transportDispatcher.closeDispatcher() 69 | -------------------------------------------------------------------------------- /omsdk/sdktime.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018-2024 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from datetime import datetime, timedelta 24 | 25 | 26 | class SchTimer: 27 | def __init__(self, time_str=None, fmt="%Y-%m-%d", untilmin=24 * 60): 28 | if time_str is None: 29 | self.time = datetime.now() 30 | else: 31 | self.time = datetime.strptime(time_str, fmt) 32 | self.until = None 33 | if untilmin is not None: 34 | self.until = self.time + timedelta(minutes=untilmin) 35 | 36 | def __str__(self): 37 | mystr = "Time: " + str(self.time) 38 | if self.until is not None: 39 | mystr = mystr + "; Until: " + str(self.until) 40 | return mystr 41 | 42 | 43 | TIME_NOW = SchTimer(time_str="1970-1-1", untilmin=None) 44 | -------------------------------------------------------------------------------- /omsdk/services/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Karthik Prabhu 22 | # 23 | 24 | 25 | def main(): 26 | print("Welcome to Dell OpenManage SDK") 27 | -------------------------------------------------------------------------------- /omsdk/simulator/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | 24 | 25 | def main(): 26 | print("Welcome to Dell OpenManage SDK") 27 | -------------------------------------------------------------------------------- /omsdk/simulator/devicesim.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import sys 24 | import logging 25 | import os 26 | from omsdk.sdkprotopref import ProtoPreference, ProtocolEnum 27 | from omsdk.sdkcenum import TypeHelper 28 | import re 29 | import json 30 | 31 | PY2 = sys.version_info[0] == 2 32 | PY3 = sys.version_info[0] == 3 33 | 34 | logger = logging.getLogger(__name__) 35 | 36 | 37 | class Simulation: 38 | def __init__(self): 39 | self.record = False 40 | self.simulate = False 41 | 42 | def start_recording(self): 43 | self.record = True 44 | self.simulate = False 45 | 46 | def end_recording(self): 47 | self.record = False 48 | self.simulate = False 49 | 50 | def start_simulating(self): 51 | self.simulate = True 52 | self.record = False 53 | 54 | def end_simulating(self): 55 | self.record = False 56 | self.simulate = False 57 | 58 | def is_recording(self): 59 | return self.record 60 | 61 | def is_simulating(self): 62 | return self.simulate 63 | 64 | def simulate_config(self, ipaddr): 65 | mypath = "." 66 | for i in ["simulator", ipaddr, 'config']: 67 | mypath = os.path.join(mypath, i) 68 | mypath = os.path.join(mypath, "config.xml") 69 | if os.path.exists(mypath) and not os.path.isdir(mypath): 70 | return mypath 71 | return None 72 | 73 | def record_config(self, ipaddr, config, name='config.xml'): 74 | mypath = "." 75 | for i in ["simulator", ipaddr, 'config']: 76 | mypath = os.path.join(mypath, i) 77 | if not os.path.exists(mypath): 78 | os.mkdir(mypath) 79 | mypath = os.path.join(mypath, name) 80 | with open(mypath, 'w') as myconfig: 81 | myconfig.write(config) 82 | return mypath 83 | 84 | def simulate_proto(self, ipaddr, enumid, clsName): 85 | mypath = "." 86 | for i in ["simulator", ipaddr, str(enumid)]: 87 | mypath = os.path.join(mypath, i) 88 | mypath = os.path.join(mypath, clsName + ".json") 89 | retval = {'Data': {}, 'Status': 'Failed', 'Message': 'No file found'} 90 | if os.path.exists(mypath) and not os.path.isdir(mypath): 91 | with open(mypath) as enum_data: 92 | retval = json.load(enum_data) 93 | return retval 94 | 95 | def record_proto(self, ipaddr, enumid, clsName, retval): 96 | mypath = "." 97 | for i in ["simulator", ipaddr, str(enumid)]: 98 | mypath = os.path.join(mypath, i) 99 | if not os.path.exists(mypath): 100 | os.mkdir(mypath) 101 | with open(os.path.join(mypath, clsName + ".json"), "w") as f: 102 | json.dump(retval, f, sort_keys=True, indent=4, 103 | separators=(',', ': ')) 104 | 105 | def simulator_connect(self, ipaddr, enumid, protoobj): 106 | mypath = "." 107 | for i in ["simulator", ipaddr, str(enumid)]: 108 | mypath = os.path.join(mypath, i) 109 | if os.path.exists(mypath) and os.path.isdir(mypath): 110 | if enumid != ProtocolEnum.WSMAN: 111 | return protobj 112 | sjson = os.path.join(mypath, 'System.json') 113 | simspec = None 114 | for i in protoobj.views: 115 | if TypeHelper.resolve(i) == 'System': 116 | simspec = re.sub(".*/", '', protoobj.views[i]) 117 | break 118 | if os.path.exists(sjson) and simspec: 119 | with open(sjson, 'r') as endata: 120 | _s = json.load(endata) 121 | if _s and 'Data' in _s and \ 122 | _s['Data'] and simspec in _s['Data']: 123 | return protoobj 124 | return None 125 | 126 | 127 | Simulator = Simulation() 128 | -------------------------------------------------------------------------------- /omsdk/typemgr/TypeState.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | from omsdk.sdkcenum import EnumWrapper, TypeHelper 24 | 25 | TypeState = EnumWrapper('TMS', { 26 | 'UnInitialized': 'UnInitialized', 27 | 'Initializing': 'Initializing', 28 | 'Precommit': 'Precommit', 29 | 'Committed': 'Committed', 30 | 'Changing': 'Changing', 31 | }).enum_type 32 | 33 | 34 | class TypeBase(object): 35 | def __init__(self): 36 | pass 37 | -------------------------------------------------------------------------------- /omsdk/typemgr/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | 24 | 25 | def main(): 26 | print("Welcome to Dell OpenManage SDK") 27 | -------------------------------------------------------------------------------- /omsdk/version/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | 24 | 25 | def main(): 26 | print("Welcome to Dell OpenManage SDK") 27 | -------------------------------------------------------------------------------- /omsdk/version/sdkversion.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. 6 | # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. 7 | # Other trademarks may be trademarks of their respective owners. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | # Authors: Vaideeswaran Ganesan 22 | # 23 | import sys 24 | 25 | PY2 = sys.version_info[0] == 2 26 | PY3 = sys.version_info[0] == 3 27 | PY2UC = (sys.version_info < (3, 0, 0)) 28 | 29 | OMSDKVersion = (0, 9, 1002) 30 | 31 | APIVersions = { 32 | 'ConfigFactory': (1, 0, 0), 33 | 'DeviceDriver': (1, 0, 0), 34 | 'ConsoleDriver': (0, 1, 0), 35 | 'SNMPListener': (0, 0, 1) 36 | } 37 | 38 | OverrideCompatibleEnumPyVersion = None 39 | 40 | 41 | class Compatibility: 42 | def __init__(self): 43 | self.compat_enum_version = None 44 | 45 | def set_compat_enum_version(self, version): 46 | self.compat_enum_version = version 47 | 48 | 49 | class CompatibilityFactory: 50 | compat = Compatibility() 51 | 52 | @staticmethod 53 | def get_compat(): 54 | return CompatibilityFactory.compat 55 | 56 | 57 | cc = CompatibilityFactory() 58 | 59 | if PY3: 60 | _EnumStyle = 'V3' 61 | else: 62 | _EnumStyle = 'NotPresent' 63 | try: 64 | import enum 65 | 66 | if hasattr(enum, 'version'): 67 | _EnumStyle = 'V3' 68 | elif hasattr(enum, '__version__'): 69 | _EnumStyle = 'V2' 70 | except ImportError: 71 | pass 72 | if _EnumStyle == 'V3': 73 | OverrideCompatibleEnumPyVersion = sys.version_info 74 | else: 75 | OverrideCompatibleEnumPyVersion = (3, 0, 0) 76 | -------------------------------------------------------------------------------- /requirements-python2x.txt: -------------------------------------------------------------------------------- 1 | pysnmp>=4.4.1 2 | pyasn1>=0.4.4 3 | enum34>=1.1.6 4 | requests>=2.12.3 5 | PyYAML>=3.12 6 | future>=0.16.0 7 | pysnmp_mibs>=0 -------------------------------------------------------------------------------- /requirements-python3x.txt: -------------------------------------------------------------------------------- 1 | pysnmp>=4.4.1 2 | requests>=2.12.3 3 | PyYAML>=3.12 4 | future>=0.16.0 5 | pysnmp_mibs>=0 6 | pywinrm 7 | urllib3 -------------------------------------------------------------------------------- /setup-omdrivers.py: -------------------------------------------------------------------------------- 1 | """A setuptools based setup module. 2 | 3 | See: 4 | https://packaging.python.org/en/latest/distributing.html 5 | https://github.com/pypa/sampleproject 6 | """ 7 | 8 | # Always prefer setuptools over distutils 9 | from setuptools import setup, find_packages 10 | # To use a consistent encoding 11 | from codecs import open 12 | from os import path 13 | 14 | here = path.abspath(path.dirname(__file__)) 15 | 16 | # Get the long description from the README file 17 | with open(path.join(here, 'README.rst'), encoding='utf-8') as f: 18 | long_description = f.read() 19 | # Get the version from _version file 20 | with open('/tmp/_version.txt', 'r') as v: 21 | ver = v.read() 22 | setup( 23 | name='omdrivers', 24 | 25 | # Versions should comply with PEP440. For a discussion on single-sourcing 26 | # the version across setup.py and the project code, see 27 | # https://packaging.python.org/en/latest/single_source_version.html 28 | version=ver, 29 | 30 | description='Dell OpenManage SDK', 31 | long_description='Dell OpenManage SDK for devices, consoles', 32 | 33 | # The project's main homepage. 34 | url='https://support.dell.com', 35 | 36 | # Author details 37 | author='Dell Technologies', 38 | author_email='OpenManageSDK@Dell.com', 39 | 40 | # Choose your license 41 | license='Apache Software License', 42 | 43 | # See https://pypi.python.org/pypi?%3Aaction=list_classifiers 44 | classifiers=[ 45 | # How mature is this project? Common values are 46 | # 3 - Alpha 47 | # 4 - Beta 48 | # 5 - Production/Stable 49 | 'Development Status :: 5 - Production/Stable', 50 | 51 | # Indicate who your project is intended for 52 | 'Intended Audience :: Developers', 53 | 'Topic :: Software Development :: Build Tools', 54 | 55 | # Pick your license as you wish (should match "license" above) 56 | 'License :: OSI Approved :: Apache Software License', 57 | 58 | # Specify the Python versions you support here. In particular, ensure 59 | # that you indicate whether you support Python 2, Python 3 or both. 60 | 'Programming Language :: Python :: 2', 61 | 'Programming Language :: Python :: 3', 62 | ], 63 | 64 | # What does your project relate to? 65 | keywords='dellomsdk, dellsdk, dell, idrac, force10', 66 | 67 | # You can just specify the packages manually here if your project is 68 | # simple. Or you can use find_packages(). 69 | packages=[ 70 | 'omdrivers', 71 | 'omdrivers.lifecycle.F10', 72 | 'omdrivers.F10', 73 | 'omdrivers.F10NG', 74 | 'omdrivers.NSeries', 75 | 'omdrivers.Printer', 76 | 'omdrivers.Compellent', 77 | 'omdrivers.EqualLogic', 78 | 'omdrivers.MDArray', 79 | 'omdrivers.NGM', 80 | 'omdrivers.ME4' 81 | ], 82 | 83 | # Alternatively, if you want to distribute just a my_module.py, uncomment 84 | # this: 85 | # py_modules=["my_module"], 86 | 87 | # List run-time dependencies here. These will be installed by pip when 88 | # your project is installed. For an analysis of "install_requires" vs pip's 89 | # requirements files see: 90 | # https://packaging.python.org/en/latest/requirements.html 91 | install_requires=[ 92 | 'omsdk>=0' 93 | ], 94 | 95 | # List additional groups of dependencies here (e.g. development 96 | # dependencies). You can install these using the following syntax, 97 | # for example: 98 | # $ pip install -e .[dev,test] 99 | extras_require={ 100 | }, 101 | 102 | # If there are data files included in your packages that need to be 103 | # installed, specify them here. If using Python 2.6 or less, then these 104 | # have to be included in MANIFEST.in as well. 105 | package_dir= {'omdrivers' : 'omdrivers' }, 106 | package_data={ 107 | 'omdrivers': [ 108 | 'F10/*.Monitor', 109 | 'F10NG/*.Monitor', 110 | 'NSeries/*.Monitor', 111 | 'Printer/*.Monitor', 112 | 'Compellent/*.Monitor', 113 | 'EqualLogic/*.Monitor', 114 | 'MDArray/*.Monitor', 115 | 'NGM/*.Monitor', 116 | 'ME4/*.Monitor' 117 | ], 118 | }, 119 | 120 | # Although 'package_data' is the preferred approach, in some case you may 121 | # need to place data files outside of your packages. See: 122 | # http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # noqa 123 | # In this case, 'data_file' will be installed into '/my_data' 124 | data_files=[ 125 | ], 126 | 127 | # To provide executable scripts, use entry points in preference to the 128 | # "scripts" keyword. Entry points provide cross-platform support and allow 129 | # pip to create the appropriate form of executable for the target platform. 130 | entry_points={ 131 | }, 132 | ) 133 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | # This flag says that the code is written to work on both Python 2 and Python 3 | # 3. If at all possible, it is good practice to do this. If you cannot, you 4 | # will need to generate wheels for each Python version that you support. 5 | universal=1 6 | -------------------------------------------------------------------------------- /uninstall.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | 4 | # Flags 5 | DEBUG_ENABLE = False # For dev/debug purpose 6 | PRINT_FILE_DATA = False # For dev/debug purpose 7 | 8 | def file_reader(setupfile): 9 | try: 10 | with open(setupfile, 'r+') as uninstallFileObj: 11 | rawData = uninstallFileObj.read() 12 | if DEBUG_ENABLE and PRINT_FILE_DATA: 13 | print(rawData) 14 | return rawData 15 | except IOError: 16 | print("Uninstall failed as record file for installed packages not found", setupfile) 17 | sys.exit(1) 18 | 19 | def del_dir_recur(basePath, pathIndex=2): 20 | try: 21 | if DEBUG_ENABLE: 22 | print("basePath: ", basePath) 23 | delPath = "" 24 | dirs = basePath.split('/') 25 | if DEBUG_ENABLE: 26 | print("dirs list: ", dirs) 27 | for index, element in enumerate(dirs): 28 | if index > (len(dirs) - pathIndex): 29 | break 30 | delPath += element + '/' 31 | 32 | if DEBUG_ENABLE: 33 | print("delPath: ", delPath) 34 | 35 | if os.path.exists(delPath) and (len(os.listdir(delPath)) == 0): 36 | if DEBUG_ENABLE: 37 | print("Deleting directory", delPath) 38 | resp = os.rmdir(delPath) 39 | print("Deleted Directory: ", delPath) 40 | # rmdir deletes empty directory 41 | if DEBUG_ENABLE: 42 | print("pathIndex", pathIndex) 43 | del_dir_recur(delPath, pathIndex) 44 | elif os.path.exists(delPath) == False: 45 | if DEBUG_ENABLE: 46 | print("Directory does not exist") 47 | print("recurPath: ", delPath) 48 | pathIndex += 1 49 | del_dir_recur(delPath, pathIndex) 50 | else: 51 | if DEBUG_ENABLE: 52 | print("recurPath: ", delPath) 53 | except OSError as osErr: 54 | if ("Directory not empty" in osErr ): 55 | if DEBUG_ENABLE: 56 | print("Directory not empty, skipping the directory") 57 | elif ("TypeError" in osErr ): 58 | if DEBUG_ENABLE: 59 | print("Directory not empty, skipping the directory") 60 | else: 61 | print("OSError occured: ", osErr) 62 | except Exception as unhandledErr: 63 | print("Error Occured: ", unhandledErr) 64 | sys.exit(1) 65 | 66 | def uninstall(rawData): 67 | try: 68 | lines = rawData.splitlines() 69 | for singleLine in lines: 70 | dirs = singleLine.split('/') 71 | if DEBUG_ENABLE: 72 | print("Deleting file", singleLine) 73 | if os.path.exists(singleLine) and os.path.isfile(singleLine): 74 | os.remove(singleLine) 75 | print("Deleted: ", singleLine) 76 | 77 | for singleLine in lines: 78 | dirs = singleLine.split('/') 79 | pathIndex = 2 80 | del_dir_recur(singleLine, pathIndex) 81 | 82 | except Exception as err: 83 | print("Error occured: ", err) 84 | sys.exit(1) 85 | 86 | if __name__ == '__main__': 87 | setupfile = 'setup_file.txt' 88 | rawData = file_reader(setupfile) 89 | uninstall(rawData) 90 | print("Uninstall completed") 91 | sys.exit(0) 92 | --------------------------------------------------------------------------------