Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The first step is to import copies of the 2 two directed graphs that we will want to modify into 3 two tabs in dgbuilder. 

The vnf-topology-operation API/Directed Graph uses the svc-action parameter ( <switch test="`$vnf-topology-operation-input.sdnc-request-header.svc-action`"> ) to run either the activate ,  delete or delete directed graph (a production version might want to look at the other svc-actions as well).

We need the twodirected two directed graphs; vnf-topology-activate and vnf-topology-delete to handle the two events that should affect the netconf mount on APPC (create after instantiating a VNF and delete after removing a VNF)

The graphs are in the SDNC repository under <ONAP_SRC>/sdnc/oam/platform-logic/vnfapi/src/main/json.

...

We are going to add some logic to find the vpg hostname and ip address from the preload-data , a set node so that we can set some properties and then the restapicall node..In a real example you would put this data into the properties file that is read by SDNC or put it into the mysql database but I wanted to demonstrate the set node as an expediant way to do things.



FIND VPG Data

The first node in the block is a for loop that starts at 0 and ends with the length of the vnf-parameters array in the preload data.

...

The set node will set the parameters needed for the RestAPICallNode.

In a real example you would put this data into the properties file that is read by SDNC or put it into the mysql database but I wanted to demonstrate the set node as an expediant way to do things.

Not that you should replace the <APPC_RESTAPI_PASSWORD> with the correct string. In a production environment you would query the database to retrieve device credentials but for the tutorial we take this shortcut.

<set>
<set>
<parameter name='prop.appcRestApi.url' value='http://appc.api.simpledemo.openecomp.org:8282' />
<!-- 8181 when doing localhost -->
<parameter name="prop.restapi.templateDir" value="/opt/openecomp/sdnc/data"/>
<parameter name="prop.appcRestApi.sdncOdl.user" value="admin"/>
<parameter name="prop.appcRestApi.sdncOdl.password" value="<APPC_RESTAPI_PASSWORD>"/>


 Next Next we add the Execute node to actually make the REST API Call to the block. Notice that it references the data from set node and template (netconf-mount-template.xml).

We will ahve have to put that the template in the directory specified in the prop.restpi.templatDir templateDir (/opt/openecom/sdnc/data on )  on the SDNC container).

The name of the node is the variable we set above $prop.vpg_hostname".

...

<execute plugin='org.openecomp.sdnc.restapicall.RestapiCallNode' method='sendRequest' >
<parameter name="templateFileName" value="`$prop.restapi.templateDir + '/netconf-mount-template.xml'`"/>
<parameter name="restapiUrl" value="`$prop.appcRestApi.url+'/restconf/config/network-topology:network-topology/topology/topology-netconf/node/'+$prop.vpg_hostname`"/>
<parameter name="restapiUser" value="`$prop.appcRestApi.sdncOdl.user`"/>
<parameter name="restapiPassword" value="`$prop.appcRestApi.sdncOdl.password`"/>
<parameter name="format" value="xml" />
<parameter name="httpMethod" value="put" />
<parameter name="responsePrefix" value="restapi-result" />


Link the "for" , "record" and "switch" nodes into the block node.

SAVE the DG 

Here There is a full DG below and in gerrit in case you want to compare it to yours by importing it to another tab in dgbuilder.

...

Upload the DG and Activate it.






...


Installing the REST API payload XML Template

Here are the steps to put the xml template on the sdnc controller docker container. Remember this will get removed if you re-install the docker container.

...

and create the file netconf-mount-template.xml with the xml below (everything from <node> to </node> inclusive).

Note that the hostname (prop.vpg_hostname) and IP address (prop.vpg_ipaddress) of the vTrafficGenerator comes from the vnf preload data found during the DG processing.

...

Access the apidoc/explorer/index.html on port 8282 of the SDNC ControllerController 

http://<SDNC_IP>:8282/apidoc/explorer/index.html


Under the SLI-API section we want the execute-graph RPC 

...

{
"input": {
"module-name": "VNF-API",
"rpc-name": "vnf-topology-activate",
"mode": "sync",
"sli-parameter": [
{
"parameter-name": "preload-data.vnf-topology-information.vnf-topology-identifier.vnf-type",
"string-value": "E636c6e5747e4eda9dbb..base_vfw..module-0"
},
{
"parameter-name": "preload-data.vnf-topology-information.vnf-parameters_length",
"string-value": "2"
},
{
"parameter-name": "preload-data.vnf-topology-information.vnf-parameters[0].vnf-parameter-name",
"string-value": "vpg_name_0"
},
{
"parameter-name": "preload-data.vnf-topology-information.vnf-parameters[0].vnf-parameter-value",
"string-value": "testname1"
},
{
"parameter-name": "preload-data.vnf-topology-information.vnf-parameters[1].vnf-parameter-name",
"string-value": "vpg_private_ip_1"
},
{
"parameter-name": "preload-data.vnf-topology-information.vnf-parameters[1].vnf-parameter-value",
"string-value": "10.0.0.1"
},
{
"parameter-name": "service-data.oper-status.order-status",
"string-value": "PendingCreate"
},
{
"parameter-name": "service-data.vnf-id",
"string-value": "Vfmodule_Ete_Name3d4e75c0-119d-4c8e-a6bf-179a2bb51831"
},
{
"parameter-name": "vnf-topology-operation-input.vnf-request-information.vnf-id",
"string-value": "Vfmodule_Ete_Name3d4e75c0-119d-4c8e-a6bf-179a2bb51831"
},
{
"parameter-name": "vnf-topology-operation-input.vnf-request-information.vnf-type",
"string-value": "E636c6e5747e4eda9dbb..base_vfw..module-0"
},
{
"parameter-name": "vnf-topology-operation-input.vnf-request-information.generic-vnf-id",
"string-value": "Vnf_Ete_Name3d4e75c0-119d-4c8e-a6bf-179a2bb51831"
}
]
}
}


Not Note that the input sets up both data that would come in on the RPC and data that is already in the controller.

...

This uses the DELETE method to the restapicall node and only need the vpg_hostname so it is a little simpler.


The current VFN-TOPOLOGY-DELETE graph assumes the MSO will be deleting the VNF so it doesnt remove the l3 network data that is still attached to the VNF in AnAI in some cases. You may want to tie the block for processing delete into both of the success branches from the order-status=Active switch test by adding a "true" outcome from the order status="Active" and linking that to the existing block node after the "other" outcome from the switch test of "aic-cllii. As shown below. This way the l3 network data would be removed from AnAI by SDNC since it was added by SDNC on the "activate". The VNF will be deleted in a few seconds after the delete runs but its probably something to consider.



Image Added


The delete node you want to delete the responsePrefix and template parameter since they are not needed and will generate errors if included in an DELETE operation.


<execute plugin='org.openecomp.sdnc.restapicall.RestapiCallNode' method='sendRequest' >
<parameter name="restapiUrl" value="`$prop.appcRestApi.url+'/restconf/config/network-topology:network-topology/topology/topology-netconf/node/'+$prop.vpg_hostname`"/>
<parameter name="restapiUser" value="`$prop.appcRestApi.sdncOdl.user`"/>
<parameter name="restapiPassword" value="`$prop.appcRestApi.sdncOdl.password`"/>
<parameter name="format" value="xml" />
<parameter name="httpMethod" value="delete" />


The tutorial data will be tutorial data will be in gerrit under the demo repository .(demo/tutorials/CreateAppcNetconfMount)

Here is a string version for quick reference.

...