Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data tag not recognized when attribute present #1021

Open
amoruck opened this issue Jul 29, 2020 · 8 comments
Open

data tag not recognized when attribute present #1021

amoruck opened this issue Jul 29, 2020 · 8 comments
Assignees

Comments

@amoruck
Copy link

amoruck commented Jul 29, 2020

Expected Behavior

Data tag should be correctly recognized

Current Behavior

"ydk - ERROR - Cannot find 'data' tag in RPC reply from device".

Steps to Reproduce

Query Arista switch with EOS 4.24.1.1F (tested with cEOS-lab-4.24.1.1F) for interface config

Your Script

from ydk.services import NetconfService, Datastore
from ydk.providers import NetconfServiceProvider
from ydk.models.openconfig import openconfig_interfaces as oc_interfaces
import logging

def set_logger():
logger = logging.getLogger("ydk")
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
formatter = logging.Formatter(("%(asctime)s - %(name)s - "
"%(levelname)s - %(message)s"))
handler.setFormatter(formatter)
logger.addHandler(handler)

set_logger()
provider = NetconfServiceProvider(address="172.18.0.3",
port=830,
username="admin",
password="abc123",
protocol="ssh")

netconf = NetconfService()
interfaces = oc_interfaces.Interfaces()
interface = interfaces.Interface()
interface.name = 'Ethernet2'
interfaces.interface.append(interface)
cfg = netconf.get_config(provider, Datastore.running, interfaces)

Logs

2020-07-29 19:44:00,581 - ydk - INFO - Path where models are to be downloaded: /root/.ydk/172.18.0.3
2020-07-29 19:44:00,588 - ydk - INFO - Connected to 172.18.0.3 on port 830 using ssh with timeout of -1
2020-07-29 19:44:00,599 - ydk - INFO - Executing 'get' RPC on [openconfig-interfaces:interfaces] from running
2020-07-29 19:44:00,607 - ydk - INFO - ============= Sending RPC to device =============

Ethernet2 2020-07-29 19:44:00,611 - ydk - INFO - ============= Received RPC from device ============= Ethernet2 true 300 false 0 Ethernet2 oc-vlan-types:TPID_0X8100 ianaift:ethernetCsmacd false false false false true 00:00:00:00:00:00 SPEED_UNKNOWN false 200 ACCESS 0 0 0 true 0 false false 1500 false false false 1500

2020-07-29 19:44:00,612 - ydk - ERROR - Cannot find 'data' tag in RPC reply from device

Ethernet2 true 300 false 0 Ethernet2 oc-vlan-types:TPID_0X8100 ianaift:ethernetCsmacd false false false false true 00:00:00:00:00:00 SPEED_UNKNOWN false 200 ACCESS 0 0 0 true 0 false false 1500 false false false 1500

Traceback (most recent call last):
File "b.py", line 31, in
cfg = netconf.get_config(provider, Datastore.running, interfaces)
File "/usr/local/lib/python3.6/dist-packages/ydk/services/netconf_service.py", line 108, in get_config
return _ns_get(provider, source, read_filter, self._ns.get_config)
File "/usr/local/lib/python3.6/dist-packages/ydk/services/netconf_service.py", line 165, in _ns_get
top_result = ns_call(provider, top_filters)
File "/usr/lib/python3.6/contextlib.py", line 99, in exit
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.6/dist-packages/ydk/errors/error_handler.py", line 82, in handle_runtime_error
_raise(_exc)
File "/usr/local/lib/python3.6/dist-packages/ydk/errors/error_handler.py", line 54, in _raise
exec("raise exc from None")
File "", line 1, in
ydk.errors.YServiceProviderError: Cannot find 'data' tag in RPC reply
2020-07-29 19:44:00,624 - ydk - INFO - Disconnected from device

System Information

Python 3.6.9
root@ydk:/var/tmp# pip freeze
bash: pip: command not found
root@ydk:/var/tmp# pip3 freeze
asn1crypto==0.24.0
chardet==3.0.4
cryptography==2.1.4
idna==2.6
keyring==10.6.0
keyrings.alt==3.0
pybind11==2.5.0
pycrypto==2.6.1
pygobject==3.26.1
python-apt==1.6.5+ubuntu0.3
python-debian==0.1.32
pyxdg==0.25
SecretStorage==2.3.1
six==1.11.0
ydk==0.8.4
ydk-models-ietf==0.1.5.post2
ydk-models-openconfig==0.1.8
root@ydk:/var/tmp# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic

@amoruck
Copy link
Author

amoruck commented Jul 29, 2020

logs.txt
attaching logs as file.

@111pontes
Copy link
Collaborator

Thanks for sharing the problem. Can you point to the standard that defines the time-modified attribute in the data tag? I believe that attribute isn't defined in an RFC.

@amoruck
Copy link
Author

amoruck commented Jul 31, 2020

Thanks for replay, please understand that I am not netconf expert, I have only noticed that my first "hello world" interaction with the device failed, and it seems the XML I'm receiving from the device has correct syntax (as long as XML and data tag presence is considered)

So if it is really forbidden to add attributes to data tag in netconf response, and the correct behaviour is to throw an error not just to ignore unknown attribute - it should be at least mentioned in error message, because now error message suggests that response parsing routine has some cognitive problems (it says tag cannot be found when the tag is in fact present).

@111pontes
Copy link
Collaborator

The underlying issue is that your device is sending non-standard NETCONF messages that are confusing your script. Having said that, I agree that, at a minimum, the error message needs to be improved since the data tag does exist in the payload sent from the router. I'm marking this as an enhancement issue.

@amoruck
Copy link
Author

amoruck commented Aug 3, 2020

So, it seems that because of this confusion caused by additional XML attibute it is now impossible to to use ydk with Arista switches; Wouldn't it be possible to change ydk behavior to warn about unknown attribute being ignored?

@111pontes
Copy link
Collaborator

Standards exist for a reason: to achieve interoperability (even at the cost of slower innovation). Interoperability suffers when you deviate from a standard. In this case, there is no debate on improving the error message. Now, deciding on whether to silently ignore an unexpected attribute would require careful analysis on our part before deciding to change the implementation. See the criticism of the Robustness principle.

@amoruck
Copy link
Author

amoruck commented Aug 4, 2020

I have tried to find some help on Arista forum, and this is what they said. Unfortunately I am too noob in netconf to make anything useful out of it, so I'm leaving it here for reference;

@111pontes
Copy link
Collaborator

Thanks for sharing. The referenced comment describes what should be fixed on the network device to not violate the NETCONF standard. That is a change required by the device vendor. Furthermore, notice that the configuration data in your log file is not vendor neutral. These are at least some of the vendor-specific nodes that are not part of the OpenConfig specification:

/interfaces/interface/config/load-interval
/interfaces/interface/ethernet/config/fec-encoding
/interfaces/interface/ethernet/config/sfp-100base-t
/interfaces/interface/ethernet/pfc

ygorelik added a commit to ygorelik/ydk-gen that referenced this issue Aug 26, 2020
@ygorelik ygorelik self-assigned this Feb 24, 2022
shmuelnatan added a commit to siklu/ydk-gen that referenced this issue Jul 12, 2022
* Fixed bug in extracting module name from namespace

* Added distribution packages in GitHub

* Added distribution packages for Ubuntu/xenial on GitHub

* Added distribution packages for Centos to GitHub

* Added distributables for darwin to GitHub

* In Entity class Added method to clone current entity instance

* In Entity class Added method to clone current entity instance

* Added shortcut operator to set yfilter value in YLeaf and YLeafList instances

* Fixing Travis test for gNMI

* Implemented Entity clone in Go (enh. CiscoDevNet#967)

* Fixing Travis test

* Resolved issue CiscoDevNet#968

* Addressed few Codacy issues

* Addressed documentation issue CiscoDevNet#971

* Fixed bug in gNMI set RPC processing

* Corrected documentation of YDK raised exceptions

* Resolved issue CiscoDevNet#978, implemented enhancement 894

* Resolved issue CiscoDevNet#980

* Fixing Travis test for MacOSX

* Resolved GitHub issue CiscoDevNet#983

* Updated bundle for XR-6.6.2 (post1)

* Upgraded GitPython package to version 2.1.15 due to Travis failure

* Upgraded openconfig bundle to version dated 2019-06-21

* Resolved github issue CiscoDevNet#996

* Resolved github issue CiscoDevNet#996

* Corrected error message

* Fixed bug in previous commit

* Fixed GitHub issue CiscoDevNet#997

* Resolved GitHub issue CiscoDevNet#969

* Bumped version to 0.8.5

* Initial development of install_ydk script

* Made corrections for Travis run

* Fixing Travis run

* Adjusted YDK installation script for CentOS

* Added support for ubuntu:focal (20.04 LTS)

* Added deployment packages for ubuntu:xenial

* Fixing Travis run for xenial

* Corrected Dockerfile to include golang packages

* Bumped YDK version to 0.8.5

* Added documentation for missing 'initialize' method

* Added unit test for XmlSubtreeCodec on user defined repository

* Adressed some issues related to installation on CentOS

* Added deployment core packages for CentOS-7

* Added disclaimer on 0.8.5 modified files

* Corrected debug statement

* Added test cases for reading on single container

* Corrected license comment

* Resolved GitHub issues CiscoDevNet#1003, CiscoDevNet#1005, CiscoDevNet#1006

* Updated YDK core deployment packages for Ubuntu xenial and bionic

* Updated YDK core and gNMI libraries for CentOS-7

* Update CONTRIBUTIONS.md with license details

* Update .gitignore

* Added YDK core and gNMI deployment packages for OSX

* Added new options in install_ydk script

* Update YDK version for XR 6.6.3 bundle

* Added C++ test cases for path::Codec with no service provider

* Added use case for deleting entire list

* Added capability for Restconf to work with HTTPS protocol (initial commit)

* Some documentation changes for YDK-0.8.5

* Partially addressed issue CiscoDevNet#917 (HTTPS support for Restconf)

* Resolved GitHub issues CiscoDevNet#1012 ans CiscoDevNet#1013

* Corrected documentation pertaining release 0.8.5

* Removed binary artifacts

* Fixing Travis test

* Fixing Travis test

* Changed bundle backward compatibility test to YDK-0.7.3

* Fixing bundle backward compatibility test

* Enabled Travis test on CentOS-7 docker

* Restored artifacts to 0.8.5

* Lowered version of go testify version

* Lowered version of go testify version

* Updated artifacts for OSX

* Updated artifacts for ubuntu:xenial

* Updated artifacts for CentOS-7

* Update travis testing for Ubuntu

Re-enable Python3 testing for Ubuntu Xenial.

* Fixed few bugs in C++ code

* Resolved issue CiscoDevNet#1021

* added github based online documentation

* Added support for Centos 8 CiscoDevNet#1019

* Resolved issue CiscoDevNet#1024

* Added support for Centos 8 CiscoDevNet#1019

* Fixing Travis test for Centos 8

* Fixing Travis test for Centos 8

* Fixing Travis test for Centos 8

* Fixing Travis test for Centos 8

* Fixing Travis test for Centos 8

* Added support for Ubuntu:focal

* Fixing Travis test for Ubuntu:focal

* Fixing Travis tests for ubuntu:focal

* Fixing Travis tests for ubuntu:focal

* Fixing Travis test for ubuntu:focal

* Fixing Travis test for ubuntu:focal

* Fixing Travis test for ubuntu:focal

* Fixing Travis test for ubuntu:focal

* Fixing Travis test for ubuntu:focal

* Improving unit tests for Mac OS Mojave

* Improving unit tests for Mac OS Mojave

* Added unit test for issue CiscoDevNet#1026

* Added test case after fixing CiscoDevNet#1026 in Libyang

* Corrected YDK service classes initialization issue for python

* Resolved issues CiscoDevNet#1026 and CiscoDevNet#1032

* Updated 0.8.5 documentation

* Resolved issue CiscoDevNet#1036

* Resolved issue CiscoDevNet#1035

* Correcting Travis tests

* Fixing deviation tests

* Fixed confd setting for deviation tests

* Addressed memory leak issue in Executor Service unit tests

* Implemented enhancement CiscoDevNet#1007

* Bumped version to 0.8.5.post1

* Additional code changes for enhancement CiscoDevNet#1007

* Added installation of flex and bison for CentOS platform

* Inforced use of pybind11 v2.2.2

* Corrected test scripts to work with confd version 7.3

* Improved test scripts

* Fixed bug in the bundle generator

* Fixed decoding of leaf-list in XMLSubtreeCodec

* Bumped build version to 2

* Added unit test case for issue CiscoDevNet#1045

* Corrected installation of curl and libcurl for ubuntu:focal

* Corrected documentation for release 0.8.5.2

* Corrected documentation for release 0.8.5.2

* Resolved issue CiscoDevNet#1049

* Fixed memory leak issue

* Added unit test for issue CiscoDevNet#635

* Fixing issue 053

* Created Go wrapper for NetconfSession, added Path API unit tests, CiscoDevNet#779

* Created Go wrappdded Path API unit tests, CiscoDevNet#779

* Resolved GitHub issue CiscoDevNet#1053

* Enabled all CRUD tests related to deleting of list and leaf-list

* Added unit tests and documentation for Path API in Go

* Bumped version to 0.8.5.3 (0.8.5.post3 for python)

* Generated docs. Changed Puthon package version to 0.8.5.3.

* Corrected Copyright statement

* Added support for RestconfSession in Go

* Added C++ documentation related to resolution of enhancement CiscoDevNet#779

* Corrected documentation related to enhancement CiscoDevNet#779

* Upgraded pyang version to 2.5.0

* Upgraded pyang version to 2.5.0

* Dropped Python2 support in the code

* Dropped Python2 support in the code (2)

* Added bundle profiles to support newer versions of IETF OpenConfig and Cisco IOS XR models

* Added bundle profiles for IOS XR version 7.0.1 and 7.0.2

* Added bundle profiles for IOS XR version 7.0.1 and 7.0.2

* Added SSH support for NetconfServiceProvider in Go

* Added SSH support for NetconfServiceProvider in Go

* Added explicit setting of OnDemand flag in NetconfServiceProvider

* Fixed setting of OnDemand flag in NetconfSession in Go

* Solves nil pointer dereference

When calling (NetconfServiceProvider).GetConfig with an empty EntityCollection panics cause of a nil pointer dereference. Adding these if-guards seems to solve the problem.

* Updated release documentation

* Bumped version to 0.8.6

* Implements requested changes

* Update types.go

Corrected suggested code changes.

* Bumped version to 0.8.6.2

* Improving installation script

* Improved installation script to allow use Python system installation

* Fixed few profiles for ietf and cisco-ios-xr bundles

* Fixed few profiles for ietf and cisco-ios-xr bundles

* Reverted version to 0.8.6

* Reverted changes to comply with Python 3.5 syntax

* Restored damaged ydktest profile

* Cleaned up older profiles

* Changed script parameter '--no-py-venv' to '--no-venv'

* Fixed unit test script

* Resolved issue CiscoDevNet#1034

* Corrected documentation after fixing issue CiscoDevNet#1034

* Corrected unit tests for CiscoDevNet#1047 and CiscoDevNet#1048

* Corrected YDK core version requirement

* Corrected YDK core version to 0.8.6.2

* Addressed segmentation fault error

* Corrected Codecy issues

* Minor doc corrections

* Made adjustments for installation on mac osx 11.6

* Added YDK demo. Mentioned added support for MacOS Big Sur

* Provided patch to ensure definition of constant SIGSTKSZ

* Patched catch.hpp for Linux distributions that do not define SIGSTKSZ

* Addressing GitHub issue CiscoDevNet#1059

* Addressing GitHub issue CiscoDevNet#1059

* added demo profile and bundles for Cisco IOS XR

* Fixed unit test in Go for the issue 1059

* Renewed documentation for release 0.8.6.2

* Resolved issue CiscoDevNet#1059

* Resolved issue CiscoDevNet#1056

* Revert "ydkgen: run autopep8 on all ydkgen py files"

This reverts commit e5c17c1.

* fixup

* Close YList class with parenthethis

* Remove one EncodingFormat from the two enums

* Remove unused Entity* in resolve_leaf_value_namespace function in xml_subtree_codec

* Remove Entity from call to resolve_leaf_value_namespace function in xml_subtree_codec

* Remove errors.hpp.
Remove _print_yang_models_function from _print_top_level_entity_functions.
Remove _print_bundle_name_function from _print_top_level_entity_functions.

Co-authored-by: Yan Gorelik <[email protected]>
Co-authored-by: ygorelik <[email protected]>
Co-authored-by: Yan Gorelik <[email protected]>
Co-authored-by: Yan Gorelik <[email protected]>
Co-authored-by: CentOS <[email protected]>
Co-authored-by: ubuntu <[email protected]>
Co-authored-by: Santiago Alvarez <[email protected]>
Co-authored-by: Santiago Álvarez <[email protected]>
Co-authored-by: ygorelik <[email protected]>
Co-authored-by: Yan Gorelik <[email protected]>
Co-authored-by: Daniele Gargano <[email protected]>
Co-authored-by: Shmuel Hazan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants