Update Robot Framework format - step 7
[integration/test.git] / csit / suites / groupbasedpolicy / GBPSXP / ise-adapter.robot
1 *** Settings ***
2 Documentation       Test suite for Group Based Policy, sxp-ise-adapter component.
3
4 Library             OperatingSystem    WITH NAME    os
5 Library             SSHLibrary
6 Library             RequestsLibrary
7 Library             DateTime
8 Library             ../../../libraries/GbpSxp.py    WITH NAME    gbpsxp
9 Resource            ../../../variables/Variables.robot
10 Resource            ../../../libraries/Utils.robot
11 Resource            ../../../libraries/TemplatedRequests.robot
12 Resource            ../../../libraries/GbpSxp.robot
13
14 Suite Setup         Setup_Ise_Cohort
15 Suite Teardown      Wipe_Clean_Ise_Source_Cohort
16
17
18 *** Variables ***
19 ${CONFIGURE_ISE_SOURCE_FILE}            ${CURDIR}/../../../variables/gbp/gbpsxp-ise-source.json
20 ${EXPECTED_EP_POLICY_TEMPLATES_FILE}    ${CURDIR}/../../../variables/gbp/gbpsxp-ep-policy-templates.json
21 ${EXPECTED_TENANT_FILE}                 ${CURDIR}/../../../variables/gbp/gbpsxp-tenant.json
22 ${ISE_API_DIR}                          ${CURDIR}/../../../variables/gbp/ise-mock-server-api
23 ${ISE_MOCK_SERVER_API_FOLDER}           mock-server-tc010
24
25
26 *** Test Cases ***
27 Configure_Ise_Source_And_Check_Results
28     [Documentation]    Configure ise source using JSON file,
29     ...    read status of ise-source harvest action (DS/operational/ise-source),
30     ...    read+check ep-templates and endpoint-groups
31     ${ise_harvest_status_json}    gbpsxp.Configure_Ise_Source_And_Gain_Harvest_Status
32     ...    session
33     ...    ${CONFIGURE_ISE_SOURCE_FILE}
34     ...    http://${TOOLS_SYSTEM_IP}:${ISE_REST_PORT}
35     gbpsxp.Check_Ise_Harvest_Status    ${ise_harvest_status_json}    5
36     ${expected_templates}    os.Get_File    ${EXPECTED_EP_POLICY_TEMPLATES_FILE}
37     ${actual_templates}    Utils.Get_Data_From_URI    session    ${GBP_EP_TEMPLATES_CONFIG_URI}
38     TemplatedRequests.Normalize_Jsons_And_Compare    ${expected_templates}    ${actual_templates}
39     ${expected_tenant}    os.Get_File    ${EXPECTED_TENANT_FILE}
40     ${actual_tenant}    Utils.Get_Data_From_URI    session    ${GBP_TENANT_CONFIG_URI}
41     TemplatedRequests.Normalize_Jsons_And_Compare    ${expected_tenant}    ${actual_tenant}
42
43
44 *** Keywords ***
45 Setup_Ise_Cohort
46     [Documentation]    Start ise mock and prepare restconf session
47     RequestsLibrary.Create_Session
48     ...    session
49     ...    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}
50     ...    auth=${AUTH}
51     ...    headers=${HEADERS}
52     GbpSxp.Prepare_Ssh_Tooling
53     gbpsxp.Deploy_Ise_Mock_Server    ${ISE_MOCK_SERVER_API_FOLDER}    ${ISE_REST_PORT}
54
55 Wipe_Clean_Ise_Source_Cohort
56     [Documentation]    Delete ise-source config, all ep-policy-templates, all endpoint-groups
57     gbpsxp.Clean_ise_source_config
58     BuiltIn.Run_Keyword_And_Ignore_Error    Utils.Remove_All_Elements_If_Exist    ${GBP_EP_TEMPLATES_CONFIG_URI}
59     BuiltIn.Run_Keyword_And_Ignore_Error    Utils.Remove_All_Elements_If_Exist    ${GBP_TENANT_CONFIG_URI}
60     gbpsxp.Teardown_Ise_Mock_Server    ${ISE_MOCK_SERVER_API_FOLDER}
61     gbpsxp.Teardown_Ssh_Tooling
62     RequestsLibrary.Delete_All_Sessions