Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Automatisierungstools

ZUSAMMENFASSUNG In diesem Thema werden einige Automatisierungstools beschrieben, die Sie mit Juniper MistTM verwenden können. Wir geben keine Empfehlung für eines der unten besprochenen Tools. Wir stellen die Informationen und Beispiele nur zu Informationszwecken zur Verfügung.

Übersicht über die Automatisierungstools

Die gesamte Juniper Mist GUI basiert auf der robusten Mist™ API. Diese Architektur ermöglicht die Verwaltung von Mist in hohem Maße anpassbar, flexibel und skalierbar. Mithilfe von Automatisierungstools können Sie Aufgaben oder Gruppen von Aufgaben ausführen, die in der GUI nicht verfügbar sind.

Automatisierung beginnt mit der Identifizierung und dem Verständnis der auszuführenden Aufgaben. Die meisten Automatisierungstools sind für Machine-to-Machine-Transaktionen konzipiert. Aufgrund dieses Designs sind Automatisierungstools für Menschen nicht immer intuitiv zu verstehen und zu konfigurieren. Zum Glück gibt es viele Tools, die Ihnen helfen, mit maschinenbasierten Schnittstellen zu interagieren und sogar Ihre eigenen Automatisierungsskripte zu erstellen. Die Juniper Mist API ist ein solches Tool.

Postman

Postman is a tool to help you automate Juniper Mist management tasks. Postman can do many things, but you will use it as an API client. According to the Postman web site (www.postman.com), the Postman API client is the foundational tool of Postman. This client enables you to easily explore, debug, and test your APIs while also enabling you to define complex API requests for HTTP, REST, SOAP, GraphQL, and WebSockets.

Postman provides its own API GUI client to interact with a REST API interface, and many others. Postman allows users to set up reusable environments and use variables for consistency and efficiency when testing. You can visually organize each individual request into an order, inspect and store responses for reuse, and even have Postman help generate programmatic code such as Python.

Here is a short video on using variables in Postman to interact with the Juniper Mist API.

Postman is an excellent development tool. You can use it to test individual configuration changes and then put them together into collections. This video is an excellent example of using Postman and a web browser to put together API requests to configure 802.1x in a switching template.

With the popularity of Postman, Juniper developers have published collections in the public Postman workspaces. Collections are a method of organizing API requests and documentation into groups. You can import, export, and share collections.

Here is a short video demonstrating the use of Postman collections and the Juniper Mist API.

The Postman collections incorporate many Juniper Mist capabilities. They also include collections for gathering client information, Mist Edge devices, switching, software-defined WAN (SD-WAN), and many other objects. You can find these collections, which include the Juniper Mist cloud APIs, Mist cloud WebSocket, and Mist Runner Collections, from this link: https://www.postman.com/juniper-mist/workspace/mist-systems-s-public-workspace.

Python

Python is an object-oriented programming language. It’s a popular language for many reasons. One reason is that Python is highly flexible and extensible. Compared to other programming languages, it is easy to learn and work with. Python is used for web development, data sciences, networking, and the Internet of Things (IoT), to name a few uses. It is open source and works on multiple platforms.

For more information about getting started with Python, check out the Python Software Foundation at https://www.python.org/about/gettingstarted/.

Juniper Networks supports Python use in many forms, such as direct script execution and toolkit scripts: https://www.juniper.net/documentation/us/en/software/junos/automation-scripting/topics/concept/junos-script-automation-python-scripts-overview.html

Python Script Examples

Leveraging the robust API library in Juniper Mist, you can automate tasks using Python. In this section, you will see some simple Python scripts that make a series of calls to the Mist API to gather information or make changes to Mist.

These scripts are meant to serve only as examples and may or may not work in your environment due to possible variances in your environment.

Display WLANs on a Specific Site

This is a simple example script that connects to the Mist API and displays all the wireless LANs (WLANs) for a specific site:

Comparing RSSI (Windows)

You execute this Python script on a Windows laptop. The script gathers the current signal quality percentage, not received signal strength indicator (RSSI), from a Windows laptop. The script then gets the RSSI from the access point (AP) to which the laptop is connected by parsing for the wireless adapter’s MAC. The script makes these requests simultaneously and displays the client’s signal quality on the same line as the AP’s RSSI. The script runs until you send a Ctrl+ccommand from your keyboard to break out of the script execution.

The script makes use of the netsh wlan show interface Windows command. This is the command’s output:

This is the script itself:

When you run the python script, the resulting output should look like this:

The Juniper Mist AP reports its statistics approximately every 60 seconds. This is the reason the AP RSSI only changed twice during the time the script was running.

Comparing RSSI (MacOS)

This Python script is executed on a MacBook laptop. It is nearly identical to the previous Windows script. The script simultaneously gathers the RSSI from the MacBook and gets the RSSI from the AP to which the laptop is connected by parsing for the wireless adapter’s MAC address. It makes these requests simultaneously and displays the client’s signal quality on the same line as the AP’s RSSI. The script runs until you send a Ctrl+c command to break out of the script execution. To access the command on the Mac OS, you must include the absolute path to the command: /SystemLibrary/PrivateFrameworks/Apple802111.framework/Versions/A/Resources/airport -I.

This is what the airport -I command displays:

This is the script itself:

When the script runs, it gathers the RSSI information from the MacBook and the connected AP (through a Mist API call) and prints its output on a single line. The script runs until you cancel it by issuing the Ctrl+c command.

The Juniper Mist AP reports its statistics approximately every 60 seconds. This is why the AP RSSI changes only once in the example output.

Random Password Creation for a Guest Portal

When you configure a WLAN for a guest portal, use the Guest Portalconfiguration to define the landing page. This is the page for guests to log on to their wireless network. This configuration page enables you to gather information about guests such as their full names, e-mail addresses, and company details. You can add custom fields if you need users to gather additional types of information.

You can configure the guest portal to use an alphanumeric passphrase for authorization. This is a manual process, but you can automate it to run regularly, such as daily, to create a new random password that you distribute to guests each day.

This image shows the current configured passphrase for the guest portal:

Random Password Creation for a Guest Portal

Below is a Python script to create a new, random password for a guest portal. This script will send a PUTcommand to the API to change the passphrase.

This is the output from the script. It lists the wlan name and the wlan_iduntil it finds the mist_guest WLAN (defined in the script) and resets the passphrase with the newly generated, random passphrase:

You can verify the passphrase change by going back to the WLAN configuration, or WLAN template page, and checking the guest portal configuration. When you click Reveal, you will see the new passphrase.

Random Password Creation for a Guest Portal

Zusätzliche Automatisierungsressourcen

Ausführliche Informationen und Beispiele finden Sie in den folgenden Ressourcen:

ist
Tabelle 1: Ressourcen für Juniper Mist Automation
Ressourcenbeschreibung , wo sie zu finden

Python-Skripte, die die Möglichkeiten von Mist APIs demonstrieren.

https://github.com/tmunzer/mist_library

Beispiele für Python-Skripte, die die Mist-APIs verwenden. Diese Skripts verwenden das mistapi Python-Paket, um den Authentifizierungsprozess zu vereinfachen. Um Skriptbeispiele anzuzeigen, gehen Sie zu:https://github.com/tmunzer/mist_library und durchsuchen Sie das Verzeichnis scripts .
MISTAPI – Python-Paket zur Verwendung von Mist-APIs Dieses Paket basiert auf den Mist OpenAPI-Spezifikationen und wurde entwickelt, um die Verwendung der Mist APIs mit Python-Skripten zu vereinfachen.

Weitere Informationen zum Paket finden Sie unter: https://pypi.org/project/mistapi/

Mist API Labs Proof-of-Concept und Prototypen von Anwendungen und Skripten, die erstellt wurden, um die Möglichkeiten der Juniper-Mist APIs und einige der Anwendungsfälle zu demonstrieren. Gehen Sie zu: Mist-Lab-Demo-Apps und geben Sie im Suchfeld Webhooks ein.
Mist Postman Webhook Beispiele Enthält vorkonfigurierte Beispiele für die POST-Webhooksyntax. Stöbern:https://www.postman.com/juniper-mist/workspace/mist-systems-s-public-workspace