60 views

Description


Dependency types are used to create a custom type through a script executing in real time. This will generate a custom view for a Dependency Views map of a specific CI.

A JavaScript function needs to be created to customize the map. The script must comply with JavaScript syntax guidelines and the directions in the default script template, and it can call platform API's.

Examples of usage of a dependency type:

  • To narrow down and simplify a map, leaving out CIs that are not important for a specific task.
  • To include only specific CIs that are hidden by default, such as qualifiers, end-points, and entry points.
  • To display virtual relationships that are calculated, and that otherwise do not exist in the CMDB.
  • As a tool to plan a new topology deployment that is based on existing resources.


Procedure


 

  1. Navigate to Dependency Views > Dependency Types.
  2. In the Load Filter Scripts list view, select an existing dependency type, or click New.
  3. Enter or modify a script, adhering to the guidelines and requirements in the script template that is provided.
  4. Click Submit.


How it works

In a Dependency Views map, you can click Use Dependency Type to apply a custom script defined in a dependency type.


Behind the scenes

Dependency Type scripts are defined in the table ngbsm_script. The variables used and their definitions are listed here below:

  • dv_ci_id : "Mandatory- Sys_id of the child CI"
  • dv_rel_id : "Optional- Relation ID, a unique identifier for this relation (generated by the system by default)",
  • dv_rel_type : "Optional- Stored ID of the relation type (1a9cb166f1571100a92eb60da2bce5c5 by default)",
  • dv_rel_type_label : "Optional- Label of the relation (overwrites the default dv_rel_type label)",
  • dv_downstream : "Optional- Indicates a downstream or upstream direction (true by default indicating a downstream direction)",
  • dv_params : "Optional- Container for sticky parameters to be passed to this script at recurring calls (empty by default)",
  • dv_messages :"Optional - Container for notifications to be send to the client [default-empty]"


In the script we need to debug if we are getting the value from the above variables, and if they are passed as needed. When we use the Dependency Type, we may fail to read the value, hence debug statements can help us troubleshooting.

Example:

INPUT

var dv_level = "System- Input parameter indicating the current depth, cannot be modified.";
var dv_ci_id = "System- Sys_id of the parent CI node";
var dv_params = "System- Container for custom sticky parameters to be passed to this script at every recursion (empty by default).";
*/

dependency_views_script();

function dependency_views_script() {

OUTPUT
Result - contains an array of the parent(args[0]) children 
*[ {
* "dv_ci_id" : "Mandatory- Sys_id of the child CI",
* "dv_rel_id" : "Optional- Relation ID, a unique identifier for this relation (generated by the system by default)",
* "dv_rel_type" : "Optional- Stored ID of the relation type (1a9cb166f1571100a92eb60da2bce5c5 by default)",
* "dv_rel_type_label" : "Optional- Label of the relation (overwrites the default dv_rel_type label)",
* "dv_downstream" : "Optional- Indicates a downstream or upstream direction (true by default indicating a downstream direction)",
* "dv_params" : "Optional- Container for sticky parameters to be passed to this script at recurring calls (empty by default)",
* "dv_messages":"Optional - Container for notifications to be send to the client [default-empty]"
* }, … ] */
var result = []; 

// <— Enter the script logic for the retrieval of the children.

/* example to define result

result.push({
"dv_ci_id" : "27d32778c0a8000b00db970eeaa60f16", //Represents the 'Email' CI
"dv_rel_id" : "27eb80f3c0a8000b00587d37871ce04e", //Represents the link between Blackberry & Email
"dv_rel_type" : "1a9cb166f1571100a92eb60da2bce5c5", //Represents the 'Depends on::Used by' relationship
"dv_downsream" : "true", //Indicates a downstream link
"dv_params" : {"test" : "1234"; //A custom parameter to be used in a recurring call of this script },
"dv_messages": { "type":"info", "msg":"Testing Info Notification"} //Pass a notification to be displayed on the client [error,info] 
*/

return result;

}
 

 

Article Information

Last Updated:2018-06-14 12:55:49
Published:2018-06-14