[CORD-2769] Service Chain Validation Legacy cordsubscriberroot

Change-Id: I1a2e133ad85a08a813604cdc9d1672d5816ca026
diff --git a/src/test/cord-api/Framework/restApi.py b/src/test/cord-api/Framework/restApi.py
index cbd157c..e34cbb7 100644
--- a/src/test/cord-api/Framework/restApi.py
+++ b/src/test/cord-api/Framework/restApi.py
@@ -180,23 +180,3 @@
         passed = self.checkResult(resp, requests.codes.created) or self.checkResult(resp, requests.codes.ok)
         return passed
 
-#test
-#'''
-test = restApi("MCORD_RestApiProperties.py")
-print test.getURL("CORE_INSTANCES")
-
-test = restApi()
-voltdevice = {
-   "name" : "volt-10",
-   "device_type" : "asf_olt",
-   "host" : "172.17.0.1",
-   "port" : 50060,
-   "switch_port" : "5",
-   "outer_tpid" : "0x8100",
-   "volt_service_id" : 7
-  }
-#result = test.ApiPost("VOLT_DEVICE",voltdevice) 
-dele = test.ApiChameleonDelete("VOLT_DEVICE",13)
-dele = test.ApiChameleonDelete("VOLT_DEVICE",14)
-dele = test.ApiChameleonDelete("VOLT_DEVICE",15)
-#'''
diff --git a/src/test/cord-api/Tests/LegacyRCORD_E2EServiceChainTest.txt b/src/test/cord-api/Tests/LegacyRCORD_E2EServiceChainTest.txt
new file mode 100644
index 0000000..22c7bdb
--- /dev/null
+++ b/src/test/cord-api/Tests/LegacyRCORD_E2EServiceChainTest.txt
@@ -0,0 +1,74 @@
+*** Settings ***
+Documentation     Test suite for end-end service chain validation for Legacy RCORD Profile (with hardware vSG instances)
+Suite Setup       Read InputFile
+Test Template     Verify Service Chain Validation for Subscribers
+Library           Collections
+Library           String
+Library           OperatingSystem
+Library           XML
+Library           RequestsLibrary
+Library           ../Framework/utils/utils.py
+Library           ../Framework/restApi.py
+
+*** Variables ***
+${PATHFILE}       ${CURDIR}/data/Ch_Subscriber.json
+
+*** Test Cases ***    TYPE                 LISTINDEX
+Test Create Subscriber-1
+                      SUBSCRIBER_CREATE    0
+
+Test Create Subscriber-2
+                      SUBSCRIBER_CREATE    1
+
+Test Create Subscriber-3
+                      SUBSCRIBER_CREATE    2
+
+*** Keywords ***
+Read InputFile
+    ${subscriberList} =    utils.jsonToList    ${PATHFILE}    SubscriberInfo
+    Set Suite Variable    ${slist}    ${subscriberList}
+    @{instanceList}=    Create List
+    Set Suite Variable    @{instanceList}
+
+Verify Service Chain Validation for Subscribers
+    [Arguments]    ${type}    ${listIndex}
+    Run Keyword If    "${type}" == "SUBSCRIBER_CREATE"    Test Post Subscriber Create    ${listIndex}
+
+Test Post Subscriber Create
+    [Arguments]    ${listIndex}
+    ${subscriberList} =    Get Variable Value    ${slist}
+    ${subscriberDict}=    utils.listToDict    ${subscriberList}    ${listIndex}
+    ${api_result}=    restApi.ApiPost    VOLT_SUBSCRIBER    ${subscriberDict}
+    Sleep    90
+    ${service_specific_id}=    utils.getFieldValueFromDict    ${subscriberDict}    service_specific_id
+    ${json_result}=    restApi.ApiGet    VOLT_SUBSCRIBER
+    Log    ${json_result}
+    ${json_result_list}=    Get From Dictionary    ${json_result}    items
+    ${getJsonDict}=    utils.getDictFromListOfDict    ${json_result_list}    service_specific_id    ${service_specific_id}
+    ${result}=    utils.compare_dict    ${subscriberDict}    ${getJsonDict}
+    Should Be True    ${result}
+    ${instanceList}    Create List
+    # Retrieve Subscribed_links_id from Posted Subscriber
+    ${subscribed_links_ids_list}=    utils.getFieldValueFromDict    ${getJsonDict}    subscribed_links_ids
+    ${subscribed_links_ids}=    Get From List    ${subscribed_links_ids_list}    0
+    # Retrieve Provided_Service_Instance_Id from "ServiceInstanceLinks"
+    ${getServiceLink}=    restApi.ApiChameleonGet    CH_CORE_SERVICELINK    ${subscribed_links_ids}
+    ${provider_service_instance_id}=    Get From Dictionary    ${getServiceLink}    provider_service_instance_id
+    # RETRIEVE VOLT OBJECT USING PROVIDER INSTANCE ID   
+    ${getVoltDict}=    restApi.ApiChameleonGet    VOLT_TENANT    ${provider_service_instance_id}
+    # RETRIEVE SUBSCRIBED_LINKS_IDS FROM THE VOLT DICTIONARY
+    ${subscribed_links_ids_list}=    utils.getFieldValueFromDict    ${getVoltDict}    subscribed_links_ids
+    ${subscribed_links_ids}=    Get From List    ${subscribed_links_ids_list}    0
+    # RETRIEVE PROVIDED_SERVICE_INSTANCE_ID 
+    ${serviceLinkDict}=    restApi.ApiChameleonGet    CH_CORE_SERVICELINK    ${subscribed_links_ids}
+    Log    ${serviceLinkDict}
+    ${VSGTenant}=    Get From Dictionary    ${serviceLinkDict}    provider_service_instance_id
+    # Retrieve VSGTenant to retrieve instance_id
+    ${getVSG_result}=    restApi.ApiChameleonGet    VSG_TENANT    ${VSGTenant}
+    ${instance_id}=    Get From Dictionary    ${getVSG_result}    instance_id
+    Append To List    ${instanceList}    ${instance_id}
+    Log    ${instanceList}
+    Set Global Variable    ${instanceList}
+    # VALIDATE INSTANCE IS PRESENT IN /CORE/INSTANCES
+    ${get_CoreInstanceresult}=    restApi.ApiChameleonGet    CH_CORE_INSTANCES    ${instance_id}
+    Should Be True    ${get_CoreInstanceresult}
diff --git a/src/test/cord-api/Tests/VOLTDevice_Test.txt b/src/test/cord-api/Tests/VOLTDevice_Test.txt
index d3b1f1c..1bbf672 100644
--- a/src/test/cord-api/Tests/VOLTDevice_Test.txt
+++ b/src/test/cord-api/Tests/VOLTDevice_Test.txt
@@ -24,8 +24,6 @@
 
 Test Get PONPort-1
                       PONRETRIEVE                     0
-#Test Delete VOLTDevice-1
-#                      DELETE       0
 Test Create VOLTDevice-2
                       CREATE       1
 Test Get VOLTDevice-2
@@ -34,18 +32,14 @@
                       PONCREATE       1
 Test Get PONPort-2
                       PONRETRIEVE     1
-#Test Delete VOLTDevice-2
-#                      DELETE       1
 Test Create VOLTDevice-3
                       CREATE       2
 Test Get VOLTDevice-3
                       RETRIEVE     2
 Test Create PONPort-3
-                      CREATE       2
+                      PONCREATE       2
 Test Get PONPort-3
-                      RETRIEVE     2
-#Test Delete VOLTDevice-3
-#                      DELETE       2
+                      PONRETRIEVE     2
 
 
 *** Keywords ***