cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
193
Views
0
Helpful
3
Replies
Highlighted
Cisco Employee

Unable to call Ydk go Netconf api concurrently

Hi ,

 

I am getting when trying to call ydk go Netconf library for Create Request and getting below error.

This error is raising when api is being called concurrently. And working fine with single request.

Can you suggest whether I am using right api.

 

goroutine 98 [syscall]:

runtime.cgocall(0x43d67a0, 0xc000311290, 0xc000311298)

/usr/local/Cellar/go/1.12.7/libexec/src/runtime/cgocall.go:128 +0x5b fp=0xc000311260 sp=0xc000311228 pc=0x400582b

github.com/CiscoDevNet/ydk-go/ydk/path._Cfunc_NetconfServiceProviderFree(0x6b000d0)

_cgo_gotypes.go:347 +0x41 fp=0xc000311290 sp=0xc000311260 pc=0x4302dc1

github.com/CiscoDevNet/ydk-go/ydk/path.DisconnectFromNetconfProvider.func1(0x6b000d0)

/Users/starlana/go/src/github.com/CiscoDevNet/ydk-go/ydk/path/path.go:451 +0x56 fp=0xc0003112c8 sp=0xc000311290 pc=0x4307046

github.com/CiscoDevNet/ydk-go/ydk/path.DisconnectFromNetconfProvider(0x47dc680, 0x6b000d0)

/Users/starlana/go/src/github.com/CiscoDevNet/ydk-go/ydk/path/path.go:451 +0x3c fp=0xc0003112f0 sp=0xc0003112c8 pc=0x43048bc

github.com/CiscoDevNet/ydk-go/ydk/providers.(*NetconfServiceProvider).Disconnect(0x4c9f6c0)

/Users/starlana/go/src/github.com/CiscoDevNet/ydk-go/ydk/providers/providers.go:165 +0x3d fp=0xc000311310 sp=0xc0003112f0 pc=0x430807d

cfm/portservice.CallNso(0xc000380030, 0x25, 0xc000378058, 0x2, 0xc00037805a, 0x2, 0xc000380060, 0x24, 0xc000378060, 0x9, ...)

 

 

API call :

 

cisco_cfm := ciscocfm.CiscoCfm{}

config_cfm(&cisco_cfm, newPort)

start := makeTimestamp()

Provider := providers.NetconfServiceProvider{

Address:  device["address"],

Username: device["username"],

Password: device["password"],

Port:     port,

Protocol: device["protocol"]}

Provider.Connect()

defer Provider.Disconnect()

fmt.Println("after connect")

result := Crud.Create(&Provider, &cisco_cfm)

3 REPLIES 3
Highlighted
Cisco Employee

Re: Unable to call Ydk go Netconf api concurrently

Hi starlana

 

Currently the YDK does not support multi-threading.

 

Regards,

Yan

Highlighted
Cisco Employee

Re: Unable to call Ydk go Netconf api concurrently

Hi Yan,

 

We have below use cases.

 

1. Pushing the config to multiple netconf devices in concurrent threads.

2. Pushing multiple configs to the same netconf device but through different concurrent threads.

 

Please let me know which of the above will work with ydk-go

 

Thanks,

Shanmukha Rao.

Highlighted
Cisco Employee

Re: Unable to call Ydk go Netconf api concurrently

Hi Shanmukha Rao

Unfortunately neither of these scenarios is going to work, primarily because Netconf client implemented in C++ component of YDK is not built to handle multiple concurrent threads. Therefore any attempt in concurrent threads to use that client will cause issues that you have described.

It will require significant efforts to develop multi-threading support in YDK, which is currently is out of our management scope.

In this situation I would suggest for you to develop singleton process, which would emulate multi-threading in single process and become a buffer between your system and YDK. Similar approach was implemented in CrossWorks.

Regards, Yan