Table of Contents |
---|
Jira Legacy | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Scope
It should be able to query all cm handles with a given set of public cm handle properties.
Requirements
- We want all cm-Handles where both things are true.
- If name is empty silently ignore, if value is empty (edge case test?)
- Those properties also need to exist.
- If query body does not follow supported structure return 400.
- Empty query will return all cm-Handles.
A/C:
- Demo - with "and" behavior
- CI Test - two attributes
Issues/Decisions
...
Do we need to explicitly declare "publicCmHandleProperties"?
Will there be another possible variation to this in the future?
Code Block | ||
---|---|---|
| ||
{
"publicCmHandleProperties" : {
"Colour": "red",
"Size": "large"
}
} |
...
Are public properties always stored (in postgress) in the format of "name" : x, "value": y?
(does NOT affect implementation)
In the fragment table there are example that follow this format
Code Block | ||
---|---|---|
| ||
{
"name": "Colour",
"value": "red"
},
{
"name": "Size",
"value": "large"
} |
...
Yes. But all this is hidden when using CpsPath type query
...
Does
Code Block | ||
---|---|---|
| ||
{
"publicCmHandleProperties" : {
"Colour" : "green",
"Size" : "small"
}
} |
...
Table of Contents |
---|
Jira Legacy | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Scope
...
It should be able to query all cm handles with a given set of public cm handle properties.
Requirements
- We want all cm-Handles where both things are true.
- If name is empty silently ignore, if value is empty (edge case test?)
- Those properties also need to exist.
- If query body does not follow supported structure return 400.
- Empty query will return all cm-Handles.
A/C:
- Demo - with "and" behavior
- CI Test - two attributes
Issues/Decisions
...
Issue | Notes | Decision | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Does request body need to declare "publicCmHandleProperties"? | Do we need to explicitly declare "publicCmHandleProperties"? Will there be another possible variation to this in the future?
|
"Size" : "small"
|
| green
|
| }
}No But all this is hidden when using CpsPath type query | |||||||||
5 | Should search be case sensitive? | depend on CPSPath functionality - may be case-sensitive https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html | Yes, that is the currently implement as such CpsPath type query. Given it is mostly machine-to-machine type queries this is good enough and performs better | |||||||||||||
6 | What format should the response take? |
| Yes | |||||||||||||
2 | Are public properties always stored (in postgress) in the format of "name" : x, "value": y? (does NOT affect implementation) | In the fragment table there are example that follow this format
| ||||||||||||||
[
"cmHandle1",
"cmHandle2",
...,
"cmHandleN"
] | 7 | what if we have valid entries and one entry is empty? | We would return all cm handles and others that match would be included in this list anyway. → To avoid this should we first check the entries int map for empty entries as further processing is unnecessary in this case. |
Analysis/Implementation Proposal
High level Jiras:
Jira Legacy server System Jira serverId 4733707d-2057-3a0f-ae5e-4fd8aff50176 key CPS-901 Jira Legacy server System Jira serverId 4733707d-2057-3a0f-ae5e-4fd8aff50176 key CPS-902 Jira Legacy server System Jira serverId 4733707d-2057-3a0f-ae5e-4fd8aff50176 key CPS-903 Jira Legacy server System Jira serverId 4733707d-2057-3a0f-ae5e-4fd8aff50176 key CPS-904
Possible High-Level Implementation Steps:
Match all xpaths using CPS Path Query
Iterate over the list and retrieve all attributes
- Iterate over the attributes and collect those instances that match
- Return collected list of cm handles
Interface Proposal
...
Request Body
Code Block | ||
---|---|---|
| ||
{
"publicCmHandleProperties" : {
"Colour" : "green",
"Size" : "small"
}
} |
Response Body Example 1
Code Block | ||
---|---|---|
| ||
[
"cmHandle1",
"cmHandle2",
...,
"cmHandleN"
] |
Below is a sample yaml for OpenAPI.
...
language | yml |
---|---|
title | Sample OpenAPI yAML |
collapse | true |
...
| Yes. But all this is hidden when using CpsPath type query | ||||||||||||
3 | Will there only ever be 1 kv pairs in public properties (in the DB)? | Yes, as each property is stored in a separate list-item Fragment But all this is hidden when using CpsPath type query | |||||||||||
4 | Does the order matter? | Does
==
| No But all this is hidden when using CpsPath type query | ||||||||||
5 | Should search be case sensitive? | depend on CPSPath functionality - may be case-sensitive https://docs.onap.org/projects/onap-cps/en/latest/cps-path.html | Yes, that is the currently implement as such CpsPath type query. Given it is mostly machine-to-machine type queries this is good enough and performs better | ||||||||||
6 | What format should the response take? | We have two options currently:
2. Return CM Handle Objects
Contact Tony Finnerty & kieran mccarthy regarding this. | |||||||||||
7 | what if we have valid entries and one entry is empty? | We would return all cm handles and others that match would be included in this list anyway. → To avoid this should we first check the entries int map for empty entries as further processing is unnecessary in this case. |
Analysis/Implementation Proposal
...
High level Jiras:
Jira Legacy server System Jira serverId 4733707d-2057-3a0f-ae5e-4fd8aff50176 key CPS-901 Jira Legacy server System Jira serverId 4733707d-2057-3a0f-ae5e-4fd8aff50176 key CPS-902 Jira Legacy server System Jira serverId 4733707d-2057-3a0f-ae5e-4fd8aff50176 key CPS-903 Jira Legacy server System Jira serverId 4733707d-2057-3a0f-ae5e-4fd8aff50176 key CPS-904
Possible High-Level Implementation Steps:
Match all xpaths using CPS Path Query
Iterate over the list and retrieve all attributes
- Iterate over the attributes and collect those instances that match
- Return collected list of cm handles
Interface Proposal
# | URI | Design Notes | Comment(s) | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | POST /ncmp/v1/data/ch/searches | Scenario : Request received to return all cm handles matching properties given Request Body
Response Body Example 1
|
Below is a sample yaml for OpenAPI.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
executeSearchForMatchingPublicProperties: post: description: Execute search to get all cm handles for the given public properties tags: - network-cm-proxy summary: Execute cm handle search using operationId: executeSearchForMatchingPublicProperties requestBody: required: true content: $ref: 'components.yaml#/components/responses/NotFound'application/json: 500: schema: $ref: 'components.yaml#/components/responses/InternalServerError' |
Testing
Edge Cases
- Null name, Value
- Empty name, Value
- no key value pairs at all
Manual Testing
...
cURL Command
...
Both properties match
(CM Handles Returned that Match)
...
...
curl --location --request POST 'http://localhost:8883/ncmp/v1/data/ch/searches' \
--header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' \
--header 'Content-Type: application/json' \
--header 'Cookie: JSESSIONID=node0p01jwoucppe9e0t2ksksk2ns7.node0' \
--data-raw '{
"publicCmHandleProperties": {
"Contact": "newemailforstore@bookstore.com"
}
}'
{
"publicCmHandleProperties": {
"Contact": "newemailforstore@bookstore.com"
}
}
...
One property doesn't match
(Nothing Returned)
...
...
curl --location --request POST 'http://localhost:8883/ncmp/v1/data/ch/searches' \
--header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' \
--header 'Content-Type: application/json' \
--header 'Cookie: JSESSIONID=node0p01jwoucppe9e0t2ksksk2ns7.node0' \
--data-raw '{
"publicCmHandleProperties": {
"Contact": "something else"
}
}'
{
"publicCmHandleProperties": {
"Contact": "something else"
}
}
...
{
"publicCmHandleProperties": {
"UnknownProperty": "doesn't matter"
}
}
...
Empty property name
Return 400
(BAD_REQUEST)
...
...
$ref: 'components.yaml#/components/schemas/PublicProperties'
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
type: string
400:
$ref: 'components.yaml#/components/responses/BadRequest'
401:
$ref: 'components.yaml#/components/responses/Unauthorized'
403:
$ref: 'components.yaml#/components/responses/Forbidden'
404:
$ref: 'components.yaml#/components/responses/NotFound'
500:
$ref: 'components.yaml#/components/responses/InternalServerError' |
Testing
...
Edge Cases
- Null name, Value
- Empty name, Value
- no key value pairs at all
Manual Testing
Data
URL
...
Results
# | Scenario | Request | Response |
---|---|---|---|
1 | Both properties match (CM Handles Returned that Match) | { "publicCmHandleProperties": { | [ |
2 | Value doesn't match (Nothing Returned) | { |
[ ] | ||
3 | Unknown properties given - NO cm handles returned (Return Empty Response) | { |
doesnt matter" |
No properties given - all cm handles returned
(that contain public properties)
[ ] | ||
4 | Empty property name Return 400 (BAD_REQUEST) | { "publicCmHandleProperties": { |
"": "doesnt matter " |
Return 400
(BAD_REQUEST)
curl --location --request POST 'http://localhost:8883/ncmp/v1/data/ch/searches' \
--header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' \
--header 'Content-Type: application/json' \
--header 'Cookie: JSESSIONID=node0p01jwoucppe9e0t2ksksk2ns7.node0' \
--data-raw '{
"publicCmHandleProperties": [
"Contact", "newemailforstore@bookstore.com"
]
}'
5 | No properties given - all cm handles returned (that contain public properties) | { "publicCmHandleProperties": { | [ |
6 | Property is empty (BAD_REQUEST) | { "publicCmHandleProperties": [ " |
", "newemailforstore@bookstore.com" ] } |
[ ] |
Future Example (Out-of-scope)
...