*** Settings ***
 Documentation     The main interface for interacting with Microservice Bus.
 Library           RequestsLibrary
+Library           Collections
+Library           String
 
 Resource          global_properties.robot
 
      ${resp}=   Run Clamp HTTPS Get Request    ${data_path}
 
 Run CLAMP Get Control Loop
-     [Documentation]   runs CLAMP Open Control Loop based on model name
+     [Documentation]   runs CLAMP Open Control Loop based on model name and returns control_loop_id
      [Arguments]   ${model_name}
      ${data_path}=   Set Variable   ${CLAMP_BASE_PATH}/clds/model/${model_name}
      ${resp}=   Run Clamp HTTPS Get Request    ${data_path}
+     # propText value is a string
+     # propText': u '{"global":[{"name":"service","value":["5fcdb3b7-5a5b-45da-83f6-14cce29181c8"]}
+     Log    ${resp.json()['propText']}
+     ${control_loop_id}=    Get Regexp Matches    ${resp.json()['propText']}     \\"service\\",\\"value\\":\\[\\"([0-9a-f\-]{36})\\"     1
+     #Set Suite Variable   ${CURRENT_CONTROL_LOOP_ID}   ${control_loop_id[0]}
+     [Return]      ${control_loop_id[0]}
 
 Run CLAMP Get Model Names
-     [Documentation]   runs CLAMP Get Model Names
+     [Documentation]   runs CLAMP Get Model Names and returns the model_id
      ${data_path}=   Set Variable   ${CLAMP_BASE_PATH}/clds/model-names
      ${resp}=   Run Clamp HTTPS Get Request    ${data_path}
+     #Set Suite Variable   ${CURRENT_MODEL_ID}   ${resp.json()[0]['value']}
+     [Return]     ${resp.json()[0]['value']}
 
 Run CLAMP Health Check
      [Documentation]    Runs CLAMP Health check
      Should Be Equal As Integers        ${resp.status_code}     200
      Log    Received response from CLAMP ${resp.text}
      [Return]    ${resp}
+
 
 *** Test Cases ***
 Basic CLAMP Health Check
     [Tags]    clamp
-    Run CLAMP Get Model Names
-    Run CLAMP Get Control Loop    CLAMPT2VLB_v2_0_vLB0605c122-90f10
-    Run CLAMP Get Properties    5fcdb3b7-5a5b-45da-83f6-14cce29181c8
+    ${current_model_id}=   Run CLAMP Get Model Names
+    ${current_control_loop_id}=   Run CLAMP Get Control Loop    ${current_model_id}
+    Run CLAMP Get Properties    ${current_control_loop_id}
+