02-24-2022 05:22 PM - edited 02-24-2022 05:25 PM
Hello,
When configuring the FEC to 'base-r' on a 8800-LC-36FH-2 using the Cisco_IOS_XR_um_interface_cfg with YDK, the following INVALID_TYPE error is seen while executing the crud_service.py device.create on the RPC:
crud_service.py 160 Info---- CREATE operation initiated
_validator.py 251 Error--- Validation error for property Interfaces.Interface.fec . Error message (INVALID_TYPE, Invalid type: 'str'. Expected type: Enum).
crud_service.py 171 Info---- CREATE operation completed
This issue is not seen when configuring FEC to 'none' or 'standard'.
Can some one please help me understand why the Enum 'base-r' is causing this error?
Thanks,
Anthony
03-04-2022 09:52 AM
03-04-2022 07:44 PM
03-04-2022 02:49 PM
Could you please clarify what is the XR release and model. Is the YANG model publicly available? If not, please attach the model. Also please clarify model definition for the fec and the enum model for values.
And yes, the link is not working. Simply attach the failing script and the log to this discussion.
Yan Gorelik
03-04-2022 08:36 PM
This issue was seen while using YDK on the Cisco-IOS-XR-um-if-ethernet-cfg which augments Cisco_IOS_XR_um_interface_cfg to configure fec on a 8800-LC-36FH-2 LC of a Cisco 8000 router running 7.5.2.13I.
The fec is defined in Cisco-IOS-XR-um-if-ethernet-cfg as:
leaf fec {
when "../a1:interface-name[starts-with(text(),'HundredGigE')]" +
" or ../a1:interface-name[starts-with(text(),'TwoHundredGigE')]" +
" or ../a1:interface-name[starts-with(text(),'FourHundredGigE')]" +
" or ../a1:interface-name[starts-with(text(),'EightHundredGigE')]" +
" or ../a1:interface-name[starts-with(text(),'TwentyFiveGigE')]" +
" or ../a1:interface-name[starts-with(text(),'FiftyGigE')]" {
tailf:dependency '../a1:interface-name';
}
type enumeration {
enum none {
value 0;
description "Disable any FEC enabled on the interface";
}
enum standard {
value 1;
description "Enable the standard (CL-91, Reed-Solomon) FEC";
}
enum base-r {
value 2;
description "Enable BASE-R FEC";
}
}
description "Set the Forward Error Correction on an interface";
}
The set_fec function is defined as:
from ydk.models.cisco_ios_xr import Cisco_IOS_XR_um_interface_cfg as xr_um_int_cfg
def set_fec(self, port, mode, intf_type=None, enable=True):
'''
Configure fec
:param port: port is the interface eg 0/0/0/0 , 0/0/0/0/1
:param mode: standard or base-r
:param intf_type: controller type, eg hundredgigectrlr, tengigectrlr etc,
:return: None
'''
intf_conf = xr_um_int_cfg.Interfaces()
enum_ = mode
if not enable:
enum_ = DELETE()
intf_configuration = intf_conf.Interface()
intf_configuration.interface_name = self.ifmgr._fix_name(self.get_interface_type(port=port)) + port
intf_configuration.active = "act"
intf_configuration.fec = enum_
self.device.create(intf_configuration)
05-26-2022 12:17 PM
Hello,
This issue was caused by improperly assigning the enum value.
Using the following syntax to assign the enum value resolved the issue:
intf_conf = xr_um_int_cfg.Interfaces()
intf_conf_fec = intf_conf.Interface.Fec()
if mode == 'none':
enum_ = intf_conf_fec.none
elif mode == 'standard':
enum_ = intf_conf_fec.standard
elif mode == 'base-r':
enum_ = intf_conf_fec.base_r
for port_ in port:
if self.collect_optics_data(self.get_optics_pid(port_)).zr_optics:
intf_configuration = intf_conf.Controller()
intf_type = 'Optics'
else:
intf_configuration = intf_conf.Interface()
if not intf_type:
intf_type = self.get_interface_type(port=port_)
intf_configuration.interface_name = intf_type + port_
intf_configuration.fec = enum_
self.device.create(intf_configuration)
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide