Debug local CPS-NCMP with Docker
1. Have other applications you are interested in running in docker
2. In intellij open run → edit configurations
Ensure that the Application.java is selected
3. Add the following envinronment variables to environment variables section:
CPS_USERNAME=cpsuser;CPS_PASSWORD=cpsr0cks!;DB_USERNAME=cps;DB_PASSWORD=cps;DMI_USERNAME=cpsuser;DMI_PASSWORD=cpsr0cks!;DB_HOST=localhost
4. The following screenshot illustrates the required parameters
5. Click Apply → OK
6. Set a breakpoint in the desired location(s)
7. Run Application.java in debug mode
8. Trigger the breakpoint and debug
e.g. to cause an exception when running passthrough:
Synchronous: localhost:8080/ncmp/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-operational?resourceIdentifier=xietf-netconf-monitoring:netconf-state&options=(fields=schemas/schema/schemas)
Asynchronous: localhost:8080/ncmp/v1/ch/PNFDemo/data/ds/ncmp-datastore:passthrough-operational?resourceIdentifier=xietf-netconf-monitoring:netconf-state&options=(fields=schemas/schema/schemas)&topic=topic-for-test
Output:
{
"status": "500 INTERNAL_SERVER_ERROR",
"message": "500 : \"{\"status\":\"500 INTERNAL_SERVER_ERROR\",\"message\":\"400 Bad Request: \\\"{\\\"errors\\\":{\\\"error\\\":[{\\\"error-tag\\\":\\\"unknown-element\\\",\\\"error-type\\\":\\\"protocol\\\",\\\"error-message\\\":\\\"Failed to lookup for module with name 'xietf-netconf-monitoring'.\\\"}]}}\\\"\",\"details\":\"Check logs for details.\"}\"",
"details": "Check logs for details."
}