Syncmapping to populate BMC_ComputerSystem from StorageDevice

Version 2
    Share This:

    ============================================================================================================================

    How to get Started creating CMDB Syncmapping Extension patterns:  Getting Started creating a CMDB Syncmapping Extension pattern

    Info about custom patterns and syncmappings, how to test, etc:  Helix Support: Discovery custom patterns discussion

    Sample syncmapping 'stubs' / starting points :  Helix Support: Discovery: Sharing my library of syncmapping extension stubs

    Sample patterns and syncmappings posted by Lisa:  https://goo.gl/8KUS3S

    ============================================================================================================================

    DISCLAIMER: Samples provided on the communities are only examples to be tested by the customer on a TEST system.  

    Adding additional data to the CMDB may adversely affect the AR Server and CMDB performance.      

    Swim at your own risk.

    ============================================================================================================================

     

     

    If you have the Storage TKU, Discovery creates StorageSystem nodes, and also populates data into the CMDB in BMC_ComputerSystem for the StorageSystem nodes.

    (With the Storage TKU, you do not need this syncmapping!)

     

    If you do not have the Storage TKU, then the StorageDevice information is not populated into the CMDB by default.

     

    Here is a custom syncmapping to move the StorageDevice data to the CMDB.

     

    Please only use this syncmapping if you do not have the Storage TKU.

     

    To use the syncmapping:

    1) Upload it from Manage-Knowledge page.

    2) To sync a StorageDevice to the CMDB, you must re-scan the StorageDevice.

    NOTE:  There is no Actions>CMDB Sync button available for StorageDevice... so, you must re-scan the StorageDevice to sync it to the CMDB.

     

     

    Here is the new BMC_ComputerSystem for the StorageDevice:

     

    Here is the syncmapping, attached also:

    ======================================================

    tpl 1.12 module CMDB.StorageDevice_ComputerSystem;

     

    metadata

        origin := "TKU";

        tree_path := "Custom", "CMDB Sync", "Storage Device", "StorageDevice -> ComputerSystem";

    end metadata;

     

    from CMDB.Host_ComputerSystem import CDM_Capability_Type 1.1;

    from CMDB.Host_ComputerSystem import PrimaryCapability_CTI_Mapping 1.1;

    from CMDB.Host_ComputerSystem import CDM_Capability_Type_Values 1.1;

     

    syncmapping StorageDevice_ComputerSystem 2.2

        """

        StorageDevice mapped to BMC_ComputerSystem.

        """

        overview

            tags Custom;

        end overview;

     

        mapping on StorageDevice as storagedevice

            computersystem -> BMC_ComputerSystem;

        end mapping;

     

        body

            log.info("Map storage device %storagedevice.name%");

     

            primary_capability := CDM_Capability_Type.Storage;

            capability_list    := CDM_Capability_Type_Values[number.toText(primary_capability)];

     

            // Category, Type and Item

            // We are not using PrimaryCapability_CTI_Mapping for Tape Libraries

            // as setting Category to "Disk device" and Item to "Disk array"

            // doesn't make any sense for Tape Libraries.

            if storagedevice.type has substring "Tape Library" then

                cdm_category := "Hardware";

                cdm_type     := "Storage";

                cdm_item     := "Tape Library";

            else

                cti_values   := PrimaryCapability_CTI_Mapping[number.toText(primary_capability)];

                cdm_category := cti_values[0];

                cdm_type     := cti_values[1];

                cdm_item     := cti_values[2];

            end if;

     

            computersystem := sync.BMC_ComputerSystem(

                key               := storagedevice.key,

                Name              := storagedevice.name,

                ShortDescription  := storagedevice.name,

                Description       := storagedevice.name,

                CapabilityList    := capability_list,

                ManufacturerName  := storagedevice.vendor,

                Model             := "%storagedevice.type%:%storagedevice.model%",

                isVirtual         := storagedevice.virtual,

                PrimaryCapability := primary_capability,

                SerialNumber      := storagedevice.serial,

                ComponentAliases  := storagedevice.cdm_component_aliases,

                Category          := cdm_category,

                Type              := cdm_type,

                Item              := cdm_item

            );

        end body;

    end syncmapping;

     

    =======================================================