...
Create the SLI-API input model
Here is a simplistic modle if the attributes that might be needed as input to the VCPE-API:vcpe-vgw-activate REST API call from SO to SDNC. The module-name and rpc-name must match the Directed Graph you will be creating in the next section. The parameters section contains the parameters that you would expect to get in from SO.
This is not a complete list but should give you a framework for prototyping.
Save this as a text file so you can copy/paste it into the SDNC apidoc swagger interface in step 3. For now the parameter names will be the variables we use in the Directed Graph in step 2.
Code Block | ||
---|---|---|
| ||
{
"input": {
"module-name": "VCPE-API",
"rpc-name": "vcpe-vgw-activate",
"mode": "sync",
"sli-parameter": [
{
"parameter-name": "vcpe-vgw-activate-input.vgw-oam-address",
"string-value": "10.1.20.2"
},
{
"parameter-name": "vcpe-vgw-activate-input.vgw-vlanid",
"string-value": "101"
},
{
"parameter-name": "vcpe-vgw-activate-input.dcae-collector-ip",
"string-value": "10.0.0.1"
}
]
}
} |
Create the Directed Graph
...
Go to the dbguilder applicaiont on port 3000 of the SDNC (http://10.0.7.1:3000/#) login with dguser/test123
Create a new tab by clicking on the "+" simbol on the right hand side if you dont have a blank pane already.
Here is a getting started json string
Expand | ||
---|---|---|
| ||
[{"id":"d79d0d35.a622a8","type":"dgstart","name":"DGSTART","outputs":1,"x":112,"y":62,"z":"9a684888.3f2538","wires":[["e8368657.f2d8f"]]},{"id":"e8368657.f2d8f","type":"service-logic","name":"VCPE-API 0.0.1-DEMO","module":"VCPE-API","version":"0.0.1-DEMO","comments":"","xml":"<service-logic xmlns='http://www.openecomp.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.openecomp.org/sdnc/svclogic ./svclogic.xsd' module='VCPE-API' version='0.0.1-DEMO'>","outputs":1,"x":318.1666564941406,"y":87.16667175292969,"z":"9a684888.3f2538","wires":[["69f272d9.6bf4f4"]]},{"id":"69f272d9.6bf4f4","type":"method","name":"method vcpe-vgw-activate","xml":"<method rpc='vcpe-vgw-activate' mode='sync'>\n","comments":"","outputs":1,"x":182.16668701171875,"y":151.16665649414062,"z":"9a684888.3f2538","wires":[["2cdda2a7.c88146"]]},{"id":"2cdda2a7.c88146","type":"block","name":"block : atomic","xml":"<block atomic=\"true\">","atomic":"true","outputs":1,"x":390,"y":239,"z":"9a684888.3f2538","wires":[["2fed121c.e86f76","f5677f8e.1ec748","942de7f6.8bda2","100c8a63.bf0bee","d9c7cd5d.e69768"]]},{"id":"2fed121c.e86f76","type":"set","name":"set: order-status = Active","xml":"<set>\n\t<parameter name=\"service-data.oper-status.order-status\" value=\"Active\"/>","comments":"","x":612,"y":351,"z":"9a684888.3f2538","wires":[]},{"id":"100c8a63.bf0bee","type":"returnSuccess","name":"return success","xml":"<return status='success'>\n\t<parameter name=\"error-code\" value=\"200\" />","comments":"","x":584,"y":538,"z":"9a684888.3f2538","wires":[]},{"id":"f5677f8e.1ec748","type":"set","name":"set: service-data = input","xml":"<set>\n\t<parameter name=\"service-data.\" value=\"vnf-topology-operation-input.\" />","comments":"","x":611.8888854980469,"y":452.388916015625,"z":"9a684888.3f2538","wires":[]},{"id":"942de7f6.8bda2","type":"set","name":"Set final indicator to Y","xml":"<set>\n<parameter name=\"ack-final\" value=\"Y\"/>","comments":"","x":606.2063369750977,"y":496.1031608581543,"z":"9a684888.3f2538","wires":[]},{"id":"d9c7cd5d.e69768","type":"record","name":"record","xml":"<record plugin=\"org.openecomp.sdnc.sli.recording.FileRecorder\">\n<parameter name=\"file\" value=\"/opt/opendaylight/current/data/log/svclogic.log\"/>\n<parameter name=\"field1\" value=\"__TIMESTAMP__\"/>\n<parameter name=\"field2\" value=\"vcpe-vgw-activate\"/>\n<parameter name=\"field3\" value=\"`$vcpe-vgw-activate-input.vgw-oam-address`\"/>\n","comments":"","outputs":1,"x":560,"y":282,"z":"9a684888.3f2538","wires":[[]]}] |
Copy it to your clipboard
On dgbuilder page, select the menu on the right hand side (the three stackk horizonal bars ) and select "import" and "clipboard"
Paste the json string into the dialog box
Move the resulting DG around the pane.
Node | Comment |
---|---|
DGSTART | Standard starting node for any DG |
Module | This matches our YANG Model name VCPE-API |
Method | The RPC that will be used by the northbound system to call SDNC |
BLOCK | wrap these nodes into a succes/fail transaction with "atomic" one branch at a time execute |
RECORD | Save some data to a file. Click on the node to see the fields that are being saved |
SET | Set the order status to Active |
SET service data to input | In a real application we copy input to the md-sal tree via this type of node. Doing it late in the tree lets us know what existing already in md-sal to distringuish an update from a new. |
SET final indicator | Set the response on success. A real DG has error legs we are worrying about in this example |
RETURN : Success | HTTP 200 return of success |
Use the SLI-API to test the DG and any Adapter nodes
- go to the http://<sdnc_ip:8282/apidoc/explorer/index.html
- select the SLI-API to open up its methods
- Select the "/operations/SLI-API:execute-graph"
- Paste the json string from the first step into the box
Click on Try It!
- You should see a 200 ok response
Log into SDNC and check the svclogic.log and see the results.
Next Steps
- You can add additional parameters to the input JSON and create input for other operations like vBRG config
- You can add REST API CALL Node to call the Netconf interface to configure a vGW device
- You can add AAI node to update AAI