cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
399
Views
0
Helpful
4
Replies

Error using YDK C++ sample app with confd in CentOS 8 stream

Mike Fisher
Level 1
Level 1

I have been able to build the CiscoDevNet YDK C++ core library, Openconfig module bundle, and Cisco_ios_xr module bundle on CentOS 8 stream.  Using the C++ samples folder source code and README instructions (from https://github.com/ygorelik/ydk-gen/tree/master/sdk/cpp/samples), I was able to build the sample applications.  Similarly, using the README instructions, I am able to run the confd router emulator.  However, when I attempt to run a sample app, I get an error.  For instance, 

[fisher_m@localhost ydk-gen-master]$ ./test/init_test_env.sh 

*** Wed Jan 11 14:11:55 MST 2023: init_test_env.sh: Initializing confd in /home/fisher_m/YangDevKit/YDK-0.8.6/CiscoDevNet/ydk-gen-master/sdk/cpp/core/tests/confd/ydktest 

*** Wed Jan 11 14:11:55 MST 2023: init_test_env.sh: Found confd resource file: /home/fisher_m/confd/confdrc 
### Killing any confd daemon or DHCP confd agents
/home/fisher_m/confd/bin/confd --stop &> /dev/null   || true
/home/fisher_m/confd/bin/confd -c confd.conf --addloadpath /home/fisher_m/confd/etc/confd --addloadpath /home/fisher_m/confd/src/confd/yang --addloadpath /home/fisher_m/confd/src/confd/aaa

*** Wed Jan 11 14:12:04 MST 2023: init_test_env.sh: Starting REST server 

*** Wed Jan 11 14:12:04 MST 2023: init_test_env.sh: REST server started with PID 249174 

*** Wed Jan 11 14:12:04 MST 2023: init_test_env.sh: Starting TCP server 

*** Wed Jan 11 14:12:04 MST 2023: init_test_env.sh: TCP server started with PID: 249192 
[fisher_m@localhost ydk-gen-master]$ popd
~/YangDevKit/YDK-0.8.6/CiscoDevNet/ydk-gen-master/sdk/cpp/samples/build
[fisher_m@localhost build]$ 
[fisher_m@localhost build]$ ./bgp_create ssh://admin:admin@127.0.0.1:12022 -v
[2023-01-11 14:13:09.712] [ydk] [error] Connection error occurred: Starting the SSH session failed (kex error : no match for method server host key algo: server [], client [ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-256,rsa-sha2-512,ssh-rsa])
[2023-01-11 14:13:09.712] [ydk] [error] Could not connect to 127.0.0.1: Session status: Undefined
Error details: YClientError: Could not connect to 127.0.0.1: Session status: Undefined

Is there some kind of ssh configuration that I need to do in my CentOS 8 stream environment?

4 Replies 4

ygorelik
Cisco Employee
Cisco Employee

Try to login to the confd device (example here):

(nso-venv) YGORELIK-M-C3GG:test ygorelik$ ssh admin@127.0.0.1 -p 12022 -s netconf
The authenticity of host '[127.0.0.1]:12022 ([127.0.0.1]:12022)' can't be established.
ED25519 key fingerprint is SHA256:0K9MqvuQuBevJ0ua/NJuP8s3CiO3rRiBIE9z9OxqrDw.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[127.0.0.1]:12022' (ED25519) to the list of known hosts.
admin@127.0.0.1's password: 
<?xml version="1.0" encoding="UTF-8"?>
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<capabilities>
<capability>urn:ietf:params:netconf:base:1.0</capability>
Connection to 127.0.0.1 closed.

This will set the SSH key and print device capabilities. Make sure you can connect, then try the app again.

I got different results then you did.  Please see below:

[fisher_m@localhost build]$ ssh admin@127.0.0.1 -p 12022 -s netconf
Unable to negotiate with 127.0.0.1 port 12022: no matching host key type found. Their offer: 

Something is missing after 'Their offer:'; it should list the encryption algorithm that your openssh does not understand. Possibly you need to recompile and reinstall openssh and/or add the missing algorithm into ssh config file ~/. ssh/config and/or /etc/ssh/ssh_config. I recommend to google it before making changes. On my Mac I have the following in ~/. ssh/config:

Host 172.xxx.xxx.xxx
    User admin
    PubkeyAcceptedAlgorithms +ssh-rsa
    HostkeyAlgorithms +ssh-rsa

On my Mac the confd ssh public key generated with algorithm 'ssh-rsa', which is potentially not added on your platform. You can view the key at ~/confd/etc/confd/ssh/ssh_host_rsa_key.pub. The key is generated automatically when confd is installed. Not sure if and how you can regenerate it locally. It is better and simpler just add the missing algorithm in ssh config file.

Thank you for the feedback.  I think this may take some time to resolve and I may end up attempting to make the ssh connection on a different machine.