Lets extend the example by adding a block of logic to setting up the data center connection to the third part local controllers between edge and core.
We will need to:
- Create a Local Controller Emulator as a simple http server with basic auth that takes POST input, logs the data and returns succes-dci-connnect.jsons.
2. Create the Directed Graph
3. Load the l3-dci-connect template into the SDNC controller for the json body to the emulator
4. Use the SLI-API: Execute Graph function to test the new DG.
Create Local Controller Emulator
If you already have an http server available use it. For this demo we will install and run a lighttp docker container on the SDNC controller so that we have a self contained enivonment.
Lets use port 9000 for the outside port.
create a "http_test_server" directory on the SDNC VM under /opt and use that as the home directory for the container
scp this tar file http_test_server.tar into the /opt/http_test_server directory and untar it
cd docker
follow the notes in the README.txt to create the debian-lighttpd container
start the container
use testEmulator.sh to test that php is working
"docker exec -it debian-lighttpd bash" to log in to the emulator
"cd /var/log/lighttpd"
"tail emulator.log"
and you should see a test line like
"17:07:21 07:29:08 | name:test,value:testdata 3"
This emulator is setup to reply on "http://10.0.7.1:9000/l3-dci-connect.php" so we will use that in the Directed Graph.
Create a Directed Graph
This directed graph adds a block to deal with the setting of parametres and a set of REST API Call Nodes to the emulator so we can see the behavoir and experiment with different templates/sequences.
This DG is 0.0.2-demo so we will add this as another version to the sdnc. I will summarize the steps since the first part and the netconf node tutorial cover this with screen shots.
Go to the dbbuilder on port 3000
Create a new tab with the "+" symbol
Copy the json string above to the clipboard
Select the menu → import → clipboard
Paste the json string into the dialog
Postition the DG on the pane
Click on the big red SAVE button
This directed graph handles both the A and B side local controller.
We use SET nodes for protoping but in the real DG we would use data form the input , or query A&AI or call resource allocate nodes to generate the data.
The WAN VNI is in its own set node but would be a resource allocation node in a real DG.
For each local controller we:
- Set the url and credentials
- Set the Data
- Call the REST API execute node - note we are using the same template just changing the parameters.
Lets upload the DG
1.Click on the DGStart node
2.Click on UploadXML
3.Click on DGList
4.Click on Activate for the new DG version 0.0.2-demo
Load the l3-dci-connect template
This is basically the same flow as the Tutorial on setting up Netconf from SDNC to APPC.
Log into the SDNC VM and then log into the sdnc_controller_container
cd /opt/openecomp/sdnc/data
create the file "l3-dci-connect.json"
{ "l3-dci-connect": { "id": "${device.id}", "name": "${device.name}", "description": "${device.description}", "router_id": "${device.router_id}", "local_subnets": ["${device.local_subnets}"], "local_network_all":false, "evpn_irts": ["${device.evpn_irts}"], "evpn_erts": ["${device.evpn_erts}"], "l3_vni": "${device.wan.l3_vni}" } }
Note that the variables for the json payload are "device." or "device.wan." . The variable name branch would be a decision by the Adapter developer as to what model it would use. The DG maps variables into this device model.
The adapter developer may choose other model parameter names so this is just illustrative for the tutorial.
This template name, location and variable names must match what we have created in the REST API Call Node
<set> <!-- example uses device. real adapter might use device.l3_connection. or something else --> <!-- ARRAY parameters could be comma separated lists or leaf lists depending on adaptor --> <parameter name='device.evpn_irts' value='1:5000'/> <parameter name='device.evpn_erts' value='1:5000'/> <parameter name='device.local_subnet' value='\"8a41319d-87cf-4cd6-8957-00000000000A\"'/> <parameter name='device.id' value='CDD702C3-7719-4FE6-A5AD-3A9C9E265309' /> <parameter name='device.name' value='PODX-routerY' /> <parameter name='device.description' value='VPC A connect VPC B' /> <parameter name='device.router_id' value='CBB702C3-6789-1234-A5AD-00000000000A' /> <execute plugin='org.openecomp.sdnc.restapicall.RestapiCallNode' method='sendRequest' > <parameter name="templateFileName" value="`$prop.restapi.templateDir + '/l3-dci-connect.json'`"/> <!-- <parameter name="restapiUrl" value="`$prop.controller_A_RestApi.url+ '/v2.0/l3-dci-connects'`/> --> <parameter name="restapiUrl" value="`$prop.controller_A_RestApi.url + '/l3-dci-connect.php'`" /> <parameter name="restapiUser" value="`$prop.controller_A_RestApi.user`" /> <parameter name="restapiPassword" value="`$prop.controller_A_RestApi.password`"/> <parameter name="format" value="xml" /> <parameter name="httpMethod" value="post" /> <parameter name="responsePrefix" value="restapi-result" />
Use the SLI-API: Execute Graph
Now that we have the emulator, the directed graph and the template loaded we can test.
Go to http://<sdnc_ip>:8282/apidoc/explorer/index.html
Go to the SLI-API:execute-graph operation and use the same input we used for the fist part of the tutorial.
{ "input": { "module-name": "VOLTE-API", "rpc-name": "volte-wan-activate", "mode": "sync", "sli-parameter": [ { "parameter-name": "volte-wan-activate.dca-wanip", "string-value": "10.1.20.2" }, { "parameter-name": "volte-wan-activate.dcz-wanip", "string-value": "10.2.20.2" }, { "parameter-name": "volte-wan-activate.wan_vni", "string-value": "101" }, { "parameter-name": "volte-wan-activate.route_target", "string-value": "6020:201" }, { "parameter-name": "volte-wan-activate.route_distinguisher", "string-value": "6020:101" } ] } }
Click on "Try It Out!"
You should get
{ "output": { "ack-final-indicator": "Y", "response-text": "service-data.dcz-wanip=10.2.20.2", "response-code": "200" } }
Log in to the debian-lighttpd container and tail the /var/log/lighttpd/emulator.log and you should see the calls to emulator for local controller A and local controler B.
Next Steps
We should map from the input to the variable needed for the device in the set node instead of hard coding the value.
Once a local controller is available we can use this DG to test against it by changing the "set A controller data (http emulator)" nodes.