Tcpmd5 password reconfig
[integration/test.git] / csit / suites / bgpcep / tcpmd5user / tcpmd5user.robot
index be632194b59ce466a8f7271196aa22b56bfa5a35..691aa605cb48ad3622306262154b4ff501a90466 100644 (file)
@@ -12,6 +12,9 @@ Documentation     TCPMD5 user-facing feature system tests, using PCEP.
 ...               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.
+...               Stop pcc-mock, check pcep-topology stays empty.
+...               Start pcc-mock with new 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.
 ...
@@ -49,10 +52,7 @@ Topology_Precondition
 
 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.
-    ${command}=    NexusKeywords.Compose_Full_Java_Command    -jar ${filename} --password topsecret --reconnect 1 --local-address ${TOOLS_SYSTEM_IP} --remote-address ${ODL_SYSTEM_IP} 2>&1 | tee pccmock.log
-    BuiltIn.Log    ${command}
-    SSHLibrary.Write    ${command}
-    Read_And_Fail_If_Prompt_Is_Seen
+    Start_Pcc_Mock_Tool_With_Password    password=topsecret
 
 Topology_Unauthorized_1
     [Documentation]    Try to catch a glimpse of pcc-mock in pcep-topology. Pass if no change from Precondition is detected over 10 seconds.
@@ -85,6 +85,43 @@ Topology_Intercondition
     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
 
+Stop_Pcc_Mock_1
+    [Documentation]    Stops First instance of pcc-mock.
+    [Setup]    FailFast.Run_Even_When_Failing_Fast
+    Stop_Pcc_Mock_Tool
+    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
+
+Topology_Unauthorized_3
+    [Documentation]    The same logic as Topology_Unauthorized_1, with no pcc-mock running.
+    [Tags]    critical
+    BuiltIn.Wait_Until_Keyword_Succeeds    10s    1s    Test_Unauthorized
+
+Start_Secure_Pcc_Mock_2
+    [Documentation]    Execute pcc-mock on Mininet with new password set, fail if pcc-mock promptly exits. Keep pcc-mock running for next test cases.
+    Start_Pcc_Mock_Tool_With_Password    password=newtopsecret
+
+Topology_Unauthorized_4
+    [Documentation]    The same logic as Topology_Unauthorized_1, but ODL password became incorrect with new pcc-mock running.
+    [Tags]    critical
+    WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout    10s    1s    Test_Unauthorized
+
+Set_Correct_Password_2
+    [Documentation]    Configure password in pcep dispatcher for client with Mininet IP address.
+    ...    This password again matches what second pcc-mock instance uses.
+    CompareStream.Run_Keyword_If_At_Least_Oxygen    Replace_Password_On_Pcep_Node    password=newtopsecret
+    CompareStream.Run_Keyword_If_Less_Than_Oxygen    Set_Password_Less_Than_Oxygen    password=newtopsecret
+
+Topology_Intercondition_2
+    [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.
     &{mapping}    BuiltIn.Create_Dictionary    IP=${TOOLS_SYSTEM_IP}    NAME=${pcc_name}
@@ -110,18 +147,15 @@ Unset_Password
     # NOTE: It is still possible to remain failing, if both previous and this test failed.
     [Teardown]    FailFast.Do_Not_Start_Failing_If_This_Failed
 
-Topology_Unauthorized_3
+Topology_Unauthorized_5
     [Documentation]    Wait for pcep-topology to become empty again.
     [Tags]    critical
     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)
+Stop_Pcc_Mock_2
+    [Documentation]    Stops second instance of pcc-mock
     [Setup]    FailFast.Run_Even_When_Failing_Fast
-    RemoteBash.Write_Bare_Ctrl_C
-    ${output}=    SSHLibrary.Read_Until_Prompt
-    BuiltIn.Log    ${output}
+    Stop_Pcc_Mock_Tool
     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
@@ -199,10 +233,6 @@ Set_Password_Less_Than_Oxygen
     ${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
-
 Read_Text_Before_Prompt
     [Documentation]    Log text gathered by SSHLibrary.Read_Until_Prompt.
     ...    This needs to be a separate keyword just because how Read_And_Fail_If_Prompt_Is_Seen is implemented.
@@ -232,3 +262,17 @@ Replace_Password_Xml_Element_In_Pcep_Client_Module_Less_Than_Oxygen
     [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    ${DIR_WITH_TEMPLATES}${/}pcep_topology_client_module    mapping=${mapping}
+
+Stop_Pcc_Mock_Tool
+    [Documentation]    Send ctrl+c to pcc-mock, fails if no prompt is seen
+    ...    after 3 seconds (the default for SSHLibrary)
+    RemoteBash.Write_Bare_Ctrl_C
+    ${output}=    SSHLibrary.Read_Until_Prompt
+    BuiltIn.Log    ${output}
+
+Start_Pcc_Mock_Tool_With_Password
+    [Arguments]    ${password}
+    [Documentation]    Starts pcc-mock with password argument.
+    ${command}=    NexusKeywords.Compose_Full_Java_Command    -jar ${filename} --password ${password} --reconnect 1 --local-address ${TOOLS_SYSTEM_IP} --remote-address ${ODL_SYSTEM_IP} 2>&1 | tee pccmock.log
+    BuiltIn.Log    ${command}
+    SSHLibrary.Write    ${command}