Sample CMDB Syncmapping extension pattern for BAI_Application

Version 5
    Share This:

    See:  Getting Started creating a CMDB Syncmapping Extension pattern

     

    Compatibility:

         Compatible with Discovery 11.3.

         How to change for other versions:

             To be compatible with other versions, the "import" statement version (2.4 - underlined in the custom pattern) may need to be revised

     

    Base Pattern:

            module:  CMDB.BAI_Application

            file:  BAI_Application.tpl

     

        Base Pattern fragments, for reference

    Custom Pattern

     

    tpl 1.12 module CMDB.Extension.BAI_Application_augment;

     

    metadata

        origin := "Customer";

        tree_path := "Customer", "CMDB Sync", "BAI_Application";

    end metadata;

     

    // the versions shown on the below "import" statement(s)

    // can change with different versions of the TKU, and/or with different versions of Discovery

    // The version number(s) below should be compatible with Discovery 11.3

    from CMDB.BAI_Application import BAI_Application 2.4;

     

    syncmapping BAI_Application_augment 1.0

        """

        This pattern modifies some attributes of BMC_Application CI's.

     

        Discovery has some BusinessApplicationInstance (BAI) nodes (usually created by SAAM or CAM)

     

        Those BAI nodes are related to "Host" nodes, either through a SI, or a direct relationship.

     

        When you sync a Host node (with related BAI) to the CMDB, then this extension pattern gets triggered after the base BAI_Application pattern is triggered.

     

        The BAI_Application pattern creates a BMC.CORE:BMC_Application CI in the CMDB.

        This pattern can extend or revise the data on the BMC.CORE:BMC_Application CI.

     

        local variables explained:

            bai = BusinessApplicationInstance node in Discovery

           application_ci = BMC.CORE:BMC_Application CI in CMDB

        """

        overview

            tags CMDB, Extension;

        end overview;

     

        mapping from BAI_Application.bai as bai

        end mapping;

     

        body

     

            application_ci := BAI_Application.application or none;                   

     

            if not application_ci then

                log.debug("BAI_Application_augment 1: No application_ci. Exiting BAI_Application_augment.");

                stop;

            end if;

     

            log.debug("BAI_Application_augment 2: BAI name is %bai.name%");

     

            if not application_ci.ManufacturerName then

                application_ci.ManufacturerName := "BMC_UNKNOWN";

                log.debug("BAI_Application_augment 3: I have set application_ci.ManufacturerName to %application_ci.ManufacturerName%");

            end if;

        end body;

    end syncmapping;