DX NetOps

Expand all | Collapse all

event procedure for attribute of type Internet Address

  • 1.  event procedure for attribute of type Internet Address

    Posted 07-28-2015 11:28 AM

    I want to make model search in event procedure with GetModelsByAttrValue function by attribute of type "Internet Address". Attributes Network_address (0x12d7f}) and ip_address (0x12dbb) have this type. I try next syntax in EventDisp:

      GetModelsByAttrValue({H 0x12d7f}, { S \"192.168.250.30\" } )
      GetModelsByAttrValue({H 0x12d7f}, { О 192.168.250.30 } )
      GetModelsByAttrValue({H 0x12d7f}, { А 192.168.250.30 } )
      GetModelsByAttrValue({H 0x12d7f}, ToIpAddr({ S \"192.168.250.30\" } ))
      GetModelsByAttrValue({H 0x12d7f}, ToString({ А 192.168.250.30 } ))
      GetModelsByAttrValue({H 0x12d7f}, ToOctetString({ S \"192.168.250.30\" } ))

    But all these procedure return empty list - no model found (I see it in debug). Even trying convert address to unsigned:

      GetModelsByAttrValue({H 0x12d7f}, ToUInteger({ А 192.168.250.30 } ))

    After these SpectroSERVER was crashed.


    Please answer, how I can send input value to function GetModelsByAttrValue for searching attribute of this type?



  • 2.  Re: event procedure for attribute of type Internet Address

    Posted 08-03-2015 01:56 PM

    Can you please post the entire event procedure you are working with?

     

    Joe



  • 3.  Re: event procedure for attribute of type Internet Address

    Posted 08-04-2015 08:53 AM

    for example:

    0xfff00010 E 20 P "DebugValue( { S \"Interface list: \" }, GetModelsByAttrValue({H 0x12dbb}, DebugValue( { S \"IP address: \" },{ S \"200.5.113.245\" })))"

    output debug:

    DEBUG: IP address:

    Text String value: 200.5.113.245

    DEBUG: End of debug output

    DEBUG: Interface list:

    Value list information:

    No list elements

    DEBUG: End of debug output

     

    search by name is working:

    0xfff00010 E 20 P "DebugValue( { S \"Interface list: \" }, GetModelsByAttrValue({H 0x1006e}, DebugValue( { S \"Name: \" },{ S \"r1303_Serial1/0\" })))"

    DEBUG: Name:

    Text String value: r1303_Serial1/0

    DEBUG: End of debug output

    DEBUG: Interface list:

    Value list information:

    List contains 1 elements.

    List index 0:

    Unsigned integer value: 2925976 (0x2ca598)

     

    These output prove that model have this IP address in this attribute, but GetModelsByAttrValue don't search it:

    0xfff00010 E 20 P "DebugValue( { S \"Interface list: \" }, ReadAttribute( { H 0x2ca598 }, { H 0x12dbb} ) )"

     

    DEBUG: Interface list:

    Object ID value: 200.5.113.245

    DEBUG: End of debug output



  • 4.  Re: event procedure for attribute of type Internet Address

    Posted 01-22-2016 04:04 PM

    Did you ever find a resolution to this? I see the exact same issue when searching on attribute 0x12dbb.

    • Debug on ReadAttribute for the model/attr I'm searching on shows object type "Object ID" is returned.
    • Debug on my search variable for my IP Address shows object type "Object ID" is returned
    • Debug on GetModelsByAttrValue shows no items returned


  • 5.  Re: event procedure for attribute of type Internet Address

    Posted 01-26-2016 10:52 AM

    No, I not find resolution with GetModelsByAttrValue. My purpose was: assign alarm to other existing model (that differ from model where SNMP trap arrived) based on IP address at some variable inside SNMP trap. I changed the approach and now use Soutbound Gateway with mapping variable to model name. Than new event models was placed in  suitable containers.



  • 6.  Re: event procedure for attribute of type Internet Address

    Posted 01-26-2016 05:42 AM

    The attribute ip_address (0x12dbb) is of type Internet Address. It seems that we cannot search model using a constant Internet address.

    I tried also the attribute Network_Address (0x12d7f) which is also of type Internet Address with the same result: No list elements

    By searching on Legacy_Network_Address (0x1027f) of type Agent ID, it works.

    I think, it's necessary to raise an idea or open a ticket.



  • 7.  Re: event procedure for attribute of type Internet Address

    Broadcom Employee
    Posted 01-26-2016 08:43 AM
      |   view attached

    Yes, you are correct.  The procedures have not been enhanced to support a version neutral IP. Here is some information I found from one of our previous developers who sent internal mail awhile back.  Looks like it would technically be an enhancement request for it to support the InternetAddress attribute.

    Cheers

    Jay

     

     

    the problem is that they are using the new network address attribute (0x12d7f), which is of type 'InternetAddress'. This type holds a version neutral IP address (so could be v4 or v6). Procedures do not yet support that type, unfortunately. The ToIpAddr() proc just returns the old v4 only IP address (IP Address, or often also 'Agent ID' in Spectrum).

     

    They could use the original, now called 'Legacy Network Address' attribute (0x1027f) instead, that should get them working. The attribute contains (for v4 devices) a copy of the new, general address attribute.

     

     

     

    Lastly, one tip, which might be useful...? They could use a variable to store the results of the GetModelsByAttrValue() call, and access it later using the 'V' tag. That way only one such search call (which is expensive) is needed.

     

    Example on how to use variables:

     

    Set variable 'nameVariable' to result of the regexp extraction.

     

    Then check if variable matches empty string, if it does, return varbind 1, otherwise return the variable itself.

     

    ....

     

    SetVariable( \

     

    { V nameVariable }, \

     

    GetRegexp(\

     

    GetEventAttribute( { U 1 } ), \

     

    { S \"(.*?)/\" }, \

     

    { U 1 } ), \

     

    If( \

     

    Equals( \

     

    { V nameVariable }, \

     

    { S \"\" } ), \

     

    GetEventAttribute( { U 1 } ), \

     

    { V nameVariable } ) ) ) )"



  • 8.  Re: event procedure for attribute of type Internet Address

    Posted 01-26-2016 11:17 AM

    Yes, it's possible use 'Legacy Network Address' attribute (0x1027f) instead Network_address (0x12d7f) - the same data. But there is no copy for ip_address (0x12dbb), legacy_ip_address (0x10e43) always have value '0.0.0.0'. So, it's not possible find interface model by IP address of interface.

    Example of using GetModelsByAttrValue by IP address for me:

    Device (model 'A' in spectrum) send to spectrum some vendor SNMP trap  about problem with connect to service on IP address. This IP address is interface IP address of another device (model 'B' in spectrum). Real problem is on device 'B' but alarms appears on model 'A'. With event procedure it could be find model with interface IP address from trap and reassign new alarm to interface on model 'B'.



  • 9.  Re: event procedure for attribute of type Internet Address

    Posted 01-28-2016 08:36 AM

    Hello,

    we had already found a solution for a customer.

    The idea is to search a String instead of an Internet Address.

    For this goal, create a watch (evaluate on demand) of type Text String which monitors ip_address, in the Watch Editor:

    1. select Internet Address as type in Expression

    2. select the attribute ip_address in Expression

    3. Change back the type to Text String

    You can then use GetModelsByAttrValue on this watch.

    Best Regards

    Philippe

     

    PS: I forgot one thing:

    When you create the watch, please take a look on the result. Because the format is different for IPv4 and IPv6 address.

    Here an example:

    ip_address              192.168.98.66

    ip_address_watch    4.192.168.98.66.0.0.0.0.1.1

    For IPv4 you need to add "4." before and ".0.0.0.0.1.1" at the end.



  • 10.  Re: event procedure for attribute of type Internet Address

    Broadcom Employee
    Posted 01-28-2016 08:41 AM
      |   view attached

    Oh, great idea!!!



  • 11.  Re: event procedure for attribute of type Internet Address

    Posted 01-28-2016 08:45 AM

    Thank you :-)



  • 12.  Re: event procedure for attribute of type Internet Address

    Posted 01-12-2017 11:13 AM

    Thanks, I put this in our environment and it works great.

     

    For those wondering how the EventProcedure looks, I modified the default OSPF trap event 0x22003f to take the IP Address, search for the port model with that IP Address, and add the ifName and ifAlias to the alarm title. If it can't find the port model, just change the alarm title to include the IP Address.

     

    The Watch value that is converting 0x12dbb to Text String is 0xffff0138 here

     

    0x0022003f P "SetVariable({V IP},Append({S \"4.\"},Append({v 2},{S \".0.0.0.0.1.1\"})), \
    SetVariable({V ATITLE},If(Exists(GetElement(GetModelsByAttrValue({H 0xffff0138},{V IP})),{U 0}), \
    Append({S \"OSPF State Change, ifName: \"}, \
    Append(ReadAttribute(GetElement(GetModelsByAttrValue({H 0xffff0138},{V IP}),{U 0}),{H 0x11f6f}), \
    Append({S \" \"}, \
    ReadAttribute(GetElement(GetModelsByAttrValue({H 0xffff0138},{V IP}),{U 0}),{H 0x13224})))), \
    Append({S \"OSPF State Change on interface assigned with \"},{v 2})), \
    CreateEventWithVariables({C CURRENT_MODEL},{H 0xfff016ec}, \
    SetEventVariable(GetEventVariableList(),{H 0x12b4c},{V ATITLE}) \
    )))"