Exemplo n.º 1
0
    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
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
    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
Exemplo n.º 4
0
    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 = {}
Exemplo n.º 5
0
    def __init__(self, dict_rack):

        CDevice.__init__(self, 'vRack')

        self.dict_config = dict_rack

        self.name = self.dict_config.get('name', '')
        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
Exemplo n.º 6
0
    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
Exemplo n.º 7
0
    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 = {}
Exemplo n.º 8
0
    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": "******",
                "password": "******"
            },
            "bmc": {
                "ip": "172.31.128.2",
                "username": "******",
                "password": "******"
            }
        }
        """

        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
Exemplo n.º 9
0
    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)
Exemplo n.º 10
0
 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'] = []
Exemplo n.º 11
0
    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
Exemplo n.º 12
0
    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
Exemplo n.º 13
0
    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": "******",
                "password": "******"
            },
            "bmc": {
                "ip": "172.31.128.2",
                "username": "******",
                "password": "******"
            }
        }
        """

        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
Exemplo n.º 14
0
    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', '')
Exemplo n.º 15
0
    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 = "lookups"

        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.log('INFO', 'URI {}'.format(self.uri))
        self.mon_data = {}
        self.look_up = {}
Exemplo n.º 16
0
    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 = {}
Exemplo n.º 17
0
    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)
Exemplo n.º 18
0
    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 = {}
Exemplo n.º 19
0
 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'
Exemplo n.º 20
0
 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
Exemplo n.º 21
0
    def __init__(self, obj_device, str_attr):
        """
        @param obj_device: Parent device that init this one
        @type obj_device: CDevice
        @param str_attr: attribute of this catalog, could be:
            - id for catalog in catalogs
            - source for catalog in nodes
        @type str_attr: string
        """

        # Initialize resource name, parents and URI
        self.resource_name = str_attr
        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 = {}
Exemplo n.º 22
0
Arquivo: PDU.py Projeto: InfraSIM/test
    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)
Exemplo n.º 23
0
    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 = {}
Exemplo n.º 24
0
    def __init__(self, obj_device, str_attr):
        """
        @param obj_device: Parent device that init this one
        @type obj_device: CDevice
        @param str_attr: attribute of this catalog, could be:
            - id for catalog in catalogs
            - source for catalog in nodes
        @type str_attr: string
        """

        # Initialize resource name, parents and URI
        self.resource_name = str_attr
        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 = {}
Exemplo n.º 25
0
    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 = 'pollers'
        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 next level object
        self.dict_pollers = {}
        self.list_poller_id = []
        
        self.mon_data = {}
Exemplo n.º 26
0
    def __init__(self, obj_device):
        """
        @param obj_device: Parent device that init this one
        @type obj_device: CDevice
        """

        # Initialize resource name, parents and URI
        # If this is obm for nodes, its resource name should be:
        #     obm
        # If this is obm managed by monorail, its resource name should be:
        #     obms/library
        self.obj_parent = obj_device
        self.resource_name = 'obms'

        CDevice.__init__(self, self.resource_name)
        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.dict_obm = {}
        self.list_obm_service = []
        self.mon_data = {}
Exemplo n.º 27
0
    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 = {}
        self.list_sku_id = []
        # dict_names is a mapping from id to SKU name
        self.dict_names = {}
        # dict_skus is a mapping from id to SKU instance
        self.dict_skus = {}
Exemplo n.º 28
0
    def __init__(self, dict_hwimo):
        '''
        Init Monorail instance
        :param dict_hwimo: a dict includes HWIMO information, e.g.
        {
            "ip": "192.168.128.1"
            "platform": "RackHD",
            "monorail_rest_rev": "1.1",
            "monorail_rest_protocol": "http",
            "monorail_rest_port": 8080,
            "username": "",
            "password": ""
        }
        '''

        CDevice.__init__(self, 'Monorail', None, None)

        try:
            self.str_device_type = 'monorail'
            self.str_sub_type = 'Root'
            # Monorail IP
            self.ip = dict_hwimo['ip']
            self.username = dict_hwimo['username']
            self.password = dict_hwimo['password']
            self.rest_username = dict_hwimo['rest_username']
            self.rest_password = dict_hwimo['rest_password']

            # Monorail REST info
            self.str_mon_rev = dict_hwimo['rest_rev']
            self.str_mon_protocol = dict_hwimo['rest_protocol']
            self.str_mon_port = dict_hwimo['rest_port']
            self.uri = '{0}://{1}:{2}/api/{3}'.format(self.str_mon_protocol,
                                                      self.ip,
                                                      self.str_mon_port,
                                                      self.str_mon_rev)
        except Exception:
            self.log('ERROR', 'Fail to build {}\n{}'\
                     .format(self.str_sub_type, traceback.format_exc()))

        self.obj_rest_agent = APIClient()
        self.set_rest_agent(self.obj_rest_agent)
        self.set_rackhd_rest_auth()
        self.obj_ssh_agent = CSSH(self.ip, self.username, self.password)

        self.b_valid = True

        # Pre-defined next level object
        self.catalogs = None
        self.config = None
        self.files = None
        self.obj_lookups = None
        self.nodes = None
        self.obms = None
        self.pollers = None
        self.profiles = None
        self.schemas = None
        self.skus = None
        self.tasks = None
        self.templates = None
        self.versions = None
        self.workflowtasks = None
        self.workflows = None
        self.workflow_library = None
        self.mon_data = {}
Exemplo n.º 29
0
    def __init__(self, dict_switch):
        CDevice.__init__(self, 'vSwitch')

        self.dict_config = dict_switch
Exemplo n.º 30
0
    def __init__(self, dict_hwimo):
        '''
        Init Monorail instance
        :param dict_hwimo: a dict includes HWIMO information, e.g.
        {
            "ip": "192.168.128.1"
            "platform": "RackHD",
            "monorail_rest_rev": "1.1",
            "monorail_rest_protocol": "http",
            "monorail_rest_port": 8080,
            "username": "",
            "password": ""
        }
        '''

        CDevice.__init__(self, 'Monorail', None, None)

        try:
            self.str_device_type = 'monorail'
            self.str_sub_type = 'Root'
            # Monorail IP
            self.ip = dict_hwimo['ip']
            self.username = dict_hwimo['username']
            self.password = dict_hwimo['password']

            # Monorail REST info
            self.str_mon_rev = dict_hwimo['rest_rev']
            self.str_mon_protocol = dict_hwimo['rest_protocol']
            self.str_mon_port =dict_hwimo['rest_port']
            self.uri = '{0}://{1}:{2}/api/{3}'.format(self.str_mon_protocol,
                                                      self.ip,
                                                      self.str_mon_port,
                                                      self.str_mon_rev)
        except Exception:
            self.log('ERROR', 'Fail to build {}\n{}'\
                     .format(self.str_sub_type, traceback.format_exc()))

        self.obj_rest_agent = APIClient()
        self.set_rest_agent(self.obj_rest_agent)
        self.obj_ssh_agent = CSSH(self.ip, self.username, self.password)

        self.b_valid = True

        # Pre-defined next level object
        self.catalogs = None
        self.config = None
        self.files = None
        self.obj_lookups = None
        self.nodes = None
        self.obms = None
        self.pollers = None
        self.profiles = None
        self.schemas = None
        self.skus = None
        self.tasks = None
        self.templates = None
        self.versions = None
        self.workflowtasks = None
        self.workflows = None
        self.workflow_library = None
        self.mon_data = {}
Exemplo n.º 31
0
 def __init__(self, str_platform, obj_xmlnode_acpi, obj_device_parent):
     CDevice.__init__(self, str_platform, obj_xmlnode_acpi, obj_device_parent)
     self.obj_xmlnode_acpi = obj_xmlnode_acpi
     self.str_device_type = 'acpi'
Exemplo n.º 32
0
 def __init__(self, str_memory_type = 'memory', obj_xmlnode_runtime = None, obj_device_parent = None):
     CDevice.__init__(self, str_memory_type, obj_xmlnode_runtime, obj_device_parent)
     self.str_device_type = 'memory'
Exemplo n.º 33
0
 def __init__(self, str_sub_type = 'cmos', obj_xmlnode_runtime = None, obj_device_parent = None):
     CDevice.__init__(self, str_sub_type, obj_xmlnode_runtime, obj_device_parent)
     self.str_device_type = 'cmos'
Exemplo n.º 34
0
    def __init__(self, dict_chassis):
        """
        dict_chassis example:
        {
            "name": "chassis",
            "ip": "192.168.132.144",
            "username": "******",
            "password": "******",
            "chassis_node_a": [{
                "admin": {
                    "ip": "10.62.83.141",
                    "username": "******",
                    "password": "******",
                    "port": "18022"
                },
                "guest_os": {
                    "ip": "10.62.83.132",
                    "username": "******",
                    "password": "******",
                    "port": "22"
                },
                "bmc": {
                    "ip": "10.62.83.141",
                    "username": "******",
                    "password": "******"
                }
            }],
            "chassis_node_b": [{
                "admin": {
                    "ip": "10.62.83.145",
                    "username": "******",
                    "password": "******",
                    "port": "28022"
                },
                "guest_os": {
                    "ip": "10.62.83.136",
                    "username": "******",
                    "password": "******",
                    "port": "22"
                },
                "bmc": {
                    "ip": "10.62.83.145",
                    "username": "******",
                    "password": "******"
                }
            }]
        }
        """

        CDevice.__init__(self, 'vChassis')

        self.dict_config = dict_chassis

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

        self.name = self.dict_config.get('name', '')
        self.node_a_name = '{}_a'.format(self.name)
        self.node_b_name = '{}_b'.format(self.name)

        self.ip = self.dict_config.get('ip', '')
        self.dict_node_a = self.dict_config.get(self.node_a_name)
        self.dict_node_b = self.dict_config.get(self.node_b_name)

        self.username = self.dict_config.get('username', '')
        self.password = self.dict_config.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)
Exemplo n.º 35
0
 def __init__(self, str_platform, obj_xmlnode_bmc, obj_device_parent):
     CDevice.__init__(self, str_platform, obj_xmlnode_bmc, obj_device_parent)
     self.obj_xmlnode_bmc = obj_xmlnode_bmc
     self.str_device_type = 'bmc'
     self.str_platform = str_platform
Exemplo n.º 36
0
    def __init__(self, dict_chassis):
        """
        dict_chassis example:
        {
            "name": "chassis",
            "ip": "192.168.132.144",
            "username": "******",
            "password": "******",
            "chassis_node_a": [{
                "admin": {
                    "ip": "10.62.83.141",
                    "username": "******",
                    "password": "******",
                    "port": "18022"
                },
                "guest_os": {
                    "ip": "10.62.83.132",
                    "username": "******",
                    "password": "******",
                    "port": "22"
                },
                "bmc": {
                    "ip": "10.62.83.141",
                    "username": "******",
                    "password": "******"
                }
            }],
            "chassis_node_b": [{
                "admin": {
                    "ip": "10.62.83.145",
                    "username": "******",
                    "password": "******",
                    "port": "28022"
                },
                "guest_os": {
                    "ip": "10.62.83.136",
                    "username": "******",
                    "password": "******",
                    "port": "22"
                },
                "bmc": {
                    "ip": "10.62.83.145",
                    "username": "******",
                    "password": "******"
                }
            }]
        }
        """

        CDevice.__init__(self, 'vChassis')

        self.dict_config = dict_chassis

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

        self.name = self.dict_config.get('name', '')
        self.node_a_name = '{}_a'.format(self.name)
        self.node_b_name = '{}_b'.format(self.name)

        self.ip = self.dict_config.get('ip', '')
        self.dict_node_a = self.dict_config.get(self.node_a_name)
        self.dict_node_b = self.dict_config.get(self.node_b_name)

        self.username = self.dict_config.get('username', '')
        self.password = self.dict_config.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)
Exemplo n.º 37
0
 def __init__(self, str_type = 'cmd', obj_xmlnode_cmd = None, obj_device_parent = None):
     CDevice.__init__(self, str_type, obj_xmlnode_cmd, obj_device_parent)
Exemplo n.º 38
0
 def __init__(self, str_type, obj_xmlnode_psu, obj_device_parent):
     CDevice.__init__(self, str_type, obj_xmlnode_psu, obj_device_parent)
     self.obj_xmlnode_psu = obj_xmlnode_psu
     self.str_type = str_type
     self.str_device_type = 'plx'
Exemplo n.º 39
0
    def __init__(self, dict_switch):
        CDevice.__init__(self, 'vSwitch')

        self.dict_config = dict_switch
Exemplo n.º 40
0
 def __init__(self, str_name = 'nvram', \
              obj_xmlnode_runtime = None, \
              obj_device_parent = None):
     CDevice.__init__(self, str_name, obj_xmlnode_runtime, obj_device_parent)
     self.str_device_type = 'nvram'
Exemplo n.º 41
0
 def __init__(self, str_platform, obj_xmlnode_runtime, obj_device_parent):
     CDevice.__init__(self, str_platform, obj_xmlnode_runtime, obj_device_parent)
     self.str_device_type = 'midplane'
     self.str_platform = str_platform
     self.int_temp_sensor_count = 0
Exemplo n.º 42
0
 def __init__(self, str_sel_type, obj_xmlnode_runtime, obj_device_parent):
     CDevice.__init__(self, str_sel_type, obj_xmlnode_runtime, obj_device_parent)
     self.int_matched_num = 0
     self.lst_matched_data = []
     self.obj_sellogger = None