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

Device features advertised in capability for imported model should be considered #777

Closed
ghost opened this issue May 1, 2018 · 4 comments
Assignees
Labels
Projects

Comments

@ghost
Copy link

ghost commented May 1, 2018

If a device advertises feature compliance in a model 'x' that is imported by model 'y', these features must be considered by YDK when validating the yang models.

Current behavior

Currently, because the features from hello message capabilities are not correctly parsed, something like the below error occurs

ydk.errors.YCoreError:  YCodecError:Unknown element "ipsec".. Path: /Cisco-IOS-XE-native:native/interface/Tunnel[name='1']/Cisco-IOS-XE-tunnel:tunnel/protection/Cisco-IOS-XE-crypto:ipsec

or

YError: YCodecError:Unknown element "bundle-name".. Path: /Cisco-IOS-XE-native:native/multilink/Cisco-IOS-XE-ppp:bundle-name
@ghost ghost added the bug label May 1, 2018
@ghost ghost added this to To do in YDK May 1, 2018
@ghost ghost assigned ygorelik May 16, 2018
@ghost
Copy link
Author

ghost commented May 17, 2018

from ydk.models.cisco_ios_xe import Cisco_IOS_XE_native 

native=Cisco_IOS_XE_native.Native()
tunnel = native.interface.Tunnel()
tunnel.name = 1
tunnel.tunnel.destination = '172.58.2.1'
tunnel.ip.address.primary.address = '192.168.1.1'
tunnel.ip.address.primary.mask = '255.255.255.252'
tunnel.tunnel.source = 'GigabitEthernet0/0/0'
tunnel.tunnel.protection.ipsec.profile = 'ipsec-profile'
tunnel.tunnel.protection.ipsec.ikev2_profile = 'ikev2-profile'
native.interface.tunnel.append(tunnel)

@ygorelik
Copy link
Collaborator

I could not reproduce the issue when using lab device XE16.7.1 and path API:

        # Create a NetconfSession instance to connect to the device
        netconf_session = NetconfSession('10.30.110.87', 'admin', 'admin')
        root = netconf_session.get_root_schema()

        native = root.create_datanode("Cisco-IOS-XE-native:native")

        tunnelInt = native.create_datanode("interface/Tunnel[name='521']")

        # Configure tunnel
        tunnel = tunnelInt.create_datanode("Cisco-IOS-XE-tunnel:tunnel")
        tunnel.create_datanode("source", "GigabitEthernet0/0/0")
        tunnel.create_datanode("destination", "172.58.2.1");

        # Tunnel Interface IP address
        ip = tunnelInt.create_datanode("ip")
        address = ip.create_datanode("address/primary")
        address.create_datanode("address", "192.168.1.1")
        address.create_datanode("mask", "255.255.255.252")

        # Protection IPsec
        ipsec = tunnel.create_datanode("protection/Cisco-IOS-XE-crypto:ipsec")
        ipsec.create_datanode("profile","ipsec-profile")
        ipsec.create_datanode("ikev2-profile","ipsec-ikev2-profile")

        c = Codec()

        xml = c.encode(native, EncodingFormat.XML, True)
        print(xml)

See attached log for details:
test_777.log

@ghost
Copy link
Author

ghost commented May 18, 2018

Looks like you are using codec.encode(). Can you try to write to the device using Rpc?

ygorelik pushed a commit to ygorelik/ydk-gen that referenced this issue May 23, 2018
ygorelik pushed a commit to ygorelik/ydk-gen that referenced this issue May 23, 2018
@ygorelik
Copy link
Collaborator

Resolved the bug. Added core test case, which uses MockSession class.

YDK automation moved this from To do to Done May 24, 2018
ghost pushed a commit that referenced this issue May 24, 2018
* Fixed issue #777

* Moved YList functions to new 'ylist' package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
YDK
  
Done
Development

No branches or pull requests

1 participant