[YANGTOOLS-101] YANG Enumeration type is not handled. Created: 13/Mar/14  Updated: 10/Apr/22  Resolved: 09/Apr/14

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Mayank Agarwal Assignee: Mayank Agarwal
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Mac OS
Platform: PC


Issue Links:
Duplicate
duplicates CONTROLLER-169 PUT toaster:toaster on toaster sample... Resolved
is duplicated by YANGTOOLS-127 yang-data-api: ClassCastException whe... Resolved
External issue ID: 523

 Description   

2014-03-13 15:12:35 PDT [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/restconf].[JAXRSRestconf]] SEVERE org.apache.catalina.core.StandardWrapperValve invoke Servlet.service() for servlet [JAXRSRestconf] in context with path [/restconf] threw exception [java.util.concurrent.ExecutionException: java.lang.IllegalStateException:
If a YANG Model contains a leaf of type enumeration, like this:

leaf node-connector-type {
type enumeration {
enum "CTRL"

{ value 0; description "Represents the OFPP_CONTROLLER reserved port to forward a packet to the controller, this is to send data packets to the controller from the data plane triggering a packet_in event."; }

enum "ALL"

{ value 1; description "Represents the OFPP_ALL reserved OF port to forward to ALL the ports in the system , should be used for flooding like mechanism to be used cautiously to avoid excessive flooding."; }

And the value is passed in via RestConf as let's say "ALL", then YANGTools fails with the following ClassCastException.

org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException: java.lang.ClassCastException: java.lang.String cannot be cast to org.opendaylight.yang.gen.v1.urn.opendaylight.host.tracker.rev140305.host.NodeConnector$NodeConnectorType] with root cause
java.lang.ClassCastException: java.lang.String cannot be cast to org.opendaylight.yang.gen.v1.urn.opendaylight.host.tracker.rev140305.host.NodeConnector$NodeConnectorType
at org.opendaylight.yang.gen.v1.urn.opendaylight.host.tracker.rev140305.host.NodeConnector$Broker$Codec$DOM.fromDomStatic(NodeConnector$Broker$Codec$DOM.java)
at org.opendaylight.yang.gen.v1.urn.opendaylight.host.tracker.rev140305.AddStaticHostInput$Broker$Codec$DOM.fromDomStatic(AddStaticHostInput$Broker$Codec$DOM.java)
at org.opendaylight.yang.gen.v1.urn.opendaylight.host.tracker.rev140305.AddStaticHostInput$Broker$Codec$DOM.deserialize(AddStaticHostInput$Broker$Codec$DOM.java)
at org.opendaylight.yangtools.sal.binding.generator.impl.LazyGeneratedCodecRegistry$DataContainerCodecImpl.deserialize(LazyGeneratedCodecRegistry.java:629)
at org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl$11.call(RuntimeGeneratedMappingServiceImpl.java:590)
at org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl$11.call(RuntimeGeneratedMappingServiceImpl.java:582


Generated at Wed Feb 07 20:52:16 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.