Optimize BR Logic for CMDB Relationship Validation and Creation

siddheshagn
Tera Contributor

Hi Team,

I have a requirement where I need to check if the following CMDB relationships exist:

  • Oracle InstanceUses::Used byDatabase
  • Oracle InstanceRuns on::Runs(Linux) Server
  • (Linux) ServerVirtualized by::VirtualizesVirtual Machine Instance
  • Mapped Application ServiceDepends on::Used byVirtual Machine Instance

If all of the above relationships exist, then I need to create a new relationship between Mapped Application Service and Database.

Currently:

  • We already have an existing Business Rule for one relationship.
  • For the other three, I created system properties to store the sys_id of the cmdb_rel_type.

Challenge:
If I go with class-hopping and iterate part by part in the same BR, the code becomes unnecessarily lengthy.

Alternative Approach:
I was thinking of using an encoded query like:
Type contains (Used::Used by) and parent.class = linux and then another query.
However, I’m concerned about the accuracy of this approach.

Additional Requirement:
We also need to validate that the CIs involved are operational (check status and substatus).

Attaching a sample of the existing code for reference.


 

1 REPLY 1

Sujit Karn
Tera Contributor

Please test the attached code. We can create the script include then call the logic in BR.