Highlighted
Absent Member.
Absent Member.
563 views

Customization of amPushMapping for new Model Hierarchy Data push

Hi,

 

We have requirement where we need to introduce a new model hierarchy during the AM Push from uCMDB.

Currently the AMPushMapping is pushing model and its Parent Model where in Model has operation type as operation-type="insert_else_reference" and Parent Model has operation-type="reference-only". Which mean AM Push can create the model if doesn't exists but Parent Model should exists and this value is hard coded in AM Push groovy function.

 

Now we need to push model with 3 level hierarchy.

 

Model

Model.Parent

Model.Parent.Parent

 

While pushing the model, AMPush can create Model and Model.Parent but it can only reference the Model.Parent.Parent

 

Model.Parent.Parent values are hardcoded in AMPush groovy and they exists in Asset Manager.

 

 

Model - insert or reference

Model.Parent - insert or referfence

Model.Parent.Parent - reference

 

While with the changes, when we push the 3 level Model data to AM, we are getting circular dependency error.

 

Can anyone suggest how to push 3 level model hierarchy from uCMDB to Asset Manager.

 

 

Below are the AMPush configuration for 3 level Model Hierarchy.

 

am-push-mapping.XML contents for Model creation

 

<am-mapping ci-type="amModel" primary-key="lModelId" operation-type="insert_else_reference" merge-allowed="true" parallel-push-allowed="true">

<reconciliation>

<reconciliation-keys>

<reconciliation-key>Name</reconciliation-key>

<reconciliation-key>lParentId</reconciliation-key>

</reconciliation-keys>

</reconciliation>

<reference-attribute ci-name="amBrand" datatype="STRING" name="lBrandId" reference-direction="child"/>

<reference-attribute ci-name="amNature" datatype="STRING" name="lNatureId" reference-direction="child"/>

<reference-attribute ci-name="amModel-Parent" datatype="STRING" name="lParentId" reference-direction="child"/>

<action-on-delete>

<ignore/>

</action-on-delete>

</am-mapping>

 

<am-mapping ci-type="amModel-Parent" primary-key="lModelId" operation-type="update_else_insert" target-ci-type="amModel" merge-allowed="true" parallel-push-allowed="true" errorcode-override="45402">

<reconciliation>

<reconciliation-keys>

<reconciliation-key>Name</reconciliation-key>

<reconciliation-key>lParentId</reconciliation-key>

</reconciliation-keys>

</reconciliation>

<reference-attribute ci-name="Model-amNature" datatype="STRING" name="lNatureId" reference-direction="child"/>

<reference-attribute ci-name="amModel-Parent-Parent" datatype="STRING" name="lParentId" reference-direction="child"/>

<action-on-delete>

<ignore/>

</action-on-delete>

</am-mapping>

 

<am-mapping ci-type="Model-amNature" primary-key="lNatureId" operation-type="reference-only" target-ci-type="amNature" merge-allowed="true" parallel-push-allowed="true" errorcode-override="45401">

<reconciliation>

<reconciliation-keys>

<reconciliation-key>Code</reconciliation-key>

</reconciliation-keys>

</reconciliation>

<action-on-delete>

<ignore/>

</action-on-delete>

</am-mapping>

 

<am-mapping ci-type="amModel-Parent-Parent" primary-key="lModelId" operation-type="reference-only" target-ci-type="amModel" merge-allowed="true" parallel-push-allowed="true" errorcode-override="45402">

<reconciliation>

<reconciliation-keys>

<reconciliation-key>BarCode</reconciliation-key>

</reconciliation-keys>

</reconciliation>

<action-on-delete>

<ignore/>

</action-on-delete>

</am-mapping>

 

 

pushMappingAMComputer.xml contents for Model

 

<target_ci_type name="amModel">

<target_mapping name="CPUType" datatype="STRING" value="AMPushFunctions.getLowestValue(Root.cpu*.getAt('cpu_type'))"/>

<target_mapping name="Name" datatype="STRING" ignore-on-null="false" value="AMPushFunctions.getFirstNotEmpty(Root['node_model'],AMPushFunctions.toSmart(Root['discovered_model']))"/>

<target_ci_type name="amBrand">

<target_mapping name="Name" datatype="STRING" value="AMPushFunctions.getBrandName(Root['vendor'],Root['discovered_vendor'])"/>

</target_ci_type>

<target_ci_type name="amNature">

<target_mapping name="Code" datatype="STRING" value="vNatureCode"/>

</target_ci_type>

<target_ci_type name="Model-amNature">

<target_mapping name="Code" datatype="STRING" value="'CPU'"/>

</target_ci_type>

<target_ci_type name="amModel-Parent">

<target_mapping name="Name" datatype="STRING" ignore-on-null="true" value="AMPushFunctions.getBrandName(Root['vendor'],Root['discovered_vendor'])"/>

</target_ci_type>

<target_ci_type name="amModel-Parent-Parent">

<target_mapping name="BarCode" datatype="STRING" ignore-on-null="true" value="AMPushFunctions.getComputerType(iIsComputerAVM, Root['node_role'], Root['os_family'], Root['os_description'])"/>

</target_ci_type>

 

<before-mapping>Logger.debug('before')</before-mapping>

<after-mapping>Logger.debug('after')</after-mapping>

</target_ci_type>

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.