mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 03:07:56 +00:00
added example code
This commit is contained in:
@@ -1,10 +1,55 @@
|
||||
# LANForge Python Scripts
|
||||
This directory contains python scripts useful for unit-tests. It uses
|
||||
libraries in ../py-json.
|
||||
This directory contains python scripts useful for unit-tests. It uses libraries in ../py-json. Please place new tests in this directory. Unless they are libraries, please avoid adding python scripts to ../py-json.
|
||||
|
||||
# Getting Started
|
||||
Please consider using the `LFCliBase` class as your script superclass. It will help you with a consistent set of JSON handling methods and pass and fail methods for recording test results. Below is a sample snippet that includes LFCliBase:
|
||||
|
||||
if 'py-json' not in sys.path:
|
||||
sys.path.append('../py-json')
|
||||
from LANforge import LFUtils
|
||||
from LANforge import lfcli_base
|
||||
from LANforge.lfcli_base import LFCliBase
|
||||
from LANforge.LFUtils import *
|
||||
import realm
|
||||
from realm import Realm
|
||||
|
||||
class Eggzample(LFCliBase):
|
||||
def __init__(self, lfclient_host, lfclient_port):
|
||||
super().__init__(lfclient_host, lfclient_port, debug=True)
|
||||
|
||||
def main():
|
||||
eggz = Eggzample("http://localhost", 8080)
|
||||
frontpage_json = eggz.json_get("/")
|
||||
pprint.pprint(frontpage_json)
|
||||
data = {
|
||||
"message": "hello world"
|
||||
}
|
||||
eggz.json_post("/cli-json/gossip", data, debug_=True)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
The above example will stimulate output on the LANforge client websocket `ws://localhost:8081`. You can monitor system activity over that channel.
|
||||
|
||||
## Useful URIs:
|
||||
* /: provides version information and a list of supported URIs
|
||||
* /DUT/: Device Under Test records
|
||||
* /alerts/: port or connection alerts
|
||||
* /cli-form: post multi-part form data to this URI
|
||||
* /cli-json: post JSON data to this URI
|
||||
* /help: list of CLI commands and refence links
|
||||
* /help/set_port: each CLI command has a command composer
|
||||
* /cx: connections
|
||||
* /endp: endpoints that make up connections
|
||||
* /gui-cli: post multi-part form data for GUI automation
|
||||
* /gui-json: post JSON data to this URI for GUI automation
|
||||
* /port: list ports and stations, oriented by shelf, resource and name: `/port/1/1/eth0` is typically your management port
|
||||
* /stations: entities that are associated to your virtual access points (vAP)
|
||||
There are more URIs you can explore, these are the more useful ones.
|
||||
|
||||
#### Scripts included are:
|
||||
|
||||
* `cicd_TipIntegration.py`:
|
||||
* `cicd_TipIntegration.py`: battery of TIP tests that include upgrading DUT and executing sta_connect script
|
||||
|
||||
* `cicd_testrail.py`:
|
||||
* `function send_get`: Issues a GET request (read) against the API.
|
||||
|
||||
Reference in New Issue
Block a user