[AAI-158] csit test for search-data-service

Change-Id: I0c3cca0352c9eb7c7671d1cc7dee9081e61fd66f
Signed-off-by: Daniel Silverthorn <daniel.silverthorn@amdocs.com>
diff --git a/test/csit/tests/aai/search-data-service/suite1/__init__.robot b/test/csit/tests/aai/search-data-service/suite1/__init__.robot
new file mode 100644
index 0000000..f14ab69
--- /dev/null
+++ b/test/csit/tests/aai/search-data-service/suite1/__init__.robot
@@ -0,0 +1,2 @@
+*** Settings ***
+Documentation    Search Service - Suite 1
diff --git a/test/csit/tests/aai/search-data-service/suite1/private.key b/test/csit/tests/aai/search-data-service/suite1/private.key
new file mode 100644
index 0000000..3dd5464
--- /dev/null
+++ b/test/csit/tests/aai/search-data-service/suite1/private.key
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpAIBAAKCAQEAmxCmMHlTR7FkdYpW3rEPOYEGEuIC2/tBvzOxsBwhk/G4qyJ4
+4nKRYMJp/4inuh75vzqd/guYqs2bgoywM2eVTsGDv7ccVrub61mB8gs5G/Yc8xFe
+C9yo8WvV3GBMGSnG2VwZceEDygGmapOY4KK0T6eBUf4UFXE33docQPP4OBzTo/LO
+g//FYjQaO+U6y/+pl5cKPorgem78VI82TTo+Kr0z6sPBQy7JpG1j0VaNgy+QwKtG
++VlSgBqysLQEbJFQBugd2TlpbcBnRxVHo0xKUQty8JQWrNpwA5YuB99fdvm+GQ5o
+CyaefObEA1XqzS1KqsPoyaODk5xglbhUUqvCNQIDAQABAoIBADRbOsHDNUtPqgvF
+2e72+Z0A43wcs7py65ATdDtyRCQfyap+yTIsXMm+2utcyMUfEFRxBkdwwuto4MkD
+l7rDjrY4wLNKsFbYoZylbCq9f1rhjoTDqG1449IgBuWR3h/g6zMY1b6NqynZxMbX
+bxbp2NfMRu3YTA+xWpuduUx1E6peCssYU+1+jK30tXhY20eqACBjY6DU8MshIxJu
+Mrxztz5xtjXsiHru8yDtpPhopgAF07TdwCt9JZq9/t+ZOqPl0AIQxOP+prJ+owVU
+nS3yt+QExRsK6Iw9GwoAC0eElDRMnYt957jSxsniOwz1m6po8lkFvblixSQ/OVnt
+h86gWUECgYEAyKyeDy72BO+XRVp0mpQa9R2W5f8eZj+ejFRIsE2m0W1LCaFypV+O
+JZvYcEGj27qFAH5W9WbTSm8okVbLjRbeUU6FPT1l8hbXNnsiwiU6MRyODIbLhkQG
+hHonOfpddsHaUcZe+Hnl3SiSuD/4lPMHYUsQxtnpJI+pcsnuZeYsHAcCgYEAxdD6
+bXLPsjws/RUagph0/yOEEytVUg+plhdmHdihFGuGqHCG/i+eoISX2EfnpyHvYR5m
+9LpaJiWiy04nGSZOn3w32kKQhQYkuwYqw6h1/M5ZwR3j6wc2T8gORHxjC8ZT+LlJ
+OINvCTBQSWmUxFwJ0C1B9JiJtKNGEZm7GlaP2OMCgYBbBvIrsQGn+4aCzyVVeRlB
+Vsq8SZ1ghDtHLHRMhOzG0uzW0YVPvqicJrVnNl89rL3oG2cWqi3t9b5RLy3mMhlm
+iFeoD9HOns3AyNpbdseOv4Uv6XUo0nKiZUal5gu/cu+1aGZsD99VErJ7IYmBBzyx
+xXs2uGIpU4FpsG+TiXU4wQKBgQCQQtD+1IXnY78jaiqFJw3bq1j8adO1Hrr8PGA6
+T+tY6vmvCTFJWg0C3u+lyPqFhlf+qZ9HxkdMHpJUVdBppOgdowdQYs7mVA6hXeP+
+AHLbRNlr3pKCqiXPlQPiqhvJUH+YmfduAVwOhW9nulnFwaFeckLxT/TNCW1mFIjA
+snQBJQKBgQCqH+/K/Dzn0z6vX0APSNM7EBp8ap0qsiLucqGzNxslxwTzinXr5ccl
+8bjJxk6+7qUjWaw66wPn+Qs5buxWrKnbf+T5qmEI0bFaBzUBWrVMx1sMdr1Nj69Y
+waWRQaZ45y8J9wN+flBFp9d5wo5JWk6w54hHMiHeMmuXDCw5zO2YMA==
+-----END RSA PRIVATE KEY-----
diff --git a/test/csit/tests/aai/search-data-service/suite1/publickey.crt b/test/csit/tests/aai/search-data-service/suite1/publickey.crt
new file mode 100644
index 0000000..5696aa3
--- /dev/null
+++ b/test/csit/tests/aai/search-data-service/suite1/publickey.crt
@@ -0,0 +1,25 @@
+Bag Attributes
+    friendlyName: tomcat
+    localKeyID: 54 69 6D 65 20 31 34 39 33 33 32 33 39 32 32 37 35 31 
+subject=/C=CA/ST=Ontario/L=Ottawa/O=ONAP/OU=ONAP/CN=ONAP
+issuer=/C=CA/ST=Ontario/L=Ottawa/O=ONAP/OU=ONAP/CN=ONAP
+-----BEGIN CERTIFICATE-----
+MIIDWTCCAkGgAwIBAgIERWHcIzANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJD
+QTEQMA4GA1UECBMHT250YXJpbzEPMA0GA1UEBxMGT3R0YXdhMQ0wCwYDVQQKEwRP
+TkFQMQ0wCwYDVQQLEwRPTkFQMQ0wCwYDVQQDEwRPTkFQMB4XDTE3MDQyNzIwMDUz
+N1oXDTM3MDExMjIwMDUzN1owXTELMAkGA1UEBhMCQ0ExEDAOBgNVBAgTB09udGFy
+aW8xDzANBgNVBAcTBk90dGF3YTENMAsGA1UEChMET05BUDENMAsGA1UECxMET05B
+UDENMAsGA1UEAxMET05BUDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
+AJsQpjB5U0exZHWKVt6xDzmBBhLiAtv7Qb8zsbAcIZPxuKsieOJykWDCaf+Ip7oe
++b86nf4LmKrNm4KMsDNnlU7Bg7+3HFa7m+tZgfILORv2HPMRXgvcqPFr1dxgTBkp
+xtlcGXHhA8oBpmqTmOCitE+ngVH+FBVxN93aHEDz+Dgc06PyzoP/xWI0GjvlOsv/
+qZeXCj6K4Hpu/FSPNk06Piq9M+rDwUMuyaRtY9FWjYMvkMCrRvlZUoAasrC0BGyR
+UAboHdk5aW3AZ0cVR6NMSlELcvCUFqzacAOWLgffX3b5vhkOaAsmnnzmxANV6s0t
+SqrD6Mmjg5OcYJW4VFKrwjUCAwEAAaMhMB8wHQYDVR0OBBYEFNji+IU70Qgptn4i
+boq/rOKNAg8tMA0GCSqGSIb3DQEBCwUAA4IBAQBc5mJLeeUUzJ4MujZjn0DS3Lvv
+THJTE54Id1euT3ddzfX3htF0Ewd90YzmLuj1y8r8PXj7b/8Bq+cvoKbmJ42c8h3X
+If0tqde+gYWx1X3NAWHwz00Cje9R0KY4Bx1Cvr39jTw/ESnuSQDKPHBnn8WyAS9K
+08ZhvrVSK54d3U7tDVut9UVva8Scdi12utTAWaOIlusLo3bU9Z6t+tgg7AnQBYc0
+N9oCMbq/MACFlLSdc1J6NITYS8XHY2RS8u88eLbWkCcEEx1glYz/PMX3+V1Ow9Uy
+MjenEx8ifl96ZSOe9XsI2gl2TCaevCY/QuREu4LZB9XmO0gncH7gF5w9Bw2b
+-----END CERTIFICATE-----
diff --git a/test/csit/tests/aai/search-data-service/suite1/test1.robot b/test/csit/tests/aai/search-data-service/suite1/test1.robot
new file mode 100644
index 0000000..db05f83
--- /dev/null
+++ b/test/csit/tests/aai/search-data-service/suite1/test1.robot
@@ -0,0 +1,59 @@
+*** Settings ***
+Library       OperatingSystem
+Library       RequestsLibrary
+Library       requests
+
+*** Variables ***
+${TARGETURL}  https://10.147.124.100:9509/services/search-data-service/v1/search/indexes/test-index3
+${INDEXDATA}  {"fields": [{"name": "Name", "data-type": "string"}, {"name": "Number", "data-type": "long"}]}
+${DOCUMENTDATA}  {"Name": "A", "Number": 5}
+
+*** Test Cases ***
+Index Create Test
+    [Documentation]             Create an index and verify success
+    ${resp}=                    PutWithCert              ${TARGETURL}              ${INDEXDATA}
+    Should Be Equal As Strings  ${resp.status_code}      201
+
+Insert Document Test
+    [Documentation]             Insert a document into the previously created index
+    ${resp}=                    PutWithCert             ${TARGETURL}/documents/testdoc   ${DOCUMENTDATA} 
+    Should Be Equal As Strings  ${resp.status_code}      201
+
+Get Document Test
+    [Documentation]             Get the document that was just created
+    ${resp}                     GetWithCert              ${TARGETURL}/documents/testdoc
+    ${content}=                 Evaluate                 $resp.json().get('content')
+    ${originaljson}=            Evaluate                 json.loads('${DOCUMENTDATA}')   json
+    Should Be Equal As Strings  ${resp.status_code}      200
+    Should Be Equal             ${content}               ${originaljson}
+
+Delete Index Test
+    [Documentation]             Delete the index
+    ${resp}=                    DeleteWithCert           ${TARGETURL}
+    Should Be Equal As Strings  ${resp.status_code}      200
+
+*** Keywords ***
+PutWithCert
+    [Arguments]      ${url}      ${data}
+    ${certinfo}=     Evaluate    ('${CURDIR}/publickey.crt', '${CURDIR}/private.key')
+    ${resp}=         Evaluate    requests.put('${url}', data='${data}', cert=${certinfo}, verify=False)    requests
+    [return]         ${resp}
+
+PostWithCert
+    [Arguments]      ${url}      ${data}
+    ${certinfo}=     Evaluate    ('${CURDIR}/publickey.crt', '${CURDIR}/private.key')
+    ${resp}=         Evaluate    requests.post('${url}', data='${data}', cert=${certinfo}, verify=False)    requests
+    [return]         ${resp}
+
+GetWithCert
+    [Arguments]      ${url}
+    ${certinfo}=     Evaluate    ('${CURDIR}/publickey.crt', '${CURDIR}/private.key')
+    ${resp}=         Evaluate    requests.get('${url}', cert=${certinfo}, verify=False)    requests
+    [return]         ${resp}
+
+DeleteWithCert
+    [Arguments]      ${url}
+    ${certinfo}=     Evaluate    ('${CURDIR}/publickey.crt', '${CURDIR}/private.key')
+    ${resp}=         Evaluate    requests.delete('${url}', cert=${certinfo}, verify=False)    requests
+    [return]         ${resp}
+