05-23-2023 07:56 AM
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
Solved! Go to Solution.
05-24-2023 05:00 AM
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
05-24-2023 06:57 AM - edited 05-24-2023 06:58 AM
You need to specifiy the keys in both levels:
https://IP/restconf/data/Cisco-IOS-XE-matm-oper:matm-oper-data/matm-table=mat-vlan,63/matm-mac-entry=mat-vlan,63,00:1f:80:18:19:24
05-23-2023 08:50 AM
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
05-24-2023 01:33 AM
Hello,
Nop, not working, error 404.
Thank for the help.
Olivier
05-24-2023 02:28 AM
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
05-24-2023 05:00 AM
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
05-24-2023 06:18 AM
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"
},
...
05-24-2023 06:26 AM
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'
05-24-2023 06:57 AM - edited 05-24-2023 06:58 AM
You need to specifiy the keys in both levels:
https://IP/restconf/data/Cisco-IOS-XE-matm-oper:matm-oper-data/matm-table=mat-vlan,63/matm-mac-entry=mat-vlan,63,00:1f:80:18:19:24
05-24-2023 07:41 AM
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.
05-24-2023 07:50 AM
No problem - glad I could help.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: