当前位置: 首页>>代码示例>>Python>>正文


Python CDevice.__init__方法代码示例

本文整理汇总了Python中lib.Device.CDevice.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python CDevice.__init__方法的具体用法?Python CDevice.__init__怎么用?Python CDevice.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lib.Device.CDevice的用法示例。


在下文中一共展示了CDevice.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from lib.Device import CDevice [as 别名]
# 或者: from lib.Device.CDevice import __init__ [as 别名]
    def __init__(self, dict_stack):

        CDevice.__init__(self, 'vStack')

        self.dict_config = dict_stack

        # HyperVisor
        self.hypervisors = {}
        for hypervisor_info in self.dict_config['available_HyperVisor']:
            obj_hypervisor = CHypervisor(hypervisor_info)
            self.hypervisors[obj_hypervisor.get_name()] = obj_hypervisor

        # vRacks
        self.racks = {}
        for rack_info in self.dict_config['vRacks']:
            obj_rack = CRack(rack_info)
            self.racks[obj_rack.get_name()] = obj_rack

        # vRackSystem REST agent
        self.dict_vracksystem = self.dict_config['vRackSystem']
        self.rest = APIClient(username=self.dict_vracksystem['username'],
                              password=self.dict_vracksystem['password'],
                              session_log=True)
        self.rest_root = '{}://{}:{}{}'.format(self.dict_vracksystem['protocol'],
                                               self.dict_vracksystem['ip'],
                                               self.dict_vracksystem['port'],
                                               self.dict_vracksystem['root'])

        self.b_valid = True
开发者ID:PaynePei,项目名称:test,代码行数:31,代码来源:Stack.py

示例2: __init__

# 需要导入模块: from lib.Device import CDevice [as 别名]
# 或者: from lib.Device.CDevice import __init__ [as 别名]
    def __init__(self, cpu_id, obj_xmlnode_cpu, obj_device_parent):
        CDevice.__init__(self, cpu_id, obj_xmlnode_cpu, obj_device_parent)

        processor_file_path=os.path.join(os.path.abspath('.'), \
                                         'pub', 'processor.xml')
        root=et.parse(processor_file_path)
        processor_list=root.findall('processor')
        for i in processor_list:
            if cpu_id == i.find('id').text:
                self.cpu_detail_xmlnode=i
                break

        self.obj_xmlnode_cpu = obj_xmlnode_cpu
        self.device_type = 'cpu'
        self.socket = 0
        self.brand_string = ''
        self.codename = ''
        self.core_num = 0
        self.core_freq = 0
        self.ht_enable = False
        self.qpi_freq = 0
        self.qpi_freq_reg = 0       #0x7:9.6GT/s
        self.ucode = 0
        self.stepping = 0
        self.por = []
        self.ha_num = 0
开发者ID:zhang-martin,项目名称:atom2,代码行数:28,代码来源:CPU.py

示例3: __init__

# 需要导入模块: from lib.Device import CDevice [as 别名]
# 或者: from lib.Device.CDevice import __init__ [as 别名]
    def __init__(self, dict_rack):

        CDevice.__init__(self, 'vRack')

        self.dict_config = dict_rack

        self.name = self.dict_config.get('name', '')
        self.hypervisor = self.dict_config.get('hypervisor', '')
        self.nodes = {}
        self.pdus = {}
        self.switchs = {}

        # vPDU
        for pdu_info in self.dict_config['vPDU']:
            obj_pdu = CPDU(pdu_info)
            self.add_pdu(obj_pdu)

        # vSwitch
        for switch_info in self.dict_config['vSwitch']:
            obj_switch = CSwitch(switch_info)
            self.add_switch(obj_switch)

        # vNode
        for node_info in self.dict_config['vNode']:
            obj_node = CNode(node_info)
            self.add_node(obj_node)

            # Bind Node to PDU outlet
            for dict_power in obj_node.get_config().get('power', {}):
                str_pdu_name = dict_power['vPDU']
                str_outlet = dict_power['outlet']
                obj_pdu = self.pdus.get(str_pdu_name, None)
                if (obj_pdu, str_outlet) not in obj_node.power:
                    obj_node.power.append((obj_pdu, str_outlet))
                obj_pdu.outlet[str_outlet]['node'] = obj_node
开发者ID:PaynePei,项目名称:test,代码行数:37,代码来源:Rack.py

示例4: __init__

# 需要导入模块: from lib.Device import CDevice [as 别名]
# 或者: from lib.Device.CDevice import __init__ [as 别名]
    def __init__(self, obj_device, str_id):
        """
        @param obj_device: Parent device that init this one
        @type obj_device: CDevice
        """

        # Initialize resource name, parents and URI
        self.resource_name = str_id
        CDevice.__init__(self, self.resource_name)
        self.obj_parent = obj_device
        self.set_logger(self.obj_parent.obj_logger)
        self.set_rest_agent(self.obj_parent.obj_rest_agent)
        self.str_device_type = self.obj_parent.str_device_type

        # If str_id is 'active', this workflow shoud be a
        # downstream resource of Node
        if str_id.lower() == 'active':
            self.uri = '{}/{}'.format(self.obj_parent.uri, self.resource_name)
        # If str_id is a 24 width hash code, this workflow
        # should be a downstream resource of Monorail root
        elif p_hash.findall(str_id):
            str_root = '/'.join(self.obj_parent.uri.split('/', 5)[0:5])
            self.uri = '{}/workflows/{}'.format(str_root, str_id)
        # If str_id is 'library', which is specified by a static
        # library workflow definition, this workflow shall have no
        # upstream resource, but only maintain a static data.
        # It can't be udpated.
        elif str_id == 'library':
            self.uri = ''
        # Else, it's not valid
        else:
            raise Exception('Invalid workflow resource name: {}'.format(str_id))

        self.mon_data = {}
开发者ID:JuneZhou19,项目名称:test,代码行数:36,代码来源:Workflow.py

示例5: __init__

# 需要导入模块: from lib.Device import CDevice [as 别名]
# 或者: from lib.Device.CDevice import __init__ [as 别名]
 def __init__(self, str_fan_type, obj_xmlnode_fan, obj_device_parent):
     CDevice.__init__(self, str_fan_type, obj_xmlnode_fan, obj_device_parent)
     self.obj_xmlnode_fan = obj_xmlnode_fan
     self.str_device_type = 'fan'
     self.int_slot = -1
     self.str_name = self.str_sub_type
     self.b_valid = True
开发者ID:zhang-martin,项目名称:atom2,代码行数:9,代码来源:Fan.py

示例6: __init__

# 需要导入模块: from lib.Device import CDevice [as 别名]
# 或者: from lib.Device.CDevice import __init__ [as 别名]
    def __init__(self, dict_bmc):

        CDevice.__init__(self, 'vBMC')

        self.dict_config = dict_bmc

        self.ip = self.dict_config.get('ip', '')
        self.username = self.dict_config.get('username', '')
        self.password = self.dict_config.get('password', '')
        self.ipmi = CIOL(str_ip=self.ip,
                         str_user=self.username,
                         str_password=self.password)
开发者ID:InfraSIM,项目名称:test,代码行数:14,代码来源:BMC.py

示例7: __init__

# 需要导入模块: from lib.Device import CDevice [as 别名]
# 或者: from lib.Device.CDevice import __init__ [as 别名]
    def __init__(self, dict_stack):

        CDevice.__init__(self, 'vStack')

        self.dict_config = dict_stack

        # vRacks
        self.racks = {}
        for rack_info in self.dict_config['vRacks']:
            obj_rack = CRack(rack_info)
            self.racks[obj_rack.get_name()] = obj_rack

        self.b_valid = True
开发者ID:InfraSIM,项目名称:test,代码行数:15,代码来源:Stack.py

示例8: __init__

# 需要导入模块: from lib.Device import CDevice [as 别名]
# 或者: from lib.Device.CDevice import __init__ [as 别名]
 def __init__(self, str_platform, obj_xmlnode_enclosure, obj_device_parent = None):
     CDevice.__init__(self, str_platform, obj_xmlnode_enclosure, obj_device_parent)
     self.str_device_type = 'enslosure'
     self.str_platform = str_platform
     self.spa = CSP
     self.spb = CSP
     self.spc = CSP
     self.spd = CSP
     self.sp = CSP
     self.lst_sp = list()
     self.b_dual_sp = False
     self.str_sp_side_available = ''
     self.dict_device_children['sp'] = []
开发者ID:zhang-martin,项目名称:atom2,代码行数:15,代码来源:Enclosure.py

示例9: __init__

# 需要导入模块: from lib.Device import CDevice [as 别名]
# 或者: from lib.Device.CDevice import __init__ [as 别名]
    def __init__(self, dict_node):
        """
        dict_node example:
        {
            "name": "vnode_a_20160126114700",
            "power": [
                {"vPDU": "vpdu_1", "outlet": "1.1"}
            ],
            "admin":{
                "ip": "192.168.134.114",
                "username": "infrasim",
                "password": "infrasim"
            },
            "bmc": {
                "ip": "172.31.128.2",
                "username": "admin",
                "password": "admin"
            }
        }
        """

        CDevice.__init__(self, 'vNode')

        self.dict_config = dict_node

        # vBMC
        obj_bmc = CBMC(self.dict_config.get('bmc', {}))
        self.bmc = obj_bmc

        # Power, a tuple of PDU information:
        # (obj_pdu, str_outlet)
        self.power = []

        self.name = self.dict_config.get('name', '')
        if 'admin' not in self.dict_config:
            raise Exception('No "admin" network defined for node {}'.format(self.name))
        self.ip = self.dict_config['admin'].get('ip', '')
        self.username = self.dict_config['admin'].get('username', '')
        self.password = self.dict_config['admin'].get('password', '')

        if self.dict_config.get('guest_os'):
            self.guest_ip = self.dict_config['guest_os'].get('ip', '')
            self.guest_user = self.dict_config['guest_os'].get('username', '')
            self.guest_password = self.dict_config['guest_os'].get('password', '')

        self.port_ipmi_console = self.dict_config.get('ipmi-console', 9300)
        self.ssh_ipmi_console = CSSH(self.ip, username='', password='', port=self.port_ipmi_console)
        self.ssh = CSSH(self.ip, username=self.username, password=self.password, port=22)
        self.b_sol = False
开发者ID:InfraSIM,项目名称:test,代码行数:51,代码来源:Node.py

示例10: __init__

# 需要导入模块: from lib.Device import CDevice [as 别名]
# 或者: from lib.Device.CDevice import __init__ [as 别名]
    def __init__(self, dict_node):

        CDevice.__init__(self, 'vNode')

        self.dict_config = dict_node

        # vBMC
        obj_bmc = CBMC(self.dict_config.get('bmc', {}))
        self.bmc = obj_bmc

        # Power, a tuple of PDU information:
        # (obj_pdu, str_outlet)
        self.power = []

        self.name = self.dict_config.get('name', '')
        self.datastore = self.dict_config.get('datastore', '')
        self.hypervisor = self.dict_config.get('hypervisor', '')
开发者ID:PaynePei,项目名称:test,代码行数:19,代码来源:Node.py

示例11: __init__

# 需要导入模块: from lib.Device import CDevice [as 别名]
# 或者: from lib.Device.CDevice import __init__ [as 别名]
    def __init__(self, obj_device, str_id):
        """
        @param obj_device: Parent device that init this one
        @type obj_device: CDevice
        @param str_id: id of this poller
        @type str_id: string
        """

        # Initialize resource name, parents and URI
        self.resource_name = str_id
        CDevice.__init__(self, self.resource_name)
        self.obj_parent = obj_device
        self.set_logger(self.obj_parent.obj_logger)
        self.set_rest_agent(self.obj_parent.obj_rest_agent)
        self.str_device_type = self.obj_parent.str_device_type
        self.uri = '{}/{}'.format(self.obj_parent.uri, self.resource_name)

        self.mon_data = {}
开发者ID:InfraSIM,项目名称:test,代码行数:20,代码来源:Poller.py

示例12: __init__

# 需要导入模块: from lib.Device import CDevice [as 别名]
# 或者: from lib.Device.CDevice import __init__ [as 别名]
 def __init__(self, ffid, obj_xmlnode_slic, obj_device_parent):
     CDevice.__init__(self, ffid, obj_xmlnode_slic, obj_device_parent)
     self.str_family_id=''
     self.str_fru_id=''
     self.str_ffid=''
     self.obj_xmlnode_slic = obj_xmlnode_slic
     self.load_ffid()
     self.obj_device_parent = obj_device_parent
     self.str_device_type = 'slic'
     self.int_slot = -1
     self.str_name = ''
     self.b_smi_supported = ''
     self.str_pci_bus_number = ''
     self.b_valid = True
     self.fw_id = None
     self.spirom_id = None
     self.cmd_fw_id = None
     self.protocol = None
     self.fw_name_resume = None
开发者ID:zhang-martin,项目名称:atom2,代码行数:21,代码来源:SLIC.py

示例13: __init__

# 需要导入模块: from lib.Device import CDevice [as 别名]
# 或者: from lib.Device.CDevice import __init__ [as 别名]
 def __init__(self, str_sensor_number, obj_xmlnode_runtime = None, obj_device_parent = None):
     CDevice.__init__(self, str_sensor_number.lower(), obj_xmlnode_runtime, obj_device_parent)
     self.str_sensor_number = str_sensor_number.lower()
     self.str_lun = ''
     self.str_description = ''
     self.str_sensor_type = ''
     self.str_event_type = ''
     self.str_assert_mask = ''
     self.str_deassert_mask = ''
     self.str_reading_mask = ''
     self.str_unr_thresh = ''
     self.str_uc_thresh = ''
     self.str_unc_thresh = ''
     self.str_lnr_thresh = ''
     self.str_lc_thresh = ''
     self.str_lnc_thresh = ''
     self.str_type = ''
     
     self.str_device_type = 'sensor'
开发者ID:zhang-martin,项目名称:atom2,代码行数:21,代码来源:Sensor.py

示例14: __init__

# 需要导入模块: from lib.Device import CDevice [as 别名]
# 或者: from lib.Device.CDevice import __init__ [as 别名]
    def __init__(self, obj_device):
        """
        @param obj_device: Parent device that init this one
        @type obj_device: CDevice
        """

        # Initialize resource name, parents and URI
        self.resource_name = "workflows"
        CDevice.__init__(self, self.resource_name)
        self.obj_parent = obj_device
        self.set_logger(self.obj_parent.obj_logger)
        self.set_rest_agent(self.obj_parent.obj_rest_agent)
        self.str_device_type = self.obj_parent.str_device_type
        self.uri = '{}/{}'.format(self.obj_parent.uri, self.resource_name)

        # Pre-defined downstream resource
        self.dict_workflows = {}
        self.list_workflow_id = []

        self.mon_data = {}
开发者ID:PaynePei,项目名称:test,代码行数:22,代码来源:WorkflowCollection.py

示例15: __init__

# 需要导入模块: from lib.Device import CDevice [as 别名]
# 或者: from lib.Device.CDevice import __init__ [as 别名]
    def __init__(self, dict_pdu):

        CDevice.__init__(self, 'vPDU')

        self.dict_config = dict_pdu

        self.ip = self.dict_config.get('ip', '')
        self.name = self.dict_config.get('name', '')
        self.community = self.dict_config.get('community', '')

        # Build outlet mapping
        self.outlet = {}
        for str_outlet, str_password in self.dict_config.get('outlet', {}).items():
            self.outlet[str_outlet] = {
                'node': None,
                'password': str_password
            }

        self.snmp = CSNMP(self.ip, self.community)
        self.ssh_vpdu = CSSH(ip=self.ip, username='', password='', port=20022)
开发者ID:InfraSIM,项目名称:test,代码行数:22,代码来源:PDU.py


注:本文中的lib.Device.CDevice.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。