Beispiel #1
0
def create_eth_if_in_service_profile(ucsm_ssh, param, eth_cnt):
    test_bed = str(param['test_bed_id'])
    chassis = str(param['chassis_id'])
    cartridge = str(param['cartridge_id'])
    server = str(param['server_id'])
    
    param['tag_service_profile_name'] = get_service_profile_name(chassis, cartridge, server)
    
    current_eth_cnt = 0
    data_vlan_start = int(test_bed) * 100 + 20 + 3
    data_vlan_end   = data_vlan_start + eth_cnt
    eth_vlan_list = range(data_vlan_start, data_vlan_end)
    eth_vlan_list.insert(0, VLAN_ISCSI)
    eth_vlan_list.insert(0, VLAN_MEDUSA)
    eth_vlan_list.insert(0, VLAN_PXE)
    for eth_vlan in eth_vlan_list: 
        eth_id = str(current_eth_cnt).zfill(2) 
        param['tag_mac_address'] = get_mac_address(test_bed, chassis, cartridge, server, eth_id)
        param["tag_eth_name"] = ''.join([param["eth_pxe_name_prefix"], str(eth_vlan)])
        param["tag_eth_vlan"] = 'vlan' + str(eth_vlan)
        param['tag_eth_order'] = str(int(current_eth_cnt) + 1)
        if current_eth_cnt % 2 == 0:
            param["tag_eth_fabric"] = 'a'
        else:
            param["tag_eth_fabric"] = 'b'
        #pprint.pprint(param)
        file_text_step = Define.PATH_SNIC_TEXT_UCSM + "service_profile_eth_vlan.txt"   
        Util.run_text_step(ucsm_ssh, file_text_step, param)
        current_eth_cnt += 1
        if current_eth_cnt >= eth_cnt: 
            break
Beispiel #2
0
def create_iscsi_in_service_profile(ucsm_ssh, param):
    test_bed = str(param['test_bed_id'])
    chassis = str(param['chassis_id'])
    cartridge = str(param['cartridge_id'])
    server = str(param['server_id'])
    param['tag_service_profile_name'] = get_service_profile_name(chassis, cartridge, server)
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "service_profile_iscsi.txt"   
    Util.run_text_step(ucsm_ssh, file_text_step, param)
Beispiel #3
0
def execute_cmd(ucsm_ssh, param):
    chassis = str(param['chassis_id'])
    cartridge = str(param['cartridge_id'])
    server = str(param['server_id'])
    
    param['tag_service_profile_name'] = get_service_profile_name(chassis, cartridge, server)
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "service_profile_deletion.txt"   
    Util.run_text_step(ucsm_ssh, file_text_step, param)
Beispiel #4
0
def reuse_local_lun(ucsm_ssh, param):
    chassis = str(param['chassis_id'])
    cartridge = str(param['cartridge_id'])
    server = str(param['server_id'])
    
    param['tag_service_profile_name'] = get_service_profile_name(chassis, cartridge, server)
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "local_lun_reuse.txt"   
    Util.run_text_step(ucsm_ssh, file_text_step, param)
Beispiel #5
0
def power_cycle_service_profile(ucsm_ssh, param, wait=False):
    chassis = str(param['chassis_id'])
    cartridge = str(param['cartridge_id'])
    server = str(param['server_id'])
    
    param['tag_service_profile_name'] = get_service_profile_name(chassis, cartridge, server)
    param['tag_power_cycle_timing'] = 'immediate'
    if wait:
        param['tag_power_cycle_timing'] = 'wait'
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "service_profile_power_cycle.txt"   
    Util.run_text_step(ucsm_ssh, file_text_step, param)
Beispiel #6
0
def create_ipmi_in_service_profile(ucsm_ssh, param):
    chassis = str(param['chassis_id'])
    cartridge = str(param['cartridge_id'])
    server = str(param['server_id'])
    
    server_full_list = [chassis, cartridge, server]
    param['tag_service_profile_name'] = get_service_profile_name(chassis, cartridge, server)
    param['tag_server_full_id'] = '/'.join(server_full_list)
    
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "service_profile_ipmi.txt"   
    Util.run_text_step(ucsm_ssh, file_text_step, param)
Beispiel #7
0
def set_vnic_no_vlan_in_service_profile(ucsm_ssh, param, vlan_number_list):
    test_bed = str(param['test_bed_id'])
    chassis = str(param['chassis_id'])
    cartridge = str(param['cartridge_id'])
    server = str(param['server_id'])
    param['tag_service_profile_name'] = get_service_profile_name(chassis, cartridge, server)
    
    for vlan_number in vlan_number_list:
        param['tag_eth_name'] = 'eth' + str(vlan_number)
        param['tag_vlan_name'] = 'vlan' + str(vlan_number)
        file_text_step = Define.PATH_SNIC_TEXT_UCSM + "service_profile_vnic_no_vlan.txt"   
        Util.run_text_step(ucsm_ssh, file_text_step, param)
Beispiel #8
0
def set_vnic_adapter_policy_in_service_profile(ucsm_ssh, param, adapter_policy_dict):
    test_bed = str(param['test_bed_id'])
    chassis = str(param['chassis_id'])
    cartridge = str(param['cartridge_id'])
    server = str(param['server_id'])
    param['tag_service_profile_name'] = get_service_profile_name(chassis, cartridge, server)
    
    for eth_name, adapter_policy in adapter_policy_dict.iteritems():
        param['tag_eth_name'] = eth_name
        param['tag_adapter_policy'] = adapter_policy
        file_text_step = Define.PATH_SNIC_TEXT_UCSM + "service_profile_vnic_adapter_policy.txt"   
        Util.run_text_step(ucsm_ssh, file_text_step, param)
Beispiel #9
0
def set_server_ext_mgmt_ip(ucsm_ssh, param):
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "server_ext_mgmt_ip.txt"   
    ip_list = get_ip_list(param['tag_kvm_ip_start'], 16)
    for chassis_id, chassis in config.iteritems():
        if chassis_id != 1: continue
        for cartridge_id, cartridge in chassis.iteritems():
            for server_id, server in cartridge.iteritems():
                param['tag_server_id']   = '/'.join([str(chassis_id), str(cartridge_id), str(server_id)])
                param['tag_addr']        = ip_list.pop()
                param['tag_default_gw']  = param['tag_kvm_ip_gateway']
                param['tag_subnet']      = param['tag_kvm_ip_netmask']
                Util.run_text_step(ucsm_ssh, file_text_step, param)
Beispiel #10
0
def create_boot_policy(ucsm_ssh, param):
    
    param['tag_boot_policy'] = 'disk-pxe-legacy'
    param['tag_boot_mode'] = 'legacy'
    
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "boot_policy_order_disk_pxe.txt"   
    Util.run_text_step(ucsm_ssh, file_text_step, param)
    
    param['tag_boot_policy'] = 'disk-pxe-uefi'
    param['tag_boot_mode'] = 'uefi'
    
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "boot_policy_order_disk_pxe.txt"   
    Util.run_text_step(ucsm_ssh, file_text_step, param)
    
    param['tag_boot_policy'] = 'iscsi-pxe-legacy'
    param['tag_boot_mode'] = 'legacy'
    
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "boot_policy_order_iscsi_pxe.txt"   
    Util.run_text_step(ucsm_ssh, file_text_step, param)
    
    param['tag_boot_policy'] = 'iscsi-pxe-uefi'
    param['tag_boot_mode'] = 'uefi'
    
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "boot_policy_order_iscsi_pxe.txt"   
    Util.run_text_step(ucsm_ssh, file_text_step, param)
Beispiel #11
0
def create_lun_in_service_profile(ucsm_ssh, param, lun):
    test_bed = str(param['test_bed_id'])
    chassis = str(param['chassis_id'])
    cartridge = str(param['cartridge_id'])
    server = str(param['server_id'])
    param['tag_service_profile_name'] = get_service_profile_name(chassis, cartridge, server)
    
    for lun_order, lun_detail in lun.iteritems():
        param['tag_lun_order'] = str(lun_order)
        param['tag_disk_size'] = str(lun_detail['disk_size'])
        raid_level = lun_detail['raid_level']
        param['tag_disk_group_config_policy_name'] = raid_level_disk_group_config_policy_dict[raid_level]['policy_name']
        param['tag_local_lun'] = ''.join(['lun', chassis, cartridge, server]) + '_' + str(lun_order)    
        file_text_step = Define.PATH_SNIC_TEXT_UCSM + "service_profile_storage_lun.txt"   
        Util.run_text_step(ucsm_ssh, file_text_step, param)
Beispiel #12
0
def create_service_profile(ucsm_ssh, param):
    test_bed    = str(param['test_bed_id'])
    chassis     = str(param['chassis_id'])
    cartridge   = str(param['cartridge_id'])
    server      = str(param['server_id'])
    
    chassis_id = str(chassis).zfill(2)
    cartridge_id = str(cartridge).zfill(2)
    server_id = str(server).zfill(2)
    
    server_full_id_list = [chassis_id, cartridge_id, server_id]
    server_full_id = ''.join(server_full_id_list)
    
    param['tag_service_profile_name'] = get_service_profile_name(chassis, cartridge, server)
    param['tag_uuid'] = ''.join([param['uuid_prefix'], server_full_id])
    
    # pprint.pprint(param)
    
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "service_profile.txt"   
    Util.run_text_step(ucsm_ssh, file_text_step, param)
Beispiel #13
0
def create_eth_if_in_service_profile(ucsm_ssh, param, eth_cnt):
    test_bed = str(param['test_bed_id'])
    chassis = str(param['chassis_id'])
    cartridge = str(param['cartridge_id'])
    server = str(param['server_id'])
    
    param['tag_service_profile_name'] = get_service_profile_name(chassis, cartridge, server)
    
    for eth_index in range(1, eth_cnt+1): 
        eth_id = str(eth_index).zfill(2) 
        param['tag_mac_address'] = get_mac_address(test_bed, chassis, cartridge, server, eth_id)
        param["tag_eth_name"] = ''.join([param["eth_pxe_name_prefix"], eth_id])
        param["tag_eth_vlan"] = 'default'
        param['tag_eth_order'] = eth_id
        if eth_index % 2 == 1:
            param["tag_eth_fabric"] = 'a'
        else:
            param["tag_eth_fabric"] = 'b'
        #pprint.pprint(param)
        file_text_step = Define.PATH_SNIC_TEXT_UCSM + "service_profile_eth_vlan.txt"   
        Util.run_text_step(ucsm_ssh, file_text_step, param)
Beispiel #14
0
    server      = str(param['server_id'])
    
    chassis_id      = str(chassis).zfill(2)
    cartridge_id    = str(cartridge).zfill(2)
    server_id       = str(server).zfill(2)
    eth_id          = str(param['eth_pxe_name_index']).zfill(2)
    
    server_full_id_list = [chassis_id, cartridge_id, server_id]
    server_full_id  = ''.join(server_full_id_list)
    
    eth_full_id_list = [chassis_id, cartridge_id, server_id, eth_id]
    eth_full_id = ''.join(eth_full_id_list)
    
    param['tag_service_profile_name'] = '-'.join(['sp', chassis, cartridge, server])
    param['tag_local_lun'] = ''.join(['lun', server_full_id])
    param['tag_volumn_name'] = ''.join(['volumn', server_full_id])
    param['tag_mac_address'] = ':'.join([param['mac_prefix'], ':'.join(eth_full_id_list)])
    param["tag_eth_name"] = ''.join([param["eth_pxe_name_prefix"], str(param["eth_pxe_name_index"])])
    param['tag_uuid'] = ''.join([param['uuid_prefix'], server_full_id])
    
    pprint.pprint(param)
    
    ucsm = UCSM(Define.UCSM_HOSTNAME);
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "service_profile.txt"   
    Util.run_text_step(ucsm.get_ssh(), file_text_step, param)
    ucsm.exit()
    

    
    
        
Beispiel #15
0
def run_in_service_profile(ucsm_ssh, param):
    param['tag_service_profile_name'] = get_service_profile_name_from_param(param)
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "local_lun_reuse.txt"   
    Util.run_text_step(ucsm_ssh, file_text_step, param)
Beispiel #16
0
def create_mac_pool(ucsm_ssh, param):
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "mac_pool.txt"   
    Util.run_text_step(ucsm_ssh, file_text_step, param)
Beispiel #17
0
def run(ucsm_ssh, param):
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + param['cmd_text_file_name']   
    Util.run_text_step(ucsm_ssh, file_text_step, param)
Beispiel #18
0
def change_boot_policy_order(ucsm_ssh, param, order_storage_local_any=1, order_lan=2):
    param['tag_boot_storage_local_any_order'] = str(order_storage_local_any)
    param['tag_boot_lan_order'] = str(order_lan)

    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "boot_policy_order_change.txt"   
    Util.run_text_step(ucsm_ssh, file_text_step, param)
Beispiel #19
0
def create_disk_group_config_policy(ucsm_ssh, param):
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "disk_group_config_policy.txt"   
    Util.run_text_step(ucsm_ssh, file_text_step, param)
Beispiel #20
0
'''
Created on Aug 26, 2014

@author: huhe
'''

from main.define import Define
from lib.util import Util
from lib.ucsm import UCSM


if __name__ == '__main__':
    
    ucsm = UCSM(Define.UCSM_HOSTNAME);
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "sp_snic_3_1.txt"   
    Util.run_text_step(ucsm.get_ssh(), file_text_step)
    ucsm.exit()
    

    
    
        
Beispiel #21
0
def create_kvm_console_ip_pool(ucsm_ssh, param):
    file_text_step = Define.PATH_SNIC_TEXT_UCSM + "kvm_console_ip_pool.txt"   
    Util.run_text_step(ucsm_ssh, file_text_step, param)