04-26-2017 12:30 AM
>>> from ydk.models.cisco_ios_xr import Cisco_IOS_XR_ip_static_cfg
>>> from ydk.providers import NetconfServiceProvider
>>> from ydk.services import CRUDService
>>> ncc = NetconfServiceProvider(address='172.27.121.52',username='root',password='lab',port=830)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/auto/cafy_dev/cafykit/exec/lib/python3.4/site-packages/ydk/providers/netconf_provider.py", line 69, in __init__
self._connect()
File "/auto/cafy_dev/cafykit/exec/lib/python3.4/site-packages/ydk/providers/netconf_provider.py", line 75, in _connect
self.sp_instance.connect(self.session_config)
File "/auto/cafy_dev/cafykit/exec/lib/python3.4/site-packages/ydk/providers/_provider_plugin.py", line 296, in connect
hostkey_verify=False)
File "/auto/cafy_dev/cafykit/exec/lib/python3.4/site-packages/ncclient/manager.py", line 154, in connect
return connect_ssh(*args, **kwds)
File "/auto/cafy_dev/cafykit/exec/lib/python3.4/site-packages/ncclient/manager.py", line 119, in connect_ssh
session.connect(*args, **kwds)
File "/auto/cafy_dev/cafykit/exec/lib/python3.4/site-packages/ncclient/transport/ssh.py", line 383, in connect
raise SSHError("Could not open socket to %s:%s" % (host, port))
ncclient.transport.errors.SSHError: Could not open socket to 172.27.121.52:830
04-26-2017 12:31 AM
baalagar@exr-idt-ucs.cisco.com%>ssh root@172.27.121.52
Password:
RP/0/RP0/CPU0:ios#
manually i can login as well , but through netconfserviceprovider
04-26-2017 08:39 AM
Please try:
ssh -p 830 -s root@172.27.121.52<mailto:root@172.27.121.52> netconf
Cheers,
Einar
05-11-2017 02:47 AM
Hi Einar,
sorry for the dealy as non availability of setup
when i connect with port 830 i seen some prob .
without port
==========
[exec] baalagar@exr-idt-ucs.cisco.com%>ssh root@192.168.122.10 netconf
Password:
Thu May 11 09:43:45.384 UTC
<?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><capability>urn:ietf:params:netconf:capability:candidate:1.0</capability><capability>urn:ietf:params:netconf:capability:notification:1.0</capability></capabilities><session-id>285212672</session-id></hello>
]]>]]>
with Port
==========
[exec] baalagar@exr-idt-ucs.cisco.com%>ssh -p 830 root@192.168.122.10 netconf
ssh: connect to host 192.168.122.10 port 830: Connection refused
===========
if i pass port no at the end . it execute like below . however it is not taking me to router prompt . could you please help here this is the place i am struggling long time
[exec] baalagar@exr-idt-ucs.cisco.com%>ssh root@192.168.122.10 netconf -p 830
Password:
^
% Invalid input detected at '^' marker.
Even i gave correct password
05-11-2017 02:54 AM
Balakrishnan,
The SSH command to connect should be:
ssh -p 830 -s root@192.168.122.10<mailto:root@192.168.122.10> netconf
The “-s” option is required to instruct ssh to open a channel to the netconf subsystem. Without the -s, ssh will attempt to open a console channel and invoke a command call ed “netconf”.
Cheers,
Einar
05-11-2017 03:08 AM
Hi Einar ,
Same error only i am hitting
[exec] baalagar@exr-idt-ucs.cisco.com%>ssh -p 830 -s root@192.168.122.10 netconf
ssh: connect to host 192.168.122.10 port 830: Connection refused
08-27-2017 09:52 PM
Were you able to resolve this issue ?
I am facing same issue wanted to know if I am missing something.
08-28-2017 01:31 PM
Hi,
Can you let me know the full error message which you are seeing?
08-28-2017 09:36 PM
Below is the error I get, but as pointed by Einar in another post my issue is probably to do with me using IoS version 15.2 with libydk which might not be supported. (https://communities.cisco.com/message/266997#266997).
$ python hello.py
Traceback (most recent call last):
File "hello.py", line 13, in <module>
provider = NetconfServiceProvider(address="10.138.77.179", port=830, username="test", password="test123", protocol="ssh")
RuntimeError: YCPPClientError: Could not connect to 10.138.77.179
10-03-2020 11:30 PM
Have you been able to solve this issue ? i am facing same issue. Cannot connect with port 830. Can you please help ?
10-04-2020 11:31 AM - edited 10-04-2020 11:37 AM
Could you please be more specific and post your test environment, script and YDK log with enabled DEBUG level.
Were you able connect to the Netconf server from CLI? The command is:
$ ssh <uname>@<IP-address> -p 830 -v -s netconf
I also would suggest to open new discussian thread as YDK changed a lot since 2017 and some SSH issues have already been addressed.
10-04-2020 11:24 PM
Good morning Baalagar!
Its a while, but I think I encountered something of a similar issue.
The way I solved it was to check if the router/switch (the device in question) had port 830 opened by the network department.
And in my case it did not. So I had to request the port opened by the network department.
It still would not work for me, and when I enquired the network dep. again they said it could be some firewall issues. They opened the internal firewall for that port and it now works for me.
Hope you get a good day,
Kind regards,
Simon Johansen
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide