Issue using a MAC address from a trap in an Event Procedure using GetElement

Document ID : KB000100493
Last Modified Date : 07/06/2018
Show Technical Document Details
Issue:

When using a MAC Address from a trap in an Event Procedure using the GetElement procedure, Spectrum is not able to associate the MAC Address to the model in the Spectrum database that has that MAC Address associated with it. 

The following is an example of the Event Procedure being used:

0xfff00071e E 50 P "\ 
CreateEventWithVariables( \ 
GetElement( \ 
GetModelsByAttrValue(\ 
{H 0x110df},\ 
ToOctetString(GetEventVariable({U 104 }))),{U 1}), \ 
{H 0xfff0071f}, \ 
GetEventVariableList())" 

In the above Event Procedure, the MAC Address value sent by the trap is saved to Event Variable "104". The "GetElement" procedure then searches for a model in the database that has the MAC_Address attribute 0x1100df with the same value as MAC Address in Event Variable "104".

Cause:
There are three basic causes for this issue to occur:

1. The MAC Address in the trap is an OctetString, but in ascii format, not raw 6byte mac format
2. The ToOctetString() procedure just dupes the incoming OctetString if type is OctetString.
3. The ToOctetString() looks for just '.' as the separator but the MAC Address sent by the trap uses ":" as the separator.
Resolution:
For causes #1 and #2 listed above, the resolution is to use the ToString() procedure on the OctetString before calling the ToOctetString() procedure. Using the above Event Procedure as an example, the Event Procedure will need to be changes as follows:

0xfff0071e E 50 P "\
CreateEventWithVariables( \
GetElement( \
GetModelsByAttrValue(\
{H 0x110df},\
ToOctetString( ToString( GetEventAttribute( {U 104 } ) ) ) ),{U 1}), \
{H 0xfff0071f}, \
GetEventVariableList())"

For cause #3, a code change has been made to the ToOctetString() procedure to look for both "." and ":" as the MAC Address separator. This code change will be available in Spectrum 10.03.00. No projected release date for Spectrum 10.03.00 at the time of this knowledge document publication.