Use iproute instead of nameserver to get gw 97/65697/3
authorSam Hague <shague@redhat.com>
Sat, 18 Nov 2017 20:29:11 +0000 (15:29 -0500)
committerSam Hague <shague@redhat.com>
Sat, 18 Nov 2017 22:52:37 +0000 (17:52 -0500)
The nameserver line is only included when a vm fails
to ping the gw and you see the below messages in the
console log:

=== pinging gateway failed, debugging connection ===

The iproute line is always included:

ip-route:169.254.169.254 via 10.20.20.2 dev eth0

The old code worked because at least one of the vms
in the list would hit the gateway failed block and
get the gw from the nameserver line. The old code
also would only copy the gw address once for all
the vms because it kept a list with size 1 for
the address. The new Get VM IPs tries to get the
gw for each vm and not just one for the whole list
of vms. Timing differences might end up not getting
the nameserver line, so instead use the metadata
line which is always present.

Change-Id: I72637575b5171d3eaad6110ed2e8bc2cefed25ed
Signed-off-by: Sam Hague <shague@redhat.com>
csit/libraries/OpenStackOperations.robot
csit/variables/Variables.robot

index 64baaacf74b63eb5c4324561d9792505873ac72e..039f1f69bb0880fa36a675457e9d30505933a9c4 100644 (file)
@@ -331,12 +331,12 @@ Collect VM IP Addresses
     [Return]    ${ip_list}    ${dhcp_ip}
 
 Get Match
-    [Arguments]    ${text}    ${regexp}
+    [Arguments]    ${text}    ${regexp}    ${index}=0
     [Documentation]    Wrapper around Get Regexp Matches to return None if not found or the first match if found.
     @{matches} =    String.Get Regexp Matches    ${text}    ${regexp}
     ${matches_length} =    Get Length    ${matches}
     BuiltIn.Set Test Variable    ${match}    None
-    BuiltIn.Run Keyword If    ${matches_length} > 0    BuiltIn.Set Test Variable    ${match}    @{matches}[0]
+    BuiltIn.Run Keyword If    ${matches_length} > ${index}    BuiltIn.Set Test Variable    ${match}    @{matches}[${index}]
     [Return]    ${match}
 
 Get VM IP
@@ -347,9 +347,9 @@ Get VM IP
     ${vm_ip} =    Set Variable    None
     ${dhcp_ip} =    Set Variable    None
     ${match} =    Get Match    ${vm_console_output}    ${REGEX_OBTAINED}
-    ${vm_ip} =    Get Match    ${match}    ${REGEX_IPV4}
-    ${match} =    Get Match    ${vm_console_output}    ${REGEX_NAMESERVER}
-    ${dhcp_ip} =    Get Match    ${match}    ${REGEX_IPV4}
+    ${vm_ip} =    Get Match    ${match}    ${REGEX_IPV4}    0
+    ${match} =    Get Match    ${vm_console_output}    ${REGEX_IPROUTE}
+    ${dhcp_ip} =    Get Match    ${match}    ${REGEX_IPV4}    1
     BuiltIn.Run Keyword If    '${fail_on_none}' == 'true'    Should Not Contain    ${vm_ip}    None
     BuiltIn.Run Keyword If    '${fail_on_none}' == 'true'    Should Not Contain    ${dhcp_ip}    None
     [Return]    ${vm_ip}    ${dhcp_ip}    ${vm_console_output}
index 73e91f278bbb430e1fbe38ccbe96c38b8fb4e2e9..c693f3ded7f46655df046a8cfda1c7c7c1dfa8fb 100644 (file)
@@ -147,6 +147,7 @@ ${PREDEFINE_ROLE_URI}    /restconf/config/nemo-user:user-roles    # FIXME: Move
 ${PREFIX}         http://${ODL_SYSTEM_IP}:${PORT}    # Deprecated. FIXME: Name is to generic. Eradicate.
 ${PROTOCOL_LOG_LEVEL}    ${DEFAULT_PROTOCOL_LOG_LEVEL}    # Some suites temporarily override org.opendaylight.protocol Karaf log level to this value.
 ${PWD}            ${ODL_RESTCONF_PASSWORD}    # Deprecated. FIXME: Eradicate.
+${REGEX_IPROUTE}    ip-route:169.254.169.254 via [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}
 ${REGEX_IPV4}     [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}
 ${REGEX_NAMESERVER}    nameserver [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}
 ${REGEX_OBTAINED}    [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3} obtained