Skip to content

Commit 25dc2b0

Browse files
toine-at-estGerrit Code Review
authored andcommitted
Merge "separate ONAP DMI stack postman environment"
2 parents 70df053 + 4d8a7e1 commit 25dc2b0

3 files changed

Lines changed: 273 additions & 8 deletions

File tree

‎postman-collections/CPS.postman_collection.json‎

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3013,6 +3013,131 @@
30133013
],
30143014
"description": "CPS-NCMP endpoints as defined by Rest OpenApi Specification [here](https://docs.onap.org/projects/onap-cps/en/latest/design.html#cps-ncmp)\n\nCPS-NCMP-Inventory endpoints as defined by Rest OpenApi Specification [here](https://docs.onap.org/projects/onap-cps/en/latest/design.html#cps-ncmp-inventory)"
30153015
},
3016+
{
3017+
"name": "ONAP-DMI-Stack",
3018+
"item": [
3019+
{
3020+
"name": "1. Register the cm-handle",
3021+
"request": {
3022+
"method": "POST",
3023+
"header": [],
3024+
"body": {
3025+
"mode": "raw",
3026+
"raw": "{\n \"dmiPlugin\": \"http://{{DMI_PLUGIN_HOST}}:{{DMI_PLUGIN_PORT}}\",\n \"createdCmHandles\": [\n {\n \"cmHandle\": \"{{CM_HANDLE}}\",\n \"cmHandleProperties\": {}\n }\n ]\n}",
3027+
"options": {
3028+
"raw": {
3029+
"language": "json"
3030+
}
3031+
}
3032+
},
3033+
"url": {
3034+
"raw": "http://{{CPS_HOST}}:{{CPS_PORT}}/ncmpInventory/v1/ch",
3035+
"protocol": "http",
3036+
"host": [
3037+
"{{CPS_HOST}}"
3038+
],
3039+
"port": "{{CPS_PORT}}",
3040+
"path": [
3041+
"ncmpInventory",
3042+
"v1",
3043+
"ch"
3044+
]
3045+
},
3046+
"description": "Registers the netconf node mounted in SDNC as a cm-handle, against the real ncmp-dmi-plugin."
3047+
},
3048+
"response": []
3049+
},
3050+
{
3051+
"name": "2. Get CM handle state",
3052+
"request": {
3053+
"method": "GET",
3054+
"header": [
3055+
{
3056+
"key": "Authorization",
3057+
"value": "{{basic_auth_171s}}"
3058+
}
3059+
],
3060+
"url": {
3061+
"raw": "http://{{CPS_HOST}}:{{CPS_PORT}}/ncmp/v1/ch/{{CM_HANDLE}}/state",
3062+
"protocol": "http",
3063+
"host": [
3064+
"{{CPS_HOST}}"
3065+
],
3066+
"port": "{{CPS_PORT}}",
3067+
"path": [
3068+
"ncmp",
3069+
"v1",
3070+
"ch",
3071+
"{{CM_HANDLE}}",
3072+
"state"
3073+
]
3074+
},
3075+
"description": "Module sync takes up to a minute. Expects \"cmHandleState\":\"READY\" before step 3 returns modules."
3076+
},
3077+
"response": []
3078+
},
3079+
{
3080+
"name": "3. Get module references",
3081+
"request": {
3082+
"method": "GET",
3083+
"header": [
3084+
{
3085+
"key": "Authorization",
3086+
"value": "{{basic_auth_171s}}"
3087+
}
3088+
],
3089+
"url": {
3090+
"raw": "http://{{CPS_HOST}}:{{CPS_PORT}}/ncmp/v1/ch/{{CM_HANDLE}}/modules",
3091+
"protocol": "http",
3092+
"host": [
3093+
"{{CPS_HOST}}"
3094+
],
3095+
"port": "{{CPS_PORT}}",
3096+
"path": [
3097+
"ncmp",
3098+
"v1",
3099+
"ch",
3100+
"{{CM_HANDLE}}",
3101+
"modules"
3102+
]
3103+
},
3104+
"description": "Returns the YANG modules read from the simulated device via SDNC, e.g. ietf-netconf, ietf-keystore, ietf-system."
3105+
},
3106+
"response": []
3107+
},
3108+
{
3109+
"name": "4. De-register the cm-handle",
3110+
"request": {
3111+
"method": "POST",
3112+
"header": [],
3113+
"body": {
3114+
"mode": "raw",
3115+
"raw": "{\n \"dmiPlugin\": \"http://{{DMI_PLUGIN_HOST}}:{{DMI_PLUGIN_PORT}}\",\n \"removedCmHandles\": [ \"{{CM_HANDLE}}\" ]\n}",
3116+
"options": {
3117+
"raw": {
3118+
"language": "json"
3119+
}
3120+
}
3121+
},
3122+
"url": {
3123+
"raw": "http://{{CPS_HOST}}:{{CPS_PORT}}/ncmpInventory/v1/ch",
3124+
"protocol": "http",
3125+
"host": [
3126+
"{{CPS_HOST}}"
3127+
],
3128+
"port": "{{CPS_PORT}}",
3129+
"path": [
3130+
"ncmpInventory",
3131+
"v1",
3132+
"ch"
3133+
]
3134+
},
3135+
"description": "Cleans up the cm-handle registered in step 1."
3136+
},
3137+
"response": []
3138+
}
3139+
]
3140+
},
30163141
{
30173142
"name": "NCMP-DMI-Stub",
30183143
"item": [
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"id": "309b42dd-8bd2-4d24-9ca4-03a5fd2e28cb",
3+
"name": "CPS Environment ONAP DMI Stack (k8s)",
4+
"values": [
5+
{
6+
"key": "CPS_HOST",
7+
"value": "localhost",
8+
"type": "default",
9+
"enabled": true
10+
},
11+
{
12+
"key": "CPS_PORT",
13+
"value": "30080",
14+
"type": "default",
15+
"enabled": true
16+
},
17+
{
18+
"key": "basic_auth_171s",
19+
"value": "Basic Y3BzdXNlcjpjcHNyMGNrcyE=",
20+
"type": "default",
21+
"enabled": true
22+
},
23+
{
24+
"key": "DMI_PLUGIN_HOST",
25+
"value": "cps-ncmp-ncmp-dmi-plugin-service",
26+
"type": "default",
27+
"enabled": true
28+
},
29+
{
30+
"key": "DMI_PLUGIN_PORT",
31+
"value": "8080",
32+
"type": "default",
33+
"enabled": true
34+
},
35+
{
36+
"key": "DMI_PLUGIN_NODEPORT",
37+
"value": "30097",
38+
"type": "default",
39+
"enabled": true
40+
},
41+
{
42+
"key": "SDNC_NODEPORT",
43+
"value": "30096",
44+
"type": "default",
45+
"enabled": true
46+
},
47+
{
48+
"key": "SDNC_AUTH",
49+
"value": "Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==",
50+
"type": "default",
51+
"enabled": true
52+
},
53+
{
54+
"key": "CM_HANDLE",
55+
"value": "ietfYang-PNFDemo",
56+
"type": "default",
57+
"enabled": true
58+
}
59+
],
60+
"color": null,
61+
"_postman_variable_scope": "environment",
62+
"_postman_exported_at": "2026-09-17T08:57:44.000Z",
63+
"_postman_exported_using": "Postman/11.73.4"
64+
}

‎postman-collections/README.md‎

Lines changed: 84 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--
22
============LICENSE_START=======================================================
3-
Copyright (C) 2024 Nordix Foundation.
3+
Copyright (C) 2024-2026 OpenInfra Foundation Europe. All rights reserved.
44
================================================================================
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
@@ -21,12 +21,33 @@
2121
# Importing and running the CPS postman collections
2222

2323
## Importing the CPS collections
24-
To import the CPS collections and environment:
24+
To import the CPS collections and environments:
2525
1. Create a "Workspace" (or if you have one already you can use that)
2626
2. Click "Import" (or click "File" then "Import")
2727
3. Drag and drop the "postman-collection" folder into the import pop-up
28-
4. The collections and environment should now be imported
29-
5. Set the current environment to "CPS Environment k8s-linux-minikube"
28+
4. The collection and environments should now be imported
29+
5. Select the environment that matches your deployment (see "Choosing an environment" below)
30+
31+
## Choosing an environment
32+
Two environments are provided. Which one you need depends on whether the DMI side
33+
of your deployment is the lightweight dmi-stub or the real ncmp-dmi-plugin.
34+
35+
| Environment file | Environment name | Use for |
36+
|---|---|---|
37+
| `Env_k8s.json` | CPS Environment k8s (linux and windows) | Default deployment, using dmi-stub |
38+
| `Env_onap_dmi_stack.json` | CPS Environment ONAP DMI Stack (k8s) | Optional `onapDmiStack` deployment, using the real ncmp-dmi-plugin and SDNC |
39+
40+
The two are kept separate because their variables do not overlap: the dmi-stub
41+
endpoints are not deployed when `onapDmiStack` is enabled, and the
42+
ncmp-dmi-plugin/SDNC endpoints do not exist otherwise.
43+
44+
Folders in the CPS collection map to the environments as follows:
45+
46+
- `CPS-Core` — neither (only needs `CPS_HOST`/`CPS_PORT`, present in both)
47+
- `CPS-NCMP`, `NCMP-DMI-Stub` — `Env_k8s.json`
48+
- `ONAP-DMI-Stack` — `Env_onap_dmi_stack.json`
49+
- `Liveness & Readiness` — spans both; its `DMI-Stub` subfolder needs
50+
`Env_k8s.json`, its `ONAP-DMI-Stack` subfolder needs `Env_onap_dmi_stack.json`
3051

3152
### Environment Setup
3253
Configure the correct host and ports based on your local setup:
@@ -39,10 +60,16 @@ minikube service list
3960
# Update environment variables with:
4061
# CPS_HOST = <minikube-ip> (e.g., 192.168.49.2)
4162
# CPS_PORT = <nodeport> (e.g., 30080)
42-
# DMI_HOST = <minikube-ip>
43-
# DMI_PORT = <nodeport> (e.g., 30092)
63+
#
64+
# Env_k8s.json (dmi-stub):
65+
# DMI_HOST_1 = <minikube-ip>
66+
# DMI_PORT_1 = <nodeport> (e.g., 30092)
4467
# DMI_HOST_2 = <minikube-ip>
4568
# DMI_PORT_2 = <nodeport> (e.g., 30094)
69+
#
70+
# Env_onap_dmi_stack.json (ONAP DMI stack):
71+
# DMI_PLUGIN_NODEPORT = <nodeport> (e.g., 30097)
72+
# SDNC_NODEPORT = <nodeport> (e.g., 30096)
4673
```
4774

4875
**Windows (Docker Desktop / minikube):**
@@ -63,12 +90,48 @@ kubectl get svc | grep -E "cps|dmi"
6390
# Use the second port (30080) in your environment
6491
```
6592

93+
### ONAP DMI stack setup
94+
The `ONAP-DMI-Stack` requests target the real ncmp-dmi-plugin and SDNC, which are
95+
only deployed when the optional stack is enabled:
96+
97+
```bash
98+
helm install cps ./cps-charts --set onapDmiStack.enabled=true --timeout 20m
99+
```
100+
101+
Select the "CPS Environment ONAP DMI Stack (k8s)" environment
102+
(`Env_onap_dmi_stack.json`) for these requests.
103+
104+
On Linux/minikube, NodePorts bind to the minikube IP rather than localhost.
105+
Either set `CPS_HOST` to the output of `minikube ip`, or port-forward:
106+
107+
```bash
108+
kubectl port-forward service/cps-ncmp-service 30080:8080
109+
kubectl port-forward service/cps-ncmp-ncmp-dmi-plugin-service 30097:8080
110+
kubectl port-forward service/cps-ncmp-sdnc-service 30096:8181
111+
```
112+
66113
## Environment Variables
67-
The environment supports:
114+
115+
Shared by both environments:
68116
- `CPS_HOST` and `CPS_PORT` - CPS service endpoint
69-
- `DMI_HOST` and `DMI_PORT` - DMI-Stub-1 endpoint
117+
- `basic_auth_171s` - basic auth header for CPS NCMP requests
118+
119+
`Env_k8s.json` (dmi-stub) adds:
120+
- `DMI_HOST_1` and `DMI_PORT_1` - DMI-Stub-1 endpoint
70121
- `DMI_HOST_2` and `DMI_PORT_2` - DMI-Stub-2 endpoint
71122

123+
`Env_onap_dmi_stack.json` (ONAP DMI stack) adds:
124+
- `DMI_PLUGIN_HOST` and `DMI_PLUGIN_PORT` - in-cluster ncmp-dmi-plugin service,
125+
used in the `dmiPlugin` field of the cm-handle registration body
126+
- `DMI_PLUGIN_NODEPORT` - ncmp-dmi-plugin NodePort, for health checks from
127+
outside the cluster
128+
- `SDNC_NODEPORT` and `SDNC_AUTH` - SDNC endpoint and basic auth header
129+
- `CM_HANDLE` - cm-handle id matching the netconf node mounted in SDNC
130+
131+
Note: the `NCMP-DMI-Stub` folder also references `DMI_STUB_1_PORT`, which is not
132+
defined in either environment file. Set it manually (or add it to
133+
`Env_k8s.json`) before running those requests.
134+
72135
## Using collections in Postman
73136
A how-to guide is provided in the CPS collection. To access this guide click on the parent CPS folder icon at the top of the collection and follow the provided instructions.
74137

@@ -80,8 +143,21 @@ The collection includes health check endpoints for all services:
80143
- **CPS**: Liveness and Readiness checks
81144
- **DMI-Stub-1**: Liveness and Readiness checks
82145
- **DMI-Stub-2**: Liveness and Readiness checks
146+
- **ONAP-DMI-Stack**: DMI plugin health check and SDNC mounted node check
147+
(requires `onapDmiStack.enabled=true` and the ONAP DMI stack environment)
83148

84149
These checks work with k8s deployments by using environment variables.
85150

151+
## ONAP DMI Stack demo flow
152+
The `ONAP-DMI-Stack` folder exercises the DMI -> NCMP -> SDNC integration path
153+
against the real ncmp-dmi-plugin. Run the requests in order:
154+
155+
1. Register the cm-handle
156+
2. Get CM handle state - module sync takes up to a minute; wait for
157+
`"cmHandleState":"READY"` before step 3
158+
3. Get module references - returns the YANG modules read from the simulated
159+
device via SDNC
160+
4. De-register the cm-handle - cleans up after the demo
161+
86162
## Notes
87163
When exporting postman collections tabs are used for spacing, so replacing all the tabs is necessary

0 commit comments

Comments
 (0)