This section describes how to build client applications for Xena Valkyrie REST server (hereafter – REST server or simply server). It contains two parts:
- Step by step implementation of basic work flow
- Summary and general architecture notes
The REST server goal is to replace the CLI API as modern best practice method for automation.
As such, it follows the CLI commands structure and maps each CLI command to a REST URL.
Each CLI commands family (chassis, port, stream etc.) is mapped to REST namespace.
The indices and sub-indices of the specific command are mapped to the URL.
For example, all stream commands have two indices module/port and one sub-index [stream]. In REST it will look like:
As you can see, in addition to module/port/stream indices we also have session ID and chassis address. These additional indices are required as REST server is multi-user and multi-chassis.
The document assumes the reader is familiar with Valkyrie CLI API and REST basics. To run the sample flow the user should have access to Valkyrie chassis with two available ports. It is recommended the ports be connected back-to-back so sent traffic will arrive the receive port but this is not mandatory.
We start by describing the general structure of the REST routes and commands.
Then we have a step-by-step sample script that shows and explains the concepts of:
- Create session
- Reserve two ports
- Create stream
- Run traffic
- Get statistics
Throughout the flow we will explain the structure and functionality of the REST server by example, using CURL commands. In Appendix A you can find short intro to curl commands and the list of all commands used throughout the example.
General concepts are colored green.
You can skip the general part and go directly to the sample.
If you are familiar enough with REST concepts you can download the swagger.json and skip directly to Appendix A to play around with the curl commands of the sample script.