Modifying tests to accommodate new feature definitions on NIC.
[integration/test.git] / csit / suites / nic / cli / console.robot
index ce12f8bcbf8947630ce1ea9aaca8103832da3dcd..03e732d873350d8e5df44297f7d1d6919bcd4d4b 100644 (file)
@@ -21,18 +21,26 @@ Variables         ../../../variables/Variables.py
 @{intent3}        10.0.0.1,10.0.0.4    10.0.0.2    ALLOW
 @{all_intents}    ${intent1}    ${intent2}    ${intent3}
 @{all_intents_ids}
-${intent_validation1}    from [10.0.0.1, 10.0.0.4] to [10.0.0.2] apply ALLOW
-${intent_validation2}    from [10.0.0.5] to [10.0.0.2] apply BLOCK
-${intent_validation3}    from [10.0.0.5] to [10.0.0.3] apply ALLOW
-${intent_validation4}    from [10.0.0.5] to [10.0.0.10] apply BLOCK
+${intent_validation1}    from [10.0.0.1, 10.0.0.4] to [10.0.0.2]
+${intent_validation2}    from [10.0.0.5] to [10.0.0.2]
+${intent_validation3}    from [10.0.0.5] to [10.0.0.3]
+${intent_validation4}    from [10.0.0.5] to [10.0.0.10]
+${intent_validation_policy1}    ALLOW
+${intent_validation_policy2}    BLOCK
+${intent_validation_policy3}    ALLOW
+${intent_validation_policy4}    BLOCK
 @{all_intent_validations}    ${intent_validation1}    ${intent_validation2}    ${intent_validation3}    ${intent_validation4}
+@{all_intent_validations_policies}    ${intent_validation_policy1}    ${intent_validation_policy2}    ${intent_validation_policy3}    ${intent_validation_policy4}
 
 *** Test Cases ***
 Verify NIC Command Add and Remove
     [Documentation]    Verification of NIC Console command add and remove. It first creates the intents
     ...    and stores the intent ids, then verifies that the intents were added. Finally, it compiles the intents
     ...    to verify that intents were properly merged and also validates intents were removed at the end per the cleanup procedure.
+    ...    The command "Wait Until Keyword Succeeds" is used to poll for 10 minutes
+    ...    until the intent:add command is availible for the test case to be run.
     [Tags]    NIC
+    Wait Until Keyword Succeeds    10 min    5 sec    Verify Intent:Add Command is Availible
     : FOR    ${intent}    IN    @{all_intents}
     \    ${id}=    Add Intent    @{intent}
     \    Append To List    ${all_intents_ids}    ${id}
@@ -42,8 +50,12 @@ Verify NIC Command Add and Remove
     \    ${intent_id}=    Get From List    ${all_intents_ids}    ${index}
     \    Verify Intent Added    ${intent_id}    ${intent}
     ${output}=    Issue Command On Karaf Console    intent:compile
-    : FOR    ${valid_intent}    IN    @{all_intent_validations}
-    \    Should Contain    ${output}    ${valid_intent}
+    ${size}=    Get Length    ${all_intent_validations}
+    : FOR    ${index}    IN RANGE    ${size}
+    \    ${compiled_intent_validation}=    Get From List    ${all_intent_validations}    ${index}
+    \    ${intent_validation_line}=    Get Lines Containing String    ${output}    ${compiled_intent_validation}
+    \    ${policy}=    Get From List    ${all_intent_validations_policies}    ${index}
+    \    Should Contain    ${intent_validation_line}    ${policy}
     : FOR    ${intent_id}    IN    @{all_intents_ids}
     \    Remove Intent    ${intent_id}
     ${output}=    Issue Command On Karaf Console    intent:list -c
@@ -53,6 +65,7 @@ Verify NIC Command Add and Remove
 *** Keywords ***
 Setup NIC Console Environment
     [Documentation]    Installing NIC Console related features (odl-nic-core, odl-nic-console)
+    Install a Feature    odl-nic-core-service-mdsal
     Install a Feature    odl-nic-core
     Install a Feature    odl-nic-console
     Start Suite
@@ -69,6 +82,13 @@ Add Intent
     ${id}=    Get From List    ${output_split}    3
     [Return]    ${id}
 
+Verify Intent:Add Command is Availible
+    [Documentation]    Verifies that odl-nic-console is up and intent:add command is available to be used. 
+    ...    Should be used with the command "Wait Until Keyword Succeeds" to poll until command is availible. 
+    ${output}=    Issue Command On Karaf Console    intent:add
+    Should Not Contain    ${output}    Command not found
+
+
 Verify Intent Added
     [Arguments]    ${id}    ${intent}
     [Documentation]    This will check if the id exists via intent:list -c, then compares intent details with arguments passed in with Add Intent