cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
882
Views
5
Helpful
5
Replies
Jeremy Halcomb
Beginner

Yang MAC Address 'matm-oper' Filter

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!!

5 REPLIES 5
yangorelik
Participant

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

 

Yan Gorelik
YDK Solutions

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.

Could you please post the reply to the whole table. I wonder, what is the data structure of the response.
Yan Gorelik
YDK Solutions

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

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. 

Yan Gorelik
YDK Solutions
Content for Community-Ad

This widget could not be displayed.