Incorporated patchset 1 review comments Updated patchset 5 review comments Updated patchset 6 review comments Fixed merge conflicts Updated patchset 8 review comments Change-Id: Icd7b08ab69273f6073b960a13cf59905532f851a Signed-off-by: Juanita-Balaraj <juanita.balaraj@windriver.com>
		
			
				
	
	
	
		
			4.7 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	Create, Test, and Terminate a PTP Notification Demo
This section provides instructions on accessing, creating, testing and terminating a ptp-notification-demo.
Use the following procedure to copy the tarball from , create, test, and terminate a ptp-notification-demo.
Copy the ptp-notification-demo_v1.0.2.tgz file from at http://mirror.starlingx.cengn.ca/mirror/starlingx/ to yor system, and extract its content.
Note
The tarball includes the docker file and code to build the reference API application, and the Helm chart to install the Sidecar along with the application.
The following files are part of the tarball:
- Helm charts
- Chart.yaml
 - values.yaml
 - _helpers.tpl
 - configmap.yaml
 - deployment.yaml
 - .helmignore
 - ptp-notification-override.yaml
 - app_start.sh
 - sidecar_start.sh
 
 - notification-docker
- Dockerfile
 - api
 
 
Note
The demo uses the following images:
- starlingx/notificationclient-base:stx.5.0-v1.0.3
 - ptp-base:1.0.1
 
- Helm charts
 Build the ptp-base:1.0.1 image using the following commands.
$ tar xvf ptp-notification-demo_<v1.0.2>.tgz $ cd ~/notification-dockers/ptp-base/ $ sudo docker build . -t ptp-base:1.0.1 $ sudo docker save ptp-base:1.0.1 -o ptp-base.1.0.1.tar $ sudo ctr -n k8s.io image import ./ptp-base.1.0.1.tar $ cd ~/charts $ tar xvf ptp-notification-demo-1.tgzNote
For -SX and AIO-DX systems, ptp-base.1.0.1.tar should be copied to each node and the import command,
sudo ctr -n k8s.io image import ./ptp-base.1.0.1.tarshould be run on each node.Install the demo's pod using the following commands.
Note
This pod includes two containers, Sidecar and the referenced API application.
$ kubectl create namespace ptpdemo $ helm install -n notification-demo ~/charts/ptp-notification-demo -f ~/charts/ptp-notification-demo/ptp-notification-override.yaml $ kubectl get pods -n ptpdemoNAME READY STATUS RESTARTS AGE notification-demo-ptp-notification-demo-cf7b65c47-s5jk6 2/2 Running 0 5m50sTest the ptp-notification demo.
Display the app logs using the following command.
$ kubectl logs -f notification-demo-ptp-notification-demo-<xyz> -c ptp-notification-demo-app -n ptpdemo
In another terminal, access the application container.
$ kubectl exec -it notification-demo-ptp-notification-demo-<zyz> -c ptp-notification-demo-app -n ptpdemo -- bashCheck if you can pull status using the REST API.
$ curl -v -H 'Content-Type: application/json' http://127.0.0.1:8080/ocloudNotifications/v1/PTP/CurrentStateSubscribe to notifications.
$ curl -v -d '{"ResourceType": "PTP", "ResourceQualifier": {"NodeName": "controller-0"}, "EndpointUri": "http://127.0.0.1:9090/v1/resource_status/ptp"}' -H 'Content-Type: application/json' -X POST http://127.0.0.1:${SIDECAR_API_PORT}/ocloudNotifications/v1/subscriptions |python -m json.toolRetrieve a list of subscriptions.
$ curl -v -H 'Content-Type: application/json' http://127.0.0.1:${SIDECAR_API_PORT}/ocloudNotifications/v1/subscriptions |python -m json.toolFor example, to get a specific subscription, use the following command.
$ curl -v -H 'Content-Type: application/json' http://127.0.0.1:${SIDECAR_API_PORT}/ocloudNotifications/v1/subscriptions/<subscriptionId>To delete a specific subscription with the subscription ID, run the following command.
$ curl -X DELETE -v -H 'Content-Type: application/json' http://127.0.0.1:${SIDECAR_API_PORT}/ocloudNotifications/v1/subscriptions/<subscriptionId>
Terminate the demo using the following command.
$ helm del --purge notification-demo