cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1021
Views
4
Helpful
9
Replies

Translate NETCONF query to a RESTCONF query (Cisco-IOS-XE-matm-oper)

Hello,

Somebody knows how to translate this NETCONF query to a RESTCONF query ?

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
  <get>
    <filter>
      <matm-oper-data xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-matm-oper">
        <matm-table>
          <vlan-id-number>63</vlan-id-number>
        </matm-table>
      </matm-oper-data>
    </filter>
  </get>
</rpc>

The idea is to get all MAC addresses from the VLAN 63 (show mac address-table vlan 63).

I try these with RESTCONF:

without success, each time error 404:

{
    "ietf-restconf:errors": {
        "error": [
            {
                "error-type": "application",
                "error-tag": "invalid-value",
                "error-message": "uri keypath not found"
            }
        ]
    }
}

We use YANG models from IOS-XE 17.6.x on Catalyst 9000.

Thanks in advance for the help.

Olivier

2 Accepted Solutions
9 Replies 9

Not got a support device to test on. but think... might work?

 

/restconf/data/Cisco-IOS-XE-vlan-oper:vlans/vlan=63/mac-address-table

 

 

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Hello,

Nop, not working, error 404.

Thank for the help.

Olivier

Hmm.... Try this one /restconf/data/Cisco-IOS-XE-matm-oper:matm-oper-data there is an example here

https://github.com/cober2019/Network-Automation/blob/master/Restconf/mac_address_table.py

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Marcel Zehnder
Spotlight
Spotlight

Hi, the table has two keys (table-type + vlan-id-number) - so to get the table for vlan 63 you must use

https://IP/restconf/data/Cisco-IOS-XE-matm-oper:matm-oper-data/matm-table=mat-vlan,63/matm-mac-entry

HTH

Hello,

OK thanks, I understand better, and if I'm right, if I want to get entries related to a MAC address, I have the 3 keys in the URL:

name	matm-mac-entry
nodetype	list
description	Lists all MAC entries associated with this VLAN
module	Cisco-IOS-XE-matm-oper
revision	2019-05-01
xpath	/matm-oper-data/matm-table/matm-mac-entry
prefix	matm-ios-xe-oper
namespace	http://cisco.com/ns/yang/Cisco-IOS-XE-matm-oper
schema node id	/matm-oper-data/matm-table/matm-mac-entry
keys	
    "table-type"
    "vlan-id-number"
    "mac"
access	read-only
operations	
    "get"

So an URL like this: restconf/data/Cisco-IOS-XE-matm-oper:matm-oper-data/matm-table/matm-mac-entry=mat-vlan,63,00:1f:80:18:19:24
But it's not working, the MAC address should be encoded in a special form ?

The content of matm-table for VLAN 63:

{
    "Cisco-IOS-XE-matm-oper:matm-table": {
        "table-type": "mat-vlan",
        "vlan-id-number": 63,
        "aging-time": 300,
        "matm-mac-entry": [
            {
...
            {
                "table-type": "mat-vlan",
                "vlan-id-number": 63,
                "mac": "00:1f:80:18:19:24",
                "mat-addr-type": "dynamic",
                "port": "Gi1/0/1"
            },
...

 

Would this work?

 

restconf/data/Cisco-IOS-XE-matm-oper:matm-oper-data/matm-table/table-type=mat-vlan&vlan-id-number=63&mac='00:1f:80:18:19:24'

 

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

OK, now I correctly understand.

I was able to resolv my self another URL where there is a lot of keys with I was fighting since a day: restconf/data/Cisco-IOS-XE-bgp-oper:bgp-state-data/bgp-route-vrfs/bgp-route-vrf=cpe-mgmt-vrf/bgp-route-afs/bgp-route-af=vpnv4-unicast/bgp-route-filters/bgp-route-filter=bgp-rf-all/bgp-route-entries/bgp-route-entry=172.18.61.129%2F32
(get the detail of a prefix in a VRF in BGP)

Thanks for help.

No problem - glad I could help.