Support both empty data formats
[integration/test.git] / csit / suites / netconf / CRUD / CRUD.robot
index 1bb2dfe96288cb660804e61315c7771b170648a6..f634d2236a3d750683ea21ea4341ab8f27a994ae 100644 (file)
@@ -71,8 +71,8 @@ Wait_For_Device_To_Become_Connected
 
 Check_Device_Data_Is_Empty
     [Documentation]    Get the device data and make sure it is empty.
-    Run_Keyword_If_Less_Than_Neon    Check_Config_Data    <data xmlns\="${ODL_NETCONF_NAMESPACE}"></data>
-    Run_Keyword_If_At_Least_Neon    Check_Config_Data    <data xmlns\="${ODL_NETCONF_NAMESPACE}"/>
+    ${escaped}=    BuiltIn.Regexp_Escape    ${ODL_NETCONF_NAMESPACE}
+    Check_Config_Data    <data xmlns\="${escaped}"(\/>|><\/data>)    ${True}
 
 Create_Device_Data_Label_Via_Xml
     [Documentation]    Send a sample test data label into the device and check that the request went OK.
@@ -213,8 +213,8 @@ Delete_Device_Data
 
 Check_Device_Data_Is_Deleted
     [Documentation]    Get the device data and make sure it is empty again.
-    Run_Keyword_If_Less_Than_Neon    Check_Config_Data    <data xmlns\="${ODL_NETCONF_NAMESPACE}"></data>
-    Run_Keyword_If_At_Least_Neon    Check_Config_Data    <data xmlns\="${ODL_NETCONF_NAMESPACE}"/>
+    ${escaped}=    BuiltIn.Regexp_Escape    ${ODL_NETCONF_NAMESPACE}
+    Check_Config_Data    <data xmlns\="${escaped}"(\/>|><\/data>)    ${True}
 
 Deconfigure_Device_From_Netconf
     [Documentation]    Make request to deconfigure the testtool device on Netconf connector.
@@ -261,12 +261,15 @@ Get_Config_Data
     RETURN    ${data}
 
 Check_Config_Data
-    [Arguments]    ${expected}    ${contains}=False
+    [Arguments]    ${expected}    ${regex}=False    ${contains}=False
     ${data}=    Get_Config_Data
-    IF    not ${contains}
+    IF    ${regex}
+        BuiltIn.Should Match Regexp    ${data}    ${expected}
+    ELSE IF    ${contains}
+        BuiltIn.Should_Contain    ${data}    ${expected}
+    ELSE
         BuiltIn.Should_Be_Equal_As_Strings    ${data}    ${expected}
     END
-    IF    ${contains}    BuiltIn.Should_Contain    ${data}    ${expected}
 
 Count_Netconf_Connectors
     ${count}=    NetconfKeywords.Count_Netconf_Connectors_For_Device    ${device_name}