Tuesday Tip: Defining a single attribute to distinguish a proxy model from one in maintenance mode
CA Spectrum Tuesday Tip by Roger Nason, Principal Support Engineer
How to compare two attributes in a watch to determine if a model is set as a proxy model
Description: The issue here is that when a model is made a proxy model, the isEventCreationEnabled (0x129f8) is set to ‘No’, however when a model is placed into maintenance mode the same attribute is also set to ‘No.’ We can distinguish a proxy model from a model in maintenance by looking a two attributes; isEventCreationEnabled and isManaged (0x1295d). On a proxy model isEventCreationEnabled will be set to 'No' while isManaged is set to 'Yes'. Whereas a model in maintenance will have both attributes set to 'No'.
Solution: Our solution needs to boil these two attributes down to one. To do this we will create a watch. This will be a Boolean watch with an expression defined as: (!isEventCreationEnabled & isManaged). In the example below I named the watch isProxy (See Figure 1). Now when a device is a proxy model the expression will evaluate to true; any other time it evaluates to false.
You will also notice that in the Properties tab (See Figure 2), I set the watch to be active by default and to evaluate on change. In addition, I set up the watch on the GnSNMPDev model type and made it inheritable, so now every SNMP-based model type will have this watch.
Figure 3 shows the watch in the model’s Watches table. Note that the Watch Status is Initial, this is expected.
Figure 4 shows the watch as an attribute, isProxy, in a model’s Attribute tab along with its calculated value.
Next we need to add following XML code to the $SPECROOT/custom/common/config/table-model-config.xml and then restart tomcat.
<?xml version="1.0" encoding="utf-8"?>
<table idref="table-model-config">
<column>
<hidden-by-default>true</hidden-by-default>
<name>Proxy</name>
<content>
<attribute>0xffff0003</attribute>
<select>
<case>
<match>true</match>
<yield>Yes</yield>
</case>
</select>
</content>
</column>
</column-list>
</table>
Now I can enable the Proxy column in my List view. Notice the models in maintenance do not have a ‘Yes’ value in the Proxy column. Only the two models that are actually set as Proxy models show a Yes in that column (See Figure 5).