f6309b293b2af9b1742b18c683a25c0c255db7be
[integration/test.git] / csit / libraries / SFC / SfcKeywords.robot
1 *** Settings ***
2
3 *** Variables ***
4
5 *** Keywords ***
6 Post Elements To URI As JSON
7     [Arguments]    ${uri}    ${data}
8     ${resp}    RequestsLibrary.Post Request    session    ${uri}    data=${data}    headers=${headers}
9     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
10
11 Get JSON Elements From URI
12     [Arguments]    ${uri}
13     ${resp}    RequestsLibrary.Get Request    session    ${uri}
14     ${value}    To Json    ${resp.content}
15     [Return]    ${value}
16
17 Check Classifier Flows
18     ${flowList}=    DockerSfc.Get Flows In Docker Containers
19     log    ${flowList}
20     Should Contain Match    ${flowList}    *actions=pop_nsh*
21     Should Contain Match    ${flowList}    *actions=push_nsh*
22
23 Check Service Function Types Added
24     [Arguments]    ${elements}
25     [Documentation]    Check that the service function types are updated with the service function names
26     Check For Elements At URI    ${SERVICE_FUNCTION_TYPES_URI}    ${elements}
27
28 Check Service Function Types Removed
29     [Arguments]    ${elements}
30     [Documentation]    Check that the service function names are removed from the service function types
31     Check For Elements Not At URI    ${SERVICE_FUNCTION_TYPES_URI}    ${elements}
32
33 Switch Ips In Json Files
34     [Arguments]    ${json_dir}    ${container_names}
35     ${normalized_dir}=    OperatingSystem.Normalize Path    ${json_dir}/*.json
36     : FOR    ${cont_name}    IN    @{container_names}
37     \    ${cont_ip}=    Get Docker IP    ${cont_name}
38     \    OperatingSystem.Run    sudo sed -i 's/${cont_name}/${cont_ip}/g' ${normalized_dir}