tcpmd5user test update 09/66309/78
authorTomas Markovic <tomas.markovic@pantheon.tech>
Thu, 7 Dec 2017 16:24:01 +0000 (17:24 +0100)
committerTomas Markovic <tomas.markovic@pantheon.tech>
Mon, 8 Jan 2018 10:15:39 +0000 (11:15 +0100)
Updated test to use new pcep MD5 authentication for oxygen.
Added backwards compability for carbon and nitrogen.
Basic tests specified for path-computation-client only
Oxygen tests include pcep-session-state comparison

Change-Id: I43066bec6ab835dec9b86bf04eed6b6256074ca8
Signed-off-by: Tomas Markovic <tomas.markovic@pantheon.tech>
22 files changed:
csit/libraries/TemplatedRequests.robot
csit/libraries/norm_json.py
csit/suites/bgpcep/tcpmd5user/tcpmd5user.robot
csit/variables/tcpmd5user/default_off/data.json [new file with mode: 0644]
csit/variables/tcpmd5user/default_off/location.uri [new file with mode: 0644]
csit/variables/tcpmd5user/default_on/data.json [new file with mode: 0644]
csit/variables/tcpmd5user/default_on/location.uri [new file with mode: 0644]
csit/variables/tcpmd5user/default_on_state/data.json [new file with mode: 0644]
csit/variables/tcpmd5user/default_on_state/location.uri [new file with mode: 0644]
csit/variables/tcpmd5user/default_on_state/volatiles.list [new file with mode: 0644]
csit/variables/tcpmd5user/default_on_updated/data.json [new file with mode: 0644]
csit/variables/tcpmd5user/default_on_updated/location.uri [new file with mode: 0644]
csit/variables/tcpmd5user/default_on_updated_state/data.json [new file with mode: 0644]
csit/variables/tcpmd5user/default_on_updated_state/location.uri [new file with mode: 0644]
csit/variables/tcpmd5user/default_on_updated_state/volatiles.list [new file with mode: 0644]
csit/variables/tcpmd5user/pcep_topology_node/data.xml [new file with mode: 0644]
csit/variables/tcpmd5user/pcep_topology_node/location.uri [new file with mode: 0644]
csit/variables/tcpmd5user/pcep_topology_node_empty/data.xml [new file with mode: 0644]
csit/variables/tcpmd5user/pcep_topology_node_empty/location.uri [new file with mode: 0644]
csit/variables/tcpmd5user/update_delegated/location.uri [new file with mode: 0644]
csit/variables/tcpmd5user/update_delegated/post_data.xml [new file with mode: 0644]
csit/variables/tcpmd5user/update_delegated/response.xml [new file with mode: 0644]

index 6d4d746bfbfa8efa07a3ab3e0691d373ee079491..19310f2d3f0f34801c82c2ea2530ef796a8720c3 100644 (file)
@@ -110,6 +110,7 @@ Documentation     Resource for supporting http Requests based on data stored in
 ...               perhaps explicit ${ACCEPT_JSON} will be better, even if it sends few bytes more?
 Library           Collections
 Library           OperatingSystem
+Library           String
 Library           RequestsLibrary
 Library           ${CURDIR}/norm_json.py
 Variables         ${CURDIR}/../variables/Variables.py
@@ -292,13 +293,24 @@ Resolve_Jmes_Path
     ${expression} =    BuiltIn.Set Variable If    ${read_jmes_file} == ${true}    ${jmes_expression}    ${EMPTY}
     [Return]    ${expression}
 
+Resolve_Volatiles_Path
+    [Arguments]    ${folder}
+    [Documentation]    Reads Volatiles List from file ${folder}${/}volatiles.list if the file exists and
+    ...    returns the Volatiles List. Empty string is returned otherwise.
+    ${read_volatiles_file} =    BuiltIn.Run Keyword And Return Status    OperatingSystem.File Should Exist    ${folder}${/}volatiles.list
+    Return From Keyword If    ${read_volatiles_file} == ${false}    ${EMPTY}
+    ${volatiles}=    OperatingSystem.Get_File    ${folder}${/}volatiles.list
+    ${volatiles_list}=    String.Split_String    ${volatiles}    ${\n}
+    [Return]    ${volatiles_list}
+
 Get_Templated
     [Arguments]    ${folder}    ${accept}    ${mapping}={}    ${session}=default    ${normalize_json}=False    ${http_timeout}=${EMPTY}
     [Documentation]    Resolve URI from folder, call Get_From_Uri, return response text.
     ${uri} =    Resolve_Text_From_Template_Folder    folder=${folder}    base_name=location    extension=uri    mapping=${mapping}
     ${jmes_expression} =    Resolve_Jmes_Path    ${folder}
+    ${volatiles_list}=    Resolve_Volatiles_Path    ${folder}
     ${response_text} =    Get_From_Uri    uri=${uri}    accept=${accept}    session=${session}    normalize_json=${normalize_json}    jmes_path=${jmes_expression}
-    ...    http_timeout=${http_timeout}
+    ...    http_timeout=${http_timeout}    keys_with_volatiles=${volatiles_list}
     [Return]    ${response_text}
 
 Put_Templated
@@ -340,6 +352,7 @@ Verify_Response_Templated
 
 Get_From_Uri
     [Arguments]    ${uri}    ${accept}=${ACCEPT_EMPTY}    ${session}=default    ${normalize_json}=False    ${jmes_path}=${EMPTY}    ${http_timeout}=${EMPTY}
+    ...    ${keys_with_volatiles}=${EMPTY}
     [Documentation]    GET data from given URI, check status code and return response text.
     ...    \${accept} is a Python object with headers to use.
     ...    If \${normalize_json}, normalize as JSON text before returning.
@@ -349,7 +362,7 @@ Get_From_Uri
     ...    ELSE    RequestsLibrary.Get_Request    alias=${session}    uri=${uri}    headers=${accept}    timeout=${http_timeout}
     Check_Status_Code    ${response}
     BuiltIn.Run_Keyword_Unless    ${normalize_json}    BuiltIn.Return_From_Keyword    ${response.text}
-    ${text_normalized} =    norm_json.normalize_json_text    ${response.text}    jmes_path=${jmes_path}
+    ${text_normalized} =    norm_json.normalize_json_text    ${response.text}    jmes_path=${jmes_path}    keys_with_volatiles=${keys_with_volatiles}
     [Return]    ${text_normalized}
 
 Put_To_Uri
index e113e7fe656ac36c835b52554225827799f6ec9a..c323c742a99ea9ee6d8172499c919c50eeacc82a 100644 (file)
@@ -154,7 +154,31 @@ def sort_bits(obj, keys_with_bits=[]):
     return obj
 
 
-def normalize_json_text(text, strict=False, indent=1, keys_with_bits=[], jmes_path=None):
+def hide_volatile(obj, keys_with_volatiles=[]):
+    """
+    Takes list of keys with volatile values, and replaces them with generic "*"
+
+    :param obj: python dict from json
+    :param keys_with_volatiles: list of volatile keys
+    :return: corrected
+    """
+    if isinstance(obj, dict):
+        for key, value in obj.iteritems():
+            # Unicode is not str and vice versa, isinstance has to check for both.
+            # Luckily, "in" recognizes equivalent strings in different encodings.
+            # Type "bytes" is added for Python 3 compatibility.
+            if key in keys_with_volatiles and isinstance(value, (unicode, str, bytes, int)):
+                obj[key] = "*"
+            else:
+                hide_volatile(value, keys_with_volatiles)
+    # A string is not a list, so there is no risk of recursion over characters.
+    elif isinstance(obj, list):
+        for item in obj:
+            hide_volatile(item, keys_with_volatiles)
+    return obj
+
+
+def normalize_json_text(text, strict=False, indent=1, keys_with_bits=[], keys_with_volatiles=[], jmes_path=None):
     """
     Attempt to return sorted indented JSON string.
 
@@ -187,6 +211,8 @@ def normalize_json_text(text, strict=False, indent=1, keys_with_bits=[], jmes_pa
             return str(err) + '\n' + text
     if keys_with_bits:
         sort_bits(object_decoded, keys_with_bits)
+    if keys_with_volatiles:
+        hide_volatile(object_decoded, keys_with_volatiles)
 
     pretty_json = dumps_indented(object_decoded, indent=indent)
 
index a2075f3d0d9a4cea51af29537051324a5594b2b7..be632194b59ce466a8f7271196aa22b56bfa5a35 100644 (file)
@@ -7,9 +7,17 @@ Documentation     TCPMD5 user-facing feature system tests, using PCEP.
 ...               terms of the Eclipse Public License v1.0 which accompanies this distribution,
 ...               and is available at http://www.eclipse.org/legal/epl-v10.html
 ...
+...               Test suite performs basic pcep md5 password authorization test cases:
+...               (Run entire basic PCEP suite without passwords.)
+...               Start pcc-mock (reconnecting mode): 1 pcc, 1 lsp, password set, check pcep-topology stays empty.
+...               Use restconf to change PCEP configuration to use a wrong password, check pcep-topology stays empty.
+...               Change ODL PCEP configuration to use the correct password, check pcep-topology shows the lsp.
+...               Update the lsp, check a change in pcep-topology.
+...               Change ODL PCEP configuration to not use password, pcep-topology empties, kill pcep-pcc-mock.
 ...
-...               The original brief description of this suite is at
-...               https://wiki.opendaylight.org/view/TCPMD5:Lithium_Feature_Tests#How_to_test
+...               Stable/carbon and stable/nitrogen are using netconf-connector-ssh to send restconf requests.
+...               Oxygen test cases no longer need netconf-connector-ssh, and they include comparison of
+...               pcep-session-state, which is exclusive to oxygen.
 Suite Setup       Set_It_Up
 Suite Teardown    Tear_It_Down
 Test Setup        FailFast.Fail_This_Fast_On_Previous_Error
@@ -17,21 +25,17 @@ Test Teardown     FailFast.Start_Failing_Fast_If_This_Failed
 Library           OperatingSystem
 Library           RequestsLibrary
 Library           SSHLibrary    prompt=]>
-Library           String
-Library           ${CURDIR}/../../../libraries/norm_json.py
-Resource          ${CURDIR}/../../../libraries/FailFast.robot
-Resource          ${CURDIR}/../../../libraries/KarafKeywords.robot
-Resource          ${CURDIR}/../../../libraries/NexusKeywords.robot
-Resource          ${CURDIR}/../../../libraries/PcepOperations.robot
-Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
-Resource          ${CURDIR}/../../../libraries/WaitForFailure.robot
-Variables         ${CURDIR}/../../../variables/Variables.py
-Variables         ${CURDIR}/../../../variables/pcepuser/variables.py    ${TOOLS_SYSTEM_IP}
+Resource          ../../../libraries/FailFast.robot
+Resource          ../../../libraries/KarafKeywords.robot
+Resource          ../../../libraries/NexusKeywords.robot
+Resource          ../../../libraries/TemplatedRequests.robot
+Resource          ../../../libraries/WaitForFailure.robot
+Resource          ../../../libraries/RemoteBash.robot
+Resource          ../../../libraries/CompareStream.robot
 
 *** Variables ***
-${directory_for_actual_responses}    ${TEMPDIR}${/}actual
-${directory_for_expected_responses}    ${TEMPDIR}${/}expected
-${directory_with_template_folders}    ${CURDIR}/../../../variables/tcpmd5user/
+${DIR_WITH_TEMPLATES}    ${CURDIR}/../../../variables/tcpmd5user/
+${CONFIG_SESSION}    session
 ${CONNECTOR_FEATURE}    odl-netconf-connector-all
 ${PCEP_FEATURE}    odl-bgpcep-pcep
 ${RESTCONF_FEATURE}    odl-restconf-all
@@ -39,9 +43,9 @@ ${RESTCONF_FEATURE}    odl-restconf-all
 *** Test Cases ***
 Topology_Precondition
     [Documentation]    Compare current pcep-topology to empty one.
-    ...    Timeout is long enough to see that pcep is ready, with no PCC is connected.
+    ...    Timeout is long enough to see that pcep is ready, with no PCC connected.
     [Tags]    critical
-    BuiltIn.Wait_Until_Keyword_Succeeds    300    1    Compare_Topology    ${off_json}    010_Precondition.json
+    BuiltIn.Wait_Until_Keyword_Succeeds    300s    1s    TemplatedRequests.Get_As_Json_Templated    ${DIR_WITH_TEMPLATES}${/}default_off    session=${CONFIG_SESSION}    verify=True
 
 Start_Secure_Pcc_Mock
     [Documentation]    Execute pcc-mock on Mininet with password set, fail if pcc-mock promptly exits. Keep pcc-mock running for next test cases.
@@ -51,47 +55,57 @@ Start_Secure_Pcc_Mock
     Read_And_Fail_If_Prompt_Is_Seen
 
 Topology_Unauthorized_1
-    [Documentation]    Try to catch a glimpse of pcc-mock in pcep-topology. Pass if no change from Precondition is detected over 1 minute.
+    [Documentation]    Try to catch a glimpse of pcc-mock in pcep-topology. Pass if no change from Precondition is detected over 10 seconds.
     [Tags]    critical
-    WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout    10s    1s    Compare_Topology    ${off_json}    020_Unauthorized_1.json
+    WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout    10s    1s    Test_Unauthorized
 
 Set_Wrong_Password
     [Documentation]    Configure password in pcep dispatcher for client with Mininet IP address.
     ...    This password does not match what pcc-mock uses.
-    ${password_line}=    Construct_Password_Element_Line_Using_Password    changeme
-    BuiltIn.Log    ${password_line}
-    Replace_Password_Xml_Element_In_Pcep_Client_Module    ${password_line}
+    CompareStream.Run_Keyword_If_At_Least_Oxygen    Replace_Password_On_Pcep_Node    password=changeme
+    CompareStream.Run_Keyword_If_Less_Than_Oxygen    Set_Password_Less_Than_Oxygen    password=changeme
 
 Topology_Unauthorized_2
     [Documentation]    The same logic as Topology_Unauthorized_1 as incorrect password was provided to ODL.
     [Tags]    critical
-    WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout    10s    1s    Compare_Topology    ${off_json}    040_Unauthorized_3.json
+    WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout    10s    1s    Test_Unauthorized
 
 Set_Correct_Password
     [Documentation]    Configure password in pcep dispatcher for client with Mininet IP address.
     ...    This password finally matches what pcc-mock uses.
-    ${password_line}=    Construct_Password_Element_Line_Using_Password    topsecret
-    BuiltIn.Log    ${password_line}
-    Replace_Password_Xml_Element_In_Pcep_Client_Module    ${password_line}
+    CompareStream.Run_Keyword_If_At_Least_Oxygen    Replace_Password_On_Pcep_Node    password=topsecret
+    CompareStream.Run_Keyword_If_Less_Than_Oxygen    Set_Password_Less_Than_Oxygen    password=topsecret
 
 Topology_Intercondition
-    [Documentation]    Compare pcep-topology to filled one, which includes a tunnel from pcc-mock.
-    BuiltIn.Wait_Until_Keyword_Succeeds    10s    1s    Compare_Topology    ${default_json}    050_Intercondition.json
+    [Documentation]    Compare pcep-topology/path-computation-client to filled one, which includes a tunnel from pcc-mock.
+    ...    For oxygen compares full pcep-topology including pcep-session-state
+    &{mapping}    BuiltIn.Create_Dictionary    IP=${TOOLS_SYSTEM_IP}    CODE=${pcc_name_code}    NAME=${pcc_name}    IP_ODL=${ODL_SYSTEM_IP}
+    BuiltIn.Wait_Until_Keyword_Succeeds    10s    1s    TemplatedRequests.Get_As_Json_Templated    ${DIR_WITH_TEMPLATES}${/}default_on    ${mapping}    ${CONFIG_SESSION}
+    ...    verify=True
+    CompareStream.Run_Keyword_If_At_Least_Oxygen    BuiltIn.Wait_Until_Keyword_Succeeds    30s    1s    TemplatedRequests.Get_As_Json_Templated    ${DIR_WITH_TEMPLATES}${/}default_on_state    ${mapping}
+    ...    ${CONFIG_SESSION}    verify=True
 
 Update_Delegated
     [Documentation]    Perform update-lsp on the mocked tunnel, check response is success.
-    ${text}=    PcepOperations.Update_Xml_Lsp_Return_Json    ${update_delegated_xml}
-    Pcep_Json_Is_Success    ${text}
+    &{mapping}    BuiltIn.Create_Dictionary    IP=${TOOLS_SYSTEM_IP}    NAME=${pcc_name}
+    ${response}=    TemplatedRequests.Post_As_Xml_Templated    ${DIR_WITH_TEMPLATES}${/}update_delegated    ${mapping}    ${CONFIG_SESSION}    verify=True
+    Log    ${response}
 
 Topology_Updated
-    [Documentation]    Compare pcep-topology to default_json, which includes the updated tunnel.
+    [Documentation]    Compare pcep-topology/path-computation-client to default_on_updated, which includes the updated tunnel.
+    ...    For oxygen compares full pcep-topology including pcep-session-state
     [Tags]    critical
-    BuiltIn.Wait_Until_Keyword_succeeds    5s    1s    Compare_Topology    ${updated_json}    060_Topology_Updated.json
+    &{mapping}    BuiltIn.Create_Dictionary    IP=${TOOLS_SYSTEM_IP}    CODE=${pcc_name_code}    NAME=${pcc_name}    IP_ODL=${ODL_SYSTEM_IP}
+    BuiltIn.Wait_Until_Keyword_Succeeds    10s    1s    TemplatedRequests.Get_As_Json_Templated    ${DIR_WITH_TEMPLATES}${/}default_on_updated    ${mapping}    ${CONFIG_SESSION}
+    ...    verify=True
+    CompareStream.Run_Keyword_If_At_Least_Oxygen    BuiltIn.Wait_Until_Keyword_Succeeds    30s    1s    TemplatedRequests.Get_As_Json_Templated    ${DIR_WITH_TEMPLATES}${/}default_on_updated_state    ${mapping}
+    ...    ${CONFIG_SESSION}    verify=True
 
 Unset_Password
     [Documentation]    De-configure password for pcep dispatcher for client with Mininet IP address.
     [Setup]    FailFast.Run_Even_When_Failing_Fast
-    Replace_Password_Xml_Element_In_Pcep_Client_Module    ${EMPTY}
+    CompareStream.Run_Keyword_If_At_Least_Oxygen    Unset_Password_On_Pcep_Node
+    CompareStream.Run_Keyword_If_Less_Than_Oxygen    Replace_Password_Xml_Element_In_Pcep_Client_Module_Less_Than_Oxygen
     FailFast.Do_Not_Fail_Fast_From_Now_On
     # NOTE: It is still possible to remain failing, if both previous and this test failed.
     [Teardown]    FailFast.Do_Not_Start_Failing_If_This_Failed
@@ -99,17 +113,15 @@ Unset_Password
 Topology_Unauthorized_3
     [Documentation]    Wait for pcep-topology to become empty again.
     [Tags]    critical
-    BuiltIn.Wait_Until_Keyword_Succeeds    10s    1s    Compare_Topology    ${offjson}    070_Unauthorized_4.json
+    BuiltIn.Wait_Until_Keyword_Succeeds    10s    1s    Test_Unauthorized
 
 Stop_Pcc_Mock
     [Documentation]    Send ctrl+c to pcc-mock, fails if no prompt is seen
     ...    after 3 seconds (the default for SSHLibrary)
     [Setup]    FailFast.Run_Even_When_Failing_Fast
-    # FIXME: Bgpcepuser has Write_Ctrl_C keyword. Re-use it.
-    ${command}=    BuiltIn.Evaluate    chr(int(3))
-    BuiltIn.Log    ${command}
-    SSHLibrary.Write    ${command}
-    SSHLibrary.Read_Until_Prompt
+    RemoteBash.Write_Bare_Ctrl_C
+    ${output}=    SSHLibrary.Read_Until_Prompt
+    BuiltIn.Log    ${output}
     FailFast.Do_Not_Fail_Fast_From_Now_On
     # NOTE: It is still possible to remain failing, if both previous and this test failed.
     [Teardown]    FailFast.Do_Not_Start_Failing_If_This_Failed
@@ -117,36 +129,35 @@ Stop_Pcc_Mock
 Topology_Postcondition
     [Documentation]    Verify that pcep-topology stays empty.
     [Tags]    critical
-    WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout    10    1    Compare_Topology    ${offjson}    080_Postcondition.json
-    # FIXME: We should delete config changes to not affect next suite.
+    WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout    10s    1s    Test_Unauthorized
 
 Delete_Pcep_Client_Module
     [Documentation]    Delete Pcep client module.
     &{mapping}    BuiltIn.Create_Dictionary    IP=${TOOLS_SYSTEM_IP}
-    TemplatedRequests.Delete_Templated    ${directory_with_template_folders}${/}pcep_topology_client_module    mapping=${mapping}
+    CompareStream.Run_Keyword_If_At_Least_Oxygen    TemplatedRequests.Delete_Templated    ${DIR_WITH_TEMPLATES}${/}pcep_topology_node    ${mapping}
+    CompareStream.Run_Keyword_If_Less_Than_Oxygen    TemplatedRequests.Delete_Templated    ${DIR_WITH_TEMPLATES}${/}pcep_topology_client_module    ${mapping}
 
 *** Keywords ***
 Set_It_Up
     [Documentation]    Create SSH session to Mininet machine, prepare HTTP client session to Controller.
     ...    Figure out latest pcc-mock version and download it from Nexus to Mininet.
     ...    Also, delete and create directories for json diff handling.
+    ...    Sets up netconf-connector on odl-streams less than oxygen.
     KarafKeywords.Setup_Karaf_Keywords
     TemplatedRequests.Create_Default_Session
-    BuiltIn.Run_Keyword_If    """${USE_NETCONF_CONNECTOR}""" == """False"""    Install_Netconf_Connector
+    BuiltIn.Run_Keyword_If    """${USE_NETCONF_CONNECTOR}""" == """False"""    CompareStream.Run_Keyword_If_Less_Than_Oxygen    Install_Netconf_Connector
     NexusKeywords.Initialize_Artifact_Deployment_And_Usage
     ${current_connection}=    SSHLibrary.Get_Connection
     ${current_prompt}=    BuiltIn.Set_Variable    ${current_connection.prompt}
     BuiltIn.Log    ${current_prompt}
     BuiltIn.Set_Suite_Variable    ${prompt}    ${current_prompt}
-    RequestsLibrary.Create_Session    ses    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${OPERATIONAL_TOPO_API}    auth=${AUTH}
+    RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
     ${name}=    NexusKeywords.Deploy_Test_Tool    bgpcep    pcep-pcc-mock
     BuiltIn.Set_Suite_Variable    ${filename}    ${name}
-    OperatingSystem.Remove_Directory    ${directory_for_expected_responses}    recursive=True
-    OperatingSystem.Remove_Directory    ${directory_for_actual_responses}    recursive=True
-    # The previous suite may have been using the same directories.
-    OperatingSystem.Create_Directory    ${directory_for_expected_responses}
-    OperatingSystem.Create_Directory    ${directory_for_actual_responses}
-    PcepOperations.Setup_Pcep_Operations
+    #Setting Pcc Name and its code for mapping for templates
+    BuiltIn.Set_Suite_Variable    ${pcc_name}    pcc_${TOOLS_SYSTEM_IP}_tunnel_1
+    ${code}=    Evaluate    binascii.b2a_base64('${pcc_name}')[:-1]    modules=binascii
+    BuiltIn.Set_Suite_Variable    ${pcc_name_code}    ${code}
     FailFast.Do_Not_Fail_Fast_From_Now_On
 
 Tear_It_Down
@@ -156,10 +167,7 @@ Tear_It_Down
     SSHLibrary.Get_File    pccmock.log
     ${pccmocklog}=    OperatingSystem.Run    cat pccmock.log
     BuiltIn.Log    ${pccmocklog}
-    ${diff}=    OperatingSystem.Run    diff -dur ${directory_for_expected_responses} ${directory_for_actual_responses}
-    BuiltIn.Log    ${diff}
-    PcepOperations.Teardown_Pcep_Operations
-    BuiltIn.Run_Keyword_If    """${USE_NETCONF_CONNECTOR}""" == """False"""    Uninstall_Netconf_Connector
+    BuiltIn.Run_Keyword_If    """${USE_NETCONF_CONNECTOR}""" == """False"""    CompareStream.Run_Keyword_If_Less_Than_Oxygen    Uninstall_Netconf_Connector
     RequestsLibrary.Delete_All_Sessions
     SSHLibrary.Close_All_Connections
 
@@ -171,7 +179,7 @@ Install_Netconf_Connector
     ${status}    ${results} =    BuiltIn.Run_Keyword_And_Ignore_Error    KarafKeywords.Install_A_Feature    ${PCEP_FEATURE}
     ${status}    ${results} =    BuiltIn.Run_Keyword_And_Ignore_Error    KarafKeywords.Install_A_Feature    ${RESTCONF_FEATURE}
     BuiltIn.Log    ${results}
-    BuiltIn.Wait_Until_Keyword_Succeeds    240    3    Check_Netconf_Up_And_Running
+    BuiltIn.Wait_Until_Keyword_Succeeds    240s    3s    Check_Netconf_Up_And_Running
 
 Check_Netconf_Up_And_Running
     [Documentation]    Make a request to netconf connector's mounted pcep module and expect it is mounted.
@@ -182,6 +190,15 @@ Uninstall_Netconf_Connector
     ${status}    ${results} =    BuiltIn.Run_Keyword_And_Ignore_Error    KarafKeywords.Uninstall_A_Feature    ${CONNECTOR_FEATURE}
     BuiltIn.Log    ${results}
 
+Test_Unauthorized
+    [Documentation]    Try to access pcep topology with wrong password, should get empty topology
+    TemplatedRequests.Get_As_Json_Templated    ${DIR_WITH_TEMPLATES}${/}default_off    session=${CONFIG_SESSION}    verify=True
+
+Set_Password_Less_Than_Oxygen
+    [Arguments]    ${password}=${EMPTY}
+    ${password_line}=    Construct_Password_Element_Line_Using_Password    password=${password}
+    Replace_Password_Xml_Element_In_Pcep_Client_Module_Less_Than_Oxygen    ${password_line}
+
 Read_And_Fail_If_Prompt_Is_Seen
     [Documentation]    Try to read SSH to see prompt, but expect to see no prompt within SSHLibrary's timeout.
     BuiltIn.Run_Keyword_And_Expect_Error    No match found for '${prompt}' in *.    Read_Text_Before_Prompt
@@ -192,23 +209,16 @@ Read_Text_Before_Prompt
     ${text}=    SSHLibrary.Read_Until_Prompt
     BuiltIn.Log    ${text}
 
-Compare_Topology
-    [Arguments]    ${expected}    ${name}
-    [Documentation]    Get current pcep-topology as json, normalize both expected and actual json.
-    ...    Save normalized jsons to files for later processing.
-    ...    Error codes and normalized jsons should match exactly.
-    # FIXME: See bgpuser to move handling of expected outside WUKS loop, as in bgpuser suite.
-    ${normexp}=    norm_json.normalize_json_text    ${expected}
-    BuiltIn.Log    ${normexp}
-    OperatingSystem.Create_File    ${directory_for_expected_responses}${/}${name}    ${normexp}
-    ${resp}=    RequestsLibrary.Get_Request    ses    topology/pcep-topology
-    BuiltIn.Log    ${resp}
-    BuiltIn.Log    ${resp.text}
-    ${normresp}=    norm_json.normalize_json_text    ${resp.text}
-    BuiltIn.Log    ${normresp}
-    OperatingSystem.Create_File    ${directory_for_actual_responses}${/}${name}    ${normresp}
-    BuiltIn.Should_Be_Equal_As_Strings    ${resp.status_code}    200
-    BuiltIn.Should_Be_Equal    ${normresp}    ${normexp}
+Replace_Password_On_Pcep_Node
+    [Arguments]    ${password}
+    [Documentation]    Send restconf PUT to replace the config module specifying PCEP password element.
+    &{mapping}    BuiltIn.Create_Dictionary    IP=${TOOLS_SYSTEM_IP}    PASSWD=${password}
+    TemplatedRequests.Put_As_Xml_Templated    ${DIR_WITH_TEMPLATES}${/}pcep_topology_node    mapping=${mapping}
+
+Unset_Password_On_Pcep_Node
+    [Documentation]    Send restconf PUT to unset the config module.
+    &{mapping}    BuiltIn.Create_Dictionary    IP=${TOOLS_SYSTEM_IP}
+    TemplatedRequests.Put_As_Xml_Templated    ${DIR_WITH_TEMPLATES}${/}pcep_topology_node_empty    mapping=${mapping}
 
 Construct_Password_Element_Line_Using_Password
     [Arguments]    ${password}
@@ -217,8 +227,8 @@ Construct_Password_Element_Line_Using_Password
     BuiltIn.Log    ${element}
     [Return]    ${element}
 
-Replace_Password_Xml_Element_In_Pcep_Client_Module
-    [Arguments]    ${password_element}
-    [Documentation]    Send restconf PUT to replace the config module specifying PCEP password element (may me empty=missing).
+Replace_Password_Xml_Element_In_Pcep_Client_Module_Less_Than_Oxygen
+    [Arguments]    ${password_element}=${EMPTY}
+    [Documentation]    Send restconf PUT to replace the config module specifying PCEP password element (may be empty=missing).
     &{mapping}    BuiltIn.Create_Dictionary    IP=${TOOLS_SYSTEM_IP}    PASSWD=${password_element}
-    TemplatedRequests.Put_As_Xml_Templated    ${directory_with_template_folders}${/}pcep_topology_client_module    mapping=${mapping}
+    TemplatedRequests.Put_As_Xml_Templated    ${DIR_WITH_TEMPLATES}${/}pcep_topology_client_module    mapping=${mapping}
diff --git a/csit/variables/tcpmd5user/default_off/data.json b/csit/variables/tcpmd5user/default_off/data.json
new file mode 100644 (file)
index 0000000..b121965
--- /dev/null
@@ -0,0 +1,10 @@
+{
+    "topology": [
+        {
+            "topology-id": "pcep-topology",
+            "topology-types": {
+                "network-topology-pcep:topology-pcep": {}
+            }
+        }
+    ]
+}
diff --git a/csit/variables/tcpmd5user/default_off/location.uri b/csit/variables/tcpmd5user/default_off/location.uri
new file mode 100644 (file)
index 0000000..7a4b1bf
--- /dev/null
@@ -0,0 +1 @@
+restconf/operational/network-topology:network-topology/topology/pcep-topology
diff --git a/csit/variables/tcpmd5user/default_on/data.json b/csit/variables/tcpmd5user/default_on/data.json
new file mode 100644 (file)
index 0000000..e162af4
--- /dev/null
@@ -0,0 +1,60 @@
+{
+    "network-topology-pcep:path-computation-client": {
+        "ip-address": "$IP",
+        "reported-lsp": [
+            {
+                "name": "$NAME",
+                "path": [
+                    {
+                        "ero": {
+                            "ignore": false,
+                            "processing-rule": false,
+                            "subobject": [
+                                {
+                                    "ip-prefix": {
+                                        "ip-prefix": "1.1.1.1/32"
+                                    },
+                                    "loose": false
+                                }
+                            ]
+                        },
+                        "lsp-id": 1,
+                        "odl-pcep-ietf-stateful07:lsp": {
+                            "administrative": true,
+                            "delegate": true,
+                            "ignore": false,
+                            "odl-pcep-ietf-initiated00:create": false,
+                            "operational": "up",
+                            "plsp-id": 1,
+                            "processing-rule": false,
+                            "remove": false,
+                            "sync": true,
+                            "tlvs": {
+                                "lsp-identifiers": {
+                                    "ipv4": {
+                                        "ipv4-extended-tunnel-id": "$IP",
+                                        "ipv4-tunnel-endpoint-address": "1.1.1.1",
+                                        "ipv4-tunnel-sender-address": "$IP"
+                                    },
+                                    "lsp-id": 1,
+                                    "tunnel-id": 1
+                                },
+                                "symbolic-path-name": {
+                                    "path-name": "$CODE"
+                                }
+                            }
+                        }
+                    }
+                ]
+            }
+        ],
+        "state-sync": "synchronized",
+        "stateful-tlv": {
+            "odl-pcep-ietf-stateful07:stateful": {
+                "lsp-update-capability": true,
+                "odl-pcep-ietf-initiated00:initiation": true
+            }
+        }
+    }
+}
+
diff --git a/csit/variables/tcpmd5user/default_on/location.uri b/csit/variables/tcpmd5user/default_on/location.uri
new file mode 100644 (file)
index 0000000..135ff3c
--- /dev/null
@@ -0,0 +1 @@
+restconf/operational/network-topology:network-topology/topology/pcep-topology/node/pcc:%2F%2F$IP/path-computation-client
diff --git a/csit/variables/tcpmd5user/default_on_state/data.json b/csit/variables/tcpmd5user/default_on_state/data.json
new file mode 100644 (file)
index 0000000..ac09377
--- /dev/null
@@ -0,0 +1,115 @@
+{
+    "topology": [
+        {
+            "node": [
+                {
+                    "network-pcep-topology-stats:pcep-session-state": {
+                        "delegated-lsps-count": 1,
+                        "local-pref": {
+                            "deadtimer": 120,
+                            "ip-address": "$IP_ODL",
+                            "keepalive": 30,
+                            "session-id": "*"
+                        },
+                        "messages": {
+                            "error-messages": {
+                                "last-received-error": {},
+                                "last-sent-error": {},
+                                "received-error-msg-count": 0,
+                                "sent-error-msg-count": 0
+                            },
+                            "last-sent-msg-timestamp": 0,
+                            "odl-pcep-stateful-stats:last-received-rpt-msg-timestamp": "*",
+                            "odl-pcep-stateful-stats:received-rpt-msg-count": 2,
+                            "odl-pcep-stateful-stats:sent-init-msg-count": 0,
+                            "odl-pcep-stateful-stats:sent-upd-msg-count": 0,
+                            "received-msg-count": 2,
+                            "reply-time": {
+                                "average-time": 0,
+                                "max-time": 0,
+                                "min-time": 0
+                            },
+                            "sent-msg-count": 0,
+                            "unknown-msg-received": 0
+                        },
+                        "peer-capabilities": {
+                            "odl-pcep-stateful-stats:active": true,
+                            "odl-pcep-stateful-stats:instantiation": true,
+                            "odl-pcep-stateful-stats:stateful": true
+                        },
+                        "peer-pref": {
+                            "deadtimer": 120,
+                            "ip-address": "$IP",
+                            "keepalive": 30,
+                            "session-id": "*"
+                        },
+                        "session-duration": "*",
+                        "synchronized": true
+                    },
+                    "network-topology-pcep:path-computation-client": {
+                        "ip-address": "$IP",
+                        "reported-lsp": [
+                            {
+                                "name": "$NAME",
+                                "path": [
+                                    {
+                                        "ero": {
+                                            "ignore": false,
+                                            "processing-rule": false,
+                                            "subobject": [
+                                                {
+                                                    "ip-prefix": {
+                                                        "ip-prefix": "1.1.1.1/32"
+                                                    },
+                                                    "loose": false
+                                                }
+                                            ]
+                                        },
+                                        "lsp-id": 1,
+                                        "odl-pcep-ietf-stateful07:lsp": {
+                                            "administrative": true,
+                                            "delegate": true,
+                                            "ignore": false,
+                                            "odl-pcep-ietf-initiated00:create": false,
+                                            "operational": "up",
+                                            "plsp-id": 1,
+                                            "processing-rule": false,
+                                            "remove": false,
+                                            "sync": true,
+                                            "tlvs": {
+                                                "lsp-identifiers": {
+                                                    "ipv4": {
+                                                        "ipv4-extended-tunnel-id": "$IP",
+                                                        "ipv4-tunnel-endpoint-address": "1.1.1.1",
+                                                        "ipv4-tunnel-sender-address": "$IP"
+                                                    },
+                                                    "lsp-id": 1,
+                                                    "tunnel-id": 1
+                                                },
+                                                "symbolic-path-name": {
+                                                    "path-name": "$CODE"
+                                                }
+                                            }
+                                        }
+                                    }
+                                ]
+                            }
+                        ],
+                        "state-sync": "synchronized",
+                        "stateful-tlv": {
+                            "odl-pcep-ietf-stateful07:stateful": {
+                                "lsp-update-capability": true,
+                                "odl-pcep-ietf-initiated00:initiation": true
+                            }
+                        }
+                    },
+                    "node-id": "pcc://$IP"
+                }
+            ],
+            "topology-id": "pcep-topology",
+            "topology-types": {
+                "network-topology-pcep:topology-pcep": {}
+            }
+        }
+    ]
+}
diff --git a/csit/variables/tcpmd5user/default_on_state/location.uri b/csit/variables/tcpmd5user/default_on_state/location.uri
new file mode 100644 (file)
index 0000000..7a4b1bf
--- /dev/null
@@ -0,0 +1 @@
+restconf/operational/network-topology:network-topology/topology/pcep-topology
diff --git a/csit/variables/tcpmd5user/default_on_state/volatiles.list b/csit/variables/tcpmd5user/default_on_state/volatiles.list
new file mode 100644 (file)
index 0000000..567832f
--- /dev/null
@@ -0,0 +1,3 @@
+odl-pcep-stateful-stats:last-received-rpt-msg-timestamp
+session-duration
+session-id
diff --git a/csit/variables/tcpmd5user/default_on_updated/data.json b/csit/variables/tcpmd5user/default_on_updated/data.json
new file mode 100644 (file)
index 0000000..513d35d
--- /dev/null
@@ -0,0 +1,65 @@
+{
+    "network-topology-pcep:path-computation-client": {
+        "ip-address": "$IP",
+        "reported-lsp": [
+            {
+                "name": "$NAME",
+                "path": [
+                    {
+                        "ero": {
+                            "ignore": false,
+                            "processing-rule": false,
+                            "subobject": [
+                                {
+                                    "ip-prefix": {
+                                        "ip-prefix": "1.1.1.1/32"
+                                    },
+                                    "loose": false
+                                },
+                                {
+                                    "ip-prefix": {
+                                        "ip-prefix": "2.2.2.2/32"
+                                    },
+                                    "loose": false
+                                }
+                            ]
+                        },
+                        "lsp-id": 1,
+                        "odl-pcep-ietf-stateful07:lsp": {
+                            "administrative": true,
+                            "delegate": true,
+                            "ignore": false,
+                            "odl-pcep-ietf-initiated00:create": false,
+                            "operational": "up",
+                            "plsp-id": 1,
+                            "processing-rule": false,
+                            "remove": false,
+                            "sync": true,
+                            "tlvs": {
+                                "lsp-identifiers": {
+                                    "ipv4": {
+                                        "ipv4-extended-tunnel-id": "$IP",
+                                        "ipv4-tunnel-endpoint-address": "1.1.1.1",
+                                        "ipv4-tunnel-sender-address": "$IP"
+                                    },
+                                    "lsp-id": 1,
+                                    "tunnel-id": 1
+                                },
+                                "symbolic-path-name": {
+                                    "path-name": "$CODE"
+                                }
+                            }
+                        }
+                    }
+                ]
+            }
+        ],
+        "state-sync": "synchronized",
+        "stateful-tlv": {
+            "odl-pcep-ietf-stateful07:stateful": {
+                "lsp-update-capability": true,
+                "odl-pcep-ietf-initiated00:initiation": true
+            }
+        }
+    }
+}
diff --git a/csit/variables/tcpmd5user/default_on_updated/location.uri b/csit/variables/tcpmd5user/default_on_updated/location.uri
new file mode 100644 (file)
index 0000000..135ff3c
--- /dev/null
@@ -0,0 +1 @@
+restconf/operational/network-topology:network-topology/topology/pcep-topology/node/pcc:%2F%2F$IP/path-computation-client
diff --git a/csit/variables/tcpmd5user/default_on_updated_state/data.json b/csit/variables/tcpmd5user/default_on_updated_state/data.json
new file mode 100644 (file)
index 0000000..52d5679
--- /dev/null
@@ -0,0 +1,121 @@
+{
+    "topology": [
+        {
+            "node": [
+                {
+                    "network-pcep-topology-stats:pcep-session-state": {
+                        "delegated-lsps-count": 1,
+                        "local-pref": {
+                            "deadtimer": 120,
+                            "ip-address": "$IP_ODL",
+                            "keepalive": 30,
+                            "session-id": "*"
+                        },
+                        "messages": {
+                            "error-messages": {
+                                "last-received-error": {},
+                                "last-sent-error": {},
+                                "received-error-msg-count": 0,
+                                "sent-error-msg-count": 0
+                            },
+                            "last-sent-msg-timestamp": "*",
+                            "odl-pcep-stateful-stats:last-received-rpt-msg-timestamp": "*",
+                            "odl-pcep-stateful-stats:received-rpt-msg-count": 3,
+                            "odl-pcep-stateful-stats:sent-init-msg-count": 0,
+                            "odl-pcep-stateful-stats:sent-upd-msg-count": 1,
+                            "received-msg-count": 3,
+                            "reply-time": {
+                                "average-time": "*",
+                                "max-time": "*",
+                                "min-time": "*"
+                            },
+                            "sent-msg-count": 1,
+                            "unknown-msg-received": 0
+                        },
+                        "peer-capabilities": {
+                            "odl-pcep-stateful-stats:active": true,
+                            "odl-pcep-stateful-stats:instantiation": true,
+                            "odl-pcep-stateful-stats:stateful": true
+                        },
+                        "peer-pref": {
+                            "deadtimer": 120,
+                            "ip-address": "$IP",
+                            "keepalive": 30,
+                            "session-id": "*"
+                        },
+                        "session-duration": "*",
+                        "synchronized": true
+                    },
+                    "network-topology-pcep:path-computation-client": {
+                        "ip-address": "$IP",
+                        "reported-lsp": [
+                            {
+                                "name": "$NAME",
+                                "path": [
+                                    {
+                                        "ero": {
+                                            "ignore": false,
+                                            "processing-rule": false,
+                                            "subobject": [
+                                                {
+                                                    "ip-prefix": {
+                                                        "ip-prefix": "1.1.1.1/32"
+                                                    },
+                                                    "loose": false
+                                                },
+                                                {
+                                                    "ip-prefix": {
+                                                        "ip-prefix": "2.2.2.2/32"
+                                                    },
+                                                    "loose": false
+                                                }
+                                            ]
+                                        },
+                                        "lsp-id": 1,
+                                        "odl-pcep-ietf-stateful07:lsp": {
+                                            "administrative": true,
+                                            "delegate": true,
+                                            "ignore": false,
+                                            "odl-pcep-ietf-initiated00:create": false,
+                                            "operational": "up",
+                                            "plsp-id": 1,
+                                            "processing-rule": false,
+                                            "remove": false,
+                                            "sync": true,
+                                            "tlvs": {
+                                                "lsp-identifiers": {
+                                                    "ipv4": {
+                                                        "ipv4-extended-tunnel-id": "$IP",
+                                                        "ipv4-tunnel-endpoint-address": "1.1.1.1",
+                                                        "ipv4-tunnel-sender-address": "$IP"
+                                                    },
+                                                    "lsp-id": 1,
+                                                    "tunnel-id": 1
+                                                },
+                                                "symbolic-path-name": {
+                                                    "path-name": "$CODE"
+                                                }
+                                            }
+                                        }
+                                    }
+                                ]
+                            }
+                        ],
+                        "state-sync": "synchronized",
+                        "stateful-tlv": {
+                            "odl-pcep-ietf-stateful07:stateful": {
+                                "lsp-update-capability": true,
+                                "odl-pcep-ietf-initiated00:initiation": true
+                            }
+                        }
+                    },
+                    "node-id": "pcc://$IP"
+                }
+            ],
+            "topology-id": "pcep-topology",
+            "topology-types": {
+                "network-topology-pcep:topology-pcep": {}
+            }
+        }
+    ]
+}
diff --git a/csit/variables/tcpmd5user/default_on_updated_state/location.uri b/csit/variables/tcpmd5user/default_on_updated_state/location.uri
new file mode 100644 (file)
index 0000000..7a4b1bf
--- /dev/null
@@ -0,0 +1 @@
+restconf/operational/network-topology:network-topology/topology/pcep-topology
diff --git a/csit/variables/tcpmd5user/default_on_updated_state/volatiles.list b/csit/variables/tcpmd5user/default_on_updated_state/volatiles.list
new file mode 100644 (file)
index 0000000..21a0739
--- /dev/null
@@ -0,0 +1,7 @@
+odl-pcep-stateful-stats:last-received-rpt-msg-timestamp
+session-duration
+session-id
+last-sent-msg-timestamp
+average-time
+max-time
+min-time
diff --git a/csit/variables/tcpmd5user/pcep_topology_node/data.xml b/csit/variables/tcpmd5user/pcep_topology_node/data.xml
new file mode 100644 (file)
index 0000000..beba061
--- /dev/null
@@ -0,0 +1,6 @@
+<node xmlns="urn:TBD:params:xml:ns:yang:network-topology">
+    <node-id>$IP</node-id>
+    <session-config xmlns="urn:opendaylight:params:xml:ns:yang:topology:pcep:config">
+        <password>$PASSWD</password>
+    </session-config>
+</node>
diff --git a/csit/variables/tcpmd5user/pcep_topology_node/location.uri b/csit/variables/tcpmd5user/pcep_topology_node/location.uri
new file mode 100644 (file)
index 0000000..8141554
--- /dev/null
@@ -0,0 +1 @@
+restconf/config/network-topology:network-topology/topology/pcep-topology/node/$IP
diff --git a/csit/variables/tcpmd5user/pcep_topology_node_empty/data.xml b/csit/variables/tcpmd5user/pcep_topology_node_empty/data.xml
new file mode 100644 (file)
index 0000000..fd203a7
--- /dev/null
@@ -0,0 +1,3 @@
+<node xmlns="urn:TBD:params:xml:ns:yang:network-topology">
+    <node-id>$IP</node-id>
+</node>
diff --git a/csit/variables/tcpmd5user/pcep_topology_node_empty/location.uri b/csit/variables/tcpmd5user/pcep_topology_node_empty/location.uri
new file mode 100644 (file)
index 0000000..8141554
--- /dev/null
@@ -0,0 +1 @@
+restconf/config/network-topology:network-topology/topology/pcep-topology/node/$IP
diff --git a/csit/variables/tcpmd5user/update_delegated/location.uri b/csit/variables/tcpmd5user/update_delegated/location.uri
new file mode 100644 (file)
index 0000000..7193120
--- /dev/null
@@ -0,0 +1 @@
+restconf/operations/network-topology-pcep:update-lsp
diff --git a/csit/variables/tcpmd5user/update_delegated/post_data.xml b/csit/variables/tcpmd5user/update_delegated/post_data.xml
new file mode 100644 (file)
index 0000000..ab64fca
--- /dev/null
@@ -0,0 +1,27 @@
+<input xmlns="urn:opendaylight:params:xml:ns:yang:topology:pcep">
+    <node>pcc://$IP</node>
+    <name>$NAME</name>
+    <network-topology-ref xmlns:topo="urn:TBD:params:xml:ns:yang:network-topology">
+    /topo:network-topology/topo:topology[topo:topology-id="pcep-topology"]
+    </network-topology-ref>
+    <arguments>
+        <lsp xmlns="urn:opendaylight:params:xml:ns:yang:pcep:ietf:stateful">
+            <delegate>true</delegate>
+            <administrative>true</administrative>
+        </lsp>
+        <ero>
+            <subobject>
+                <loose>false</loose>
+                <ip-prefix>
+                    <ip-prefix>2.2.2.2/32</ip-prefix>
+                </ip-prefix>
+            </subobject>
+            <subobject>
+                <loose>false</loose>
+                <ip-prefix>
+                    <ip-prefix>1.1.1.1/32</ip-prefix>
+                </ip-prefix>
+            </subobject>
+        </ero>
+    </arguments>
+</input>
diff --git a/csit/variables/tcpmd5user/update_delegated/response.xml b/csit/variables/tcpmd5user/update_delegated/response.xml
new file mode 100644 (file)
index 0000000..220ef12
--- /dev/null
@@ -0,0 +1 @@
+<output xmlns="urn:opendaylight:params:xml:ns:yang:topology:pcep"></output>