03-08-2021 07:01 PM
Using Postman, I am able to pull down the MAC address table of a Catalyst 9200 with this URL: https://1.1.1.1/restconf/data/Cisco-IOS-XE-matm-oper:matm-oper-data/matm-table
The results look like:
{ "Cisco-IOS-XE-matm-oper:matm-table": [ { "table-type": "mat-vlan", "vlan-id-number": 1, "aging-time": 300, "matm-mac-entry": [ { "table-type": "mat-vlan", "vlan-id-number": 1, "mac": "11:11:11:22:22:22", "mat-addr-type": "dynamic", "port": "Te1/1/4" }, { "table-type": "mat-vlan", "vlan-id-number": 1, "mac": "11:22:33:22:33:11", "mat-addr-type": "dynamic", "port": "Te1/1/4" }, { "table-type": "mat-vlan", "vlan-id-number": 1, "mac": "00:00:00:11:11:11", "mat-addr-type": "dynamic", "port": "Te1/1/4" },...
How would I add a filter to only receive back only a single result, say I know the MAC address and want to use it as a filter?
The YANG model looks like this:
module: Cisco-IOS-XE-matm-oper +--ro matm-oper-data +--ro matm-table* [table-type vlan-id-number] +--ro aging-time? uint32 +--ro matm-mac-entry* [table-type vlan-id-number mac] | +--ro mat-addr-type? matm-ios-xe-oper:e-matm-addr-type | +--ro port? string | +--ro vlan-all? empty | +--ro table-type matm-ios-xe-oper:e-matm-table-type | +--ro vlan-id-number uint32 | +--ro mac yang:mac-address +--ro table-type matm-ios-xe-oper:e-matm-table-type +--ro vlan-id-number uint32
I have tried:
https://1.1.1.1/restconf/data/Cisco-IOS-XE-matm-oper:matm-oper-data/matm-table/mac=00:11:22:33:44:55
https://1.1.1.1/restconf/data/Cisco-IOS-XE-matm-oper:matm-oper-data/matm-table/matm-mac-entry
https://1.1.1.1/restconf/data/Cisco-IOS-XE-matm-oper:matm-oper-data/matm-table/matm-mac-entry/mac=00:11:22:33:44:55
and 1000 other combinations.
Thanks!!
03-09-2021 10:13 PM - edited 03-09-2021 10:44 PM
Hello Jeremy
The node matm-table is a list with keys table-type and vlan-id-number. The list matm-mac-entry also has 3 keys: table-type, vlan-id-number, mac. Therefore, in order to get single entry, you need to specify all of the keys in the query. Example:
https://1.1.1.1/restconf/data/Cisco-IOS-XE-matm-oper:matm-oper-data/matm-table/table-type=mat-vlan&vlan-id-number=1/matm-mac-entry/table-type=mat-vlan&vlan-id-number=1&mac=00:11:22:33:44:55
05-26-2021 11:52 AM - edited 05-26-2021 12:03 PM
Thank You yangorelik that makes sense.
If I try to go a little further and add the next part:
https://1.2.3.4/restconf/data/Cisco-IOS-XE-matm-oper:matm-oper-data/matm-table/table-type=mat-vlan&vlan-id-number=1
Shouldn't I get all MAC addresses on VLAN 1? I am getting a 500 Internal Server Error from Postman.
If I remove the last part "table-type=mat-vlan&vlan-id-number=1" then I get a reply of everything, which is what I expect.
05-26-2021 03:49 PM
05-27-2021 01:47 PM
Sure, when I run this:
https://1.2.3.4/restconf/data/Cisco-IOS-XE-matm-oper:matm-oper-data/matm-table/
I get this response:
{ "Cisco-IOS-XE-matm-oper:matm-table": [ { "table-type": "mat-vlan", "vlan-id-number": 1, "aging-time": 300, "matm-mac-entry": [ { "table-type": "mat-vlan", "vlan-id-number": 1, "mac": "11:11:11:11:11:11", "mat-addr-type": "dynamic", "port": "Gi4/0/2" } ] }, { "table-type": "mat-vlan", "vlan-id-number": 11, "aging-time": 300, "matm-mac-entry": [ { "table-type": "mat-vlan", "vlan-id-number": 11, "mac": "00:00:00:99:99:99", "mat-addr-type": "dynamic", "port": "Po1" }, { "table-type": "mat-vlan", "vlan-id-number": 11, "mac": "00:00:22:22:22:22", "mat-addr-type": "dynamic", "port": "Po1" }, { "table-type": "mat-vlan", "vlan-id-number": 11, "mac": "00:26:26:26:26:26", "mat-addr-type": "dynamic", "port": "Po1" }, { "table-type": "mat-vlan", "vlan-id-number": 11, "mac": "11:22:33:44:55:66", "mat-addr-type": "dynamic", "port": "Po1" },........etc
05-27-2021 02:51 PM
Hi Jeremy
In you previous post you are missing 'mac' parameter as it is a key for the table entry and must be specified in the request. It should be something like this:
https://1.2.3.4/restconf/data/Cisco-IOS-XE-matm-oper:matm-oper-data/matm-table/table-type=mat-vlan&vlan-id-number=11&mac='11:22:33:99:99:99'
Besides the specified plan number 1 is not present in the table, hence the issue.
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