I manage the doc team. We'll get the python script corrected and re-posted as soon as possible.
Apologies for the inaccuracy.
Thanks
--Pete
Pete Robbins
Senior Manager, Product Adoption Content and Education (PACE)
AI-Driven Enterprise
Juniper Networks, Inc.
Juniper.net/documentation
Juniper Business Use Only
Original Message:
Sent: 2/5/2025 7:33:00 AM
From: asharp
Subject: RE: Bulk AP naming via python
The example code on the Juniper website is incorrect. I've raised this with the doc team and hopefully they will be able to update the code example with something that is accurate.
At a guess, I would say that the definition for retreive_ap_mac_list() is incorrect, and should be as follows:
def retreive_ap_mac_list(csv_filename: str):
"""
This function converts the content of the CSV file to a Python dictionary.
Parameters:
- csv_filename: the name of the comma separated value file.
Returns:
- A dictionary containing the content of the CSV file
"""
ap_csv = csv.DictReader(csv_filename)
ap_list = []
for line in ap_csv:
ap_list.append(line)
return ap_list
In relation to your question below, the script as it is won't move a device from org inventory to a site. It will just print that the ap is not part of the site.
Regards
Original Message:
Sent: 02-04-2025 12:13
From: CHRISTOPHER HIATT
Subject: Bulk AP naming via python
I'm referencing the following use case document from Juniper.
When I try to run the script I'm getting the following error. I'm also not 100% certain on the syntax of how the CSV filename is entered into the scrip. I'm 30 minutes into learning Python. But any change in the CSV entry format gives the same error.
D:\Python>python main-rename-ap.py config.json ap-names.csv
File "D:\Python\main-rename-ap.py", line 67
def retreive_ap_mac_list(csv_ap-names: str) -} dict:
^
SyntaxError: unmatched '}'
Renaming Access Points (Use Case)
Juniper | remove preview |
| Renaming Access Points (Use Case) | At times, you and other wireless administrators need to rename Juniper Mist network access points (APs) at a specific site. Consistent naming helps provide order and consistency in network inventory documentation. For example, a site may physically move to a new location and take on a new naming convention. | View this on Juniper > |
|
|
------------------------------
CHRISTOPHER HIATT
------------------------------