Fix bgpcep-1node-userfeatures tests
[integration/test.git] / csit / suites / bgpcep / pcepuser / pcepuser.robot
index 62b5d487002d31ed1e28e354766ba67647bacd18..6e15be212506a56df06e2fcd20222272362bf9b5 100644 (file)
@@ -17,13 +17,14 @@ Resource          ../../../libraries/PcepOperations.robot
 Resource          ../../../libraries/Utils.robot
 Resource          ../../../libraries/RemoteBash.robot
 Resource          ../../../libraries/TemplatedRequests.robot
-Resource          ../../../libraries/KarafKeywords.robot
-Variables         ../../../variables/Variables.py
-Variables         ../../../variables/pcepuser/variables.py    ${TOOLS_SYSTEM_IP}
+Resource          ../../../libraries/CompareStream.robot
+Resource          ../../../variables/Variables.robot
+Variables         ../../../variables/pcepuser/${ODL_STREAM}/variables.py    ${TOOLS_SYSTEM_IP}
 
 *** Variables ***
 ${CONFIG_SESSION}    session
-${PATH_SESSION_URI}    node/pcc:%2F%2F${TOOLS_SYSTEM_IP}/path-computation-client
+${PATH_SESSION_URI}    node=pcc:%2F%2F${TOOLS_SYSTEM_IP}/network-topology-pcep:path-computation-client
+${PCEP_VARIABLES_FOLDER}    ${CURDIR}/../../../variables/pcepuser/${ODL_STREAM}
 
 *** Test Cases ***
 Topology_Precondition
@@ -34,10 +35,19 @@ Topology_Precondition
 
 Start_Pcc_Mock
     [Documentation]    Execute pcc-mock on Mininet, fail is Open is not sent, keep it running for next tests.
-    ${command}=    NexusKeywords.Compose_Full_Java_Command    -jar ${filename} --local-address ${TOOLS_SYSTEM_IP} --remote-address ${ODL_SYSTEM_IP} 2>&1 | tee pccmock.log
+    ${command}=    NexusKeywords.Compose_Full_Java_Command    -jar ${filename} --reconnect 1 --local-address ${TOOLS_SYSTEM_IP} --remote-address ${ODL_SYSTEM_IP} 2>&1 | tee pccmock.log
     Log    ${command}
     Write    ${command}
     Read_Until    started, sent proposal Open
+    # Sleep required because of BGPCEP-890
+    Sleep    1s
+
+Configure_Speaker_Entity_Identifier
+    [Documentation]    Additional PCEP Speaker configuration for at least oxygen streams.
+    ...    Allows PCEP speaker to determine if state synchronization can be skipped when a PCEP session is restarted.
+    CompareStream.Run_Keyword_If_Less_Than_Oxygen    BuiltIn.Pass_Execution    Test case valid only for versions oxygen and above.
+    &{mapping}    BuiltIn.Create_Dictionary    IP=${ODL_SYSTEM_IP}
+    TemplatedRequests.Put_As_Xml_Templated    ${PCEP_VARIABLES_FOLDER}${/}node_speaker_entity_identifier    mapping=${mapping}    session=${CONFIG_SESSION}
 
 Topology_Default
     [Documentation]    Compare pcep-topology to default_json, which includes a tunnel from pcc-mock.
@@ -49,7 +59,6 @@ Update_Delegated
     [Documentation]    Perform update-lsp on the mocked tunnel, check response is success.
     [Tags]    critical
     ${text}=    Update_Xml_Lsp_Return_Json    ${update_delegated_xml}
-    Pcep_Json_Is_Success    ${text}
 
 Topology_Updated
     [Documentation]    Compare pcep-topology to default_json, which includes the updated tunnel.
@@ -71,7 +80,6 @@ Add_Instantiated
     [Documentation]    Perform add-lsp to create new tunnel, check that response is success.
     [Tags]    critical
     ${text}=    Add_Xml_Lsp_Return_Json    ${add_instantiated_xml}
-    Pcep_Json_Is_Success    ${text}
 
 Topology_Second_Default
     [Documentation]    Compare pcep-topology to default_json, which includes the updated delegated and default instantiated tunnel.
@@ -82,7 +90,6 @@ Update_Instantiated
     [Documentation]    Perform update-lsp on the newly instantiated tunnel, check that response is success.
     [Tags]    critical
     ${text}=    Update_Xml_Lsp_Return_Json    ${update_instantiated_xml}
-    Pcep_Json_Is_Success    ${text}
 
 Topology_Second_Updated
     [Documentation]    Compare pcep-topology to default_json, which includes the updated delegated and updated instantiated tunnel.
@@ -93,7 +100,6 @@ Remove_Instantiated
     [Documentation]    Perform remove-lsp on the instantiated tunnel, check that response is success.
     [Tags]    critical
     ${text}=    Remove_Xml_Lsp_Return_Json    ${remove_instantiated_xml}
-    Pcep_Json_Is_Success    ${text}
 
 Topology_Again_Updated
     [Documentation]    Compare pcep-topology to default_json, which includes the updated tunnel, to verify that instantiated tunnel was removed.
@@ -139,6 +145,8 @@ Compare_Topology
     ...    Error codes and normalized jsons should match exactly.
     # TODO: Add Node Session State Check For Oxygen, see tcpmd5user
     # TODO: Possibly remake all tests with TemplatedRequests
-    ${response}=    RequestsLibrary.Get Request    ${CONFIG_SESSION}    ${OPERATIONAL_TOPO_API}/topology/pcep-topology/${uri}
+    ${topology_uri}=    BuiltIn.Set_Variable_If    '${uri}'=='${EMPTY}'
+    ...    ${REST_API}/${TOPOLOGY_URL}=pcep-topology?content=nonconfig    ${REST_API}/${TOPOLOGY_URL}=pcep-topology/${uri}?content=nonconfig
+    ${response}=    RequestsLibrary.Get Request    ${CONFIG_SESSION}    ${topology_uri}
     BuiltIn.Should_Be_Equal_As_Strings    ${response.status_code}    200
     TemplatedRequests.Normalize_Jsons_And_Compare    ${exp}    ${response.text}