# Backend-client
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/wirepas/backend-client)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/bf0c23237cf04ea6ac48e98cf10b6a7b)](https://www.codacy.com/manual/wirepas/backend-client?utm_source=github.com&utm_medium=referral&utm_content=wirepas/backend-client&utm_campaign=Badge_Grade) [![Build Status](https://travis-ci.com/wirepas/backend-apis.svg?branch=master)](https://travis-ci.com/wirepas/backend-client) [![Documentation Status](https://readthedocs.org/projects/backend-client/badge/?version=latest)](https://backend-client.readthedocs.io/en/latest/?badge=latest) [![PyPi](https://img.shields.io/pypi/v/wirepas-backend-client.svg)](https://pypi.org/project/wirepas-backend-client/)
<!-- MarkdownTOC levels="1,2,3" autolink="true" style="ordered" -->
1. [Introduction](#introduction)
1. [Installation](#installation)
1. [Host dependencies](#host-dependencies)
1. [Setting up a Python virtual environment](#setting-up-a-python-virtual-environment)
1. [Installing from PyPi](#installing-from-pypi)
1. [Installing from Github](#installing-from-github)
1. [Entrypoints](#entrypoints)
1. [Gateway command line interface](#gateway-command-line-interface)
1. [WPE Viewer](#wpe-viewer)
1. [WNT Viewer](#wnt-viewer)
1. [Provisioning server](#provisioning-server)
1. [Framework](#framework)
1. [Structure](#structure)
1. [Examples](#examples)
1. [Logging to fluentd](#logging-to-fluentd)
1. [Building and running over Docker](#building-and-running-over-docker)
1. [Dockerhub](#dockerhub)
1. [Running with docker](#running-with-docker)
1. [Running with compose](#running-with-compose)
1. [Building the image locally](#building-the-image-locally)
1. [Source documentation](#source-documentation)
1. [Contributing](#contributing)
1. [License](#license)
<!-- /MarkdownTOC -->
## Introduction
The Backend Client is a tool to serve as a decoder and a test framework
where you can extend the existing interfaces to develop your own test cases.
Interactions with
a [gateway][wirepas_gateway] must be compliant with the Wirepas
Backend to Gateway API.
In addition to the interaction with the Backend to Gateway Public API,
the Backend Client has also support for Wirepas Positioning Engine and Wirepas
Network Tool. Support for these tools is still work in progress
(see [milestones][backend_client_gh_milestones] and [projects][backend_client_gh_projects]).
However, you can already benefit from existing
entrypoints to help you capture data and debug your
integration (see [entrypoints](#entrypoints)).
Figure 1 illustrates the horizon where Backend Client is located.
![Architecture overview][here_img_overview]
**Figure 1** - Backend Client role in the Wirepas ecosystem.
## Installation
The Backend Client is written in python and it requires a valid MQTT
broker target to connect to, WNT or WPE credentials.
If you need help installing a MQTT broker or auxiliary software please
refer to our tutorials repository.
### Host dependencies
The main requirements of Backend Client are:
- Python 3.7
- Pip (we recommend the latest available)
- Linux system
Certain Backend Client's dependencies must be
compiled locally upon installation,
thus require the installation of specific development headers.
Under Debian, the extra requirements are met with:
```bash
sudo apt-get install default-libmysqlclient-dev gcc python3.7-dev
```
Please be advised that the name of such packages might change depending on your
Linux system. Please refer to the Dockerfiles
under the [container folder][here_container] for more detailed information.
Windows native environments are not supported. For help running the tool
in Windows, please use the Linux subsystem, Docker or a virtual machine.
### Setting up a Python virtual environment
As a recommendation, it is good practice to install and run the
application on a virtual python environment. Such approach avoids
possible issues with conflicting package versions.
We recommend you use [pipenv][pipenv]:
```shell
pip3 install pipenv
```
If you choose to install and run the Backend Client inside a virtual
environment, please activate the environment before moving with the next
steps.
For pipenv, a virtual environment is created and activated by:
```shell
pipenv --three
pipenv shell
```
Once you activate your environment your can safely install the python
package under it.
For more information please refer to the tool's webpage.
### Installing from PyPi
The Backend Client is available from
[PyPi][backend_client_pypi] and you can install the latest stable version
with:
```shell
pip install wirepas-backend-client
```
If you wish to install a particular version please see the release history
from PyPi.
### Installing from Github
First of all, make sure to clone the repository using the https address.
Checkout the
[git tag that corresponds to the release version][backend_client_gh_releases]
you want to install and install the package with:
```shell
pip3 install .
```
If you leave your branch checked out to the top of master, it is likely that
you might run into a few issues. If you find them, please be so kind to
raise them to us through an [issue or bug report][backend_client_gh_issues].
If you want to develop or patch a bug under your local environment,
you can install the package in development mode through:
```shell
pip3 install -e .
```
When installed in development mode, changes to the source files will be
immediately visible.
## Entrypoints
After installation, the Backend Client exposes several
[shell entrypoints][here_setup_entrypoints] that
can be run from any location in your system. This section describes their
usage in more detail.
### Gateway command line interface
The Backend Client exposes an interactive gateway command line which is
meant to interact with a gateway and sink pair connected to a given
MQTT broker.
To start an interactive command line to interact with a broker located
in your _localhost_ environment type:
```shell
wm-gw-cli
```
Connecting to a remote server requires you to specify the values as an
argument or by reading from a yaml settings file. To view all the
arguments, please issue the command:
```shell
wm-gw-cli --help
```
#### Connecting to the MQTT broker
For the gateway client to function properly, it needs to establish a
connection to the same MQTT broker where one or multiple gateways
are connected to.
To do so, let's assume the following MQTT credentials are saved in
./examples/settings.yml:
```yaml
# examples/settings.yml
# Example on how to set the MQTT credentials towards a local broker
# with basic authentication
mqtt_hostname: 127.0.0.1
mqtt_password: password
mqtt_username: username
mqtt_port: 1883 # defaults to 8883 (secure port)
mqtt_force_unsecure: True # defaults to False (secure)
```
To start the gateway against the MQTT broker specified in
./examples/settings.yml, issue the following command:
```shell
wm-gw-cli cli --settings ./examples/settings.yml
```
Once the client launches, you will be greeted with:
```shell
Welcome to the Wirepas Gateway Client cli!
Connecting to mosquittouser@127.0.0.1:1883 (unsecure: True)
Type help or ? to list commands
Type ! to escape shell commands
Use Arrow Up/Down to navigate your command history
Use CTRL-D or bye to exit
09:50.17 | wm-gw-cli >
```
#### Commands
The gateway client has a set of commands which you can view by typing ?
in the client's shell:
```shell
wm-gw-cli > ?
Documented commands (type help <topic>):
========================================
EOF playback set_loop_iterations
bye q set_loop_timeout
clear_offline_gateways record set_reply_greeting
eof scratchpad_s
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
资源分类:Python库 所属语言:Python 资源全名:wirepas_backend_client-1.3.6rc1.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
Python库 | wirepas_backend_client-1.3.6rc1.tar.gz (115个子文件)
setup.cfg 38B
LICENSE 11KB
README.md 28KB
PKG-INFO 35KB
PKG-INFO 35KB
gateway.py 92KB
connectors.py 54KB
http.py 32KB
arguments.py 23KB
inventory.py 22KB
kpi_adv.py 18KB
shell.py 17KB
sm.py 13KB
fea_set_neighbor_diagnostics.py 13KB
generic.py 12KB
connectors.py 12KB
message.py 11KB
mqtt.py 11KB
kpi_mesh.py 11KB
connectors.py 10KB
topics.py 9KB
handlers.py 8KB
daemon.py 8KB
provisioning_server.py 8KB
logs.py 7KB
nodediagnostics.py 7KB
data.py 6KB
influx_viewer.py 6KB
handlers.py 6KB
advertiser.py 6KB
test_dreq_role_membership.py 5KB
manager.py 5KB
diagnostics.py 5KB
state.py 5KB
utils.py 5KB
fea_set_neighbor_diagnostic_message_builder.py 4KB
connectors.py 4KB
mqtt_viewer.py 4KB
msap_scratchpad_status.py 4KB
test_received_messages.py 3KB
gateway.py 3KB
handlers.py 3KB
test_v1_v2_content.py 3KB
testnw.py 3KB
interface.py 3KB
network.py 3KB
__main__.py 3KB
ruuvi.py 3KB
positioning.py 3KB
connectors.py 3KB
msap_ping.py 3KB
trafficdiagnostics.py 3KB
find_all_nodes.py 3KB
bootdiagnostics.py 3KB
setup.py 3KB
manager.py 3KB
decode_apdu.py 3KB
neighbordiagnostics.py 3KB
msap_update.py 3KB
msap_scratchpad_update.py 2KB
realtime.py 2KB
metadata.py 2KB
__init__.py 2KB
settings.py 2KB
cli_starter.py 2KB
authentication.py 2KB
msap_cancel.py 2KB
msap_begin.py 2KB
msap_end.py 2KB
device.py 2KB
__init__.py 2KB
stream.py 2KB
decorators.py 2KB
settings.py 1KB
advertiser_report_parser.py 1KB
__init__.py 1KB
__init__.py 1KB
settings.py 1KB
__main__.py 1KB
events.py 1023B
settings.py 1022B
__main__.py 993B
__init__.py 862B
__init__.py 817B
__about__.py 808B
__init__.py 806B
__init__.py 799B
sink.py 768B
types.py 700B
settings.py 695B
__init__.py 604B
__init__.py 510B
__init__.py 498B
__init__.py 494B
__init__.py 428B
__init__.py 383B
__init__.py 324B
mqtt_options.py 317B
handlers.py 285B
__init__.py 273B
共 115 条
- 1
- 2
资源评论
挣扎的蓝藻
- 粉丝: 14w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功