*** Settings *** Documentation This suite is a common keywordis file for genius project. Library OperatingSystem Library RequestsLibrary Library SSHLibrary Resource ../../variables/Variables.robot *** Variables *** *** Keywords *** Create Vteps [Arguments] ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP} ${vlan} ${gateway-ip} [Documentation] This keyword creates VTEPs between ${TOOLS_SYSTEM_IP} and ${TOOLS_SYSTEM_2_IP} ${body} OperatingSystem.Get File ${genius_config_dir}/Itm_creation_no_vlan.json ${substr} Should Match Regexp ${TOOLS_SYSTEM_IP} [0-9]\{1,3}\.[0-9]\{1,3}\.[0-9]\{1,3}\. ${subnet} Catenate ${substr}0 Log ${subnet} Set Global Variable ${subnet} ${vlan}= Set Variable ${vlan} ${gateway-ip}= Set Variable ${gateway-ip} ${body} Set Json ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP} ${vlan} ${gateway-ip} ${subnet} ${vtep_body} Set Variable ${body} Set Global Variable ${vtep_body} ${resp} RequestsLibrary.Post Request session ${CONFIG_API}/itm:transport-zones/ data=${body} Log ${resp.status_code} should be equal as strings ${resp.status_code} 204 Set Json [Arguments] ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP} ${vlan} ${gateway-ip} ${subnet} [Documentation] Sets Json with the values passed for it. ${body} OperatingSystem.Get File ${genius_config_dir}/Itm_creation_no_vlan.json ${body} replace string ${body} 1.1.1.1 ${subnet} ${body} replace string ${body} "dpn-id": 101 "dpn-id": ${Dpn_id_1} ${body} replace string ${body} "dpn-id": 102 "dpn-id": ${Dpn_id_2} ${body} replace string ${body} "ip-address": "2.2.2.2" "ip-address": "${TOOLS_SYSTEM_IP}" ${body} replace string ${body} "ip-address": "3.3.3.3" "ip-address": "${TOOLS_SYSTEM_2_IP}" ${body} replace string ${body} "vlan-id": 0 "vlan-id": ${vlan} ${body} replace string ${body} "gateway-ip": "0.0.0.0" "gateway-ip": "${gateway-ip}" Log ${body} [Return] ${body} # returns complete json that has been updated Get Dpn Ids [Arguments] ${connection_id} [Documentation] This keyword gets the DPN id of the switch after configuring bridges on it.It returns the captured DPN id. Switch connection ${connection_id} ${cmd} set Variable sudo ovs-vsctl show | grep Bridge | awk -F "\\"" '{print $2}' ${Bridgename1} Execute command ${cmd} log ${Bridgename1} ${output1} Execute command sudo ovs-ofctl show -O Openflow13 ${Bridgename1} | head -1 | awk -F "dpid:" '{ print $2 }' log ${output1} # "echo \$\(\(16\#${output1}\)\) command below converts ovs dpnid (i.e., output1) from hexadecimal to decimal." ${Dpn_id} Execute command echo \$\(\(16\#${output1}\)\) log ${Dpn_id} [Return] ${Dpn_id} Delete All Sessions [Documentation] This will delete vtep. ${resp} RequestsLibrary.Delete Request session ${CONFIG_API}/itm:transport-zones/ data=${vtep_body} Log ${resp.status_code} Should Be Equal As Strings ${resp.status_code} 200 Log "Before disconnecting CSS with controller" ${output}= Issue Command On Karaf Console ${TEP_SHOW} Log ${output} ${output}= Issue Command On Karaf Console ${TEP_SHOW_STATE} Log ${output}