4549afdd05afa5cd694594a7ac9ccd35653ca90f
[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 Suite Setup       Setup_Ise_Cohort
4 Suite Teardown    Wipe_Clean_Ise_Source_Cohort
5 Library           OperatingSystem    WITH NAME    os
6 Library           SSHLibrary
7 Library           RequestsLibrary
8 Library           DateTime
9 Library           ../../../libraries/GbpSxp.py    WITH NAME    gbpsxp
10 Resource          ../../../variables/Variables.robot
11 Resource          ../../../libraries/Utils.robot
12 Resource          ../../../libraries/TemplatedRequests.robot
13 Resource          ../../../libraries/GbpSxp.robot
14
15 *** Variables ***
16 ${CONFIGURE_ISE_SOURCE_FILE}    ${CURDIR}/../../../variables/gbp/gbpsxp-ise-source.json
17 ${EXPECTED_EP_POLICY_TEMPLATES_FILE}    ${CURDIR}/../../../variables/gbp/gbpsxp-ep-policy-templates.json
18 ${EXPECTED_TENANT_FILE}    ${CURDIR}/../../../variables/gbp/gbpsxp-tenant.json
19 ${ISE_API_DIR}    ${CURDIR}/../../../variables/gbp/ise-mock-server-api
20 ${ISE_MOCK_SERVER_API_FOLDER}    mock-server-tc010
21
22 *** Test Cases ***
23 Configure_Ise_Source_And_Check_Results
24     [Documentation]    Configure ise source using JSON file,
25     ...    read status of ise-source harvest action (DS/operational/ise-source),
26     ...    read+check ep-templates and endpoint-groups
27     ${ise_harvest_status_json}    gbpsxp.Configure_Ise_Source_And_Gain_Harvest_Status    session    ${CONFIGURE_ISE_SOURCE_FILE}    http://${TOOLS_SYSTEM_IP}:${ISE_REST_PORT}
28     gbpsxp.Check_Ise_Harvest_Status    ${ise_harvest_status_json}    5
29     ${expected_templates}    os.Get_File    ${EXPECTED_EP_POLICY_TEMPLATES_FILE}
30     ${actual_templates}    Utils.Get_Data_From_URI    session    ${GBP_EP_TEMPLATES_CONFIG_URI}
31     TemplatedRequests.Normalize_Jsons_And_Compare    ${expected_templates}    ${actual_templates}
32     ${expected_tenant}    os.Get_File    ${EXPECTED_TENANT_FILE}
33     ${actual_tenant}    Utils.Get_Data_From_URI    session    ${GBP_TENANT_CONFIG_URI}
34     TemplatedRequests.Normalize_Jsons_And_Compare    ${expected_tenant}    ${actual_tenant}
35
36 *** Keywords ***
37 Setup_Ise_Cohort
38     [Documentation]    Start ise mock and prepare restconf session
39     RequestsLibrary.Create_Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
40     GbpSxp.Prepare_Ssh_Tooling
41     gbpsxp.Deploy_Ise_Mock_Server    ${ISE_MOCK_SERVER_API_FOLDER}    ${ISE_REST_PORT}
42
43 Wipe_Clean_Ise_Source_Cohort
44     [Documentation]    Delete ise-source config, all ep-policy-templates, all endpoint-groups
45     gbpsxp.Clean_ise_source_config
46     BuiltIn.Run_Keyword_And_Ignore_Error    Utils.Remove_All_Elements_If_Exist    ${GBP_EP_TEMPLATES_CONFIG_URI}
47     BuiltIn.Run_Keyword_And_Ignore_Error    Utils.Remove_All_Elements_If_Exist    ${GBP_TENANT_CONFIG_URI}
48     gbpsxp.Teardown_Ise_Mock_Server    ${ISE_MOCK_SERVER_API_FOLDER}
49     gbpsxp.Teardown_Ssh_Tooling
50     RequestsLibrary.Delete_All_Sessions