Service model inquiry
This topic gives an overview of the service model inquiry function.
smcomps/5—search for certain Service Model components
smcomps/5 arguments
Argument | Mode | Type | Description |
---|---|---|---|
$PARMNAMES | Input | LIST_OF STRING | List of parameter names |
$PARMVALS | Input | LIST_OF STRING | List of parameter values |
$COMPS1 | Output | LIST_OF OBJECT | List of primary search components |
$SHADOW | Output | LIST_OF OBJECT | List of shadow components |
$COMPS2 | Output | LIST_OF OBJECT | List of secondary search components |
Use the smcomps/5 primitive to return a list of pointers to the components that are in the impact path or the cause path of a selected component. Various parameters can be used to refine that list.
The smcomps/5 primitive makes it possible to retrieve, manage, and propagate a list of impacted components or causal components from within the rules of a Knowledge Base.
smcomps/5 searches for Service Model components as specified by the $PARMNAMES and $PARMVALS argument values. The result is returned as a list of primary search components $COMPS1, a list of shadow components $SHADOWS, and a list of secondary search components $COMPS2.
The two parameter lists—the $PARMNAMES list that contains only the names of the parameters and the $PARMVALS list that contains the values corresponding to the parameters named in $PARMNAMES in the same order—determine the search behavior. Available parameter names and possible values are as follows:
Parameter | Value |
comp | mc_udid of the focus Service Model component data object. Default value is 0; therefore, you must enter a valid value for this parameter. |
dir | c | i where c=cause and i=impact. Default direction value is c. |
impact | t | p where t=true impact and p=possible impact. Default impact type is p. |
events | T | F where T=True and F=False. Default value is F (it is not requested that the components have attached events). |
ext | T | F where T=True and F=False. Default value is F (extended search is not turned on). |
leaf | T | F where T=True and F=False. Default value is F (leaf nodes are not required). |
type | Component class name. Default is the BMC_BaseElement class. |
The smcomps primitive retrieves components, starting with the focus component identified by comp, in the direction specified by dir. The other parameters influence whether or not a component is included in the result, and whether or not the search is continued. A component is included if each of the following conditions holds:
- The component must be an instance of the class given in the type parameter or one of its subclasses.
- When the events parameter is set to T, only components with attached events (components with self_status!=NONE) are retrieved by smcomps.
When the leaf parameter is set to T, only leaf components (components with self_status > impact_status) are retrieved.
In an impact direction search, shadowed components (components with shadow_cells not empty) are always included, regardless of the above conditions.
The search is terminated if any of the following conditions holds:
- If true impact is requested through the impact parameter (impact=t), but the relationship does not have true_impact=YES
- If leaf components were requested (leaf = T) and a leaf component has been found
If an extended search is requested through the ext parameter (ext=T), and the primary search is terminated at the focus component, a secondary search is performed, continuing after the focus component under the same conditions.
The $SHADOWS list contains shadow components (components with scope=SHADOW). Such components are included in the result without checking any constraints. The $COMPS2 list contains the components returned from the secondary search and is empty if no extended search was requested. It can be nonempty only if the list $COMPS1 is either empty or only contains only the focus component. $SHADOWS and $COMPS2 normally are not used in the context of MRL.
The smcomps primitive does not cross cell boundaries.
smcomps/5 example
listwalk($COMPS,$COMP);
concat([$MSG,' ',$COMP.mc_udid],$MSG);
In this example, a listwalk of the result list is performed to save the mc_udids in a slot of the event. You can then retrieve the desired properties from the components by a using clause referencing the udids.