03-31-2021 03:44 AM
Hi All,
I am getting "Data is invalid according to the yang model. Libyang error: Unknown element "qos". Path: '/Cisco-IOS-XR-um-policymap-classmap-cfg:policy-map/type/qos[policy-map-name='l2vpn-v1410-PE-PARENT-EGRESS']'" while using the Codec Service to generation XML RPC configuration.
Below are the log messages -
2021-03-31 09:05:00,474 [CID=1234567] [Thread-6] DEBUG ydk - Extracting module names from JSON payload
2021-03-31 09:05:00,474 [CID=1234567] [Thread-6] DEBUG ydk - Loading module 'Cisco-IOS-XR-um-policymap-classmap-cfg', revision ''
2021-03-31 09:05:00,474 [CID=1234567] [Thread-6] DEBUG ydk - [libyang] Searching for "Cisco-IOS-XR-um-policymap-classmap-cfg" in /opt/adani/Code/PycharmProjects/netconf-adapter-testapi/venv/lib/python3.6/site-packages/ydk/models/bt_cisco_ios_xr/_yang.
2021-03-31 09:05:00,475 [CID=1234567] [Thread-6] DEBUG ydk - [libyang] Searching for "Cisco-IOS-XR-um-policymap-classmap-cfg" in /opt/adani/Code/PycharmProjects/netconf-adapter-testapi.
2021-03-31 09:05:00,475 [CID=1234567] [Thread-6] DEBUG ydk - [libyang] Loading schema from "/opt/adani/Code/PycharmProjects/netconf-adapter-testapi/venv/lib/python3.6/site-packages/ydk/models/bt_cisco_ios_xr/_yang/Cisco-IOS-XR-um-policymap-classmap-cfg.yang" file.
2021-03-31 09:05:00,475 [CID=1234567] [Thread-6] DEBUG ydk - [libyang] Searching for "cisco-semver" in /opt/adani/Code/PycharmProjects/netconf-adapter-testapi/venv/lib/python3.6/site-packages/ydk/models/bt_cisco_ios_xr/_yang.
2021-03-31 09:05:00,476 [CID=1234567] [Thread-6] DEBUG ydk - [libyang] Searching for "cisco-semver" in /opt/adani/Code/PycharmProjects/netconf-adapter-testapi.
2021-03-31 09:05:00,476 [CID=1234567] [Thread-6] DEBUG ydk - [libyang] Loading schema from "/opt/adani/Code/PycharmProjects/netconf-adapter-testapi/venv/lib/python3.6/site-packages/ydk/models/bt_cisco_ios_xr/_yang/cisco-semver.yang" file.
2021-03-31 09:05:00,476 [CID=1234567] [Thread-6] DEBUG ydk - [libyang] Module "cisco-semver@2019-03-13" successfully parsed as implemented.
2021-03-31 09:05:00,477 [CID=1234567] [Thread-6] DEBUG ydk - [libyang] Searching for "Cisco-IOS-XR-types" in /opt/adani/Code/PycharmProjects/netconf-adapter-testapi/venv/lib/python3.6/site-packages/ydk/models/bt_cisco_ios_xr/_yang.
2021-03-31 09:05:00,477 [CID=1234567] [Thread-6] DEBUG ydk - [libyang] Searching for "Cisco-IOS-XR-types" in /opt/adani/Code/PycharmProjects/netconf-adapter-testapi.
2021-03-31 09:05:00,477 [CID=1234567] [Thread-6] DEBUG ydk - [libyang] Loading schema from "/opt/adani/Code/PycharmProjects/netconf-adapter-testapi/venv/lib/python3.6/site-packages/ydk/models/bt_cisco_ios_xr/_yang/Cisco-IOS-XR-types.yang" file.
2021-03-31 09:05:00,479 [CID=1234567] [Thread-6] DEBUG ydk - [libyang] Module "Cisco-IOS-XR-types@2020-06-25" successfully parsed as implemented.
2021-03-31 09:05:00,487 [CID=1234567] [Thread-6] DEBUG ydk - [libyang] Resolving "Cisco-IOS-XR-um-policymap-classmap-cfg" unresolved schema nodes and their constraints...
2021-03-31 09:05:00,488 [CID=1234567] [Thread-6] DEBUG ydk - [libyang] All "Cisco-IOS-XR-um-policymap-classmap-cfg" schema nodes and constraints resolved.
2021-03-31 09:05:00,488 [CID=1234567] [Thread-6] DEBUG ydk - [libyang] Module "Cisco-IOS-XR-um-policymap-classmap-cfg@2020-10-05" successfully parsed as implemented.
2021-03-31 09:05:00,488 [CID=1234567] [Thread-6] DEBUG ydk - Added new libyang module 'Cisco-IOS-XR-um-policymap-classmap-cfg'
2021-03-31 09:05:00,488 [CID=1234567] [Thread-6] DEBUG ydk - Populating new module schema 'Cisco-IOS-XR-um-policymap-classmap-cfg'
2021-03-31 09:05:00,489 [CID=1234567] [Thread-6] ERROR ydk - Data is invalid according to the yang model. Libyang error: Unknown element "qos". Path: '/Cisco-IOS-XR-um-policymap-classmap-cfg:policy-map/type/qos[policy-map-name='l2vpn-v1410-PE-PARENT-EGRESS']'
2021-03-31 09:05:00,489 [CID=1234567] [Thread-6] ERROR ydk - Parsing failed with message Unknown element "qos".
03-31-2021 01:52 PM
The YANG model states this:
container policy-map {
description
"Configure a policy-map";
container type {
description
"policy-map type";
...
list qos {
if-feature "pmap-type-qos";
key "policy-map-name";
...
That means the feature "pmap-type-qos" must be enabled in order for "list qos" to be present in the model. In the log it is visible that this feature is not present in server capabilities. If it was present, the log would have this message:
DEBUG ydk - Enabled feature 'pmap-type-qos' in 'Cisco-IOS-XR-um-policymap-classmap-cfg'
Please check that your server indeed supports feature "pmap-type-qos" and the feature is present in the capabilities for module "Cisco-IOS-XR-um-policymap-classmap-cfg".
03-31-2021 11:58 PM - edited 04-01-2021 12:40 AM
Thank you for response
The logs shared above are before the Netconf Session/Capabilities are exchanged, I am not using YDK NetconfProvider, just using Codec Service to convert JSON configuration templates to XML. using the CodecServiceProvider with type=json or type=xml, Do I need to use discovery capabilities before using CodecServiceProvider ?
From my understanding - the decode of JSON to YDK Python Object is failing
<capability>http://cisco.com/ns/yang/Cisco-IOS-XR-um-policymap-classmap-cfg?module=Cisco-IOS-XR-um-policymap-classmap-cfg&revision=2020-01-27&features=pmap-type-qos,pmap-type-pbr,pmap-type-accounting,pmap-type-redirect,pmap-type-traffic,pmap-type-control,pmap-type-afmon,cmap-type-qos,cmap-type-traffic,match-ipv4-acl,match-ipv6-acl,match-ethernet-services-acl,match-ipv4-dscp,match-ipv4-prec,match-ipv6-dscp,match-ipv6-prec,match-dscp,match-prec,match-proto,match-mpls-exp-top,match-cos,match-cos-inner,match-vlan,match-vlan-inner,match-source-port,match-destination-port,match-src-mac,match-dst-mac,match-src-addr-ipv4,match-dst-addr-ipv4,match-src-addr-ipv6,match-dst-addr-ipv6,match-atm,match-cac,match-dei,match-dei-inner,match-discard-class,match-ethertype,match-flow-key,match-fragment-type,flow-max-count,match-fr-de,match-fr,match-mpls-disp-ipv4-acl,match-mpls-disp-ipv6-acl,match-mpls-disp-cmap,match-mpls-exp-imposition,match-ipv4-packet-length,match-ipv6-packet-length,match-authen-status,match-timer,match-username,match-vpls-known,match-vpls-unknown,match-vpls-control,matchnot-ipv4-acl,matchnot-ipv6-acl,matchnot-es-acl,matchnot-cac-local,matchnot-dei,matchnot-authen-status,matchnot-protocol,matchnot-timer,matchnot-username,matchnot-ethertype,matchnot-fr-de,matchnot-fr,matchnot-ipv4-packet-length,matchnot-ipv6-packet-length,matchnot-vlan,matchnot-vlan-inner,matchnot-vpls-known,matchnot-vpls-unknown,matchnot-vpls-bcast,matchnot-vpls-control,matchnot-vpls-mcast,matchnot-flow-tag,matchnot-mac-address,matchnot-mpls-disp-ipv4-acl,matchnot-mpls-disp-ipv6-acl,action-compress-header-ip,action-encap-sequence,action-accounting,action-prepaid,action-timeout,action-authenticate,action-authorize,action-disconnect,action-monitor,action-set-timer,action-stop-timer,action-copy,action-http-redirect,action-http-enrichment,action-punt,action-redirect-nexthop,action-redirect-rt,action-service-function,action-set-dst-address,action-set-df,action-set-fwd-class,action-set-src-address,action-transmit,action-decap-gre,action-fmm,action-metric,action-ipcbr,action-ipcbr-pkt-rate,action-ipcbr-media-rate,action-mdi-pkt-rate,action-rtp,action-rtp-min-seq,action-rtp-seq-ext,action-rtp-j2k,action-rtp-mmr,action-rtp-voice,action-react,action-react-snmp,action-react-clone,action-react-alarm,action-react-grouped-alarm,action-cac,action-bandwidth,action-service-fragment,action-pfc,action-police-bucket,action-police-peak-burst,action-police-conform-color,action-police-exceed-color,action-police-coupled,action-police-set-fr-de,action-set-atm-clp,action-set-traffic-class,action-shape-burst,action-service-from-line,action-service-internal</capability>
04-04-2021 02:54 PM
If you are not using Netconf capabilities and just want to use CodecService for encoding your model object to XML or JSON string, you have to initialize CodecServiceProvider by explicitly specifying capabilities. Here is example that you would need to adopt to your application:
from ydk.path import Repository
from ydk.providers import CodecServiceProvider
from ydk.services import CodecService
repo = Repository('path/to/model/repository')
lookup_table = {'http://cisco.com/ns/yang/Cisco-IOS-XR-um-policymap-classmap-cfg': Capability('Cisco-IOS-XR-um-policymap-classmap-cfg', '', ['pmap-type-qos'], []),
}
capabilities = [Capability('Cisco-IOS-XR-um-policymap-classmap-cfg', '', ['pmap-type-qos'], []),
]
root_schema = repo.create_root_schema(lookup_table, capabilities)
json_codec_provider = CodecServiceProvider(type='json', repo=repo)
xml_codec_provider = CodecServiceProvider(type='xml', repo=repo)
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