Create OOM based CSIT for OSDF

Adding CSIT test cases for OSDF for homing and pci-opt

Change-Id: I6ad770ef12d8c90373fd7e8b97091a262f1d241a
Signed-off-by: vrvarma <vv8305@att.com>
Issue-ID: OPTFRA-450
diff --git a/robot/assets/templates/optf-osdf/pci-opt-request.json b/robot/assets/templates/optf-osdf/pci-opt-request.json
new file mode 100644
index 0000000..7ec9ab5
--- /dev/null
+++ b/robot/assets/templates/optf-osdf/pci-opt-request.json
@@ -0,0 +1,20 @@
+{
+  "requestInfo": {
+    "transactionId": "xxx-xxx-xxxx",
+    "requestId": "yyy-yyy-yyyy",
+    "callbackUrl": "https://wiki.onap.org:5000/callbackUrl/",
+    "sourceId": "SO",
+    "requestType": "create",
+    "numSolutions": 1,
+    "optimizers": [
+      "placement"
+    ],
+    "timeout": 600
+  },
+  "cellInfo": {
+    "networkId": "1000",
+    "cellIdList": [
+      "cell0"
+    ]
+  }
+}
\ No newline at end of file
diff --git a/robot/assets/templates/optf-osdf/placement_request.json b/robot/assets/templates/optf-osdf/placement_request.json
new file mode 100644
index 0000000..d9b16ca
--- /dev/null
+++ b/robot/assets/templates/optf-osdf/placement_request.json
@@ -0,0 +1,102 @@
+{
+  "requestInfo": {
+    "transactionId": "xxx-xxx-xxxx",
+    "requestId": "yyy-yyy-yyyy",
+    "callbackUrl": "https://wiki.onap.org:5000/callbackUrl/",
+    "sourceId": "SO",
+    "requestType": "create",
+    "numSolutions": 1,
+    "optimizers": ["placement"],
+    "timeout": 600
+  },
+  "placementInfo": {
+    "requestParameters": { "customerLatitude": 32.89748, "customerLongitude": -97.040443, "customerName": "xyz" },
+    "subscriberInfo": {"globalSubscriberId": "xxx-xx-xxx", "subscriberName": "subscriber_x"},
+    "placementDemands": [
+        {
+            "resourceModuleName": "vGMuxInfra",
+            "serviceResourceId": "vGMuxInfra-xx",
+            "tenantId": "vGMuxInfra-tenant",
+            "resourceModelInfo": {
+                "modelInvariantId": "vGMuxInfra-modelInvariantId",
+                "modelVersionId": "vGMuxInfra-versionId",
+                "modelName": "vGMuxInfra-model",
+                "modelType": "resource",
+                "modelVersion": "1.0",
+                "modelCustomizationName": "vGMuxInfra-customeModelName"
+            }
+        },
+        {
+            "resourceModuleName": "vG",
+            "serviceResourceId": "71d563e8-e714-4393-8f99-cc480144a05e",
+            "tenantId": "vG-tenant",
+            "resourceModelInfo": {
+                "modelInvariantId": "vG-modelInvariantId",
+                "modelVersionId": "vG-versionId",
+                "modelName": "vG-model",
+                "modelType": "resource",
+                "modelVersion": "1.0",
+                "modelCustomizationName": "vG-customeModelName"
+            },
+            "existingCandidates": [
+                {
+                    "identifierType": "serviceInstanceId",
+                    "cloudOwner": "",
+                    "identifiers": ["gjhd-098-fhd-987"]
+                }
+            ],
+            "excludedCandidates": [
+                {
+                    "identifierType": "serviceInstanceId",
+                    "cloudOwner": "",
+                    "identifiers": ["gjhd-098-fhd-987"]
+                },
+                {
+                    "identifierType": "vimId",
+                    "cloudOwner": "vmware",
+                    "identifiers": ["NYMDT67"]
+                }
+            ],
+            "requiredCandidates": [
+                {
+                    "identifierType": "vimId",
+                    "cloudOwner": "amazon",
+                    "identifiers": ["TXAUS219"]
+                }
+            ]
+        }
+    ]
+  },
+  "serviceInfo": {
+    "serviceInstanceId": "d61b2543-5914-4b8f-8e81-81e38575b8ec",
+    "serviceName": "vCPE",
+    "modelInfo": {
+      "modelInvariantId": "vCPE-invariantId",
+      "modelVersionId": "vCPE-versionId",
+      "modelName": "vCPE-model",
+      "modelType": "service",
+      "modelVersion": "1.0",
+      "modelCustomizationName": "vCPE-customeModelName"
+    }
+  },
+  "licenseInfo": {
+      "licenseDemands": [
+        {
+          "resourceModuleName": "vGMuxInfra",
+          "serviceResourceId": "vGMuxInfra-xx",
+          "resourceModelInfo": {
+            "modelInvariantId": "vGMuxInfra-modelInvariantId",
+            "modelVersionId": "vGMuxInfra-versionId",
+            "modelName": "vGMuxInfra-model",
+            "modelType": "resource",
+            "modelVersion": "1.0",
+            "modelCustomizationName": "vGMuxInfra-customeModelName"
+          },
+          "existingLicenses": {
+            "entitlementPoolUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"],
+            "licenseKeyGroupUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"]
+          }
+        }
+      ]
+  }
+}
\ No newline at end of file
diff --git a/robot/resources/oof_interface.robot b/robot/resources/oof_interface.robot
index aad0652..7d078ab 100644
--- a/robot/resources/oof_interface.robot
+++ b/robot/resources/oof_interface.robot
@@ -18,6 +18,7 @@
 ${OOF_CMSO_TEMPLATE_FOLDER}   robot/assets/templates/cmso
 ${OOF_CMSO_UTC}   %Y-%m-%dT%H:%M:%SZ
 ${OOF_HOMING_PLAN_FOLDER}    robot/assets/templates/optf-has
+${OOF_OSDF_TEMPLATE_FOLDER}   robot/assets/templates/optf-osdf
 
 ${OOF_HOMING_ENDPOINT}    ${GLOBAL_OOF_SERVER_PROTOCOL}://${GLOBAL_INJECTED_OOF_HOMING_IP_ADDR}:${GLOBAL_OOF_HOMING_SERVER_PORT}
 ${OOF_SNIRO_ENDPOINT}     ${GLOBAL_OOF_SERVER_PROTOCOL}://${GLOBAL_INJECTED_OOF_SNIRO_IP_ADDR}:${GLOBAL_OOF_SNIRO_SERVER_PORT}
@@ -164,3 +165,28 @@
     ${json_string}=    Evaluate    json.dumps(${json})    json
     ${escaped}=   Replace String    ${json_string}   "   \\"
     [Return]   ${escaped}
+
+Run OOF-OSDF Post Request
+    [Documentation]    Runs a scheduler POST request
+    [Arguments]   ${data_path}   ${data}={} ${auth}
+
+    ${session}=    Create Session   session   ${OOF_OSDF_ENDPOINT}   auth=${auth}
+    ${headers}=  Create Dictionary   Accept=application/json    Content-Type=application/json
+    ${resp}= 	Post Request 	session 	${data_path}     headers=${headers}   data=${data}
+    Log    Received response from osdf ${resp.text}
+    [Return]    ${resp}
+
+
+Run OOF-OSDF Post Homing
+   [Documentation]    Runs a osdf homing request
+    ${auth}=  Create List  ${GLOBAL_OOF_OSDF_USERNAME}    ${GLOBAL_OOF_OSDF_PASSWORD}
+    ${data}=         Get Binary File     ${OOF_OSDF_TEMPLATE_FOLDER}${/}placement_request.json
+    ${resp}=   Run OOF-OSDF Post Request  /api/oof/placement/v1   data=${data}    auth=${auth}
+    Should Be Equal As Strings    ${resp.status_code}   204
+
+Run OOF-OSDF Post PCI-OPT
+    [Documentation]    Runs a osdf PCI-OPT request
+    ${auth}=  Create List  ${GLOBAL_OOF_PCI_USERNAME}    ${GLOBAL_OOF_PCI_PASSWORD}
+    ${data}=         Get Binary File     ${OOF_OSDF_TEMPLATE_FOLDER}${/}pci-opt-request.json
+    ${resp}=   Run OOF-OSDF Post Request  /api/oof/pci/v1   data=${data}    auth=${auth}
+    Should Be Equal As Strings    ${resp.status_code}   204
diff --git a/robot/testsuites/oof-osdf.robot b/robot/testsuites/oof-osdf.robot
new file mode 100644
index 0000000..72e04c0
--- /dev/null
+++ b/robot/testsuites/oof-osdf.robot
@@ -0,0 +1,14 @@
+*** Settings ***
+Documentation     Testing OOF-HAS
+...
+...               Testing OOF-HAS SEND PLANS
+Resource          ../resources/oof_interface.robot
+
+*** Test Cases ***
+Basic OOF-OSDF CSIT for Homing
+    [Tags]    homing
+    Run OOF-OSDF Post Homing
+
+Basic OOF-OSDF CSIT for pci-opt
+    [Tags]    homing
+    Run OOF-OSDF Post PCI-OPT