cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
553
Views
0
Helpful
1
Replies

Reading System Alarms : Libyang error: Failed to resolve identityref "oc-alarm-types:MAJOR"

csrm7
Cisco Employee
Cisco Employee

Hi, 

 

Was trying to read alarms on the device. Seeing below messages/errors. Please help. 

 

  1. Cannot find model with module name 'openconfig-aaa'
    1. Not clear on this warning. The module is present in the ydk/models/openconfig folder
    2. The module is present in the provided repository.
  2. Data is invalid according to the yang model. Libyang error: Data model "Fan" not found.
    1. Fan is not a Data Model here.
    2. Looks like this is due to alarm text "Fan: One or more LCs missing, running fans at max speed.\"
  3. Libyang error: Failed to resolve identityref "oc-alarm-types:MAJOR". Path: '/openconfig-system:system/alarms/alarm[id='SM/HW_ENVMON_PEM_ALARM/22#CHASSIS/LCC/1']/state/severity'
    1. YDK is having trouble with prefixes here ?
    2. Here "oc-alarm-types" is prefix for "openconfig-alarm-types"

 

I repeated the test with model bundles generated with yang files from the device and have the same observations

 

 

>>> from  ydk.models.openconfig import openconfig_system
>>> alarms = crud.read(provider, openconfig_system.System.Alarms())
Cannot find model with module name 'openconfig-aaa'
Cannot find model with module name 'openconfig-aaa'
Executing CRUD read operation on [openconfig-system:system]

=============== Get Request Sent ================
path {
  origin: "openconfig-system"
  elem {
    name: "system"
  }
  elem {
    name: "alarms"
  }
}
encoding: JSON_IETF



============= Get Response Received =============
notification {
  timestamp: 1607427249044136202
  update {
    path {
      origin: "openconfig-system"
      elem {
        name: "system"
      }
      elem {
        name: "alarms"
      }
    }
    val {
      json_ietf_val: "{\"alarm\":[{\"id\":\"SM/HW_ENVMON_PEM_ALARM/22#CHASSIS/LCC/1\",\"state\":{\"id\":\"SM/HW_ENVMON_PEM_ALARM/22#CHASSIS/LCC/1\",\"resource\":\"0\",\"text\":\"Power Module redundancy lost.\",\"time-created\":\"1607382067\",\"severity\":\"oc-alarm-types:MAJOR\",\"type-id\":\"oc-alarm-types:HW_ENVMON_PEM_LVL_RED_LOST\"}},{\"id\":\"SM/HW_ENVMON_FAN_ALARM/201#CHASSIS/LCC/1\",\"state\":{\"id\":\"SM/HW_ENVMON_FAN_ALARM/201#CHASSIS/LCC/1\",\"resource\":\"0\",\"text\":\"Fan: One or more LCs missing, running fans at max speed.\",\"time-created\":\"1607382086\",\"severity\":\"oc-alarm-types:CRITICAL\",\"type-id\":\"oc-alarm-types:HW_ENVMON_RM_LC_REMOVAL\"}},{\"id\":\"SYSTEM/HW_ERROR/82#CHASSIS/LCC/1:CONTAINER/LC/3\",\"state\":{\"id\":\"SYSTEM/HW_ERROR/82#CHASSIS/LCC/1:CONTAINER/LC/3\",\"resource\":\"0/2\",\"text\":\"Verification of SUDI Certificate Failed On LC.\",\"time-created\":\"1607382102\",\"severity\":\"oc-alarm-types:MAJOR\",\"type-id\":\"oc-alarm-types:LC_SUDI_FAILURE\"}},{\"id\":\"XR/SW_MISC_ERR/1#CHASSIS/LCC/1:CONTAINER/CC/1:MODULE/RP/1:MODULE/FPGA/4\",\"state\":{\"id\":\"XR/SW_MISC_ERR/1#CHASSIS/LCC/1:CONTAINER/CC/1:MODULE/RP/1:MODULE/FPGA/4\",\"resource\":\"0/RP0\",\"text\":\"One Or More FPDs Need Upgrade Or Not In Current State\",\"time-created\":\"1607382108\",\"severity\":\"oc-alarm-types:MAJOR\",\"type-id\":\"oc-alarm-types:FPD_NEED_UPGRADE_ALARM\"}},{\"id\":\"XR/HW_G709/18#CHASSIS/LCC/1:CONTAINER/LC/3:MODULE/TRC/1:MODULE/SLICE/0:PORT/OPTICS/5:PORT/G709/2:PORT/G709/2\",\"state\":{\"id\":\"XR/HW_G709/18#CHASSIS/LCC/1:CONTAINER/LC/3:MODULE/TRC/1:MODULE/SLICE/0:PORT/OPTICS/5:PORT/G709/2:PORT/G709/2\",\"resource\":\"ODU20/2/0/5/2\",\"text\":\"Path Monitoring Alarm Indication Signal\",\"time-created\":\"1607427024\",\"severity\":\"oc-alarm-types:WARNING\",\"type-id\":\"oc-alarm-types:G709_PM_AIS\"}},{\"id\":\"XR/HW_ETHERNET/121#CHASSIS/LCC/1:CONTAINER/LC/3:MODULE/TRC/1:MODULE/SLICE/0:PORT/OPTICS/5:PORT/ETHERNET/1\",\"state\":{\"id\":\"XR/HW_ETHERNET/121#CHASSIS/LCC/1:CONTAINER/LC/3:MODULE/TRC/1:MODULE/SLICE/0:PORT/OPTICS/5:PORT/ETHERNET/1\",\"resource\":\"TenGigECtrlr0/2/0/5/1\",\"text\":\"Local Fault\",\"time-created\":\"1607427025\",\"severity\":\"oc-alarm-types:MAJOR\",\"type-id\":\"oc-alarm-types:ETHER_LF\"}}]}"
    }
  }
}
error {
}


Get Operation Succeeded
Cannot find model with module name 'Fan'
Data is invalid according to the yang model. Libyang error: Data model "Fan" not found.
Data is invalid according to the yang model. Libyang error: Failed to resolve identityref "oc-alarm-types:MAJOR". Path: '/openconfig-system:system/alarms/alarm[id='SM/HW_ENVMON_PEM_ALARM/22#CHASSIS/LCC/1']/state/severity'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/ydk_vne/lib/python3.6/site-packages/ydk/services/crud_service.py", line 60, in read
    return _crud_read(provider, read_filter, False, self._crud.read)
  File "/root/ydk_vne/lib/python3.6/site-packages/ydk/services/crud_service.py", line 88, in _crud_read
    read_top_entity = crud_call(provider, top_filters)
  File "/usr/lib/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "/root/ydk_vne/lib/python3.6/site-packages/ydk/errors/error_handler.py", line 82, in handle_runtime_error
    _raise(_exc)
  File "/root/ydk_vne/lib/python3.6/site-packages/ydk/errors/error_handler.py", line 54, in _raise
    exec("raise exc from None")
  File "<string>", line 1, in <module>
ydk.errors.YModelError:  Failed to resolve identityref "oc-alarm-types:MAJOR". Path: /openconfig-system:system/alarms/alarm[id='SM/HW_ENVMON_PEM_ALARM/22#CHASSIS/LCC/1']/state/severity

 

 

1 Reply 1

yangorelik
Spotlight
Spotlight

1. Your query (line 2) is not correct. You always must to instantiate top level entity and build your model upon it:

>>> from ydk.models.openconfig import openconfig_system
>>> oc_system = openconfig_system.System()
>>> alarms = crud.read(provider, oc_system.alarms)

2. Please ignore these errors as YDK does.

3. Here identityref uses module prefix instead of module name. That is unexpected in the device reply. Currently model API generated by YDK does not have mapping of module prefixes to module names and therefore there is no means to find module name by its prefix, hence the YModelError. Unfortunately there is no workaround for this issue. New development is needed. Please file new issue in ydk-gen GitHub.

Yan Gorelik
YDK Solutions