<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Test script adding additional aWIPS to DNA center. in Controllers</title>
    <link>https://community.cisco.com/t5/controllers/test-script-adding-additional-awips-to-dna-center/m-p/4861656#M2580</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Testing the DNA center API.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To locate Wireless Intrusion Prevention System (WIPS) information in Cisco DNA Center, you can use the Cisco DNA Center API. Specifically, you can make use of the &lt;/SPAN&gt;GET /dna/intent/api/v1/stealthwatch/wips/rogue-aps&lt;SPAN&gt; endpoint to retrieve WIPS-related details for rogue APs. Here's an example script in Python that demonstrates how to retrieve the mentioned WIPS information:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import requests&lt;/P&gt;&lt;P&gt;# Cisco DNA Center API endpoint and credentials&lt;BR /&gt;base_url = 'https://&amp;lt;DNA_CENTER_IP&amp;gt;'&lt;BR /&gt;username = '&amp;lt;USERNAME&amp;gt;'&lt;BR /&gt;password = '&amp;lt;PASSWORD&amp;gt;'&lt;/P&gt;&lt;P&gt;# Authentication: Get the access token&lt;BR /&gt;auth_endpoint = base_url + '/dna/system/api/v1/auth/token'&lt;BR /&gt;auth_headers = {'Content-Type': 'application/json'}&lt;BR /&gt;auth_payload = {'username': username, 'password': password}&lt;BR /&gt;auth_response = requests.post(auth_endpoint, headers=auth_headers, json=auth_payload, verify=False)&lt;BR /&gt;auth_response.raise_for_status()&lt;BR /&gt;access_token = auth_response.json()['Token']&lt;/P&gt;&lt;P&gt;# WIPS endpoint&lt;BR /&gt;wips_endpoint = base_url + '/dna/intent/api/v1/stealthwatch/wips/rogue-aps'&lt;/P&gt;&lt;P&gt;# API request headers&lt;BR /&gt;headers = {&lt;BR /&gt;'Content-Type': 'application/json',&lt;BR /&gt;'X-Auth-Token': access_token&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;try:&lt;BR /&gt;# Send the API request&lt;BR /&gt;response = requests.get(wips_endpoint, headers=headers, verify=False)&lt;BR /&gt;response.raise_for_status()&lt;/P&gt;&lt;P&gt;# Handle the API response&lt;BR /&gt;wips_data = response.json()&lt;/P&gt;&lt;P&gt;# Extract and display the relevant information&lt;BR /&gt;for rogue_ap in wips_data['response']:&lt;BR /&gt;print("Last Seen Time:", rogue_ap['lastSeenTime'])&lt;BR /&gt;print("Rogue MAC Address:", rogue_ap['macAddress'])&lt;BR /&gt;print("Detecting AP Name:", rogue_ap['detectingAPName'])&lt;BR /&gt;print("Radio Type:", rogue_ap['radioType'])&lt;BR /&gt;print("Controller IP Address:", rogue_ap['controllerIpAddress'])&lt;BR /&gt;print("Detecting AP Map Location:", rogue_ap['detectingAPMapLocation'])&lt;BR /&gt;print("SSID:", rogue_ap['ssid'])&lt;BR /&gt;print("Rogue AP Channel Number:", rogue_ap['rogueApChannelNumber'])&lt;BR /&gt;print("Severity Score:", rogue_ap['severityScore'])&lt;BR /&gt;print("Classification Name:", rogue_ap['classificationName'])&lt;BR /&gt;print("Alarm State:", rogue_ap['alarmState'])&lt;BR /&gt;print("Classification Type:", rogue_ap['classificationType'])&lt;BR /&gt;print("On Network:", rogue_ap['onNetwork'])&lt;BR /&gt;print("Encryption:", rogue_ap['encryption'])&lt;BR /&gt;print("Switch IP Address:", rogue_ap['switchIpAddress'])&lt;BR /&gt;print("Switch Name:", rogue_ap['switchName'])&lt;BR /&gt;print("Port Description:", rogue_ap['portDescription'])&lt;BR /&gt;print("--------------------------------------")&lt;/P&gt;&lt;P&gt;except requests.exceptions.RequestException as e:&lt;BR /&gt;print("Error:", e)&lt;/P&gt;</description>
    <pubDate>Sat, 24 Jun 2023 01:50:14 GMT</pubDate>
    <dc:creator>andrewboyd21</dc:creator>
    <dc:date>2023-06-24T01:50:14Z</dc:date>
    <item>
      <title>Test script adding additional aWIPS to DNA center.</title>
      <link>https://community.cisco.com/t5/controllers/test-script-adding-additional-awips-to-dna-center/m-p/4861656#M2580</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Testing the DNA center API.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To locate Wireless Intrusion Prevention System (WIPS) information in Cisco DNA Center, you can use the Cisco DNA Center API. Specifically, you can make use of the &lt;/SPAN&gt;GET /dna/intent/api/v1/stealthwatch/wips/rogue-aps&lt;SPAN&gt; endpoint to retrieve WIPS-related details for rogue APs. Here's an example script in Python that demonstrates how to retrieve the mentioned WIPS information:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import requests&lt;/P&gt;&lt;P&gt;# Cisco DNA Center API endpoint and credentials&lt;BR /&gt;base_url = 'https://&amp;lt;DNA_CENTER_IP&amp;gt;'&lt;BR /&gt;username = '&amp;lt;USERNAME&amp;gt;'&lt;BR /&gt;password = '&amp;lt;PASSWORD&amp;gt;'&lt;/P&gt;&lt;P&gt;# Authentication: Get the access token&lt;BR /&gt;auth_endpoint = base_url + '/dna/system/api/v1/auth/token'&lt;BR /&gt;auth_headers = {'Content-Type': 'application/json'}&lt;BR /&gt;auth_payload = {'username': username, 'password': password}&lt;BR /&gt;auth_response = requests.post(auth_endpoint, headers=auth_headers, json=auth_payload, verify=False)&lt;BR /&gt;auth_response.raise_for_status()&lt;BR /&gt;access_token = auth_response.json()['Token']&lt;/P&gt;&lt;P&gt;# WIPS endpoint&lt;BR /&gt;wips_endpoint = base_url + '/dna/intent/api/v1/stealthwatch/wips/rogue-aps'&lt;/P&gt;&lt;P&gt;# API request headers&lt;BR /&gt;headers = {&lt;BR /&gt;'Content-Type': 'application/json',&lt;BR /&gt;'X-Auth-Token': access_token&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;try:&lt;BR /&gt;# Send the API request&lt;BR /&gt;response = requests.get(wips_endpoint, headers=headers, verify=False)&lt;BR /&gt;response.raise_for_status()&lt;/P&gt;&lt;P&gt;# Handle the API response&lt;BR /&gt;wips_data = response.json()&lt;/P&gt;&lt;P&gt;# Extract and display the relevant information&lt;BR /&gt;for rogue_ap in wips_data['response']:&lt;BR /&gt;print("Last Seen Time:", rogue_ap['lastSeenTime'])&lt;BR /&gt;print("Rogue MAC Address:", rogue_ap['macAddress'])&lt;BR /&gt;print("Detecting AP Name:", rogue_ap['detectingAPName'])&lt;BR /&gt;print("Radio Type:", rogue_ap['radioType'])&lt;BR /&gt;print("Controller IP Address:", rogue_ap['controllerIpAddress'])&lt;BR /&gt;print("Detecting AP Map Location:", rogue_ap['detectingAPMapLocation'])&lt;BR /&gt;print("SSID:", rogue_ap['ssid'])&lt;BR /&gt;print("Rogue AP Channel Number:", rogue_ap['rogueApChannelNumber'])&lt;BR /&gt;print("Severity Score:", rogue_ap['severityScore'])&lt;BR /&gt;print("Classification Name:", rogue_ap['classificationName'])&lt;BR /&gt;print("Alarm State:", rogue_ap['alarmState'])&lt;BR /&gt;print("Classification Type:", rogue_ap['classificationType'])&lt;BR /&gt;print("On Network:", rogue_ap['onNetwork'])&lt;BR /&gt;print("Encryption:", rogue_ap['encryption'])&lt;BR /&gt;print("Switch IP Address:", rogue_ap['switchIpAddress'])&lt;BR /&gt;print("Switch Name:", rogue_ap['switchName'])&lt;BR /&gt;print("Port Description:", rogue_ap['portDescription'])&lt;BR /&gt;print("--------------------------------------")&lt;/P&gt;&lt;P&gt;except requests.exceptions.RequestException as e:&lt;BR /&gt;print("Error:", e)&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jun 2023 01:50:14 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/test-script-adding-additional-awips-to-dna-center/m-p/4861656#M2580</guid>
      <dc:creator>andrewboyd21</dc:creator>
      <dc:date>2023-06-24T01:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Test script adding additional aWIPS to DNA center.</title>
      <link>https://community.cisco.com/t5/controllers/test-script-adding-additional-awips-to-dna-center/m-p/4891283#M2592</link>
      <description>&lt;P&gt;For some reason I got the error:&lt;BR /&gt;&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "/Users/Doc/DNA-C/dnac_wips.py", line 15, in &amp;lt;module&amp;gt;&lt;BR /&gt;auth_response.raise_for_status()&lt;BR /&gt;File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/models.py", line 960, in raise_for_status&lt;BR /&gt;raise HTTPError(http_error_msg, response=self)&lt;BR /&gt;requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: &lt;A href="https://10.194.104.200/dna/system/api/v1/auth/token" target="_blank"&gt;https://&amp;lt;&lt;SPAN&gt;DNA_CENTER_IP&amp;gt;&lt;/SPAN&gt;/dna/system/api/v1/auth/token&lt;/A&gt;&lt;BR /&gt;I replaced the post request for getting token then it's ok. Of cause we need to fix the indentation caused by copy and paste too.&lt;BR /&gt;&lt;BR /&gt;auth_response=requests.post(auth_endpoint, auth=(username, password), verify=False)&lt;BR /&gt;#auth_response = requests.post(auth_endpoint, headers=auth_headers, json=auth_payload, verify=False)&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2023 18:18:14 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/test-script-adding-additional-awips-to-dna-center/m-p/4891283#M2592</guid>
      <dc:creator>yawming</dc:creator>
      <dc:date>2023-07-24T18:18:14Z</dc:date>
    </item>
  </channel>
</rss>

