When trying to configure “controller optics 0/0/0/3 perf-mon enable” on a NCS5500 I get the “’Controller’ object has no attribute ‘perf_mon’” error even though the Cisco-IOS-XR-um-interface-cfg.yang augments the CiscoIOS-XR-um-cont-optics-cfg.yang data model that has a perf-mon container:
First of all, you are erroneously use the model API when building the model object. Please check the generated Python API (module Cisco_IOS_XR_um_interface_cfg.py in your bundle). You have to keep in mind that all the components of the class are pre-initialized in the class instance, just do not have values. The exception is for the presence containers, if applicable the corresponding object must be initialized explicitly. The list elements must be initialized explicitly and then added to corresponding YList in the parent class.
missing here: contr_conf.controller.append(contr_configuration) # have to add list element to YList
1254 -> contr_perf_mon_cfg = contr_configuration.perf_mon # all the containers are present in the instance
Second. The errors like "AttributeError: 'Controller' object has no attribute 'perf_mon'" show that YANG module CiscoIOS-XR-um-cont-optics-cfg.yang was not added to the bundle. Please check your bundle profile, add the missing module, and regenerate the bundle.