Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents


Jira Legacy
serverSystem Jira
columnIdsissuekey,summary,issuetype,created,updated,duedate,assignee,reporter,priority,status,resolution
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId4733707d-2057-3a0f-ae5e-4fd8aff50176
keyCPS-731

...

Given the public properties below


IssueNotesDecision
1Does request body need to declare "publicCmHandleProperties"?

Do we need to explicitly declare "publicCmHandleProperties"? 

Will there be another possible variation to this in the future?

Code Block
languageyml
{
  "publicCmHandleProperties" : {
          "Colour": "red",
          "Size": "large"
   }
}


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 

Code Block
languageyml
{
	"name": "Colour",
	"value": "red"
},
{
	"name": "Size",
	"value": "large"
}


Yes. But all this is hidden when using CpsPath type query


3Will 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
4Does the order matter?

Does

Code Block
languageyml
{
  "publicCmHandleProperties" : {
          "Colour" : "green",
          "Size" : "small"
   }
}

==

Code Block
languageyml
{
  "publicCmHandleProperties" : {
          "Size" : "small"
          "Colour" : "green",
     }
}


No
But all this is hidden when using CpsPath type query
5Should 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
6What format should the response take?

We have two options currently:


  1. Return List<String>
Code Block
languageyml
[
    "cmHandle1",
    "cmHandle2",
    ...,
    "cmHandleN"
]


2. Return CM Handle Objects

    1. Already defined in CPS
    2. <Example Pending>

Contact Tony Finnerty & kieran mccarthy regarding this.
Tony Finnerty Has no opinion on this matter

It has been decided to implement this using a list of cm handles
7what 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.

Discussed with Toine Siebelink and implementation changes are required for handling edges cases. we will handle empty and unknown properties separately.

8

Regarding empty/missing property in request

e.g.

{

    "publicCmHandleProperties": {
        """doesnt matter "
    }
}

Do we want to throw an exception if there is an empty property?

Do we silently ignore them and move on?

should we send two lists back... one with matching cm handles and one with those that failed processing?

We will throw a DataValidationException if an entry contains an empty property9

CPS stores Integers as Strings.

Code Block
languageyml
{
    "cmHandle": "Bookstore6",
    publicCmHandleProperties": {
        "color": 12345
        }
}, {
    "cmHandle": "Bookstore7",
    "publicCmHandleProperties": {
        "color": "12345"
        }
}

When stored in CPS Integers are stored as Strings.

xpathattributes

/dmi-registry/cm-handles[@id='Bookstore6']/public-properties[@name='color']

{"name": "color", "value": "12345"}
/dmi-registry/cm-handles[@id='Bookstore7']/public-properties[@name='color']{"name": "color", "value": "12345"}

{
    "publicCmHandleProperties": {
        "color" : "12345"
    }
}

and

{
    "publicCmHandleProperties": {
        "color"12345
    }
}

return

[
    "Bookstore6",
    "Bookstore7"
]

Analysis/Implementation Proposal

High level Jiras:

  1. Jira Legacy
    serverSystem Jira
    serverId4733707d-2057-3a0f-ae5e-4fd8aff50176
    keyCPS-901
  2. Jira Legacy
    serverSystem Jira
    serverId4733707d-2057-3a0f-ae5e-4fd8aff50176
    keyCPS-902
  3. Jira Legacy
    serverSystem Jira
    serverId4733707d-2057-3a0f-ae5e-4fd8aff50176
    keyCPS-903
  4. Jira Legacy
    serverSystem Jira
    serverId4733707d-2057-3a0f-ae5e-4fd8aff50176
    keyCPS-904

Possible High-Level Implementation Steps:

  1. Match all xpaths using CPS Path Query

  2. Iterate over the list and retrieve all attributes

  3. Iterate over the attributes and collect those instances that match
  4. Return collected list of cm handles

Interface Proposal

...

Request Body

Code Block
languageyml
{
  "publicCmHandleProperties" : {
     "Colour" : "green",
     "Size" : "small"
   }
}

Response Body Example 1

Code Block
languageyml
[
	"cmHandle1",
	"cmHandle2",
	...,
	"cmHandleN"
]

Below is a sample yaml for OpenAPI.

...

languageyml
titleSample OpenAPI yAML
collapsetrue

...


Analysis/Implementation Proposal

...

High level Jiras:

  1. Jira Legacy
    serverSystem Jira
    serverId4733707d-2057-3a0f-ae5e-4fd8aff50176
    keyCPS-901
  2. Jira Legacy
    serverSystem Jira
    serverId4733707d-2057-3a0f-ae5e-4fd8aff50176
    keyCPS-902
  3. Jira Legacy
    serverSystem Jira
    serverId4733707d-2057-3a0f-ae5e-4fd8aff50176
    keyCPS-903
  4. Jira Legacy
    serverSystem Jira
    serverId4733707d-2057-3a0f-ae5e-4fd8aff50176
    keyCPS-904


Possible High-Level Implementation Steps:

  1. Match all xpaths using CPS Path Query

  2. Iterate over the list and retrieve all attributes

  3. Iterate over the attributes and collect those instances that match
  4. Return collected list of cm handles

Interface Proposal

#URIDesign NotesComment(s)
1POST /ncmp/v1/data/ch/searches

Scenario :  Request received to return all cm handles matching properties given
Method   : POST
URI          : {ncmpRoot}/ncmp/v1/data/ch/searches 
Header    : Content-Type: application/json

Request Body

Code Block
languageyml
{
  "publicCmHandleProperties" : {
     "Colour" : "green",
     "Size" : "small"
   }
}


Response Body Example 1

Code Block
languageyml
[
	"cmHandle1",
	"cmHandle2",
	...,
	"cmHandleN"
]




Below is a sample yaml for OpenAPI.

Code Block
languageyml
titleSample OpenAPI yAML
collapsetrue
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:
        application/json:
          schema:
            $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/schemasresponses/PublicPropertiesForbidden'
    responses:  404:
    200:         description: OK$ref: 'components.yaml#/components/responses/NotFound'
         content500:
          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

https://gerrit.onap.org/r/c/cps/+/127541

Data Used for Testing

...

$ref: 'components.yaml#/components/responses/InternalServerError'


Testing

...

https://gerrit.onap.org/r/c/cps/+/127541

Data Used for Testing

...

Bookstore5[@name='color']
#xpathattributes
1/dmi-registry/cm-handles[@id='Bookstore5']/public-properties[@name='color']{"name": "color", "value": "won't match"}
2/dmi-registry/cm-handles[@id='PNFDemo']/public-properties[@name='Contact']{"name": "Contact", "value": "newemailforstore@bookstore.com"}
3/dmi-registry/cm-handles[@id='Bookstore4']/public-properties[@name='color']{"name": "color", "value": ""}
4/dmi-registry/cm-handles[@id='Bookstore3']/public-properties[@name='color']{"name": "color", "value": "red"}
5/dmi-registry/cm-handles[@id='Bookstore2']/public-properties[@name='Contact']{"name": "Contact", "value": "newemailforstore2@bookstore.com"}
6/dmi-registry/cm-handles[@id='Bookstore1']/public-properties{"name": "color", "value": "won't match"}
2/dmi-registry/cm-handles[@id='PNFDemo']/public-properties[@name='Contact']{"name": "Contact", "value": "newemailforstore@bookstore.com"}
3/dmi-registry/cm-handles[@id='Bookstore4']/public-properties[@name='color']{"name": "color", "value": ""}
4/dmi-registry/cm-handles[@id='Bookstore3']/public-properties[@name='color']{"name": "color", "value": "red"}
5/dmi-registry/cm-handles[@id='Bookstore2']/public-properties[@name='Contact']{"name": "Contact", "value": "newemailforstore2@bookstore.com"}
6/dmi-registry/cm-handles[@id='Bookstore1']/public-properties[@name='Contact']{"name": "Contact", "value": "newemailforstore@bookstore.com"}

...

languageyml
titleCreate CM Handles JSON
collapsetrue

...

[@name='Contact']{"name": "Contact", "value": "newemailforstore@bookstore.com"}


Code Block
languageyml
titleCreate CM Handles JSON
collapsetrue
{
    "dmiPlugin": "http://172.24.170.77:8783",
    "createdCmHandles": [
        {
            "cmHandle": "Bookstore1",
            "publicCmHandleProperties": {
                "Contact": "newemailforstore@bookstore.com"
            }
        },
        {
            "cmHandle": "Bookstore2",
            "publicCmHandleProperties": {
                "Contact": "newemailforstore2@bookstore.com"
            }
        },
        {
            "cmHandle": "Bookstore3",
            "publicCmHandleProperties": {
                "color": "red"
            }
        },
        {
            "cmHandle": "Bookstore1Bookstore4",
            "publicCmHandleProperties": {
                "Contactcolor": "newemailforstore@bookstore.com"
            }
        },
        {
            "cmHandle": "Bookstore2Bookstore5",
            "publicCmHandleProperties": {
         
      "Contact": "newemailforstore2@bookstore.com"           "color": "won't match"
 }         },  }
      {  }
          "cmHandle": "Bookstore3",
            "publicCmHandleProperties": {
                "color": "red"
            }
        },
        {
            "cmHandle": "Bookstore4",
            "publicCmHandleProperties": {
                "color": ""
            }
        },
        {
            "cmHandle": "Bookstore5",
            "publicCmHandleProperties": {
                "color": "won't match"
            }
        }
    ]
}

URL Used for all Requessts

http://localhost:8883/ncmp/v1/data/ch/searches

...

]
}



URL Used for all Requessts

http://localhost:8883/ncmp/v1/data/ch/searches

Results - Happy Path

#ScenarioRequestResponse
1

Both properties match

(Return CM Handles that Match

{
    "publicCmHandleProperties": {
        "Contact""newemailforstore@bookstore.com"
    }
}

[
    "Bookstore1",
    "PNFDemo"
]

2

Multiple Entries - both properties match

(Return CM Handles that Match

{
    "publicCmHandleProperties": {
        "Contact""newemailforstore@bookstore.com",
        "color" : "red"
    }
}

[
    "Bookstore1",
    "Bookstore3",
    "PNFDemo"
]

3

No properties given

(Return All CM Handles which contain public properties

{

    "publicCmHandleProperties": {
    }
}

[
    "Bookstore4",
    "Bookstore5",
    "Bookstore1",
    "Bookstore2",
    "Bookstore3",
    "PNFDemo"
]

Results - Edge Cases

#ScenarioRequestResponse
1
Both properties match

Value doesn't match 

(Return

CM Handles that Match

Empty Response

{
    "publicCmHandleProperties": {
        "Contact""wont match"
    }
}

[ ]
2

Unknown properties given

(Return Empty Response)

{
    "publicCmHandleProperties"

"newemailforstore@bookstore.com

{
        "UnknwnProperty""doesnt matter"
    }
}

[

    "Bookstore1",
    "PNFDemo"
]
2Multiple Entries - both properties match
3

Empty value (valid)

(Return CM Handles Returned that Match

{

    "publicCmHandleProperties": {


        "Contact""newemailforstore@bookstore.com",


        "color"

 

"

red

"
    }
}

[
    "

Bookstore1",
    "Bookstore3",
    "PNFDemo

No properties given

(Return All CM Handles which contain public properties

Bookstore4"
]

3
4

Empty property (invalid)

(BAD_REQUEST)

{

    "publicCmHandleProperties": {

   

        """doesnt matter "
    }
}

[

{
    "

Bookstore4",
    "Bookstore5

status""400 BAD_REQUEST",
    "

Bookstore1",
    "Bookstore2

message""Invalid data",
    "

Bookstore3",
    "PNFDemo"
]

Results - Edge Cases

Value doesn't match 

(Return Empty Response

Empty value (valid)

(Return CM Handles Returned that Match[Bookstore4"
]won't matchstatus"500 INTERNAL_SERVER_ERROR",
    "message"Error while parsing cpsPath expression
#ScenarioRequestResponse
1

details""Missing property - please supply a valid property"
}

5

Multiple entries with one empty property (invalid)

(BAD_REQUEST)

{
    "publicCmHandleProperties": {
        "color" : "",
        "" : "doesnt matter",
        "Contact""wont matchnewemailforstore@bookstore.com"
    }
}

[ ]2

Unknown properties given

(Return Empty Response)

{
    "

publicCmHandleProperties
        "UnknwnProperty

status"

{

"400 BAD_REQUEST",
    "message""

doesnt matter

Invalid data",
    

}

"details""Missing property - please supply a valid property"
}

[ ]3
6

Apostrophe in cm handle 

(Exception)

*** CPS can create a cm handle with a public property value that has an apostrophe but throws exception when queried ***

{
    "publicCmHandleProperties": {
        "color" "won't match"
    }
}

6

Apostrophe in cm handle 

(Exception)

*** CPS can create a cm handle with a public property value that has an apostrophe but throws exception when queried ***

{
    "status"

4

Empty property (invalid)

(BAD_REQUEST)

{

    "publicCmHandleProperties": {
        """doesnt matter "
    }
}

{
    "status""400 BAD_REQUEST",
    "message""Invalid data",
    "details""Missing property - please supply a valid property"
}

5

Multiple entries with one empty property (invalid)

(BAD_REQUEST)

{
    "publicCmHandleProperties": {
        "color" : "",
        "" : "doesnt matter",
        "Contact""newemailforstore@bookstore.com"
    }
}

{
    "status""400 BAD_REQUEST",
    "message""Invalid data",
    "details""Missing property - please supply a valid property"
}

"500 INTERNAL_SERVER_ERROR",
    "message""Error while parsing cpsPath expression",
    "details""failed to parse at line 1 due to extraneous input 't' expecting {']', 'and'}"
}

7

CPS stores Integers as Strings.

Given the public properties below

Code Block
languageyml
{
    "cmHandle": "Bookstore6",
    publicCmHandleProperties": {
        "color": 12345
        }
}, {
    "cmHandle": "Bookstore7",
    "publicCmHandleProperties": {
        "color": "12345"
        }
}


When stored in CPS Integers are stored as Strings.

xpathattributes

/dmi-registry/cm-handles[@id='Bookstore6']/public-properties[@name='color']

{"name": "color", "value": "12345"}
/dmi-registry/cm-handles[@id='Bookstore7']/public-properties[@name='color']{"name": "color", "value": "12345"}

Therefore the two requests below return both cm handles regardless of wanting Integer or String.


{
    "publicCmHandleProperties": {
        "color" : "

12345"
    }
}


{
    "

publicCmHandleProperties"

{
        "color"

12345
    }
}

[
    "Bookstore6",
    "details""failed to parse at line 1 due to extraneous input 't' expecting {']', 'and'}"
}Bookstore7"
]


Future Example (Out-of-scope)

...