-
Notifications
You must be signed in to change notification settings - Fork 78
Duplicate code in generated cisco-ios-xe Go bundle #891
Copy link
Copy link
Closed
Description
The issue has been found by Raman Viswanathan ramanvi@cisco.com
Current Behavior
When tried to use cisco-ios-xe Go bundle the compiler gives syntax errors:
We ran into compilation issues with : https://github.com/CiscoDevNet/ydk-go/blob/master/ydk/models/cisco_ios_xe/native/native.go
There are some redeclared code errors:
/root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:571155:6: Native_Interface_Vlan_CiscoIOSXEInterfacesSwitchportConf redeclared in this block
previous declaration at /root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:554401:6
/root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:571185:6: Native_Interface_Vlan_CiscoIOSXEInterfacesSwitchport redeclared in this block
previous declaration at /root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:554431:6
/root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:571211:6: Native_Interface_Vlan_CiscoIOSXEInterfacesStackwiseVirtual redeclared in this block
previous declaration at /root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:554457:6
/root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:571246:6: Native_Interface_Vlan_CiscoIOSXEInterfacesArp redeclared in this block
previous declaration at /root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:554492:6
/root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:571276:6: Native_Interface_Vlan_CiscoIOSXEInterfacesBackup redeclared in this block
previous declaration at /root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:554522:6
/root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:571314:6: Native_Interface_Vlan_CiscoIOSXEInterfacesBackup_Delay redeclared in this block
previous declaration at /root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:554560:6
/root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:571351:6: Native_Interface_Vlan_CiscoIOSXEInterfacesBackup_Delay_Failure redeclared in this block
previous declaration at /root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:554597:6
/root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:571354:139: Native_Interface_Vlan_CiscoIOSXEInterfacesBackup_Delay_Failure_never redeclared in this block
previous declaration at /root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:554600:139
/root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:571358:6: Native_Interface_Vlan_CiscoIOSXEInterfacesBackup_Delay_SecondaryDisable redeclared in this block
previous declaration at /root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:554604:6
/root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:571361:157: Native_Interface_Vlan_CiscoIOSXEInterfacesBackup_Delay_SecondaryDisable_never redeclared in this block
previous declaration at /root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:554607:157
/root/ydk-go/golang/src/github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go:571361:157: too many errors
Your Script
package main
import (
"flag"
"fmt"
"github.com/CiscoDevNet/ydk-go/ydk"
"github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native"
"github.com/CiscoDevNet/ydk-go/ydk/providers"
"github.com/CiscoDevNet/ydk-go/ydk/services"
encoding "github.com/CiscoDevNet/ydk-go/ydk/types/encoding_format"
)
const (
inputXML = `
<native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
<utd-mt xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-utd">
<utd>
<multi-tenancy />
<engine>
<standard>
<multi-tenancy>
<threat-inspection>
<profile>
<name>rv-test1</name>
</profile>
<profile>
<name>rv-test2</name>
<threat>protection</threat>
<policy>security</policy>
</profile>
</threat-inspection>
<policy>
<name>rv-utd-test1</name>
<all-interfaces />
<vrf>
<name>global</name>
</vrf>
<threat-inspection>
<profile>rv-test1</profile>
</threat-inspection>
</policy>
<policy>
<name>rv-utd-test2</name>
<all-interfaces />
<vrf>
<name>1</name>
</vrf>
<threat-inspection>
<profile>rv-test2</profile>
</threat-inspection>
</policy>
</multi-tenancy>
</standard>
</engine>
</utd>
</utd-mt>
</native>
`
)
// main executes main program.
func main() {
defer func() {
if r := recover(); r != nil {
fmt.Println("\nError occured!!\n ", r)
}
}()
vPtr := flag.Bool("v", false, "Enable verbose")
flag.Parse()
if *vPtr {
ydk.EnableLogging(ydk.Info)
}
// create codec provider
jsonProvider := providers.CodecServiceProvider{}
jsonProvider.Encoding = encoding.JSON
xmlProvider := providers.CodecServiceProvider{}
xmlProvider.Encoding = encoding.XML
fmt.Println("RV Test1")
// create codec service
var codec = services.CodecService{}
fmt.Println("RV Test2")
var native native.Native
native = codec.Decode(&xmlProvider, inputXML)
fmt.Println("RV Test3")
// encode and print object
fmt.Println(codec.Encode(&jsonProvider, native))
}
System Information
YDK-Go 0.8.1 docker.
Reactions are currently unavailable