${output}= Write Commands Until Expected Prompt curl -i http://169.254.169.254 ${OS_SYSTEM_PROMPT}
Should Contain ${output} 200
+Execute Command on VM Instance
+ [Arguments] ${net_name} ${src_ip} ${cmd} ${user}=cirros ${password}=cubswin:)
+ [Documentation] Login to the vm instance using ssh in the network, executes a command inside the VM and returns the ouput.
+ ${devstack_conn_id} = Get ControlNode Connection
+ Switch Connection ${devstack_conn_id}
+ ${net_id} = Get Net Id ${net_name} ${devstack_conn_id}
+ ${output} = Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ssh ${user}@${src_ip} -o ConnectTimeout=10 -o StrictHostKeyChecking=no d:
+ Log ${output}
+ ${output} = Write Commands Until Expected Prompt ${password} ${OS_SYSTEM_PROMPT}
+ Log ${output}
+ ${rcode} = Run Keyword And Return Status Check If Console Is VmInstance
+ ${output} = Run Keyword If ${rcode} Write Commands Until Expected Prompt ${cmd} ${OS_SYSTEM_PROMPT}
+ [Teardown] Exit From Vm Console
+ [Return] ${output}
+
Test Operations From Vm Instance
[Arguments] ${net_name} ${src_ip} ${list_of_local_dst_ips} ${l2_or_l3}=l2 ${list_of_external_dst_ips}=${NONE} ${user}=cirros
... ${password}=cubswin:)
Run Keyword If ${rcode} Write Commands Until Expected Prompt ifconfig ${OS_SYSTEM_PROMPT}
Run Keyword If ${rcode} Write Commands Until Expected Prompt route ${OS_SYSTEM_PROMPT}
Run Keyword If ${rcode} Write Commands Until Expected Prompt arp -an ${OS_SYSTEM_PROMPT}
- ${dest_vm}= Get From List ${list_of_local_dst_ips} 0
- Log ${dest_vm}
- Run Keyword If ${rcode} Check Ping ${dest_vm}
- ${dest_dhcp}= Get From List ${list_of_local_dst_ips} 1
- Log ${dest_dhcp}
- Run Keyword If ${rcode} Check Ping ${dest_dhcp}
- ${dest_vm}= Get From List ${list_of_local_dst_ips} 2
- Log ${dest_vm}
- Run Keyword If ${rcode} Check Ping ${dest_vm}
+ : FOR ${dest_ip} IN @{list_of_local_dst_ips}
+ \ Log ${dest_ip}
+ \ Run Keyword If ${rcode} Check Ping ${dest_ip}
Run Keyword If ${rcode} Check Metadata Access
Run Keyword If '${l2_or_l3}' == 'l3' Ping Other Instances ${list_of_external_dst_ips}
[Teardown] Exit From Vm Console
[Arguments] ${list_of_external_dst_ips}
[Documentation] Check reachability with other network's instances.
${rcode}= Run Keyword And Return Status Check If Console Is VmInstance
- ${dest_vm}= Get From List ${list_of_external_dst_ips} 0
- Log ${dest_vm}
- Run Keyword If ${rcode} Check Ping ${dest_vm}
- ${dest_dhcp}= Get From List ${list_of_external_dst_ips} 1
- Log ${dest_dhcp}
- Run Keyword If ${rcode} Check Ping ${dest_dhcp}
- ${dest_vm}= Get From List ${list_of_external_dst_ips} 2
- Log ${dest_vm}
- Run Keyword If ${rcode} Check Ping ${dest_vm}
+ : FOR ${dest_ip} IN @{list_of_external_dst_ips}
+ \ Log ${dest_ip}
+ \ Run Keyword If ${rcode} Check Ping ${dest_ip}
Create Router
[Arguments] ${router_name}
Close Connection
Should Contain ${output} Removed interface from router
+Update Router
+ [Arguments] ${router_name} ${cmd}
+ [Documentation] Update the router with the command. Router name and command should be passed as argument.
+ ${devstack_conn_id} = Get ControlNode Connection
+ Switch Connection ${devstack_conn_id}
+ ${output} = Write Commands Until Prompt neutron router-update ${router_name} ${cmd} 30s
+ Close Connection
+ Should Contain ${output} Updated
+
+Show Router
+ [Arguments] ${router_name} ${options}
+ [Documentation] Show information of a given router. Router name and optional fields should be sent as arguments.
+ ${devstack_conn_id} = Get ControlNode Connection
+ Switch Connection ${devstack_conn_id}
+ ${output} = Write Commands Until Prompt neutron router-show ${router_name} ${options} 30s
+ Log ${output}
+ Close Connection
+
Delete Router
[Arguments] ${router_name}
[Documentation] Delete Router and Interface to the subnets.