3 Replies Latest reply on Feb 22, 2019 6:38 PM by Ryan Nicosia

    Syncmapping for EOL (retirement_date)

    Ryan Nicosia
      Share:|

      I've got a requirement to map EOL and EOS data into the CMDB from discovery but I am struggling with the appropriate syntax in my syncmapping.  To be honest, it is not my strong suit so if anybody has had success and can share their pattern, that would be great.

       

      This is about as far as I've gotten and I'm not even sure it is close to being correct.    

       

      tpl 1.12 module AO.Extension.CMDB.NonStandard.Package_Product;

       

      metadata

      publisher := "Ryan Nicosia";

      tkn_name := "AO EOL Date extension";

      tree_path := 'Custom Modules';

      end metadata;

       

      from CMDB.SoftwareInstance_SoftwareServer import SoftwareInstance_SoftwareServer 4.0;

      from CMDB.SoftwareInstance_ApplicationSystem import SoftwareInstance_ApplicationSystem 1.0;

      from CMDB.SoftwareCluster_Cluster import SoftwareCluster_Cluster 1.0;

       

      syncmapping SoftwareInstance_Extension 1.0

          """

          Maps EOL Date to Product.

          """

          overview

              tags CMDB, NonStandard, Extension;

          end overview;

       

      mapping from SoftwareInstance_SoftwareServer.softwareinstance

           from SoftwareInstance_ApplicationSystem.softwareinstance

           from SoftwareCluster_Cluster.softwarecluster

           as softwareinstance

       

           traverse ElementWithDetail:SupportDetail:SoftwareDetail:SupportDetail as sptdetail

       

             product -> BMC_Product;

           end traverse;

          end mapping;

          body

        • 1. Re: Syncmapping for EOL (retirement_date)
          Ryan Nicosia

          Ok.  I think this is right but something wrong with my traverse as I'm getting error saying sptdetail not set

           

          // This is a template pattern module containing a CMDB syncmapping

          // that augments the BMC_SoftwareServer CI with additional attributes

          // taken from the BMC Discovery SoftwareInstance node.

          //

          // Names surrounded by double dollar signs like $$pattern_name$$ should all be

          // replaced with values suitable for the pattern.

          //

          // Text prefixed with // like these lines are comments that extend to

          // the end of the line.

          //

          // This pattern is in the public domain.

           

           

          tpl 1.5 module CMDB.Extension.SoftwareServer_Augment;

           

           

          from CMDB.SoftwareInstance_SoftwareServer import SoftwareInstance_SoftwareServer 4.0;

           

           

          syncmapping SoftwareServer_Augment 1.0

              """

              Add one or more new attributes to the BMC_SoftwareServer CI, based

              on attributes in the BMC Discovery SoftwareInstance node.

              """

              overview

                  tags CMDB, Extension;

              end overview;

           

           

              mapping from SoftwareInstance_SoftwareServer.softwareinstance as softwareinstance

                  // No additional structure -- we are just modifying the

                  // existing SoftwareServer CI.

           

          traverse ElementWithDetail:SupportDetail:SoftwareDetail:SupportDetail as sptdetail

           

          end traverse;

              end mapping;

           

           

              body

                  softwareserver := SoftwareInstance_SoftwareServer.softwareserver;

           

           

          // Only try to set attributes if the softwareserver is defined.

          // Second-order SoftwareInstance nodes are mapped to

          // BMC_ApplicationSystem instead.

           

           

                  if softwareserver then

           

           

                      // Set as many additional attributes as we need:

                      softwareserver.NumberofSlots := sptdetail.retirement_date;

                  end if;

           

           

              end body;

           

           

          end syncmapping;

          • 2. Re: Syncmapping for EOL (retirement_date)
            Brice-Emmanuel Loiseaux

            Simple error, sptdetail is the result of a traversal so a collection of node. Use "for each sptdetail do" loop to access sptdetail.retirement_date.

            1 of 1 people found this helpful
            • 3. Re: Syncmapping for EOL (retirement_date)
              Ryan Nicosia

              Brice-Emmanuel Loiseaux, thanks.  I knew it was something simple!!