Wireless

 View Only
last person joined: 9 days ago 

Ask questions and share experiences with Mist APs, Marvis, and all things wireless and Wi-Fi.
  • 1.  Bulk AP naming via python

    Posted 10 days ago

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


  • 2.  RE: Bulk AP naming via python

    Posted 10 days ago

    And curious question. If a device is still in org inventory, will this move it to the site if it is missing? Would be nice to do a two for one move and rename in a single hit.



    ------------------------------
    CHRISTOPHER HIATT
    ------------------------------



  • 3.  RE: Bulk AP naming via python

     
    Posted 9 days ago

    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




  • 4.  RE: Bulk AP naming via python

    Posted 9 days ago

    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






  • 5.  RE: Bulk AP naming via python

    Posted 9 days ago

    Thank you.

    See if they can modify the script to rename and move to a site in one shot or create a second example script to move APs from org inventory to site inventory.



    ------------------------------
    CHRISTOPHER HIATT
    ------------------------------