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 DAY-N config-assign and config-deploy.
You can refer to PnP PNF Simulator -> NF 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.
cd $HOME
git clone https://github.com/onap/integration.git
Start PNF simulator
cd ~/integration/test/mocks/pnfsimulator
./simulator.sh stop
./simulator.sh stop
docker ps -a | grep netopeer
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; } } } } } |
---|
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-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> |
---|
<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> |
---|
sysrepoctl -i -g /etc/sysrepo/yang/pg.yang
In the below steps we just initialise the Yang model with one pg-stream record. We will be using CDS to perform the day-1 configuration and day-2 configuration changes.
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:* > edit-config --target running --config=/dev-models/sample-plugin-data.xml OK > get --filter-xpath /sample-plugin:* DATA <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> >
|
---|
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:* > edit-config --target running --config=/dev-models/sample-plugin-data.xml OK > get --filter-xpath /sample-plugin:* DATA <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> >
|
---|
kubectl get pods -n onap NAME READY STATUS RESTARTS AGE dev-cds-blueprints-processor-b8656f584-dhj58 1/1 Running 0 4m2s dev-cds-command-executor-78b98dff4f-qzf4j 1/1 Running 0 4m2s dev-cds-db-0 1/1 Running 0 4m2s dev-cds-py-executor-5667f84d8-n6j5h 1/1 Running 0 4m2s dev-cds-sdc-listener-749896d795-4r9vp 0/1 Init:0/1 0 4m2s dev-cds-ui-77f74ff6db-8m6t2 1/1 Running 0 4m2s dev-mariadb-galera-0 1/1 Running 0 4m2s |
---|
kubectl get pods -n onap NAME READY STATUS RESTARTS AGE dev-cds-blueprints-processor-b8656f584-dhj58 1/1 Running 0 4m2s dev-cds-command-executor-78b98dff4f-qzf4j 1/1 Running 0 4m2s dev-cds-db-0 1/1 Running 0 4m2s dev-cds-py-executor-5667f84d8-n6j5h 1/1 Running 0 4m2s dev-cds-sdc-listener-749896d795-4r9vp 0/1 Init:0/1 0 4m2s dev-cds-ui-77f74ff6db-8m6t2 1/1 Running 0 4m2s dev-mariadb-galera-0 1/1 Running 0 4m2s |
---|
CDS Boot strap
The below script will load the CDS default model artifacts into CDS DB. You should get HTTP status 200 for the below command.
cd PNF_DEMO/Scripts/ bash -x ./bootstrap-cds.sh |
---|
cd PNF_DEMO/Scripts/ bash -x ./bootstrap-cds.sh |
---|
Get the default model "artifactName": "vFW-CDS" loaded by bootstrap
bash -x ./get-cds-blueprint-models.sh |
---|
bash -x ./get-cds-blueprint-models.sh |
---|
Load PNF CDS blueprint model data dictionary
cd PNF_DEMO/Scripts bash -x ./dd-microk8s.sh ./dd.json |
---|
cd PNF_DEMO/Scripts bash -x ./dd-microk8s.sh ./dd.json |
---|
Check CDS database for PNF data dictionaries
You should see 6 rows as shown below
./connect-cds-mariadb.sh select name, data_type from RESOURCE_DICTIONARY where updated_by='Aarna service <vmuthukrishnan@aarnanetworks.com>';
+---------------------+-----------+ | name | data_type | +---------------------+-----------+ | netconf-password | string | | netconf-server-port | string | | netconf-username | string | | pnf-id | string | | pnf-ipv4-address | string | | stream-count | integer | +---------------------+-----------+ quit exit |
---|
./connect-cds-mariadb.sh select name, data_type from RESOURCE_DICTIONARY where updated_by='Aarna service <vmuthukrishnan@aarnanetworks.com>';
+---------------------+-----------+ | name | data_type | +---------------------+-----------+ | netconf-password | string | | netconf-server-port | string | | netconf-username | string | | pnf-id | string | | pnf-ipv4-address | string | | stream-count | integer | +---------------------+-----------+ quit exit |
---|
Create PNF CDS Blueprint archive pnf-demo.zip
cd PNF_DEMO/ rm pnf-demo.zip
zip -r pnf-demo.zip * # You should see the below ZIP file ls -l pnf-demo.zip |
---|
cd PNF_DEMO/ rm pnf-demo.zip
zip -r pnf-demo.zip * # You should see the below ZIP file ls -l pnf-demo.zip |
---|
Enrich PNF Bluerprint archive
cd PNF_DEMO/Scripts bash -x ./enrich-and-download-cds-blueprint.sh ../pnf-demo.zip
|
---|
cd PNF_DEMO/Scripts bash -x ./enrich-and-download-cds-blueprint.sh ../pnf-demo.zip
|
---|
Verify Enriched Blue pring archive /tmp/CBA/ENRICHED-CBA.zip
cd /tmp/CBA/ unzip ENRICHED-CBA.zip tree |
---|
cd /tmp/CBA/ unzip ENRICHED-CBA.zip tree |
---|
Deploy/Save the Blueprint into CDS database
cd PNF_DEMO/Scripts bash -x ./save-enriched-blueprint.sh ../pnf-demo.zip # You should see the new model "artifactName": "pnf_netconf" bash -x ./get-cds-blueprint-models.sh |
---|
cd PNF_DEMO/Scripts bash -x ./save-enriched-blueprint.sh ../pnf-demo.zip # You should see the new model "artifactName": "pnf_netconf" bash -x ./get-cds-blueprint-models.sh |
---|
Config-Assign
# The assumption is that we are using the same host to run PNF NETCONF simulator as well as CDS
# bash -x ./create-config-assing-data.sh day-1 LOCAL_HOST_IP_ADDRESS 5
You can verify the CURL command JSON pay load file /tmp/day-n-pnf-config.json
cd PNF_DEMO/Scripts bash -x ./create-config-assing-data.sh day-1 10.128.0.86 5
|
---|
cd PNF_DEMO/Scripts bash -x ./create-config-assing-data.sh day-1 10.128.0.86 5
|
---|
Verify the day-1 NETCONF RPC payload in CDS DB you should see the NETCONF RPC with 5 streams (fw_udp_1 TO fw_udp_5)
./connect-cds-mariadb.sh MariaDB [sdnctl]> select * from TEMPLATE_RESOLUTION where resolution_key='day-1' AND artifact_name='netconfrpc';
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <edit-config> <target> <running/> </target> <config> <sample-plugin xmlns="urn:opendaylight:params:xml:ns:yang:sample-plugin"> <pg-streams> <pg-stream> <id>fw_udp_1</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_2</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_3</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_4</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_5</id> <is-enabled>true</is-enabled> </pg-stream> </pg-streams> </sample-plugin> </config> </edit-config> </rpc>
|
---|
./connect-cds-mariadb.sh MariaDB [sdnctl]> select * from TEMPLATE_RESOLUTION where resolution_key='day-1' AND artifact_name='netconfrpc';
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <edit-config> <target> <running/> </target> <config> <sample-plugin xmlns="urn:opendaylight:params:xml:ns:yang:sample-plugin"> <pg-streams> <pg-stream> <id>fw_udp_1</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_2</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_3</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_4</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_5</id> <is-enabled>true</is-enabled> </pg-stream> </pg-streams> </sample-plugin> </config> </edit-config> </rpc>
|
---|
You can verify the CURL command JSON pay load file /tmp/day-n-pnf-config.json
cd PNF_DEMO/Scripts bash -x ./create-config-assing-data.sh day-2 10.128.0.86 10 |
---|
cd PNF_DEMO/Scripts bash -x ./create-config-assing-data.sh day-2 10.128.0.86 10 |
---|
Verify the day-2 NETCONF RPC payload in CDS DB you should see the NETCONF RPC with 5 streams (fw_udp_1 TO fw_udp_10)
MariaDB [sdnctl]> select * from TEMPLATE_RESOLUTION where resolution_key='day-2' AND artifact_name='netconfrpc';
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <edit-config> <target> <running/> </target> <config> <sample-plugin xmlns="urn:opendaylight:params:xml:ns:yang:sample-plugin"> <pg-streams> <pg-stream> <id>fw_udp_1</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_2</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_3</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_4</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_5</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_6</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_7</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_8</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_9</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_10</id> <is-enabled>true</is-enabled> </pg-stream> </pg-streams> </sample-plugin> </config> </edit-config> </rpc> |
---|
MariaDB [sdnctl]> select * from TEMPLATE_RESOLUTION where resolution_key='day-2' AND artifact_name='netconfrpc';
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <edit-config> <target> <running/> </target> <config> <sample-plugin xmlns="urn:opendaylight:params:xml:ns:yang:sample-plugin"> <pg-streams> <pg-stream> <id>fw_udp_1</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_2</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_3</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_4</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_5</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_6</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_7</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_8</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_9</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_10</id> <is-enabled>true</is-enabled> </pg-stream> </pg-streams> </sample-plugin> </config> </edit-config> </rpc> |
---|
Note:- Till this point CDS did not interact with the PNF simulator or device. We just created the day-1 and day-2 configurations and
stored in CDS database
Config-Deploy
This is to make CDS REST API calls to push the day-1 and day-2 configuration changes PNF simulator
Open a new terminal and tail CDS Blueprint processor logs and keep it running. We will need it to review the config-deploy actions
cd PNF_DEMO/Scripts bash -x ./tail-cds-bp-log.sh
|
---|
cd PNF_DEMO/Scripts bash -x ./tail-cds-bp-log.sh
|
---|
Push the NETCONF changes for day-1
# Command syntax
# bash -x ./process-config-deploy.sh RESOLUTION_KEY PNF_IP_ADDRESS
# resolution-key = day-1 you can look at the JSON payload /tmp/pnf-config-deploy.json
cd PNF_DEMO/Scripts bash -x ./process-config-deploy.sh day-1 10.128.0.86 |
---|
cd PNF_DEMO/Scripts bash -x ./process-config-deploy.sh day-1 10.128.0.86 |
---|
Verify the CDS blueprint processor logs and you should see NETCONF RPC OK response as shown below
2020-09-08 13:16:25,783|||Thread-57||||INFO||||||| 10.128.0.86:830: Received message with messageId: 2 <rpc-reply message-id="2" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><ok/></rpc-reply> |
---|
2020-09-08 13:16:25,783|||Thread-57||||INFO||||||| 10.128.0.86:830: Received message with messageId: 2 <rpc-reply message-id="2" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><ok/></rpc-reply> |
---|
Go back to PNF netopeer cli console and verify if you can see 5 streams fw_udp_1 to fw_udp_5 enabled
> > get --filter-xpath /sample-plugin:* DATA <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-stream> <id>fw_udp_1</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_2</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_3</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_4</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_5</id> <is-enabled>true</is-enabled> </pg-stream> </pg-streams> </sample-plugin> > |
---|
> > get --filter-xpath /sample-plugin:* DATA <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-stream> <id>fw_udp_1</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_2</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_3</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_4</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_5</id> <is-enabled>true</is-enabled> </pg-stream> </pg-streams> </sample-plugin> > |
---|
Push the NETCONF changes for day-2
# Command syntax
# bash -x ./process-config-deploy.sh RESOLUTION_KEY PNF_IP_ADDRESS
# resolution-key = day-1 you can look at the JSON payload /tmp/pnf-config-deploy.json
cd PNF_DEMO/Scripts bash -x ./process-config-deploy.sh day-1 10.128.0.86 |
---|
cd PNF_DEMO/Scripts bash -x ./process-config-deploy.sh day-1 10.128.0.86 |
---|
Verify the CDS blueprint processor logs and you should see NETCONF RPC OK response as shown below
2020-09-08 13:19:59,078|||Thread-60||||INFO||||||| 10.128.0.86:830: Received message with messageId: 2 <rpc-reply message-id="2" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><ok/></rpc-reply> |
---|
2020-09-08 13:19:59,078|||Thread-60||||INFO||||||| 10.128.0.86:830: Received message with messageId: 2 <rpc-reply message-id="2" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><ok/></rpc-reply> |
---|
Go back to PNF netopeer cli console and verify if you can see 5 streams fw_udp_1 to fw_udp_10 enabled
> get --filter-xpath /sample-plugin:* DATA <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-stream> <id>fw_udp_1</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_2</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_3</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_4</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_5</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_6</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_7</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_8</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_9</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_10</id> <is-enabled>true</is-enabled> </pg-stream> </pg-streams> </sample-plugin> |
---|
> get --filter-xpath /sample-plugin:* DATA <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-stream> <id>fw_udp_1</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_2</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_3</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_4</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_5</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_6</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_7</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_8</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_9</id> <is-enabled>true</is-enabled> </pg-stream> <pg-stream> <id>fw_udp_10</id> <is-enabled>true</is-enabled> </pg-stream> </pg-streams> </sample-plugin> |
---|