Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Next »

This user guide explains how to launch the pnc-simulator and initialize it with administrative APIs.

Step 1. Fetch the simulator docker image

First, pull down the simulator image from docker hub.

docker pull dzhanghuawei/pncsimulator:1.0.5-SNAPSHOT

Step 2. Launch the simulator container(s)

After compiling the pnc-simulator image locally or fetching the docker image from remote registry, execute the command below to start the container:

docker run –p 18181:8181 –d –name pncsimu-18181 –t dzhanghuawei/pncsimulator:1.0.5-SNAPSHOT

It should be noted that, we redirect the request from host:18181 to container:8181. You can configure whatever port, mapping to container:8181 at your discretion.

After starting the container, you should be able to verify the running container by:

docker container ps –a | grep pncsimu

Step 3. Initialize the simulator

The simulator offers a set of administrative APIs which are designed for initialization and management purposes.

To initialize the simulator:
curl –X POST –H "content-type:application/json" http://${SERVER_IP:SERVER_PORT}/pncsimu/v1/reload-data -d @INITIAL_DATA_FILE

In our case, SERVER_PORT is 18181.

Here, INITIAL_DATA_FILE is a JSON representation describing the status of operational datastore.

The file is formatted as follows.

To reset the simulator to the most recent initialization point:
curl –X POST –H "content-type:application/json" http://${SERVER_IP:SERVER_PORT}/pncsimu/v1/reload-data -d'{}'

For demonstration purposes, A sample INITIAL_DATA_FILE is attached.

  • No labels