Change-Id: I4fccc3166514b774c48c1414d364fecc0e8ec295
Signed-off-by: David Lopez <david.lopez.munoz@ericsson.com>
Library String
Library Collections
Library RequestsLibrary
+Library ipaddress
Resource Utils.robot
Resource ClusterManagement.robot
Resource ${CURDIR}/TemplatedRequests.robot
Log ${dpnid}
[Return] ${dpnid}
+Get Subnet
+ [Arguments] ${ip}
+ [Documentation] Return the subnet from the system at the given ip address and interface
+ ${output} = Run Command On Remote System ${ip} /usr/sbin/ip addr show | grep ${ip} | cut -d' ' -f6
+ ${interface} = ipaddress.ip_interface ${output}
+ ${network}= Set Variable ${interface.network.__str__()}
+ [Return] ${network}
+
Get Ethernet Adapter
[Arguments] ${ip}
[Documentation] Returns the ethernet adapter name from the system at the given ip address using ip addr show.
${node_2_dpid} = Get DPID ${OS_COMPUTE_2_IP}
${node_1_adapter} = Get Ethernet Adapter ${OS_COMPUTE_1_IP}
${node_2_adapter} = Get Ethernet Adapter ${OS_COMPUTE_2_IP}
- ${first_two_octets} ${third_octet} ${last_octet}= Split String From Right ${OS_COMPUTE_1_IP} . 2
- ${subnet} = Set Variable ${first_two_octets}.0.0/16
+ ${subnet} = Get Subnet ${OS_COMPUTE_1_IP}
${gateway} = Get Default Gateway ${OS_COMPUTE_1_IP}
ITM Create Tunnel tunneltype=vxlan vlanid=0 prefix=${subnet} gateway=${gateway} ipaddress1=${OS_COMPUTE_1_IP} dpnid1=${node_1_dpid}
... portname1=${node_1_adapter} ipaddress2=${OS_COMPUTE_2_IP} dpnid2=${node_2_dpid} portname2=${node_2_adapter}