cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2279
Views
10
Helpful
2
Replies

DNAC API client-detail - "MAC Address has an invalid format"

pescla
Spotlight
Spotlight

I want to call client details such as username, IP, MAC from DNAC controlled switches via API. I am running Version 1.3.3.9.

I get an auth token by supplying login credentials via Basic Auth. Then i call /api/v1/host to get a list of all endpoints (i know this is deprecated but i could not find a newer alternative...) so far everything works.

 

Then i use the MAC that is returned from the last API call, in this format: "00:00:2a:01:00:19" and pass it as a JSON Body into /dna/intent/api/v1/client-detail:

 

{
    "macAddress""00:00:2a:01:00:19"
}

 

But i get back HTTP 200 - "errorMessage" : "MAC Address has an invalid format". Why? I tried every possible format i can think of, removing ":", replacing it with "-", uppercase, lowercase. I dont understand, what is this error? I tried it with the devnet sandbox aswell, same issue.

 

 

 

1 Accepted Solution

Accepted Solutions

Alex Stevenson
Cisco Employee
Cisco Employee

 

Hi @pescla,

 

Well, the Version 1.3.3 Docs (https://dnacentersdk.readthedocs.io/en/latest/api/api.html#clients-1-3-3) state the following:

 

get_client_detail(mac_address, timestamp=None, headers=None, **request_parameters)[source]

Returns detailed Client information retrieved by Mac Address for any given point of time. .

Parameters
  • timestamp (basestring, int) – Epoch time(in milliseconds) when the Client health data is required.

  • mac_address (basestring) – MAC Address of the client.

  • headers (dict) – Dictionary of HTTP Headers to send with the Request .

  • **request_parameters – Additional request parameters (provides support for parameters that may be added in the future).

Returns

JSON response. Access the object’s properties by using the dot notation or the bracket notation.

Return type

MyDict

Raises
  • TypeError – If the parameter types are incorrect.

  • MalformedRequest – If the request body created is invalid.

  • ApiError – If the DNA Center cloud returns an error.

 

You are converting the MAC address to a string, so that's correct. The error you're getting doesn't exactly match anything they have listed here. Have you tried truncating the leading zeros in the MAC address? I think it would be "::2a:01:00:19", at least that's how we do it with IPv6. Not sure if it's allowed with MACs, actually, but it's worth a try. Another thing to observe is that this MAC begins with a zero, meaning it's Unicast. Is that type of traffic allowed?

 

View solution in original post

2 Replies 2

Alex Stevenson
Cisco Employee
Cisco Employee

 

Hi @pescla,

 

Well, the Version 1.3.3 Docs (https://dnacentersdk.readthedocs.io/en/latest/api/api.html#clients-1-3-3) state the following:

 

get_client_detail(mac_address, timestamp=None, headers=None, **request_parameters)[source]

Returns detailed Client information retrieved by Mac Address for any given point of time. .

Parameters
  • timestamp (basestring, int) – Epoch time(in milliseconds) when the Client health data is required.

  • mac_address (basestring) – MAC Address of the client.

  • headers (dict) – Dictionary of HTTP Headers to send with the Request .

  • **request_parameters – Additional request parameters (provides support for parameters that may be added in the future).

Returns

JSON response. Access the object’s properties by using the dot notation or the bracket notation.

Return type

MyDict

Raises
  • TypeError – If the parameter types are incorrect.

  • MalformedRequest – If the request body created is invalid.

  • ApiError – If the DNA Center cloud returns an error.

 

You are converting the MAC address to a string, so that's correct. The error you're getting doesn't exactly match anything they have listed here. Have you tried truncating the leading zeros in the MAC address? I think it would be "::2a:01:00:19", at least that's how we do it with IPv6. Not sure if it's allowed with MACs, actually, but it's worth a try. Another thing to observe is that this MAC begins with a zero, meaning it's Unicast. Is that type of traffic allowed?

 

Thanks, that must have been it, i could use the API successfully in the 2.2.2.3 Cisco Sandbox and will try in our environment when our new 2.2.x DNAC is ready.

Getting Started

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: