Syncmappings to sync the HardwareDetail EOL data to BMC_ComputerSystem

Version 3
    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

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

     

    Attached are 2 syncmappings to move the HardwareDetail End-of-Life data from Discovery nodes to the BMC_ComputerSystem CI in the CMDB.

     

    HardwareDetail on the following Discovery nodes are handled by these 2 syncmappings:

          Host

          NetworkDevice

          SNMPManagedDevice

          Printer

          StorageSystem

          HardwareContainer

          HostContainer

     

     

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

                       Swim at your own risk.

     

    The syncmappings require 3 custom attributes be added to the BMC_ComputerSystem class as follows:

                 Name                                        Type

               EOLRetirementDate                           DateTime

               EOSDate                                     DateTime

               EOESDate                                    DateTime

      

    STEPS FOR TESTING:

    1) Add the required attributes to the BMC_ComputerSystem class in the CMDB

    2) Restart the Discovery services

    3) Upload the 2 attached patterns, or just upload the single .zip file

    4) Scan or Sync some Hosts, NetworkDevices, etc.

    5) Check the data in the CMDB to see if the new attributes are populated on the BMC_ComputerSystem

     

    TROUBLESHOOTING:

    Notice the log.debug statements in the syncmappings below such as:

       log.debug("HardwareEOL: deviceName=%device.name%  deviceKey=%device.key%  ciName=%computersystem.Name%  ciKey=%computersystem.key%");

     

    If having trouble with the pattern, put CMDB Sync logging into DEBUG mode (so that those debug statements get written to the logs), and then Sync some Hosts/Devices.

    Next, check the tw_svc_cmdbsync_transformer.log files on the cluster coordinator.

     

    To see those debug statements from the coordinator command-line, the following command is very useful:

                grep "HardwareEOL" /usr/tideway/*cmdbsync*.log

     

    Customers can also open a BMC Support case to request help with implementation / testing of the syncmapping.

    Include the transformer logs on the support case, and include the results of the grep.

     

     

    Syncmapping#1: Handles Host, NetworkDevice, SNMPManagedDevice, Printer, and StorageSystem nodes

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

    tpl 1.14 module CMDB.Extension.HardwareDetail_EOL_devices;

     

    metadata

        origin := "Customer";

        tree_path := "Custom", "CMDB Sync", "HardwareDetail_EOL_devices";

    end metadata;

     

    from CMDB.Host_ComputerSystem                import Host_ComputerSystem 2.3;

    from CMDB.NetworkDevice_ComputerSystem       import NetworkDevice_ComputerSystem 2.1;

    from CMDB.SNMPManagedDevice_ComputerSystem   import SNMPManagedDevice_ComputerSystem 2.1;

    from CMDB.Printer_Printer                    import Printer_Printer 2.0;

    from CMDB.StorageSystem_ComputerSystem       import StorageSystem_ComputerSystem 2.1;

     

    syncmapping HardwareDetail_EOL_devices 1.0

        """

        Update/Modify values for BMC_ComputerSystem class

        """

        overview

            tags CMDB, Extension;

        end overview;

     

        mapping from Host_ComputerSystem.host

                from NetworkDevice_ComputerSystem.device

                from SNMPManagedDevice_ComputerSystem.device

                from Printer_Printer.printer_node

                from StorageSystem_ComputerSystem.storagesystem

            as device

          traverse ElementWithDetail:SupportDetail:HardwareDetail:SupportDetail as hardware_detail

          end traverse;

        end mapping;

     

        body

            computersystem := Host_ComputerSystem.computersystem or

                              NetworkDevice_ComputerSystem.device_cs or

                              SNMPManagedDevice_ComputerSystem.device_cs or

                              Printer_Printer.printer_ci or

                              StorageSystem_ComputerSystem.computersystem;

     

            log.debug("HardwareEOL: deviceName=%device.name%  deviceKey=%device.key%  ciName=%computersystem.Name%  ciKey=%computersystem.key%");

     

            // NOTE:

            //   These attributes must be added to the BMC_ComputerSystem form in the CMDB, as a DateTime

            //      EOLRetirementDate

            //      EOSDate

            //      EOESDate

            //

            // After they are added, the Discovery services must be restarted so that Discovery will read the new CMDB definitions

     

            for each hardware_detail do

                if hardware_detail.retirement_date then

                    computersystem.EOLRetirementDate := hardware_detail.retirement_date;

                    log.debug("HardwareEOL: deviceName=%device.name% : set EOLRetirementDate=%computersystem.EOLRetirementDate% ciName=%computersystem.Name%  ciKey=%computersystem.key%");

                end if;

     

                if hardware_detail.end_support_date then

                    computersystem.EOSDate := hardware_detail.end_support_date;

                    log.debug("HardwareEOL: deviceName=%device.name% : set EOSDate=%computersystem.EOSDate% ciName=%computersystem.Name%  ciKey=%computersystem.key%");

                end if;

     

                if hardware_detail.end_ext_support_date then

                    computersystem.EOESDate := hardware_detail.end_ext_support_date;

                    log.debug("HardwareEOL: deviceName=%device.name% : set EOESDate=%computersystem.EOESDate% ciName=%computersystem.Name%  ciKey=%computersystem.key%");

                end if;

            end for;

        end body;

    end syncmapping;

    ===================================== END ================================================

     

     

    Syncmapping#2: Handles HostContainer and HardwareContainer nodes

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

    tpl 1.14 module CMDB.Extension.HardwareDetail_EOL_containers;

     

    metadata

        origin := "Customer";

        tree_path := "Custom", "CMDB Sync", "HardwareDetail_EOL_containers";

    end metadata;

     

    from CMDB.HardwareContainer_ComputerSystem   import HardwareContainer_ComputerSystem 1.2;

    from CMDB.HostContainer_ComputerSystem       import HostContainer_ComputerSystem 2.3;

     

    syncmapping HardwareDetail_EOL_containers 1.0

        """

        Update/Modify values for BMC_ComputerSystem class

        """

        overview

            tags CMDB, Extension;

        end overview;

     

        mapping from HardwareContainer_ComputerSystem.hardware_container

                from HostContainer_ComputerSystem.host_container

            as device

          traverse ElementWithDetail:SupportDetail:HardwareDetail:SupportDetail as hardware_detail

          end traverse;

        end mapping;

     

     

        body

            computersystem := HardwareContainer_ComputerSystem.container_cs or

                              HostContainer_ComputerSystem.container_cs;

     

            log.debug("HardwareEOL_containers:  deviceName=%device.name%  deviceKey=%device.key%  ciName=%computersystem.Name%  ciKey=%computersystem.key%");

     

            // NOTE:

            //   These attributes must be added to the BMC_ComputerSystem form in the CMDB, as a DateTime

            //      EOLRetirementDate

            //      EOSDate

            //      EOESDate

            //

            // After they are added, the Discovery services must be restarted so that Discovery will read the new CMDB definitions

     

            for each hardware_detail do

                if hardware_detail.retirement_date then

                    computersystem.EOLRetirementDate := hardware_detail.retirement_date;

                    log.debug("HardwareEOL_containers: deviceName=%device.name% : set EOLRetirementDate=%computersystem.EOLRetirementDate% ciName=%computersystem.Name%  ciKey=%computersystem.key%");

                end if;

     

                if hardware_detail.end_support_date then

                    computersystem.EOSDate := hardware_detail.end_support_date;

                    log.debug("HardwareEOL_containers: deviceName=%device.name% : set EOSDate=%computersystem.EOSDate% ciName=%computersystem.Name%  ciKey=%computersystem.key%");

                end if;

     

                if hardware_detail.end_ext_support_date then

                    computersystem.EOESDate := hardware_detail.end_ext_support_date;

                    log.debug("HardwareEOL_containers: deviceName=%device.name% : set EOESDate=%computersystem.EOESDate% ciName=%computersystem.Name%  ciKey=%computersystem.key%");

                end if;

            end for;

        end body;

    end syncmapping;

    ===================================== END ================================================