Skip to content

Go YDK fails to build unique types for cascading typedef statements in Yang model #675

@ygorelik

Description

@ygorelik

Steps to Reproduce

Include the following statements (taken from NXOS) into Yang model and then build go bundle:

typedef comp_InstType {
    type enumeration {
        enum unknown {
            value 0;   // Unknown
        }
        enum phys {
            value 1;     // Baremetal Host
        }
        enum virt {
            value 2;     // Virtual Machine
        }
        enum hv {
            value 3;   // Hypervisor Host
        }
    }
    default "unknown";
}

typedef comp_NicInstType {
    type comp_InstType;
}

In this model the "comp_NicInstType" type "cascades" or "repeats" definition of "comp_InstType"

The Go API builder creates duplicate statements like this one, which causes compiler syntax error

// CompInstType
type CompInstType int
const (
CompInstType_unknown CompInstType = 0
CompInstType_phys CompInstType = 1
CompInstType_virt CompInstType = 2
CompInstType_hv CompInstType = 3
)

The type CompNicInstType does not appear in the Go code.

Additional notes

The issue does not appear in C++ and Python bundle builders.

Logs

TBD

System Information

Ubuntu 14.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions