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 »

The objective of this page is to give you some basics about setting up ONAP PNF simulator and how to create a simple CDS blueprint model to perform config-assign and config-deploy using CDS REST API interfaces.

  • Setting up PNF simulator integration project

You can refer to PnP PNF Simulator wiki page to clone the GIT repo and start the required docker containers. We are interested in the sysrepo/sysrepo-netopeer2 docker container to load a simple YANG similar to vFW Packet Generator.


  • Start PNF simulator docker containers

cd $HOME

git clone https://github.com/onap/integration.git

Start PNF simulator

cd ~/integration/test/mocks/pnfsimulator

./simulator.sh stop

./simulator.sh stop


  • Verify the you have netopeer docker container are up and running. It will be mapped to host port 830

docker ps -a | grep netopeer


  • Create a simple packet generator YANG model (pg.yang)


module sample-plugin {

yang-version 1;
namespace "urn:opendaylight:params:xml:ns:yang:sample-plugin";
prefix "sample-plugin";

description
"This YANG module defines the generic configuration and
operational data for sample-plugin in VPP";

revision "2016-09-18" {
description "Initial revision of sample-plugin model";
}

container sample-plugin {
uses sample-plugin-params;
description "Configuration data of sample-plugin in Honeycomb";

// READ
// curl -u admin:admin http://localhost:8181/restconf/config/sample-plugin:sample-plugin

// WRITE
// curl http://localhost:8181/restconf/operational/sample-plugin:sample-plugin

}

grouping sample-plugin-params {
container pg-streams {
list pg-stream {

key id;
leaf id {
type string;
}

leaf is-enabled {
type boolean;
}
}
}
}
}

  • Sample XML data definition for the above model to initialise one single PG stream (pg-data.xml)

<sample-plugin xmlns="urn:opendaylight:params:xml:ns:yang:sample-plugin">
<pg-streams>
<pg-stream>
<id>1</id>
<is-enabled>true</is-enabled>
</pg-stream>
</pg-streams>
</sample-plugin>


  • Copy the above two files into netopeer docker container (pg.yang & pg-data.xml) under /etc/sysrepo/data folder


  • Execute the following command within netopeer docker container to install the pg.yang model

sysrepoctl -i -g /etc/sysrepo/yang/pg.yang


  • Connect to netopeer docker container and execute the following commands to initialise the pg.yang model

cd /opt/dev/Netopeer2/cli/build
./netopeer2-cli
> connect --host localhost --login netconf
> edit-config --target running --config=/dev-models/pg-data.xml
> get --filter-xpath /sample-plugin:*

> quit

exit

  • Now create a simple CDS blue print to update the number of streams using NETCONF. 


  • You can use the attached demo-pnf-bp.zip.zip file to enrich, save, publish and deploy from CDS UI.


  • You can extract the above BP archive to find the Scripts/dd.json & Scripts/dd.sh. You execute the below command to populate the data dictionary (CDS_UI_PORT = 3000)


bash -x ./dd.sh CDS_UI_PORT ./dd.json


  • CDS UI you should the all operation successful as shown below

Config-Assign


  • The assumption is that all the below parameters for config-assign will sent as part of config-assing REST call

              Day-0 : config-assign parameters                          

                             pnf-ipv4-address, netconf-server-port, netconf-username, netconf-password, stream-count


curl -v --location --request POST 'http://localhost:8000/api/v1/execution-service/process' \
--header 'Content-Type: application/json;charset=UTF-8' \
--header 'Accept: application/json;charset=UTF-8,application/json' \
--header 'Authorization: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==' \
--header 'Host: cds-blueprints-processor-http:8080' \
--header 'Content-Type: text/json' \
--data-raw '
{
"actionIdentifiers": {
"mode": "sync",
"blueprintName": "pnf_config",
"blueprintVersion": "1.0.0",
"actionName": "config-assign"
},
"payload": {
"config-assign-request": {
"template-prefix": [
"pnf"
],
"resolution-key": "day-0",
"config-assign-properties": {
"pnf-id": "abcd",
"pnf-ipv4-address": "192.168.122.20",
"netconf-password": "admin",
"netconf-username": "admin",
"netconf-server-port": "netconf-server-port",
"stream-count": "5"
}
}
},
"commonHeader": {
"subRequestId": "143748f9-3cd5-4910-81c9-a4601ff2ea58",
"requestId": "e5eb1f1e-3386-435d-b290-d49d8af8db4c",
"originatorId": "SDNC_DG"
}
}
'

              Day-1 : config-assign parameters

                            pnf-ipv4-address, netconf-server-port, netconf-username, netconf-password, stream-count


Config-Deploy


  • config-deploy request will send the Day-0 or Day-1 resolution key as part of the REST call.

            "resolution-key" : "day-1"    (OR)  "resolution-key" : "day-2"


  • config-deploy should retrieve the Day-1 or Day-2 configuration based on the resolution-key and executes the NETCONF command processor Kotlin code


  • TODO: REST API CURL Command for Day-1 configuration deployment


  • TODO: REST API CURL Command for Day-2 configuration deployment
  • No labels