DMTF / YANG-to-Redfish-Converter

This tool converts a YANG model file to the corresponding Redfish schema, specified in OData CSDL, in accordance with the YANG-to-CSDL Mapping Specification.
Other
4 stars 5 forks source link

Property with no defined type #28

Closed dorado18 closed 5 years ago

dorado18 commented 6 years ago

Hello,

I'm getting some errors when trying to use odata-csdl-vallidator on a file set generated by the Yang-to-Redfish tool. I'm attaching a tar.gz file with the CSDL and yang files where the issues can be reproduced.

The tar contents will be extract into a directory named 'interfaces', and executing the command

python odata_validator.py ./interfaces/output_dir

You will see an error:

MetaData:http://redfish.dmtf.org/schemas/v1/RedfishYangExtensions_v1.xml->DataServices->Schema:RedfishYangExtensions.v1_0_0->Term:uint8->Name uint8 is already defined in schema

There is a file I named RedfishYangExtensions_v1.xml.some_fixes where I fixed this error and some other small ones (like the value 'True' to 'true'). If you rename RedfishYangExtensions_v1.xml.some_fixes to RedfishYangExtensions_v1.xml and execute the tool again, You'll stumble on an error that I think is a problem from the Yang-to-Redfish converter:

MetaData:http://redfish.dmtf.org/schemas/v1/openconfig_if_ethernet.ethernet_top.ethernet.config_v1.xml->DataServices->Schema:openconfig_if_ethernet.ethernet_top.ethernet.config.v1_0_0->EntityType:config->Property:duplex_mode->Annotation:RedfishYang.YangType->Unparsed child XML ['{http://docs.oasis-open.org/odata/ns/edm}Member', '{http://docs.oasis-open.org/odata/ns/edm}Member']

If you look after the definition of 'duplex_mode', we can see that it is defined in openconfig_if_ethernet.ethernet_interface_config_v1.xml as an EnumType, but in file openconfig_if_ethernet.ethernet_top.ethernet.config_v1.xml the property at line 67 is declared with type 'RedfishYang.duplex_mode', which does not exist. 'RedfishYang' is an alias for 'RedfishYangExtensions.v1_0_0'.

I understand that this may be happening because of OpenConfig's complex nesting of grouping/container/uses statements, I just would like to confirm this with you.

Thanks, andre

tomasg2012 commented 6 years ago

If your suspicion is true, this does seem to be a consequence of new type definitions not being defined in the Extension file automatically, and that's still in the works. I wrote something of an example of the program generating a new Extensions file but am going to discuss more about how to handle this with individuals who would know more about it.

dorado18 commented 6 years ago

Ok, thanks. By the way, I got the definition file RedfishYangExtensions_v1.xml from TF-Network branch. At this stage pyang does not generate it, correct ?

tomasg2012 commented 6 years ago

Pyang handles parsing and modifying of nodes with Augment and Uses, but the rest is generated by the plugin. There might be an easier way to get certain type info via pyang but I currently am not sure.

tomasg2012 commented 5 years ago

Closed, unrelated to the tool itself as Extensions file needed to be scrubbed.