...
...
...
...
...
...
...
...
Warning | ||
---|---|---|
| ||
Further updates must be done in the corresponding RST file(s) by following the build process for documentation. https://docs.onap.org/projects/onap-ccsdk-cds/en/latest/usecases/pnf-simulator.html 2020-10-19, Jakob Krieg |
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 using CDS REST API interfaces.
- Setting up PNF simulator integration project
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.
You can also consider using the Netopeer docker container alone to bring up NETCONF server. You can download the docker compose file test-netopeer.tar.gz
- Start PNF simulator docker containers. You can consider changing the netopeer image verion to image: sysrepo/sysrepo-netopeer2:iop in docker-compose.yml file If you find any issues with the default image.
cd $HOME
git clone https://github.com/onap/integration.git
...
./simulator.sh stop
- Verify the that you have netopeer docker container are up and running. It will be mapped to host port 830
...
sysrepoctl -i -g /etc/sysrepo/yang/pg.yang
- Connect to netopeer docker container and execute the following commands to initialise the pg.yang model. You can leave this terminal up and running.
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 > quit exit |
---|
...
edit-config --target running --config=/dev-models/sample-plugin-data.xml > |
---|
- You can use the attached either plain CBA file (pnf-demo-
...
- unenriched.zip) or the enriched (PNF-DEMO-ENRICHED-WORKING.zip
...
- ) file to enrich, save, publish and deploy
...
- 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
- The assumption is 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
Day-1 : config-assign parameters
pnf-ipv4-address, netconf-server-port, netconf-username, netconf-password, stream-count
- 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 codeusing utility scripts under Scripts folder
git clone "https://gerrit.onap.org/r/ccsdk/cds" |
---|
- Setup CDS k8s environment by following Running CDS on Microk8s wiki page
- After Verify if you can see CDS k8s PODs
kubectl get pods -n onap NAME READY STATUS RESTARTS AGE |
---|
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 |
---|
Get the default model "artifactName": "vFW-CDS" loaded by bootstrap
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 |
---|
Check CDS database for PNF data dictionaries
You should see 6 rows as shown below
./connect-cds-mariadb.sh
+---------------------+-----------+ quit exit |
---|
Create PNF CDS Blueprint archive pnf-demo.zip
cd PNF_DEMO/
zip -r pnf-demo.zip * # You should see the below ZIP file |
---|
Enrich PNF Bluerprint archive
cd PNF_DEMO/Scripts
|
---|
Verify Enriched Blue pring archive /tmp/CBA/ENRICHED-CBA.zip
cd /tmp/CBA/ unzip ENRICHED-CBA.zip tree |
---|
Deploy/Save the Blueprint into CDS database
cd PNF_DEMO/Scripts # You should see the new model "artifactName": "pnf_netconf" |
---|
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
- Create PNF configuration for resolution-key = day-1 (stream-count = 5)
You can verify the CURL command JSON pay load file /tmp/day-n-pnf-config.json
cd PNF_DEMO/Scripts
|
---|
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> |
---|
- Create PNF configuration for resolution-key = day-2 (stream-count = 10)
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 |
---|
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"> |
---|
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
- config-deploy resoultion-key = day-1
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
|
---|
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 |
---|
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 |
---|
Go back to PNF netopeer cli console and verify if you can see 5 streams fw_udp_1 to fw_udp_5 enabled
> > |
---|
- config-deploy resoultion-key = day-2
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 |
---|
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> |
---|
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> |
---|