WAE Offline Planning to Automation with APIs

In this section, you will see how an offline workflow in the Design client can become an automated task using the WAE Design API. These automated workflows can be wrapped in some additional python logic and put on the server, enabling these tasks to be executed via RESTCONF or NETCONF APIs.

The WAE Design RPC API

The operations and capabilities of the WAE Design planning tool can be automated using the WAE Design RPC python API. Usually scripts written for the Design RPC API are run locally on the machine in which Design is installed. For example, if someone wanted to add an LSP to the model, the operation could be done in the GUI as shown on the left or using the API which is shown on the right.

WAE Design RPC API

WAE Design RPC API Example

The WAE Design RPC API documentation contains several examples. When using the Design RPC API all scripts start out the same way as below:

import sys
import com.cisco.wae.design

if __name__ == '__main__':
  # Get input variables
  srcPlanFile = sys.argv[sys.argv.index('-plan-file')+1]

  # This is like starting the Design client
  conn = com.cisco.wae.design.ServiceConnectionManager.newService()

  # This is like opening a plan file
  id = conn.getPlanManager().newPlanFromFileSystem(srcPlanFile)

  ###
  # In this section, do all the cool stuff you want the script to do
  ###

  # Do this if you want to save the output plan file with name 'out.pln'
  id.serializeToFileSystem('out.pln')

When it's time to run the script, go to the WAE Design bin directory and use the design_api_python utility

$ cd $CARIDEN_HOME/bin << CARIDEN_HOME is a path that points to where WAE Design is installed.
$ ./design_api_python <rpc_api_script_name>.py -plan-file <plan file>.pln <other options or files you pass in...>

The Optimization and Prediction Module (OPM) API Wrapper

One drawback to the Design RPC API is the complexity. You need a very good understanding of the WAE network model including the table relations and also the workflow you would do in Design in order to create a WAE Design RPC API script.

To make things simple, the WAE solutions team has developed the OPM API which provides a more "pythonic" way of working with the API where the user does not need a complete understanding of the WAE relational model.

For example, when using the OPM API below shows how to retrieve a plan file to be used in the script.

from com.cisco.wae.opm.network import open_plan

input_plan = 'some/plan/file.pln'
output_plan = 'some/plan/out-file.pln'
with open_plan(input_plan) as network:
    model = network.model
    # Do stuff with the network model ...
    network.write(output_plan)

NETCONF/RESTCONF APIs using the WAE server

This functionality has been deprecated. Starting WAE 7.2.1, it is no longer possible to use NETCONF/RESTCONF APIs for accessing the network model.