Aruba即时restapi的Python包装器

instantp的Python项目详细描述


Aruba即时Python API包装

这个模块为ArubaInstant8.6RESTAPI提供了一个Python3接口。在

请理解此项目是WIP。我也非常感谢你帮我测试一下。我的即时集群是我在家里生产的wifi。我无法彻底测试对API的某些调用(特别是在配置部分),因为在家中断wifi会导致家庭不幸福。

有关完整文档,请参见here。在

restapi分为三个部分。监视Action,和配置。每一部分的细节如下。登录和注销由login()logout()方法处理。登录有一个decorator方法,可以在需要时处理登录。您仍然需要处理注销。请参阅下面的示例。

监控

显然,API的监视端点用于监视。它用于从主、从或独立即时AP收集状态、统计信息和日志。这部分API的体系结构与“show”命令的cli输出非常相似。当前支持的命令是show clientsshow aps。不久将添加更多内容。还有一个通用的show command方法,它将接受任何CLI show命令并返回非结构化文本。在

如果结构化输出有帮助,请随意打开问题并请求对更多命令的支持。如果有帮助的话,我还可以添加对不同操作系统版本(至少回到8.5)的支持。在

NOTE: The response from the API is currently unstructred text and requires parsing with RegEx.  
This lends itself to breaking easily between versions.  My current testing has been against 8.6.

行动

操作终结点用于配置AP特定的设置。有关支持的端点,请参见下文。在

EndpointMethodDescription
Hostnamehostname()Set the hostname of a specific IAP.
Swarm Modeswarm()Set an AP to be standalone or part of a swarm cluster.
Static Channel and Powerchannel()Set the tx channel and power of the radios of a specific IAP.
Zonezone()Set the zone of a specific IAP.
Antenna Gainantenna_gain()Set the specific antenna gain when external antennas are used.
Enable and Disable Radiosradio_state()Enable or disable a radio in an AP.
Generic Show Commandshow_cmd()Returns unstructured output text from any "show" command provided.

配置

配置终结点用于配置即时虚拟控制器。有关支持的端点,请参阅下表。在

当初始化InstantVC()的实例时,“templates”目录默认为项目中的文件夹。建议您创建自己的模板目录并使用此目录作为参考。在

^{pr2}$ ^{tb2}$

示例:

使用@autologin decorator登录-在这个场景中,decorator将在第一次调用API时为您登录。在

import instantpy

vc = instantpy.InstantVC('user', 'password', 'VC IP')

result = vc.clients()
...
vc.logout()

监控端点示例

列出已连接的客户端

import json
import instantpy

vc = instantpy.InstantVC('user', 'password', 'VC IP')
result = vc.clients()
print(json.dumps(result, indent=4))
vc.logout()

任意“show”命令

import json
import instantpy

vc = instantpy.InstantVC('user', 'password', 'VC IP')
result = vc.show_command(command="show swarm state")
print(result)
vc.logout()

操作终结点示例

设置特定AP的主机名

import json
import instantpy

vc = instantpy.InstantVC('user', 'password', 'VC IP')
result = vc.hostname(name="testname", iap_ip="1.2.3.4")
print(json.dumps(result, indent=4))
vc.logout()

配置端点示例

设置RADIUS身份验证服务器

import json
import instantpy

vc = instantpy.InstantVC('user', 'password', 'VC IP')
result = vc.auth_server(template='auth_server_template.json')
print(json.dumps(result, indent=4))
vc.logout()

如果这个项目有帮助,你可以buy me a coffee,但请不要觉得有义务。在

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
安卓中的java标签长点击问题   JavaSpringMVC多行表单提交提交新的ModelAttribute   程序来查找java程序中的方法数   在JSF中自动选择java下拉列表   java onNext为ArrayList的每个元素触发,而不是使用RXJava触发一次   为什么java不允许创建内部类的实例?   JavaJSF<p:calendar>小部件在选择不同月份时不会刷新   java如何限制JFileChooser只允许选择特定数量的文件?   java ANT build无法识别geckodriver可执行文件“驱动程序可执行文件不存在”   java TextView空指针异常   java试图在安卓中传递参数   如何将XML配置转换为Java   java支持使用JAXRPC的soap服务,但pom中没有定义它。xml   在Java中检查整个ArrayList