--- /dev/null
+*** Settings ***
+Documentation Test Suite for Interface manager
+Suite Setup Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
+Suite Teardown Delete All Sessions
+Library OperatingSystem
+Library String
+Library RequestsLibrary
+Library Collections
+Library re
+Variables ../../variables/Variables.py
+Resource ../../libraries/Utils.robot
+
+*** Variables ***
+${genius_config_dir} ${CURDIR}/../../variables/genius
+${bridgename} BR1
+${interface_name} l2vlan-trunk
+${trunk_json} l2vlan.json
+${trunk_member_json} l2vlan_member.json
+
+*** Test Cases ***
+Create l2vlan transparent interface
+ [Documentation] This testcase creates a l2vlan transparent interface between 2 dpns.
+ Log >>>> Creating L2vlan interface <<<<<
+ Create Interface ${trunk_json} transparent
+ Log >>>> Get interface config <<<<<
+ @{l2vlan} create list l2vlan-trunk l2vlan transparent l2vlan true
+ Check For Elements At URI ${CONFIG_API}/ietf-interfaces:interfaces/ ${l2vlan}
+ Log >>>>> Get interface operational state<<<<
+ Wait Until Keyword Succeeds 50 5 get operational interface ${interface_name}
+ ${ovs-check} Wait Until Keyword Succeeds 40 10 table0 entry ${conn_id_1} ${bridgename}
+
+Delete l2vlan transparent interface
+ [Documentation] This testcase deletes the l2vlan transparent interface created between 2 dpns.
+ Remove All Elements At URI And Verify ${CONFIG_API}/ietf-interfaces:interfaces/
+ No Content From URI session ${OPERATIONAL_API}/ietf-interfaces:interfaces/ headers=${ACCEPT_XML}
+ Wait Until Keyword Succeeds 30 10 no table0 entry
+
+Create l2vlan trunk interface
+ [Documentation] This testcase creates a l2vlan trunk interface between 2 DPNs.
+ Log >>>> Getting file for posting json <<<<<<<
+ Create Interface ${trunk_json} trunk
+ Log >>>> Get interface config <<<<<
+ @{l2vlan} create list l2vlan-trunk l2vlan trunk tap8ed70586-6c true
+ Check For Elements At URI ${CONFIG_API}/ietf-interfaces:interfaces/ ${l2vlan}
+ Log >>>>> Get interface operational state<<<<
+ Wait Until Keyword Succeeds 50 5 get operational interface ${interface_name}
+ Wait Until Keyword Succeeds 30 10 table0 entry ${conn_id_1} ${bridgename}
+
+Create l2vlan Trunk member interface
+ [Documentation] This testcase creates a l2vlan Trunk member interface for the l2vlan trunk interface created in 1st testcase.
+ Log >>>> Creating L2vlan member interface <<<<<
+ Log >>>> Getting file for posting json <<<<<<<
+ ${body} OperatingSystem.Get File ${genius_config_dir}/l2vlan_member.json
+ ${post_resp} RequestsLibrary.Post Request session ${CONFIG_API}/ietf-interfaces:interfaces/ data=${body}
+ Log ${post_resp.content}
+ Log ${post_resp.status_code}
+ Should Be Equal As Strings ${post_resp.status_code} 204
+ Log >>>> Get interface config <<<<<
+ @{l2vlan} create list l2vlan-trunk1 l2vlan trunk-member 1000 l2vlan-trunk
+ ... true
+ Check For Elements At URI ${CONFIG_API}/ietf-interfaces:interfaces/ ${l2vlan}
+ Log >>>>> Get interface operational state<<<<
+ Wait Until Keyword Succeeds 10 5 get operational interface ${l2vlan[0]}
+ Wait Until Keyword Succeeds 40 10 ovs check for member interface creation ${conn_id_1} ${bridgename}
+
+Bind service on Interface
+ [Documentation] This testcase binds service to the interface created .
+ Log >>>> Getting file for posting json <<<<<<<
+ ${body} OperatingSystem.Get File ${genius_config_dir}/bind_service.json
+ ${body} replace string ${body} service1 VPN
+ ${body} replace string ${body} service2 elan
+ log ${body}
+ ${service_mode} Set Variable interface-service-bindings:service-mode-ingress
+ ${post_resp} RequestsLibrary.Post Request session ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/ data=${body}
+ log ${post_resp.content}
+ log ${post_resp.status_code}
+ Should Be Equal As Strings ${post_resp.status_code} 204
+ Log >>>>> Verifying Binded interface <<<<<
+ @{bind_array} create list 2 3 VPN elan 50
+ ... 21
+ Check For Elements At URI ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/ ${bind_array}
+ Log >>>>> OVS check for table enteries <<<<
+ ${command} set variable sudo ovs-ofctl -O OpenFlow13 dump-flows ${bridgename}
+ Wait Until Keyword Succeeds 40 10 table entry ${command}
+
+unbind service on interface
+ [Documentation] This testcase Unbinds the service which is binded by the 3rd testcase.
+ Log >>>>>>Unbinding the service on interface <<<<
+ ${service-priority-1} set variable 3
+ ${service-priority-2} set variable 4
+ ${service_mode} Set Variable interface-service-bindings:service-mode-ingress
+ Remove All Elements At URI And Verify ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/bound-services/${service-priority-1}/
+ log >>>> Ovs check for table 21 absence <<<
+ ${table-id} set variable 21
+ Wait Until Keyword Succeeds 10 2 no goto_table entry ${table-id}
+ Remove All Elements At URI And Verify ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/bound-services/${service-priority-2}/
+ No Content From URI session ${CONFIG_API}/interface-service-bindings:service-bindings/services-info/${interface_name}/${service_mode}/bound-services/${service-priority-2}/
+ log >>>> Ovs check for table 50 absence <<<
+ ${table-id} set variable 50
+ Wait Until Keyword Succeeds 10 2 no goto_table entry ${table-id}
+
+Delete l2vlan trunk interface
+ [Documentation] Deletion of l2vlan trunk interface is done.
+ Remove All Elements At URI And Verify ${CONFIG_API}/ietf-interfaces:interfaces/
+ No Content From URI session ${OPERATIONAL_API}/ietf-interfaces:interfaces/
+ ${resp} Wait Until Keyword Succeeds 30 10 no table0 entry
+
+*** Keywords ***
+get operational interface
+ [Arguments] ${interface_name}
+ [Documentation] checks operational status of the interface.
+ ${get_oper_resp} RequestsLibrary.Get Request session ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/interface/${interface_name}/ headers=${ACCEPT_XML}
+ log ${get_oper_resp.content}
+ log ${get_oper_resp.status_code}
+ Should Be Equal As Strings ${get_oper_resp.status_code} 200
+ Should not contain ${get_oper_resp.content} down
+ Should Contain ${get_oper_resp.content} up up
+
+table entry
+ [Arguments] ${command}
+ [Documentation] Checks for tables entry wrt the service the Interface is binded.
+ switch connection ${conn_id_1}
+ ${result} execute command ${command}
+ log ${result}
+ should contain ${result} table=17
+ should contain ${result} goto_table:21
+ should contain ${result} goto_table:50
+
+no table0 entry
+ [Documentation] after Deleting trunk interface , checking for absence of table 0 in the flow dumps
+ switch connection ${conn_id_1}
+ ${bridgename} set variable BR1
+ ${ovs-check} execute command sudo ovs-ofctl -O OpenFlow13 dump-flows ${bridgename}
+ log ${ovs-check}
+ should not contain ${ovs-check} table=0
+ should not contain ${ovs-check} goto_table:17
+
+no goto_table entry
+ [Arguments] ${table-id}
+ [Documentation] cchecks for absence of no goto_table afetr unbinding the service on the interface.
+ switch connection ${conn_id_1}
+ ${ovs-check1} execute command sudo ovs-ofctl -O OpenFlow13 dump-flows ${bridgename}
+ Log ${ovs-check1}
+ should not contain ${ovs-check1} goto_table:${table-id}
+
+table0 entry
+ [Arguments] ${connection-id} ${bridgename}
+ [Documentation] after Deleting trunk interface , checking for absence of table 0 in the flow dumps
+ switch connection ${connection-id}
+ log switch connection
+ ${ovs-check} execute command sudo ovs-ofctl -O OpenFlow13 dump-flows ${bridgename}
+ log sudo ovs-ofctl -O OpenFlow13 dump-flows ${bridgename}
+ log ${ovs-check}
+ should contain ${ovs-check} table=0
+
+ovs check for member interface creation
+ [Arguments] ${connection-id} ${bridgename}
+ switch connection ${connection-id}
+ ${ovs-check} execute command sudo ovs-ofctl -O OpenFlow13 dump-flows ${bridgename}
+ log ${ovs-check}
+ should contain ${ovs-check} table=0
+ should contain ${ovs-check} dl_vlan=1000
+ should contain ${ovs-check} actions=pop_vlan
+
+Create Interface
+ [Arguments] ${json_file} ${interface_mode}
+ ${body} OperatingSystem.Get File ${genius_config_dir}/${json_file}
+ log ${genius_config_dir}/${json_file}
+ ${body} replace string ${body} "l2vlan-mode":"trunk" "l2vlan-mode":"${interface_mode}"
+ log "l2vlan-mode":"${interface_mode}"
+ log ${body}
+ ${post_resp} RequestsLibrary.Post Request session ${CONFIG_API}/ietf-interfaces:interfaces/ data=${body}
+ Log ${post_resp.content}
+ Log ${post_resp.status_code}
+ Should Be Equal As Strings ${post_resp.status_code} 204
--- /dev/null
+*** Settings ***
+Documentation Test Suite for Interface manager
+Suite Setup Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
+Suite Teardown Delete All Sessions
+Library OperatingSystem
+Library String
+Library RequestsLibrary
+Library Collections
+Library re
+Variables ../../variables/Variables.py
+Resource ../../libraries/Utils.robot
+
+*** Variables ***
+${genius_config_dir} ${CURDIR}/../../variables/genius
+${pool-name} test-pool
+@{test_keys} test-key1 test-key2 test-key3
+${create_json} createIdpool.json
+${allocaterange_json} allocateIdRange.json
+${OPERATIONS_API} /restconf/operations
+
+*** Test Cases ***
+Create ID pool in range 10:20
+ [Documentation] This testcase creates Id pool in range 10 to 20.
+ Post Elements To URI From File ${OPERATIONS_API}/id-manager:createIdPool ${genius_config_dir}/${create_json}
+ @{poolrange} create list ${pool-name} 10 20
+ Check For Elements At URI ${CONFIG_API}/id-manager:id-pools/id-pool/${pool-name}/ ${poolrange}
+ @{availiable_pool} create List 10 20 10
+ Check For Elements At URI ${CONFIG_API}/id-manager:id-pools/id-pool/${pool-name}/available-ids-holder/ ${availiable_pool}
+
+Allocate Ids from pool created within size as 5
+ [Documentation] This testcase allocated IDs of specified size for the pool created in 1st testcase.
+ ${body} OperatingSystem.Get File ${genius_config_dir}/${allocaterange_json}
+ ${body} replace string ${body} test-key ${test_keys[0]}
+ log ${body}
+ Post Elements To URI ${OPERATIONS_API}/id-manager:allocateIdRange ${body}
+ get Id pool
+
+Neg_Allocate ids of size 10 from the same pool
+ [Documentation] This is a Negative testcase where when trying to allocate Id range out of the availiable IDs we have, the IDs are not allocated.
+ ${pool-name} Set Variable test-pool
+ ${body} OperatingSystem.Get File ${genius_config_dir}/${allocaterange_json}
+ ${body} Replace String ${body} 5 6
+ ${body} Replace String ${body} test-key ${test_keys[1]}
+ log ${body}
+ ${resp} RequestsLibrary.Post Request session ${OPERATIONS_API}/id-manager:allocateIdRange data=${body}
+ Log ${resp.content}
+ should be equal as strings ${resp.status_code} 500
+
+Allocate IDs of size 3 from the pool
+ ${body} OperatingSystem.Get File ${genius_config_dir}/${allocaterange_json}
+ ${body} replace string ${body} test-key ${test_keys[2]}
+ ${body} replace string ${body} 5 3
+ log ${body}
+ Post Elements To URI ${OPERATIONS_API}/id-manager:allocateIdRange ${body}
+ ${get_resp} RequestsLibrary.Get Request session ${CONFIG_API}/id-manager:id-pools/id-pool/${pool-name}/available-ids-holder/ headers=${ACCEPT_XML}
+ Log ${get_resp.content}
+ Should Contain ${get_resp.content} 17
+ Should Be Equal As Strings ${get_resp.status_code} 200
+
+Release a block of IDs allocated using releaseIds RPC
+ ${body} OperatingSystem.Get File ${genius_config_dir}/releaseIds.json
+ log ${body}
+ ${body} replace string ${body} test-key ${test_keys[2]}
+ Post Elements To URI ${OPERATIONS_API}/id-manager:releaseId ${body}
+ ${get_resp2} RequestsLibrary.Get Request session ${CONFIG_API}/id-manager:id-pools/id-pool/${pool-name}/ headers=${ACCEPT_XML}
+ Log ${get_resp2.content}
+ Should Be Equal As Strings ${get_resp2.status_code} 200
+ ${child-pool-name} Should Match Regexp ${get_resp2.content} ${pool-name}\.[0-9]+
+ log ${child-pool-name}
+ ${get_releasedIds} RequestsLibrary.Get Request session ${CONFIG_API}/id-manager:id-pools/id-pool/${child-pool-name}/released-ids-holder/ headers=${ACCEPT_XML}
+ log ${get_releasedIds.content}
+ Should Be Equal As Strings ${get_releasedIds.status_code} 200
+ @{released_ids} re.findall <id>[0-9]+ ${get_releasedIds.content}
+ log ${released_ids}
+
+Delete the ID Pool using deleteIdPool RPC
+ ${body} OperatingSystem.Get File ${genius_config_dir}/deleteIdPool.json
+ ${body} replace string ${body} poolname ${pool-name}
+ log ${body}
+ Post Elements To URI ${OPERATIONS_API}/id-manager:deleteIdPool ${body}
+ No Content From URI session ${CONFIG_API}/id-manager:id-pools/id-pool/${pool-name}/ headers=${ACCEPT_XML}
+
+*** Keywords ***
+get Id pool
+ ${get_resp} RequestsLibrary.Get Request session ${CONFIG_API}/id-manager:id-pools/id-pool/${pool-name}/available-ids-holder/ headers=${ACCEPT_XML}
+ Log ${get_resp.content}
+ Should Contain ${get_resp.content} 14
+ Should Be Equal As Strings ${get_resp.status_code} 200
--- /dev/null
+*** Settings ***
+Documentation Test Suite for ITM
+Suite Setup Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
+Suite Teardown Delete All Sessions
+Library OperatingSystem
+Library String
+Library RequestsLibrary
+Variables ../../variables/Variables.py
+Library Collections
+Resource ../../libraries/Utils.robot
+Library re
+
+*** Variables ***
+@{itm_created} TZA
+${genius_config_dir} ${CURDIR}/../../variables/genius
+${Bridge-1} BR1
+${Bridge-2} BR2
+
+*** Test Cases ***
+Create and Verify VTEP -No Vlan
+ [Documentation] This testcase creates a Internal Transport Manager - ITM tunnel between 2 DPNs without VLAN and Gateway configured in Json.
+ ${Dpn_id_1} Get Dpn Ids ${conn_id_1}
+ ${Dpn_id_2} Get Dpn Ids ${conn_id_2}
+ Set Global Variable ${Dpn_id_1}
+ Set Global Variable ${Dpn_id_2}
+ ${vlan}= Set Variable 0
+ ${gateway-ip}= Set Variable 0.0.0.0
+ Create Vteps ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP} ${vlan} ${gateway-ip}
+ Wait Until Keyword Succeeds 40 10 Get ITM ${itm_created[0]} ${subnet} ${vlan}
+ ... ${Dpn_id_1} ${TOOLS_SYSTEM_IP} ${Dpn_id_2} ${TOOLS_SYSTEM_2_IP}
+ ${type} set variable odl-interface:tunnel-type-vxlan
+ ${tunnel-1} Wait Until Keyword Succeeds 40 10 Get Tunnel ${Dpn_id_1} ${Dpn_id_2}
+ ... ${type}
+ Set Global Variable ${tunnel-1}
+ ${tunnel-2} Wait Until Keyword Succeeds 40 10 Get Tunnel ${Dpn_id_2} ${Dpn_id_1}
+ ... ${type}
+ Set Global Variable ${tunnel-2}
+ ${tunnel-type}= Set Variable type: vxlan
+ Get Data From URI session ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_1}/ headers=${ACCEPT_XML}
+ Get Data From URI session ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_2}/ headers=${ACCEPT_XML}
+ Log >>>>OVS Validation in Switch 1 for Tunnel Created<<<<<
+ Wait Until Keyword Succeeds 40 10 Ovs Verification 2 Dpn ${conn_id_1} ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP}
+ ... ${tunnel-1} ${tunnel-type}
+ Log >>>>OVS Validation in Switch 2 for Tunnel Created<<<<<
+ Wait Until Keyword Succeeds 40 10 Ovs Verification 2 Dpn ${conn_id_2} ${TOOLS_SYSTEM_2_IP} ${TOOLS_SYSTEM_IP}
+ ... ${tunnel-2} ${tunnel-type}
+ Log >>>> Getting Network Topology Operational <<<<<<
+ ${url-2}= Set Variable ${OPERATIONAL_API}/network-topology:network-topology/
+ ${resp} Wait Until Keyword Succeeds 40 10 Get Network Topology with Tunnel ${Bridge-1} ${Bridge-2}
+ ... ${tunnel-1} ${tunnel-2} ${url-2}
+ Log >>>>Validating Interface 1 & 2 states<<<<
+ ${return} Validate interface state ${tunnel-1} ${Dpn_id_1} ${tunnel-2} ${Dpn_id_2}
+ log ${return}
+ ${lower-layer-if-1} Get from List ${return} 0
+ ${port-num-1} Get From List ${return} 1
+ ${lower-layer-if-2} Get from List ${return} 2
+ ${port-num-2} Get From List ${return} 3
+ Log >>>>>Verify Oper data base of Interface state<<<<<
+ ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/ headers=${ACCEPT_XML}
+ Log ${resp.content}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} ${Dpn_id_1} ${tunnel-1}
+ Should Contain ${resp.content} ${Dpn_id_2} ${tunnel-2}
+ Log >>>>> Checking Entry in table 0 on OVS 1<<<<<
+ ${check-3} Wait Until Keyword Succeeds 40 10 Check Table0 Entry for 2 Dpn ${conn_id_1} ${Bridge-1}
+ ... ${port-num-1}
+ Log >>>>> Checking Entry in table 0 on OVS 2<<<<<
+ ${check-4} Wait Until Keyword Succeeds 40 10 Check Table0 Entry for 2 Dpn ${conn_id_2} ${Bridge-2}
+ ... ${port-num-2}
+ ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_API}/opendaylight-inventory:nodes/ headers=${ACCEPT_XML}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} ${lower-layer-if-1} ${lower-layer-if-2}
+ Log ${resp.content}
+
+Delete and Verify VTEP -No Vlan
+ [Documentation] This Delete testcase , deletes the ITM tunnel created between 2 dpns.
+ Remove All Elements At URI And Verify ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
+ Wait Until Keyword Succeeds 40 10 Verify Data Base after Delete ${Dpn_id_1} ${Dpn_id_2} ${tunnel-1}
+ ... ${tunnel-2}
+
+Create and Verify VTEP-Vlan
+ [Documentation] This testcase creates a Internal Transport Manager - ITM tunnel between 2 DPNs with VLAN and \ without Gateway configured in Json.
+ ${vlan}= Set Variable 100
+ ${gateway-ip}= Set Variable 0.0.0.0
+ Create Vteps ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP} ${vlan} ${gateway-ip}
+ ${get} Wait Until Keyword Succeeds 40 10 Get ITM ${itm_created[0]} ${subnet}
+ ... ${vlan} ${Dpn_id_1} ${TOOLS_SYSTEM_IP} ${Dpn_id_2} ${TOOLS_SYSTEM_2_IP}
+ Log ${get}
+ ${type} set variable odl-interface:tunnel-type-vxlan
+ ${tunnel-3} Wait Until Keyword Succeeds 40 10 Get Tunnel ${Dpn_id_1} ${Dpn_id_2}
+ ... ${type}
+ log ${tunnel-3}
+ Set Global Variable ${tunnel-3}
+ ${tunnel-4} Wait Until Keyword Succeeds 40 10 Get Tunnel ${Dpn_id_2} ${Dpn_id_1}
+ ... ${type}
+ log ${tunnel-4}
+ Set Global Variable ${tunnel-4}
+ ${tunnel-type}= Set Variable type: vxlan
+ Get Data From URI session ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_1}/ headers=${ACCEPT_XML}
+ Get Data From URI session ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_2}/ headers=${ACCEPT_XML}
+ Log >>>>OVS Validation in Switch 1 for Tunnel Created<<<<<
+ Wait Until Keyword Succeeds 40 10 Ovs Verification 2 Dpn ${conn_id_1} ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP}
+ ... ${tunnel-3} ${tunnel-type}
+ Log >>>>OVS Validation in Switch 2 for Tunnel Created<<<<<
+ Wait Until Keyword Succeeds 40 10 Ovs Verification 2 Dpn ${conn_id_2} ${TOOLS_SYSTEM_2_IP} ${TOOLS_SYSTEM_IP}
+ ... ${tunnel-4} ${tunnel-type}
+ Log >>>>> Checking Network opertional Topology <<<<<<
+ ${url_2} set variable ${OPERATIONAL_API}/network-topology:network-topology/
+ Wait Until Keyword Succeeds 40 10 Get Network Topology with Tunnel ${Bridge-1} ${Bridge-2} ${tunnel-3}
+ ... ${tunnel-4} ${url_2}
+ ${return} Validate interface state ${tunnel-3} ${Dpn_id_1} ${tunnel-4} ${Dpn_id_2}
+ log ${return}
+ ${lower-layer-if-1} Get from List ${return} 0
+ ${port-num-1} Get From List ${return} 1
+ ${lower-layer-if-2} Get from List ${return} 2
+ ${port-num-2} Get From List ${return} 3
+ Log >>>>>Verify Oper data base of Interface state<<<<<
+ ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/
+ Log ${resp.content}
+ Should Contain ${resp.content} ${Dpn_id_1} ${tunnel-3}
+ Should Contain ${resp.content} ${Dpn_id_2} ${tunnel-4}
+ Log >>>>> Checking Entry in table 0 on OVS 1<<<<<
+ Wait Until Keyword Succeeds 40 10 Check Table0 Entry for 2 Dpn ${conn_id_1} ${Bridge-1} ${port-num-1}
+ Log >>>>> Checking Entry in table 0 on OVS \ 2<<<<<
+ Wait Until Keyword Succeeds 40 10 Check Table0 Entry for 2 Dpn ${conn_id_2} ${Bridge-2} ${port-num-2}
+ ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_API}/opendaylight-inventory:nodes/ headers=${ACCEPT_XML}
+ Log ${resp.content}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} ${lower-layer-if-2} ${lower-layer-if-1}
+
+Delete and Verify VTEP -Vlan
+ [Documentation] This Delete testcase , deletes the ITM tunnel created between 2 dpns.
+ Remove All Elements At URI And Verify ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
+ Wait Until Keyword Succeeds 40 10 Verify Data Base after Delete ${Dpn_id_1} ${Dpn_id_2} ${tunnel-3}
+ ... ${tunnel-4}
+
+Create VTEP - Vlan and Gateway
+ [Documentation] This testcase creates a Internal Transport Manager - ITM tunnel between 2 DPNs with VLAN and Gateway configured in Json.
+ ${vlan}= Set Variable 101
+ ${substr} Should Match Regexp ${TOOLS_SYSTEM_IP} [0-9]\{1,3}\.[0-9]\{1,3}\.[0-9]\{1,3}\.
+ ${subnet} Catenate ${substr}0
+ ${gateway-ip} Catenate ${substr}1
+ Log ${subnet}
+ Create Vteps ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP} ${vlan} ${gateway-ip}
+ Wait Until Keyword Succeeds 40 10 Get ITM ${itm_created[0]} ${subnet} ${vlan}
+ ... ${Dpn_id_1} ${TOOLS_SYSTEM_IP} ${Dpn_id_2} ${TOOLS_SYSTEM_2_IP}
+ ${type} set variable odl-interface:tunnel-type-vxlan
+ ${tunnel-5} Wait Until Keyword Succeeds 40 10 Get Tunnel ${Dpn_id_1} ${Dpn_id_2}
+ ... ${type}
+ log ${tunnel-5}
+ Set Global Variable ${tunnel-5}
+ ${tunnel-6} Wait Until Keyword Succeeds 40 10 Get Tunnel ${Dpn_id_2} ${Dpn_id_1}
+ ... ${type}
+ log ${tunnel-6}
+ Set Global Variable ${tunnel-6}
+ ${tunnel-type}= Set Variable type: vxlan
+ Get Data From URI session ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_1}/ headers=${ACCEPT_XML}
+ Get Data From URI session ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_2}/ headers=${ACCEPT_XML}
+ Log >>>>OVS Validation in Switch 1 for Tunnel Created<<<<<
+ ${check-1} Wait Until Keyword Succeeds 40 10 Ovs Verification 2 Dpn ${conn_id_1} ${TOOLS_SYSTEM_IP}
+ ... ${TOOLS_SYSTEM_2_IP} ${tunnel-5} ${tunnel-type}
+ Log ${check-1}
+ ${check-2} Wait Until Keyword Succeeds 40 10 Ovs Verification 2 Dpn ${conn_id_2} ${TOOLS_SYSTEM_2_IP}
+ ... ${TOOLS_SYSTEM_IP} ${tunnel-6} ${tunnel-type}
+ Log ${check-2}
+ ${url-2}= Set Variable ${OPERATIONAL_API}/network-topology:network-topology/
+ ${resp} Wait Until Keyword Succeeds 40 10 Get Network Topology with Tunnel ${Bridge-1} ${Bridge-2}
+ ... ${tunnel-5} ${tunnel-6} ${url-2}
+ Log ${resp}
+ ${return} Validate interface state ${tunnel-5} ${Dpn_id_1} ${tunnel-6} ${Dpn_id_2}
+ log ${return}
+ ${lower-layer-if-1} Get from List ${return} 0
+ ${port-num-1} Get From List ${return} 1
+ ${lower-layer-if-2} Get from List ${return} 2
+ ${port-num-2} Get From List ${return} 3
+ ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/
+ Log ${resp.content}
+ Should Contain ${resp.content} ${Dpn_id_1} ${tunnel-5}
+ Should Contain ${resp.content} ${Dpn_id_2} ${tunnel-6}
+ ${check-3} Wait Until Keyword Succeeds 40 10 Check Table0 Entry for 2 Dpn ${conn_id_1} ${Bridge-1}
+ ... ${port-num-1}
+ Log ${check-3}
+ ${check-4} Wait Until Keyword Succeeds 40 10 Check Table0 Entry for 2 Dpn ${conn_id_2} ${Bridge-2}
+ ... ${port-num-2}
+ Log ${check-4}
+ ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_API}/opendaylight-inventory:nodes/ headers=${ACCEPT_XML}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} ${lower-layer-if-2} ${lower-layer-if-1}
+ Log ${resp.content}
+
+Delete VTEP -Vlan and gateway
+ [Documentation] This Delete testcase deletes the ITM tunnel created between 2 dpns.
+ Remove All Elements At URI And Verify ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
+ Wait Until Keyword Succeeds 40 10 Verify Data Base after Delete ${Dpn_id_1} ${Dpn_id_2} ${tunnel-5}
+ ... ${tunnel-6}
+
+*** 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}
+ ${resp} RequestsLibrary.Post Request session ${CONFIG_API}/itm:transport-zones/ data=${body}
+ Log ${resp.content}
+ Log ${resp.status_code}
+ should be equal as strings ${resp.status_code} 204
+
+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}
+ ${Dpn_id} Execute command echo \$\(\(16\#${output1}\)\)
+ log ${Dpn_id}
+ [Return] ${Dpn_id}
+
+Get Tunnel
+ [Arguments] ${src} ${dst} ${type}
+ [Documentation] This Keyword Gets the Tunnel /Interface name which has been created between 2 DPNS by passing source , destination DPN Ids along with the type of tunnel which is configured.
+ ${resp} RequestsLibrary.Get Request session ${CONFIG_API}/itm-state:tunnel-list/internal-tunnel/${src}/${dst}/${type}/ headers=${ACCEPT_XML}
+ Log ${CONFIG_API}/itm-state:tunnel-list/internal-tunnel/${src}/${dst}/
+ Log ${resp.content}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} ${src} ${dst} TUNNEL:
+ ${result} re.sub <.*?> , ${resp.content}
+ Log ${result}
+ @{resp_array} Split String ${result} ,,
+ ${Tunnel} Get From List ${resp_array} 4
+ Log ${Tunnel}
+ [Return] ${Tunnel}
+
+Validate interface state
+ [Arguments] ${tunnel-1} ${dpid-1} ${tunnel-2} ${dpid-2}
+ [Documentation] Validates the created Interface Tunnel by checking its Operational status as UP/DOWN from the dump.
+ Log ${tunnel-1},${dpid-1},${tunnel-2},${dpid-2}
+ ${data1-2} Wait Until Keyword Succeeds 40 10 Check Interface status ${tunnel-1} ${dpid-1}
+ ${data2-1} Wait Until Keyword Succeeds 40 10 Check Interface status ${tunnel-2} ${dpid-2}
+ @{data} combine lists ${data1-2} ${data2-1}
+ log ${data}
+ [Return] ${data}
+
+Check Table0 Entry for 2 Dpn
+ [Arguments] ${connection_id} ${Bridgename} ${port-num1}
+ [Documentation] Checks the Table 0 entry in the OVS when flows are dumped in it.
+ Switch Connection ${connection_id}
+ Log ${connection_id}
+ ${check} Execute Command sudo ovs-ofctl -O OpenFlow13 dump-flows ${Bridgename}
+ Log ${check}
+ Should Contain ${check} in_port=${port-num1}
+ [Return] ${check}
+
+Ovs Verification 2 Dpn
+ [Arguments] ${connection_id} ${local} ${remote-1} ${tunnel} ${tunnel-type}
+ [Documentation] Checks whether the created Interface is seen on OVS or not.
+ Switch Connection ${connection_id}
+ Log ${connection_id}
+ ${check} Execute Command sudo ovs-vsctl show
+ Log ${check}
+ Should Contain ${check} local_ip="${local}" remote_ip="${remote-1}" ${tunnel}
+ Should Contain ${check} ${tunnel-type}
+ [Return] ${check}
+
+Get ITM
+ [Arguments] ${itm_created[0]} ${subnet} ${vlan} ${Dpn_id_1} ${TOOLS_SYSTEM_IP} ${Dpn_id_2}
+ ... ${TOOLS_SYSTEM_2_IP}
+ [Documentation] It returns the created ITM Transport zone with the passed values during the creation is done.
+ Log ${itm_created[0]},${subnet}, ${vlan}, ${Dpn_id_1},${TOOLS_SYSTEM_IP}, ${Dpn_id_2}, ${TOOLS_SYSTEM_2_IP}
+ @{Itm-no-vlan} Create List ${itm_created[0]} ${subnet} ${vlan} ${Dpn_id_1} ${Bridge-1}-eth1
+ ... ${TOOLS_SYSTEM_IP} ${Dpn_id_2} ${Bridge-2}-eth1 ${TOOLS_SYSTEM_2_IP}
+ Check For Elements At URI ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]} ${Itm-no-vlan}
+
+Get Network Topology with Tunnel
+ [Arguments] ${Bridge-1} ${Bridge-2} ${tunnel-1} ${tunnel-2} ${url}
+ [Documentation] Returns the Network topology with Tunnel info in it.
+ @{bridges} Create List ${Bridge-1} ${Bridge-2} ${tunnel-1} ${tunnel-2}
+ Check For Elements At URI ${url} ${bridges}
+
+Get Network Topology without Tunnel
+ [Arguments] ${url} ${tunnel-1} ${tunnel-2}
+ [Documentation] Returns the Network Topology after Deleting of ITM transport zone is done , which wont be having any TUNNEL info in it.
+ @{tunnels} create list ${tunnel-1} ${tunnel-2}
+ Check For Elements Not At URI ${url} ${tunnels}
+
+Validate interface state Delete
+ [Arguments] ${tunnel}
+ [Documentation] Check for the Tunnel / Interface absence in OPERATIONAL data base of IETF interface after ITM transport zone is deleted.
+ Log ${tunnel}
+ ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/interface/${tunnel}/ headers=${ACCEPT_XML}
+ Log ${resp.content}
+ Should Be Equal As Strings ${resp.status_code} 404
+ Should not contain ${resp.content} ${tunnel}
+
+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
+
+check-Tunnel-delete-on-ovs
+ [Arguments] ${connection-id} ${tunnel}
+ Log ${tunnel}
+ Switch Connection ${connection-id}
+ Log ${connection-id}
+ ${return} Execute Command sudo ovs-vsctl show
+ Log ${return}
+ Should Not Contain ${return} ${tunnel}
+ [Return] ${return}
+
+check interface status
+ [Arguments] ${tunnel} ${dpid}
+ ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/interface/${tunnel}/ headers=${ACCEPT_XML}
+ Log ${OPERATIONAL_API}/ietf-interfaces:interfaces-state/interface/${tunnel}/
+ Log ${resp.content}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should not contain ${resp.content} down
+ Should Contain ${resp.content} ${tunnel} up up
+ ${result-1} re.sub <.*?> , ${resp.content}
+ Log ${result-1}
+ ${lower_layer_if} Should Match Regexp ${result-1} openflow:${dpid}:[0-9]+
+ log ${lower_layer_if}
+ @{resp_array} Split String ${lower_layer_if} :
+ ${port-num} Get From List ${resp_array} 2
+ Log ${port-num}
+ [Return] ${lower_layer_if} ${port-num}
+
+Verify Data Base after Delete
+ [Arguments] ${Dpn_id_1} ${Dpn_id_2} ${tunnel-1} ${tunnel-2}
+ ${type} set variable odl-interface:tunnel-type-vxlan
+ No Content From URI session ${CONFIG_API}/itm-state:tunnel-list/internal-tunnel/${Dpn_id_1}/${Dpn_id_2}/${type}/ headers=${ACCEPT_XML}
+ No Content From URI session ${CONFIG_API}/itm-state:tunnel-list/internal-tunnel/${Dpn_id_2}/${Dpn_id_1}/${type}/ headers=${ACCEPT_XML}
+ No Content From URI session ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_1}/ headers=${ACCEPT_XML}
+ No Content From URI session ${CONFIG_API}/itm-state:dpn-endpoints/DPN-TEPs-info/${Dpn_id_2}/ headers=${ACCEPT_XML}
+ ${resp_7} RequestsLibrary.Get Request session ${CONFIG_API}/ietf-interfaces:interfaces/ headers=${ACCEPT_XML}
+ Run Keyword if '${resp_7.content}'=='404' Response is 404
+ Run Keyword if '${resp_7.content}'=='200' Response is 200
+ ${resp_8} Wait Until Keyword Succeeds 40 10 Get Network Topology without Tunnel ${CONFIG_TOPO_API} ${tunnel-1}
+ ... ${tunnel-2}
+ Log ${resp_8}
+ ${Ovs-del-1} Wait Until Keyword Succeeds 40 10 check-Tunnel-delete-on-ovs ${conn_id_1} ${tunnel-1}
+ Log ${Ovs-del-1}
+ ${Ovs-del-2} Wait Until Keyword Succeeds 40 10 check-Tunnel-delete-on-ovs ${conn_id_2} ${tunnel-2}
+ Log ${Ovs-del-2}
+ Log >>>>>>> Getting Network Topology Config without Tunnels<<<<<<<
+ ${url-2}= Set variable ${OPERATIONAL_API}/network-topology:network-topology/
+ Wait Until Keyword Succeeds 40 10 Get Network Topology without Tunnel ${url-2} ${tunnel-1} ${tunnel-2}
+ Wait Until Keyword Succeeds 40 10 Validate interface state Delete ${tunnel-1}
+ Wait Until Keyword Succeeds 40 10 Validate interface state Delete ${tunnel-2}