[YANGTOOLS-385] Union objects are generated incorrectly when using bits type Created: 05/Dec/14  Updated: 10/Apr/22  Resolved: 23/Jan/15

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

Type: Bug
Reporter: Michal Polkorab Assignee: Martin Ciglan
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 2480

 Description   

I have defined following model:

typedef port-state-v13 {
description
"Current state of the physical port. These are not configurable from
the controller.";
type bits {
bit link_down

{ //description "No physical link present."; position 0; }

bit blocked

{ //description "Port is blocked"; position 1; }

bit live

{ //description "Live for Fast Failover Group."; position 2; }

}
}

typedef port-state-v10 {
description "Current state of the physical port. These are not configurable from
the controller.";
type bits {
bit link_down

{ description "No physical link present."; position 0; }

bit blocked

{ description "Port is blocked"; position 1; }

bit live

{ description "Live for Fast Failover Group."; position 2; }

bit stp_listen

{ description "Not learning or relaying frames."; }

bit stp_learn

{ description "Learning but not relaying frames."; }

bit stp_forward

{ description "Learning and relaying frames."; }

bit stp_block

{ description "Not part of spanning tree."; }

bit stp_mask

{ description "Bit mask for OFPPS_STP_* values."; }

}
}

typedef port-state {
type union

{ type port-state-v10; type port-state-v13; }

}

Code generation succeeds, but compilation of PortState object fails due to incorrect method call:



 Comments   
Comment by Martin Ciglan [ 05/Dec/14 ]

replicated, will take a look next week

Comment by Martin Ciglan [ 10/Dec/14 ]

fix pushed:

https://git.opendaylight.org/gerrit/#/c/13535/

Comment by Jozef Gloncak [ 11/Dec/14 ]

Just for completion. Problem was that class generated for typedef port-state was generated with constructors which expect that attribute _value is filled via calling of method getValue(). Such method currently isn't generated for >>bit<< type and therefore compilation error has occured.

Comment by George Zhao [ 19/Jan/15 ]

move to Lithium

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