def __init__(self, direct, complist): # self.defs contains mapping between AttribRegistry ==> AttribRegistry.json self.defs = {} # self.complist contains compspec self.complist = complist # load self.defs from config directory for file1 in glob.glob(os.path.join(direct, "*.json")): with open(file1) as enum_data: myjson = json.load(enum_data) comp = re.sub("^.*/", "", myjson["$ref"]) self.defs[comp] = myjson # self.compen is the enum for AttribRegistry's compens = {} for i in self.defs: compens[i] = i self.compen = EnumWrapper("ConfigComp", compens).enum_type arspec = {} for cenum in self.compen: ens = {} cvalue = TypeHelper.resolve(cenum) for i in self.get_fields(cvalue): ens[i] = i arspec[cvalue] = EnumWrapper(cvalue + "ConfigEnum", ens).enum_type self.arspec = AttribRegistryNames(arspec)
def importPath(self, srcdir=None): oldpaths = sys.path if not srcdir is None: oldpaths = [srcdir] counter = 0 paths = [] for k in oldpaths: if not k in paths: paths.append(k) for psrcdir in paths: pypath = os.path.join(psrcdir, 'omdrivers', '__DellDrivers__.py') pyglobpath = os.path.join(psrcdir, 'omdrivers', '*.py') pydrivers = os.path.join(psrcdir, 'omdrivers') if not os.path.exists(pypath): continue fl = glob.glob(pyglobpath) for i in range(len(fl)): if fl[i].endswith("__.py"): continue counter = counter + 1 logger.debug("Loading: " + str(counter) + "::" + fl[i]) module_loaded = self.load_from_file(fl[i]) self.drivers[module_loaded["name"]] = module_loaded["module"] self.driver_names[module_loaded["name"]] = module_loaded["name"] discClass = getattr(module_loaded["module"], module_loaded["name"]) self.disc_modules[module_loaded["name"]] = discClass(pydrivers) aliases = self.disc_modules[module_loaded["name"]].my_aliases() mname = module_loaded["name"] for alias in aliases: self.disc_modules[alias] = self.disc_modules[mname] self.drivers[alias] = self.drivers[mname] self.driver_names[alias] = self.driver_names[mname] tempdict = OrderedDict(sorted(self.disc_modules.items(), key=lambda t: t[1].prefDiscOrder)) self.disc_modules = tempdict self.driver_enum = EnumWrapper("Driver", self.driver_names).enum_type
import os import socket import yaml import json import re from urllib.parse import urlparse, unquote from http import HTTPStatus from http.server import SimpleHTTPRequestHandler, HTTPServer from random import choice from socketserver import ThreadingMixIn from omsdk.sdkcenum import EnumWrapper, TypeHelper logger = logging.getLogger(__name__) SDKServerProtocolEnum = EnumWrapper('SDKServerProtocolEnum', { 'HTTP': "http", 'HTTPS': "https" }).enum_type SDKServerStateEnum = EnumWrapper('SDKServerStateEnum', { 'Running': 1, 'Stopped': 2 }).enum_type class SDKHTTPServer(ThreadingMixIn, HTTPServer): def __init__(self, base_path, *args, **kwargs): HTTPServer.__init__(self, *args, **kwargs) self.RequestHandlerClass.base_path = base_path class SDKServerRequestHandler(SimpleHTTPRequestHandler):
from omsdk.sdkcenum import EnumWrapper ProtocolEnum = EnumWrapper('ProtocolEnum', { 'SNMP': 1, 'WSMAN': 2, 'REDFISH': 3, 'REST': 4, 'Other': 100, 'Simulator': 101 }).enum_type ProtoMethods = EnumWrapper("FST", { "HuntMode": "HuntMode", "MergeMode": "MergeMode" }).enum_type class ProtoPreference: def __init__(self, *args): self.orig_protocols = [] for arg in args: self.orig_protocols.append(arg) self.orig_mode = ProtoMethods.HuntMode self.reset() def set_mode(self, mode): self.mode = mode def reset(self): self.protocols = [] self.include_flag = []
from omsdk.sdkcenum import EnumWrapper import sys import logging PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 logger = logging.getLogger(__name__) BusProtocolTypes = EnumWrapper("BusProtocolTypes", { "PCIe": "PCIe", }).enum_type BusProtocolVersionTypes = EnumWrapper( "BusProtocolVersionTypes", { "T_2_0": "2.0", "T_2_1": "2.1", "T_3_0": "3.0", "T_3_1": "3.1", "Unknown": "Unknown", }).enum_type CapableSpeedTypes = EnumWrapper( "CapableSpeedTypes", { "T_2_5_GT_s": "2.5 GT/s", "T_5_0_GT_s": "5.0 GT/s", "T_8_0_GT_s": "8.0 GT/s", "Unknown": "Unknown", }).enum_type CryptographicEraseTypes = EnumWrapper("CryptographicEraseTypes", {
from pysnmp import debug PyPSNMP = True except ImportError: PyPSNMP = False class NoConfig: def __init__(self, obj): logger.debug("not implemented") NSeriesCompEnum = EnumWrapper( 'NSeriesCompEnum', { "System": "System", "FanTray": "FanTray", "PowerSupply": "PowerSupply", "Processor": "Processor", "Port": "Port", "Fan": "Fan", "PowerSupplyTray": "PowerSupplyTray", }).enum_type if PyPSNMP: NSeriesPSNMPViews = { NSeriesCompEnum.System: { 'SysObjectID': ObjectIdentity('SNMPv2-MIB', 'sysObjectID'), 'ServiceTag': ObjectIdentity("1.3.6.1.4.1.674.10895.3000.1.2.100.8.1.4"), 'PrimaryStatus': ObjectIdentity("1.3.6.1.4.1.674.10895.3000.1.2.110.1"), 'Model':
PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 ME4CompEnum = EnumWrapper( 'ME4CompEnum', { "System": "System", "Fan": "Fan", "Disk": "Disk", "Port": "Port", "ExpanderPort": "ExpanderPort", "Expander": "Expander", "Controller": "Controller", "PowerSupply": "PowerSupply", "Sensor_Temperature": "Sensor_Temperature", "Sensor_Voltage": "Sensor_Voltage", "Sensor_ChargeCapacity": "Sensor_ChargeCapacity", "Sensor_Amperage": "Sensor_Amperage", "Enclosure": "Enclosure", "StorageEnclosure": "StorageEnclosure", "Volume": "Volume", "Subsystem": "Subsystem", "IOM": "IOM", "StoragePool": "StoragePool", "NIC": "NIC", "VDisks": "VDisks" }).enum_type ME4MiscEnum = EnumWrapper('ME4MiscEnum', { "ServiceTag": "ServiceTag", "Versions": "Versions"
OMViperPresent = True except ImportError: OMViperPresent = False PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 emcViperCompEnum = EnumWrapper( 'emcViperCompEnum', { "System": "System", "Disk": "Disk", "Capacity": "Capacity", "Node": "Node", "Service": "Service", "HealthMonitor": "HealthMonitor", "Namespace": "Namespace", "Users": "Users", "Configuration": "Configuration", "Tenants": "Tenants", "Projects": "Projects", "Volumes": "Volumes", "VirtualPools": "VirtualPools", "vCenters": "vCenters", "License": "License", }).enum_type class emcViper(iDeviceDiscovery): def __init__(self, srcdir): if PY2: super(emcViper, self).__init__( iDeviceRegistry("emcViper", srcdir, emcViperCompEnum))
class NoConfig: def __init__(self, obj): logger.debug("not implemented") if not Pyconfig_mgr: EqualLogicConfig = NoConfig if not Pyconfig_mgr and PyPSNMP: EqualLogicPSNMPCmds = {} EqualLogicCompEnum = EnumWrapper( 'EqualLogicCompEnum', { "System": "System", "Member": "Member", "Volume": "Volume", "PhysicalDisk": "PhysicalDisk", "StoragePool": "StoragePool", "InetAddr": "InetAddr", }).enum_type if PyPSNMP: EqualLogicPSNMPViews = { EqualLogicCompEnum.System: { 'SysObjectID': ObjectIdentity('SNMPv2-MIB', 'sysObjectID'), 'GroupName': ObjectIdentity("1.3.6.1.4.1.12740.1.1.1.1.19"), 'GroupIP': ObjectIdentity("1.3.6.1.4.1.12740.1.1.1.1.20"), 'MemberCount': ObjectIdentity("1.3.6.1.4.1.12740.1.1.2.1.13"), 'VolumeCount': ObjectIdentity("1.3.6.1.4.1.12740.1.1.2.1.12"), }, EqualLogicCompEnum.Member: {
# Authors: Vaideeswaran Ganesan # from omsdk.sdkcenum import EnumWrapper import sys import logging PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 logger = logging.getLogger(__name__) BootScanSelectionTypes = EnumWrapper( "BootScanSelectionTypes", { "Disabled": "Disabled", "FabricDiscovered": "FabricDiscovered", "FirstLUN": "FirstLUN", "FirstLUN0": "FirstLUN0", "FirstNOTLUN0": "FirstNOTLUN0", "SpecifiedLUN": "SpecifiedLUN", }).enum_type FCTapeTypes = EnumWrapper("FCTapeTypes", { "Disabled": "Disabled", "Enabled": "Enabled", }).enum_type FramePayloadSizeTypes = EnumWrapper( "FramePayloadSizeTypes", { "Auto": "Auto", "T_1024": "1024", "T_2048": "2048",
import logging logger = logging.getLogger(__name__) PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 _membuiltin = ["__class__", "__delattr__", "__dict__", "__dir__", "__doc__", "__eq__", "__format__", "__ge__", "__getattribute__", "__gt__", "__hash__", "__init__", "__le__", "__lt__", "__module__", "__ne__", "__new__", "__reduce__", "__reduce_ex__", "__repr__", "__setattr__", "__sizeof__", "__str__", "__subclasshook__", "__weakref__"] MemberType = EnumWrapper("omsdk.reflection.sdkapi.MemberType", { 'Field': 'Field', 'Private_Field': 'Private_Field', 'Public_Field': 'Public_Field', 'Method': 'Method', 'Public_Method': 'Public_Method', 'Private_Method': 'Private_Method' }).enum_type class SDKApiVisitor(object): def __init__(self): pass def method_start(self, method): pass def method_arg(self, arg): pass
from pysnmp.entity.rfc3413.oneliner import cmdgen from pysnmp.proto import rfc1902 from pysnmp import debug PySnmpPresent = True except ImportError: PySnmpPresent = False CompellentCompEnum = EnumWrapper('CompellentCompEnum', { "System" : "System", "Controller" : "Controller", "Enclosure" : "Enclosure", "Disk" : "Disk", "Volume" : "Volume", "EnclosurePSU" : "EnclosurePSU", "UPS" : "UPS", "PowerSupply" : "PowerSupply", "EnclosureFan" : "EnclosureFan", "EnclosureIOM" : "EnclosureIOM", "ControllerFan" : "ControllerFan", "StorageCenter" : "StorageCenter", "PhysicalDisk" : "PhysicalDisk", }).enum_type if PySnmpPresent: CompellentSNMPViews = { CompellentCompEnum.System : { 'SysObjectID': ObjectIdentity('SNMPv2-MIB', 'sysObjectID'), #'SysObjectID': ObjectIdentity('1.3.6.1.4.1.8072.3.2.8'), 'ProductID' : ObjectIdentity('1.3.6.1.4.1.674.11000.2000.500.1.2.1'), 'Description' : ObjectIdentity('1.3.6.1.4.1.674.11000.2000.500.1.2.2'),
# # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # Authors: Vaideeswaran Ganesan # import xml.etree.ElementTree as ET import re import os import sys from omsdk.sdkprint import PrettyPrint from omsdk.sdkcenum import EnumWrapper RowStatus = EnumWrapper("MS", { 'Row_With_Valid_Key' : 1, 'Partial' : 2, 'Row_With_Invalid_Key' : 3, }).enum_type class ConfigEntries(object): def __init__(self, keyfield): self.valuemap = {} self.compmap = {} self.slotmap = { } self.keyfield = keyfield self.loaded = False def process(self, fname, incremental): valuemap = {}
try: from pysnmp.hlapi import * from pysnmp.smi import * from pysnmp.entity.rfc3413.oneliner import cmdgen from pysnmp.proto import rfc1902 from pysnmp import debug PySnmpPresent = True except ImportError: PySnmpPresent = False PrinterCompEnum = EnumWrapper("PrinterCompEnum", { "System" : "System", "PrinterMarker" : "PrinterMarker", "PrinterMarkerSupplies" : "PrinterMarkerSupplies", "PrinterGeneral" : "PrinterGeneral", "Interface" : "Interface", "PrinterConsoleDisplayBuffer" : "PrinterConsoleDisplayBuffer", "PrinterCover" : "PrinterCover", "PrinterInput" : "PrinterInput", "PrinterMediaPath" : "PrinterMediaPath", "PrinterOutput" : "PrinterOutput", }).enum_type if PySnmpPresent: PrinterSNMPViews = { "System" : { 'hrDeviceIndex' : ObjectIdentity('HOST-RESOURCES-MIB', 'hrDeviceIndex'), 'hrDeviceDescr' : ObjectIdentity('HOST-RESOURCES-MIB', 'hrDeviceDescr'), 'hrDeviceID' : ObjectIdentity('HOST-RESOURCES-MIB', 'hrDeviceID'), 'hrPrinterDetectedErrorState' : ObjectIdentity('HOST-RESOURCES-MIB', 'hrPrinterDetectedErrorState'), 'hrPrinterStatus' : ObjectIdentity('HOST-RESOURCES-MIB', 'hrPrinterStatus'), "prtGeneralSerialNumber" : ObjectIdentity('PRINTER-MIB', 'prtGeneralSerialNumber'), #hrDeviceIndex
logger = logging.getLogger(__name__) try: from scaleiopy.scaleio import ScaleIO OMScaleIOPresent = True except ImportError: OMScaleIOPresent = False PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 emcScaleIOCompEnum = EnumWrapper( 'emcScaleIOCompEnum', { "System": "System", "SDC": "SDC", "SDS": "SDS", "Volume": "Volume", "ProtectionDomain": "ProtectionDomain", "StoragePool": "StoragePool" }).enum_type class emcScaleIO(iDeviceDiscovery): def __init__(self, srcdir): if PY2: super(emcScaleIO, self).__init__( iDeviceRegistry("emcScaleIO", srcdir, emcScaleIOCompEnum)) else: super().__init__( iDeviceRegistry("emcScaleIO", srcdir, emcScaleIOCompEnum)) self.protofactory.add(PCONSOLE(obj=self))
if not Pyconfig_mgr: F10Config = NoConfig if not Pyconfig_mgr and PyPSNMP: F10PSNMPCmds = {} F10CompEnum = EnumWrapper( 'F10CompEnum', { "System": "System", "FanTray": "FanTray", "PEBinding": "PEBinding", "Card": "Card", "Chassis": "Chassis", "PowerSupply": "PowerSupply", "Flash": "Flash", "SwModule": "SwModule", "SysIf": "SysIf", "StackPort": "StackPort", "SysCores": "SysCores", "StackUnit": "StackUnit", "CpuUtil": "CpuUtil", "PE": "PE", "Processor": "Processor", "Port": "Port", "Fan": "Fan", "PowerSupplyTray": "PowerSupplyTray", }).enum_type F10MiscEnum = EnumWrapper("F10MiscEnum", { "EntityPortMap": "EntityPortMap" }).enum_type
from enum import Enum from omsdk.sdkcenum import TypeHelper, EnumWrapper import sys import json from omsdk.sdkprint import PrettyPrint import logging logger = logging.getLogger(__name__) PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 CredentialsEnum = EnumWrapper('CredentialsEnum', { 'User' : 'User', 'SNMPv1_v2c' : 'SNMPv1_v2c', 'SNMPv3' : 'SNMPv3' }).enum_type class iCredentials(object): def __init__(self, credsEnum = CredentialsEnum.User): self.enid = credsEnum def __str__(self): return TypeHelper.resolve(self.enid) def __repr__(self): return TypeHelper.resolve(self.enid) class Snmpv2Credentials(iCredentials): def __init__(self, community, writeCommunity = None):
PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 try: from pysnmp.hlapi import * from pysnmp.smi import * from pysnmp.entity.rfc3413.oneliner import cmdgen from pysnmp.proto import rfc1902 from pysnmp import debug PySnmpPresent = True except ImportError: PySnmpPresent = False ConfigFileTypeEnum = EnumWrapper("CFT", { "FTOS": 1, "RunningConfig": 2, "StartupConfig": 3, }).enum_type ConfigFileLocationEnum = EnumWrapper("CFLE", { "Flash": 1, "Slot0": 2, "Tftp": 3, "FTP": 4, "SCP": 5, "USBFlash": 6 }).enum_type if PySnmpPresent: F10SNMPCmds = { #######
import sys PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 # MessageID, Message CMCCompEnum = EnumWrapper( "CMCCompEnum", { "System": "System", "ComputeModule": "ComputeModule", "StorageModule": "StorageModule", "IOModule": "IOModule", "Fan": "Fan", "CMC": "CMC", "PowerSupply": "PowerSupply", "Controller": "Controller", "Enclosure": "Enclosure", "EnclosureEMM": "EnclosureEMM", "EnclosurePSU": "EnclosurePSU", "PCIDevice": "PCIDevice", "ControllerBattery": "ControllerBattery", "VirtualDisk": "VirtualDisk", "PhysicalDisk": "PhysicalDisk", "KVM": "KVM", }).enum_type CMCMiscEnum = EnumWrapper( "CMCMiscEnum", { "PassThroughModule": "PassThroughModule", "PSPackage": "PSPackage", "PSSlot": "PSSlot",
from pysnmp.proto import rfc1902 from pysnmp import debug PyPSNMP = True except ImportError: PyPSNMP = False class NoConfig: def __init__(self, obj): logger.debug("not implemented") F10NGCompEnum = EnumWrapper( 'F10NGCompEnum', { "System": "System", "FanTray": "FanTray", "PowerSupply": "PowerSupply", "Port": "Port", "Fan": "Fan", }).enum_type if PyPSNMP: F10NGPSNMPViews = { F10NGCompEnum.System: { 'SysObjectID': ObjectIdentity('SNMPv2-MIB', 'sysObjectID'), 'ServiceTag': ObjectIdentity("1.3.6.1.4.1.674.11000.5000.100.4.1.1.3.1.7"), 'PrimaryStatus': ObjectIdentity("1.3.6.1.4.1.674.11000.5000.100.4.1.1.4.1.4"), 'Model': ObjectIdentity("1.3.6.1.4.1.674.11000.5000.100.4.1.1.4.1.2"),
if not Pyconfig_mgr: F10Config = NoConfig F10PSNMPCmds = {} if not Pyconfig_mgr and PyPSNMP: F10PSNMPCmds = {} F10CompEnum = EnumWrapper( 'F10CompEnum', { "System": "System", "dellNetFanTray": "dellNetFanTray", "dellNetPEBinding": "dellNetPEBinding", "dellNetCard": "dellNetCard", "dellNetChassis": "dellNetChassis", "dellNetPowerSupply": "dellNetPowerSupply", "dellNetFlash": "dellNetFlash", "dellNetSwModule": "dellNetSwModule", # "dellNetSysIf" : "dellNetSysIf", "dellNetStackPort": "dellNetStackPort", "dellNetSysCores": "dellNetSysCores", "dellNetStackUnit": "dellNetStackUnit", "dellNetCpuUtil": "dellNetCpuUtil", "dellNetPE": "dellNetPE", "dellNetProcessor": "dellNetProcessor", }).enum_type if PyPSNMP: F10PSNMPViews = { F10CompEnum.System: { 'SysObjectID': ObjectIdentity('SNMPv2-MIB', 'sysObjectID') },
# along with this program. If not, see <http://www.gnu.org/licenses/>. # # Authors: Vaideeswaran Ganesan # import sys import json from omsdk.sdkcenum import EnumWrapper, TypeHelper from omsdk.sdkenum import Filter PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 DiffStyleMap = { "Standard": 1, "Formal": 2, } DiffStyle = EnumWrapper("DS", DiffStyleMap).enum_type DiffScopeMap = { # added entries "Added": 1 << 0, # same entries "Same": 1 << 1, # Modified entries "Modified": 1 << 2, # Deleted entries "Deleted": 1 << 3, "Default": 1 << 0 | 1 << 2 | 1 << 3, } DiffScope = EnumWrapper("DSp", DiffScopeMap).enum_type
from pysnmp.entity.rfc3413.oneliner import cmdgen from pysnmp.proto import rfc1902 from pysnmp import debug PySnmpPresent = True except ImportError: PySnmpPresent = False EntityCompEnum = EnumWrapper( "EntityCompEnum", { "System": "System", "other": "other", "chassis": "chassis", "backplane": "backplane", "container": "container", "powerSupply": "powerSupply", "fan": "fan", "sensor": "sensor", "module": "module", "port": "port", "stack": "stack", "cpu": "cpu", "Entity": "Entity" }).enum_type if PySnmpPresent: EntityComponentTree = { "Full": [EntityCompEnum.stack], EntityCompEnum.stack: [EntityCompEnum.chassis], EntityCompEnum.chassis: [EntityCompEnum.container], EntityCompEnum.container: [EntityCompEnum.module], EntityCompEnum.module: [
from omsdk.sdkcenum import EnumWrapper import sys import logging PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 logger = logging.getLogger(__name__) AddressingModeTypes = EnumWrapper("AddressingModeTypes", { "FPMA": "FPMA", "SPMA": "SPMA", }).enum_type BootOptionROMTypes = EnumWrapper("BootOptionROMTypes", { "Disabled": "Disabled", "Enabled": "Enabled", }).enum_type BootRetryCntTypes = EnumWrapper( "BootRetryCntTypes", { "IndefiniteRetries": "IndefiniteRetries", "NoRetry": "NoRetry", "T_1Retry": "1Retry", "T_2Retries": "2Retries", "T_3Retries": "3Retries", "T_4Retries": "4Retries", "T_5Retries": "5Retries", "T_6Retries": "6Retries", }).enum_type
PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 try: from pysnmp.hlapi import * from pysnmp.smi import * from pysnmp.entity.rfc3413.oneliner import cmdgen from pysnmp.proto import rfc1902 from pysnmp import debug PySnmpPresent = True except ImportError: PySnmpPresent = False MDArrayCompEnum = EnumWrapper('MDArrayCompEnum', { "System": "System", }).enum_type if PySnmpPresent: MDArraySNMPViews = { MDArrayCompEnum.System: { 'SysObjectID': ObjectIdentity('SNMPv2-MIB', 'sysObjectID'), 'Name': ObjectIdentity('1.3.6.1.4.1.674.10893.2.31.500.1.1'), 'WWID': ObjectIdentity('1.3.6.1.4.1.674.10893.2.31.500.1.2'), 'ServiceTag': ObjectIdentity('1.3.6.1.4.1.674.10893.2.31.500.1.3'), 'ProductID': ObjectIdentity('1.3.6.1.4.1.674.10893.2.31.500.1.5'), 'Status': ObjectIdentity('1.3.6.1.4.1.674.10893.2.31.500.1.7'), 'SysName': ObjectIdentity('1.3.6.1.2.1.1.5') } } MDArraySNMPClassifier = {
MonitorScopeMap = { "Key" : 1 << 0, "Metrics" : 1 << 1, "ConfigState" : 1 << 2, # Inventory includes all "BasicInventory" : 1 << 3, "OtherInventory" : 1 << 4, "Inventory" : 1 << 3 | 1 << 4, "MainHealth" : 1 << 10, # Main component health "OtherHealth" : 1 << 11, # other health component # Health includes all health "Health" : 1 << 10 | 1 << 11, } MonitorScope = EnumWrapper("MS", MonitorScopeMap).enum_type class MonitorScopeFilter(Filter): def __init__(self, *args): if PY2: super(MonitorScopeFilter, self).__init__(*args) else: super().__init__(*args) def allowedtype(self, scopeType): return type(scopeType) == type(MonitorScope) def check(self, scopeEnum): return TypeHelper.belongs_to(MonitorScope, scopeEnum) def all(self): return self._all(MonitorScope)
logger = logging.getLogger(__name__) class VersionObj: def __init__(self, version): self.version_string = version try: flist = re.sub("[^0-9]+", ".", version).split('.') self.version = tuple([int(x) for x in flist]) except Exception as ex: logger.debug(str(ex)) self.version = tuple(version, ) UpdatePresenceEnum = EnumWrapper('UPE', { 'Present': 'Present', 'Absent': 'Absent', }).enum_type UpdateTypeEnum = EnumWrapper( 'UTE', { 'On_Par': 'On_Par', 'New': 'New', 'Upgrade': 'Upgrade', 'Downgrade': 'Downgrade', 'Absent': 'Absent', }).enum_type UpdateNeededEnum = EnumWrapper('UNE', { 'Needed': True, 'NotNeeded': False, 'Unknown': 'Unknown'
import requests.adapters import requests.exceptions import requests.packages.urllib3 from requests.packages.urllib3.exceptions import InsecureRequestWarning from omsdk.sdkprotobase import ProtocolBase from omsdk.sdkcenum import EnumWrapper, TypeHelper from omsdk.http.sdkrestpdu import RestRequest, RestResponse from omsdk.http.sdkhttpep import HttpEndPoint, HttpEndPointOptions PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 ReturnValueMap = {'Success': 0, 'Error': 2, 'JobCreated': 4096, 'Invalid': -1} ReturnValue = EnumWrapper('ReturnValue', ReturnValueMap).enum_type class RestOptions(HttpEndPointOptions): def __init__(self): if PY2: super(RestOptions, self).__init__() else: super().__init__() class RestProtocol(ProtocolBase): def __init__(self, ipaddr, creds, pOptions): if PY2: super(RestProtocol, self).__init__() else:
# # 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. # # Authors: Vaideeswaran Ganesan # from omsdk.sdkcenum import EnumWrapper, TypeHelper import logging logger = logging.getLogger(__name__) iDRACLicenseEnum = EnumWrapper("iDRACLicenseEnum", { "License": "License", "LicensableDevice": "LicensableDevice", }).enum_type iDRACFirmEnum = EnumWrapper("iDRACFirmEnum", { "Firmware": "Firmware", }).enum_type iDRACLogsEnum = EnumWrapper("iDRACLogEnum", { "Logs": "Logs", "SELLog": "SELLog" }).enum_type JobStatusEnum = EnumWrapper( "iDRACJSE", { 'Success': 'Success', 'InProgress': 'InProgress',
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # Authors: Vaideeswaran Ganesan # from omsdk.sdkcenum import EnumWrapper, TypeHelper import logging logger = logging.getLogger(__name__) iDRACLicenseEnum = EnumWrapper("iDRACLicenseEnum", { "License": "License", "LicensableDevice": "LicensableDevice", }).enum_type iDRACFirmEnum = EnumWrapper("iDRACFirmEnum", { "Firmware": "Firmware", }).enum_type iDRACLogsEnum = EnumWrapper("iDRACLogEnum", { "Logs": "Logs", "SELLog": "SELLog" }).enum_type JobStatusEnum = EnumWrapper( "iDRACJSE", { 'Success': 'Success', 'InProgress': 'InProgress',