Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
Library SSHLibrary timeout=10s
Library RequestsLibrary
-Variables ${CURDIR}/../../../variables/Variables.py
+Variables ${CURDIR}/../../../variables/Variables.robot
Resource ${CURDIR}/../../../libraries/SetupUtils.robot
Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
Resource ${CURDIR}/../../../libraries/RemoteBash.robot
Get Example Bgp Rib Owner
[Documentation] Find an odl node which is able to accept incomming connection. To this node netconf connector should be configured.
${rib_owner} ${rib_candidates}= BuiltIn.Wait_Until_Keyword_Succeeds 5x 2s ClusterManagement.Get_Owner_And_Successors_For_Device example-bgp-rib
- ... Bgpcep 1
+ ... org.opendaylight.mdsal.ServiceEntityType 1
BuiltIn.Set Suite variable ${rib_owner}
BuiltIn.Log ${ODL_SYSTEM_${rib_owner}_IP}
BuiltIn.Set Suite variable ${rib_candidates}
- ${session}= Resolve_Http_Session_For_Member member_index=${rib_owner}
+ ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${rib_owner}
BuiltIn.Set_Suite_Variable ${living_session} ${session}
BuiltIn.Set_Suite_Variable ${living_node} ${rib_owner}
[Documentation] Verifies exabgp's presence in operational ds.
BuiltIn.Wait_Until_Keyword_Succeeds 5x 2s Verify_Tools_Connection ${living_session}
-Stop_Current_Owner_Member
- [Documentation] Stopping karaf which is connected with exabgp.
+Kill_Current_Owner_Member
+ [Documentation] Killing karaf which is connected with exabgp.
Kill_Single_Member ${rib_owner}
BuiltIn.Set Suite variable ${old_rib_owner} ${rib_owner}
BuiltIn.Set Suite variable ${old_rib_candidates} ${rib_candidates}
${idx}= Collections.Get From List ${old_rib_candidates} 0
- ${session}= Resolve_Http_Session_For_Member member_index=${idx}
+ ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${idx}
BuiltIn.Set_Suite_Variable ${living_session} ${session}
BuiltIn.Set_Suite_Variable ${living_node} ${idx}
Verify_New_Rib_Owner_Elected
[Arguments] ${old_owner} ${node_to_ask}
[Documentation] Verifies new owner was elected
- ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device example-bgp-rib Bgpcep ${node_to_ask}
+ ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device example-bgp-rib org.opendaylight.mdsal.ServiceEntityType ${node_to_ask}
BuiltIn.Should_Not_Be_Equal ${old_owner} ${owner}
Verify_New_Rib_Candidate_Present
[Arguments] ${candidate} ${node_to_ask}
[Documentation] Verifies candidate's presence.
- ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device example-bgp-rib Bgpcep ${node_to_ask}
+ ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device example-bgp-rib org.opendaylight.mdsal.ServiceEntityType ${node_to_ask}
BuiltIn.Should_Contain ${candidates} ${candidate}
Verify_Tools_Connection
--- /dev/null
+*** Settings ***
+Documentation BGP functional HA testing with one exabgp peer.
+...
+... Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+...
+... This program and the accompanying materials are made available under the
+... terms of the Eclipse Public License v1.0 which accompanies this distribution,
+... and is available at http://www.eclipse.org/legal/epl-v10.html
+...
+... This suite uses exabgp. It is configured to have 3 peers (all 3 nodes of odl).
+... Bgp implemented with singleton accepts only one incomming conection. Exabgp
+... logs will show that one peer will be connected and two will fail.
+... After stopping karaf which owned connection new owner should be elected and
+... this new owner should accept incomming bgp connection.
+Suite Setup Setup_Everything
+Suite Teardown Teardown_Everything
+Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
+Library SSHLibrary timeout=10s
+Library RequestsLibrary
+Variables ${CURDIR}/../../../variables/Variables.robot
+Resource ${CURDIR}/../../../libraries/SetupUtils.robot
+Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
+Resource ${CURDIR}/../../../libraries/RemoteBash.robot
+Resource ${CURDIR}/../../../libraries/SSHKeywords.robot
+Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
+
+*** Variables ***
+${BGP_VAR_FOLDER} ${CURDIR}/../../../variables/bgpclustering
+${BGP_PEER_FOLDER} ${CURDIR}/../../../variables/bgpclustering/bgp_peer_openconf
+${DEFAUTL_EXA_CFG} exa.cfg
+${EXA_CMD} env exabgp.tcp.port=1790 exabgp
+${PEER_CHECK_URL} /restconf/operational/bgp-rib:bgp-rib/rib/example-bgp-rib/peer/bgp:%2F%2F
+${HOLDTIME} 180
+${RIB_INSTANCE} example-bgp-rib
+
+*** Test Cases ***
+Get Example Bgp Rib Owner
+ [Documentation] Find an odl node which is able to accept incomming connection. To this node netconf connector should be configured.
+ ${rib_owner} ${rib_candidates}= BuiltIn.Wait_Until_Keyword_Succeeds 5x 2s ClusterManagement.Get_Owner_And_Successors_For_Device example-bgp-rib
+ ... org.opendaylight.mdsal.ServiceEntityType 1
+ BuiltIn.Set Suite variable ${rib_owner}
+ BuiltIn.Log ${ODL_SYSTEM_${rib_owner}_IP}
+ BuiltIn.Set Suite variable ${rib_candidates}
+ ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${rib_owner}
+ BuiltIn.Set_Suite_Variable ${living_session} ${session}
+ BuiltIn.Set_Suite_Variable ${living_node} ${rib_owner}
+
+Reconfigure_ODL_To_Accept_Connection
+ [Documentation] Configure BGP peer module with initiate-connection set to false.
+ [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+ &{mapping} Create Dictionary IP=${TOOLS_SYSTEM_IP} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
+ TemplatedRequests.Put_As_Xml_Templated ${BGP_PEER_FOLDER} mapping=${mapping} session=${living_session} http_timeout=5
+ [Teardown] SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
+
+Start_ExaBgp_Peer
+ [Documentation] Starts exabgp
+ Start_Tool ${DEFAUTL_EXA_CFG}
+
+Verify ExaBgp Connected
+ [Documentation] Verifies exabgp's presence in operational ds.
+ BuiltIn.Wait_Until_Keyword_Succeeds 5x 2s Verify_Tools_Connection ${living_session}
+
+Stop_Current_Owner_Member
+ [Documentation] Stopping karaf which is connected with exabgp.
+ Kill_Single_Member ${rib_owner}
+ BuiltIn.Set Suite variable ${old_rib_owner} ${rib_owner}
+ BuiltIn.Set Suite variable ${old_rib_candidates} ${rib_candidates}
+ ${idx}= Collections.Get From List ${old_rib_candidates} 0
+ ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${idx}
+ BuiltIn.Set_Suite_Variable ${living_session} ${session}
+ BuiltIn.Set_Suite_Variable ${living_node} ${idx}
+
+Verify_New_Rib_Owner
+ [Documentation] Verifies if new owner of example-bgp-rib is elected.
+ BuiltIn.Wait_Until_Keyword_Succeeds 5x 2s Verify_New_Rib_Owner_Elected ${old_rib_owner} ${living_node}
+
+Verify_ExaBgp_Reconnected
+ [Documentation] Verifies exabgp's presence in operational ds.
+ BuiltIn.Wait_Until_Keyword_Succeeds 5x 2s Verify_Tools_Connection ${living_session}
+
+Start_Stopped_Member
+ [Documentation] Starting stopped node
+ Start_Single_Member ${old_rib_owner}
+
+Verify_New_Candidate
+ [Documentation] Verifies started node become candidate for example-bgp-rib
+ BuiltIn.Wait_Until_Keyword_Succeeds 10x 5s Verify_New_Rib_Candidate_Present ${old_rib_owner} ${living_node}
+
+Verify ExaBgp Still Connected
+ [Documentation] Verifies exabgp's presence in operational ds
+ BuiltIn.Wait_Until_Keyword_Succeeds 5x 2s Verify_Tools_Connection ${living_session}
+
+Stop_ExaBgp_Peer
+ [Documentation] Stops exabgp
+ Stop_Tool
+
+Delete_Bgp_Peer_Configuration
+ [Documentation] Revert the BGP configuration to the original state: without any configured peers
+ &{mapping} Create Dictionary BGP_RIB_OPENCONFIG=${RIB_INSTANCE} IP=${TOOLS_SYSTEM_IP}
+ TemplatedRequests.Delete_Templated ${BGP_PEER_FOLDER} mapping=${mapping} session=${living_session} http_timeout=5
+
+*** Keywords ***
+Setup_Everything
+ [Documentation] Initial setup
+ SetupUtils.Setup_Utils_For_Setup_And_Teardown
+ ClusterManagement.ClusterManagement_Setup
+ ${tools_system_conn_id}= SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP} prompt=${DEFAULT_LINUX_PROMPT} timeout=6s
+ Builtin.Set_Suite_Variable ${tools_system_conn_id}
+ SSHKeywords.Flexible_Mininet_Login ${TOOLS_SYSTEM_USER}
+ SSHKeywords.Virtual_Env_Create
+ SSHKeywords.Virtual_Env_Install_Package exabgp==3.4.16
+ Upload_Config_Files
+
+Teardown_Everything
+ [Documentation] Suite cleanup
+ SSHKeywords.Virtual_Env_Delete
+ RequestsLibrary.Delete_All_Sessions
+ SSHLibrary.Close_All_Connections
+
+Start_Tool
+ [Arguments] ${cfg_file} ${mapping}={}
+ [Documentation] Starts the tool
+ ${start_cmd} BuiltIn.Set_Variable ${EXA_CMD} ${cfg_file}
+ BuiltIn.Log ${start_cmd}
+ SSHKeywords.Virtual_Env_Activate_On_Current_Session log_output=${True}
+ ${output}= SSHLibrary.Write ${start_cmd}
+ BuiltIn.Log ${output}
+
+Stop_Tool
+ [Documentation] Stops the tool by sending ctrl+c
+ ${output}= SSHLibrary.Read
+ BuiltIn.Log ${output}
+ RemoteBash.Write_Bare_Ctrl_C
+ ${output}= SSHLibrary.Read_Until_Prompt
+ BuiltIn.Log ${output}
+ SSHKeywords.Virtual_Env_Deactivate_On_Current_Session log_output=${True}
+
+Upload_Config_Files
+ [Documentation] Uploads exabgp config files.
+ SSHLibrary.Put_File ${BGP_VAR_FOLDER}/${DEFAUTL_EXA_CFG} .
+ @{cfgfiles}= SSHLibrary.List_Files_In_Directory . *.cfg
+ : FOR ${cfgfile} IN @{cfgfiles}
+ \ SSHLibrary.Execute_Command sed -i -e 's/EXABGPIP/${TOOLS_SYSTEM_IP}/g' ${cfgfile}
+ \ SSHLibrary.Execute_Command sed -i -e 's/ODLIP1/${ODL_SYSTEM_1_IP}/g' ${cfgfile}
+ \ SSHLibrary.Execute_Command sed -i -e 's/ODLIP2/${ODL_SYSTEM_2_IP}/g' ${cfgfile}
+ \ SSHLibrary.Execute_Command sed -i -e 's/ODLIP3/${ODL_SYSTEM_3_IP}/g' ${cfgfile}
+ \ SSHLibrary.Execute_Command sed -i -e 's/ROUTEREFRESH/disable/g' ${cfgfile}
+ \ SSHLibrary.Execute_Command sed -i -e 's/ADDPATH/disable/g' ${cfgfile}
+ \ ${stdout}= SSHLibrary.Execute_Command cat ${cfgfile}
+ \ Log ${stdout}
+
+Verify_New_Rib_Owner_Elected
+ [Arguments] ${old_owner} ${node_to_ask}
+ [Documentation] Verifies new owner was elected
+ ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device example-bgp-rib org.opendaylight.mdsal.ServiceEntityType ${node_to_ask}
+ BuiltIn.Should_Not_Be_Equal ${old_owner} ${owner}
+
+Verify_New_Rib_Candidate_Present
+ [Arguments] ${candidate} ${node_to_ask}
+ [Documentation] Verifies candidate's presence.
+ ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device example-bgp-rib org.opendaylight.mdsal.ServiceEntityType ${node_to_ask}
+ BuiltIn.Should_Contain ${candidates} ${candidate}
+
+Verify_Tools_Connection
+ [Arguments] ${session} ${connected}=${True}
+ [Documentation] Checks peer presence in operational datastore
+ ${exp_status_code}= BuiltIn.Set_Variable_If ${connected} ${200} ${404}
+ ${rsp}= RequestsLibrary.Get Request ${session} ${PEER_CHECK_URL}${TOOLS_SYSTEM_IP}
+ BuiltIn.Log ${rsp.content}
+ BuiltIn.Should_Be_Equal_As_Numbers ${exp_status_code} ${rsp.status_code}
Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
Library SSHLibrary timeout=10s
-Library RequestsLibrary
Library Collections
Library OperatingSystem
Resource ../../../variables/Variables.robot
Resource ../../../libraries/SetupUtils.robot
Resource ../../../libraries/ClusterManagement.robot
Resource ../../../libraries/RemoteBash.robot
-Resource ../../../libraries/SSHKeywords.robot
Resource ../../../libraries/TemplatedRequests.robot
Resource ../../../libraries/NexusKeywords.robot
[Documentation] Verifies if example-bmp-monitor reported expected data
Verify_Data_Reported
-Stop_Current_Owner_Member
+Kill_Current_Owner_Member
[Documentation] Killing cluster node which is connected with bmp mock.
ClusterManagement.Kill_Single_Member ${bm_owner}
BuiltIn.Set Suite variable ${old_bm_owner} ${bm_owner}
Setup_Everything
[Documentation] Initial setup
SetupUtils.Setup_Utils_For_Setup_And_Teardown
- ${odl1} = SSHKeywords.Open_Connection_To_ODL_System ip_address=${ODL_SYSTEM_1_IP}
- SSHLibrary.Put_File ${CURDIR}/../../../../tools/deployment/search.sh
- SSHLibrary.Close_Connection
- ${odl2} = SSHKeywords.Open_Connection_To_ODL_System ip_address=${ODL_SYSTEM_2_IP}
- SSHLibrary.Put_File ${CURDIR}/../../../../tools/deployment/search.sh
- SSHLibrary.Close_Connection
- ${odl3} = SSHKeywords.Open_Connection_To_ODL_System ip_address=${ODL_SYSTEM_3_IP}
- SSHLibrary.Put_File ${CURDIR}/../../../../tools/deployment/search.sh
- SSHLibrary.Close_Connection
ClusterManagement.ClusterManagement_Setup
- SSHKeywords.Open_Connection_To_Tools_System
+ NexusKeywords.Initialize_Artifact_Deployment_And_Usage
+ #ClusterManagement.Cluster_Setup_For_Artifact_Deployment_And_Usage
${name}= NexusKeywords.Deploy_Test_Tool bgpcep bgp-bmp-mock
BuiltIn.Set_Suite_Variable ${filename} ${name}
Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
Library SSHLibrary timeout=10s
-Library RequestsLibrary
Library Collections
Library OperatingSystem
Resource ../../../variables/Variables.robot
Resource ../../../libraries/SetupUtils.robot
Resource ../../../libraries/ClusterManagement.robot
Resource ../../../libraries/RemoteBash.robot
-Resource ../../../libraries/SSHKeywords.robot
Resource ../../../libraries/TemplatedRequests.robot
Resource ../../../libraries/NexusKeywords.robot
Setup_Everything
[Documentation] Initial setup
SetupUtils.Setup_Utils_For_Setup_And_Teardown
- ${odl1} = SSHKeywords.Open_Connection_To_ODL_System ip_address=${ODL_SYSTEM_1_IP}
- SSHLibrary.Put_File ${CURDIR}/../../../../tools/deployment/search.sh
- SSHLibrary.Close_Connection
- ${odl2} = SSHKeywords.Open_Connection_To_ODL_System ip_address=${ODL_SYSTEM_2_IP}
- SSHLibrary.Put_File ${CURDIR}/../../../../tools/deployment/search.sh
- SSHLibrary.Close_Connection
- ${odl3} = SSHKeywords.Open_Connection_To_ODL_System ip_address=${ODL_SYSTEM_3_IP}
- SSHLibrary.Put_File ${CURDIR}/../../../../tools/deployment/search.sh
- SSHLibrary.Close_Connection
ClusterManagement.ClusterManagement_Setup
- SSHKeywords.Open_Connection_To_Tools_System
+ NexusKeywords.Initialize_Artifact_Deployment_And_Usage
+ #ClusterManagement.Cluster_Setup_For_Artifact_Deployment_And_Usage
${name}= NexusKeywords.Deploy_Test_Tool bgpcep bgp-bmp-mock
BuiltIn.Set_Suite_Variable ${filename} ${name}
--- /dev/null
+*** Settings ***
+Documentation PCEP functional HA testing with one pcep peer.
+...
+... Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+...
+... This program and the accompanying materials are made available under the
+... terms of the Eclipse Public License v1.0 which accompanies this distbmution,
+... and is available at http://www.eclipse.org/legal/epl-v10.html
+...
+... This suite uses PCC mock. It is configured to have 3 peers (all 3 nodes of odl).
+... PCEP implemented with singleton accepts only one incomming conection. PCC mock
+... logs will show that one peer will be connected and two will fail.
+... After killing karaf which owned connection new owner should be elected and
+... this new owner should accept incomming PCC connection.
+Suite Setup Setup_Everything
+Suite Teardown Teardown_Everything
+Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
+Library SSHLibrary timeout=10s
+Library Collections
+Library OperatingSystem
+Resource ../../../variables/Variables.robot
+Resource ../../../libraries/SetupUtils.robot
+Resource ../../../libraries/ClusterManagement.robot
+Resource ../../../libraries/RemoteBash.robot
+Resource ../../../libraries/TemplatedRequests.robot
+Resource ../../../libraries/NexusKeywords.robot
+
+*** Variables ***
+${HOLDTIME} 180
+${DIR_WITH_TEMPLATES} ${CURDIR}/../../../variables/bgpclustering/
+
+*** Test Cases ***
+Get_Example_Pcep_Owner
+ [Documentation] Find an odl node which is able to accept incomming connection. To this node netconf connector should be configured.
+ ${pcep_owner} ${pcep_candidates}= Wait_Until_Keyword_Succeeds 5x 2s ClusterManagement.Get_Owner_And_Successors_For_device pcep-topology
+ ... Bgpcep 1
+ BuiltIn.Set Suite variable ${pcep_owner}
+ BuiltIn.Log ${pcep_owner}
+ BuiltIn.Set Suite variable ${pcep_candidates}
+ ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${pcep_owner}
+ BuiltIn.Set_Suite_Variable ${living_session} ${session}
+ BuiltIn.Log ${living_session}
+ BuiltIn.Set_Suite_Variable ${living_node} ${pcep_owner}
+
+Verify_Data_Reported_1
+ [Documentation] Verifies if pcep-topology reported expected data
+ ... Expects pcep-topology not be empty/filled path-computation.
+ Verify_Data_Reported
+
+Kill_Current_Owner_Member
+ [Documentation] Killing cluster node which is connected with pcc-mock.
+ ClusterManagement.Kill_Single_Member ${pcep_owner}
+ BuiltIn.Set Suite variable ${old_pcep_owner} ${pcep_owner}
+ BuiltIn.Set Suite variable ${old_pcep_candidates} ${pcep_candidates}
+ ${idx}= Collections.Get From List ${old_pcep_candidates} 0
+ ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${idx}
+ BuiltIn.Set_Suite_Variable ${living_session} ${session}
+ BuiltIn.Set_Suite_Variable ${living_node} ${idx}
+
+Verify_New_Pcep_Owner
+ [Documentation] Verifies if new owner of pcep-topology is elected.
+ BuiltIn.Wait_Until_Keyword_Succeeds 10x 5s Verify_New_Pcep_Owner_Elected ${old_pcep_owner} ${living_node}
+
+Verify_Data_Reported_2
+ [Documentation] Verifies if pcep-topology reports expected data
+ ... Expects pcep-topology not be empty/filled path-computation.
+ Verify_Data_Reported
+
+Start_Stopped_Member
+ [Documentation] Starting stopped node
+ ClusterManagement.Start_Single_Member ${old_pcep_owner}
+
+Verify_New_Candidate
+ [Documentation] Verifies started node become candidate for pcep_topology
+ BuiltIn.Wait_Until_Keyword_Succeeds 10x 5s Verify_New_Pcep_Candidate_Present ${old_pcep_owner} ${living_node}
+
+Verify_Data_Reported_3
+ [Documentation] Verifies if pcep-topology reported expected data
+ ... Expects pcep-topology not be empty/filled path-computation.
+ Verify_Data_Reported
+
+Stop_Pcc_Mock
+ [Documentation] Send ctrl+c to pcc-mock to stop it.
+ RemoteBash.Write_Bare_Ctrl_C
+ ${output}= SSHLibrary.Read_Until_Prompt
+ BuiltIn.Log ${output}
+
+*** Keywords ***
+Setup_Everything
+ [Documentation] Initial setup
+ SetupUtils.Setup_Utils_For_Setup_And_Teardown
+ ClusterManagement.ClusterManagement_Setup
+ NexusKeywords.Initialize_Artifact_Deployment_And_Usage
+ ${name}= NexusKeywords.Deploy_Test_Tool bgpcep pcep-pcc-mock
+ BuiltIn.Set_Suite_Variable ${filename} ${name}
+ #Setting Pcc Name and its code for mapping for templates
+ BuiltIn.Set_Suite_Variable ${pcc_name} pcc_${TOOLS_SYSTEM_IP}_tunnel_1
+ ${code}= Evaluate binascii.b2a_base64('${pcc_name}')[:-1] modules=binascii
+ BuiltIn.Set_Suite_Variable ${pcc_name_code} ${code}
+ Start_Pcc_Mock
+
+Teardown_Everything
+ [Documentation] Suite cleanup
+ SSHLibrary.Get_File pccmock.log
+ ${cnt}= OperatingSystem.Get_File pccmock.log
+ Log ${cnt}
+ RequestsLibrary.Delete_All_Sessions
+ SSHLibrary.Close_All_Connections
+
+Start_Pcc_Mock
+ [Documentation] Starts pcc mock
+ ${command}= NexusKeywords.Compose_Full_Java_Command -jar ${filename} --reconnect 1 --local-address ${TOOLS_SYSTEM_IP} --remote-address ${ODL_SYSTEM_1_IP}:4189,${ODL_SYSTEM_2_IP}:4189,${ODL_SYSTEM_3_IP}:4189 --log-level INFO 2>&1 | tee pccmock.log
+ BuiltIn.Log ${command}
+ SSHLibrary.Set_Client_Configuration timeout=30s
+ SSHLibrary.Write ${command}
+ ${output}= SSHLibrary.Read_Until started
+ BuiltIn.Log ${output}
+
+Verify_Data_Reported
+ [Documentation] Verifies if the tool reported expected data
+ &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP} CODE=${pcc_name_code} NAME=${pcc_name} IP_ODL=${ODL_SYSTEM_${pcep_owner}_IP}
+ BuiltIn.Wait_Until_Keyword_Succeeds 10x 5s TemplatedRequests.Get_As_Json_Templated ${DIR_WITH_TEMPLATES}${/}pcep_on_state ${mapping} ${living_session}
+ ... verify=True
+
+Verify_New_Pcep_Owner_Elected
+ [Arguments] ${old_owner} ${node_to_ask}
+ [Documentation] Verifies new owner was elected
+ ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device pcep-topology Bgpcep ${node_to_ask}
+ BuiltIn.Should_Not_Be_Equal ${old_owner} ${owner}
+ BuiltIn.Set_Suite_Variable ${pcep_owner} ${owner}
+
+Verify_New_Pcep_Candidate_Present
+ [Arguments] ${candidate} ${node_to_ask}
+ [Documentation] Verifies candidate's presence.
+ ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device pcep-topology Bgpcep ${node_to_ask}
+ Collections.Append_To_List ${candidates} ${owner}
+ BuiltIn.Should_Contain ${candidates} ${candidate}
+ BuiltIn.Set_Suite_Variable ${pcep_owner} ${owner}
--- /dev/null
+*** Settings ***
+Documentation PCEP functional HA testing with one pcep peer.
+...
+... Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+...
+... This program and the accompanying materials are made available under the
+... terms of the Eclipse Public License v1.0 which accompanies this distbmution,
+... and is available at http://www.eclipse.org/legal/epl-v10.html
+...
+... This suite uses PCC mock. It is configured to have 3 peers (all 3 nodes of odl).
+... PCEP implemented with singleton accepts only one incomming conection. PCC mock
+... logs will show that one peer will be connected and two will fail.
+... After stopping karaf which owned connection new owner should be elected and
+... this new owner should accept incomming PCC connection.
+Suite Setup Setup_Everything
+Suite Teardown Teardown_Everything
+Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
+Library SSHLibrary timeout=10s
+Library Collections
+Library OperatingSystem
+Resource ../../../variables/Variables.robot
+Resource ../../../libraries/SetupUtils.robot
+Resource ../../../libraries/ClusterManagement.robot
+Resource ../../../libraries/RemoteBash.robot
+Resource ../../../libraries/TemplatedRequests.robot
+Resource ../../../libraries/NexusKeywords.robot
+
+*** Variables ***
+${HOLDTIME} 180
+${DIR_WITH_TEMPLATES} ${CURDIR}/../../../variables/bgpclustering/
+
+*** Test Cases ***
+Get_Example_Pcep_Owner
+ [Documentation] Find an odl node which is able to accept incomming connection. To this node netconf connector should be configured.
+ ${pcep_owner} ${pcep_candidates}= Wait_Until_Keyword_Succeeds 5x 2s ClusterManagement.Get_Owner_And_Successors_For_device pcep-topology
+ ... Bgpcep 1
+ BuiltIn.Set Suite variable ${pcep_owner}
+ BuiltIn.Log ${pcep_owner}
+ BuiltIn.Set Suite variable ${pcep_candidates}
+ ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${pcep_owner}
+ BuiltIn.Set_Suite_Variable ${living_session} ${session}
+ BuiltIn.Log ${living_session}
+ BuiltIn.Set_Suite_Variable ${living_node} ${pcep_owner}
+
+Verify_Data_Reported_1
+ [Documentation] Verifies if pcep-topology reported expected data
+ ... Expects pcep-topology not be empty/filled path-computation.
+ Verify_Data_Reported
+
+Stop_Current_Owner_Member
+ [Documentation] Stopping cluster node which is connected with pcc-mock.
+ ClusterManagement.Stop_Single_Member ${pcep_owner}
+ BuiltIn.Set Suite variable ${old_pcep_owner} ${pcep_owner}
+ BuiltIn.Set Suite variable ${old_pcep_candidates} ${pcep_candidates}
+ ${idx}= Collections.Get From List ${old_pcep_candidates} 0
+ ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${idx}
+ BuiltIn.Set_Suite_Variable ${living_session} ${session}
+ BuiltIn.Set_Suite_Variable ${living_node} ${idx}
+
+Verify_New_Pcep_Owner
+ [Documentation] Verifies if new owner of pcep-topology is elected.
+ BuiltIn.Wait_Until_Keyword_Succeeds 10x 5s Verify_New_Pcep_Owner_Elected ${old_pcep_owner} ${living_node}
+
+Verify_Data_Reported_2
+ [Documentation] Verifies if pcep-topology reports expected data
+ ... Expects pcep-topology not be empty/filled path-computation.
+ Verify_Data_Reported
+
+Start_Stopped_Member
+ [Documentation] Starting stopped node
+ ClusterManagement.Start_Single_Member ${old_pcep_owner}
+
+Verify_New_Candidate
+ [Documentation] Verifies started node become candidate for pcep_topology
+ BuiltIn.Wait_Until_Keyword_Succeeds 10x 5s Verify_New_Pcep_Candidate_Present ${old_pcep_owner} ${living_node}
+
+Verify_Data_Reported_3
+ [Documentation] Verifies if pcep-topology reported expected data
+ ... Expects pcep-topology not be empty/filled path-computation.
+ Verify_Data_Reported
+
+Stop_Pcc_Mock
+ [Documentation] Send ctrl+c to pcc-mock to stop it.
+ RemoteBash.Write_Bare_Ctrl_C
+ ${output}= SSHLibrary.Read_Until_Prompt
+ BuiltIn.Log ${output}
+
+*** Keywords ***
+Setup_Everything
+ [Documentation] Initial setup
+ SetupUtils.Setup_Utils_For_Setup_And_Teardown
+ ClusterManagement.ClusterManagement_Setup
+ NexusKeywords.Initialize_Artifact_Deployment_And_Usage
+ ${name}= NexusKeywords.Deploy_Test_Tool bgpcep pcep-pcc-mock
+ BuiltIn.Set_Suite_Variable ${filename} ${name}
+ #Setting Pcc Name and its code for mapping for templates
+ BuiltIn.Set_Suite_Variable ${pcc_name} pcc_${TOOLS_SYSTEM_IP}_tunnel_1
+ ${code}= Evaluate binascii.b2a_base64('${pcc_name}')[:-1] modules=binascii
+ BuiltIn.Set_Suite_Variable ${pcc_name_code} ${code}
+ Start_Pcc_Mock
+
+Teardown_Everything
+ [Documentation] Suite cleanup
+ SSHLibrary.Get_File pccmock.log
+ ${cnt}= OperatingSystem.Get_File pccmock.log
+ Log ${cnt}
+ RequestsLibrary.Delete_All_Sessions
+ SSHLibrary.Close_All_Connections
+
+Start_Pcc_Mock
+ [Documentation] Starts pcc mock
+ ${command}= NexusKeywords.Compose_Full_Java_Command -jar ${filename} --reconnect 5 --local-address ${TOOLS_SYSTEM_IP} --remote-address ${ODL_SYSTEM_1_IP}:4189,${ODL_SYSTEM_2_IP}:4189,${ODL_SYSTEM_3_IP}:4189 --log-level INFO 2>&1 | tee pccmock.log
+ BuiltIn.Log ${command}
+ SSHLibrary.Set_Client_Configuration timeout=30s
+ SSHLibrary.Write ${command}
+ ${output}= SSHLibrary.Read_Until started
+ BuiltIn.Log ${output}
+
+Verify_Data_Reported
+ [Documentation] Verifies if the tool reported expected data
+ &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP} CODE=${pcc_name_code} NAME=${pcc_name} IP_ODL=${ODL_SYSTEM_${pcep_owner}_IP}
+ BuiltIn.Wait_Until_Keyword_Succeeds 10x 5s TemplatedRequests.Get_As_Json_Templated ${DIR_WITH_TEMPLATES}${/}pcep_on_state ${mapping} ${living_session}
+ ... verify=True
+
+Verify_New_Pcep_Owner_Elected
+ [Arguments] ${old_owner} ${node_to_ask}
+ [Documentation] Verifies new owner was elected
+ ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device pcep-topology Bgpcep ${node_to_ask}
+ BuiltIn.Should_Not_Be_Equal ${old_owner} ${owner}
+ BuiltIn.Set_Suite_Variable ${pcep_owner} ${owner}
+
+Verify_New_Pcep_Candidate_Present
+ [Arguments] ${candidate} ${node_to_ask}
+ [Documentation] Verifies candidate's presence.
+ ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device pcep-topology Bgpcep ${node_to_ask}
+ Collections.Append_To_List ${candidates} ${owner}
+ BuiltIn.Should_Contain ${candidates} ${candidate}
+ BuiltIn.Set_Suite_Variable ${pcep_owner} ${owner}
# Place the suites in run order:
integration/test/csit/suites/bgpcep/bgpclustering/060_bmp_ha_karaf_restart.robot
integration/test/csit/suites/bgpcep/bgpclustering/070_bmp_ha_karaf_stop.robot
+integration/test/csit/suites/bgpcep/bgpclustering/080_pcep_ha_karaf_restart.robot
+integration/test/csit/suites/bgpcep/bgpclustering/090_pcep_ha_karaf_stop.robot
integration/test/csit/suites/bgpcep/bgpclustering/040_bgp_ha_karaf_restart.robot
+integration/test/csit/suites/bgpcep/bgpclustering/050_bgp_ha_karaf_stop.robot
# Place the suites in run order:
integration/test/csit/suites/bgpcep/bgpclustering/040_bgp_ha_karaf_restart.robot
+integration/test/csit/suites/bgpcep/bgpclustering/050_bgp_ha_karaf_stop.robot
--- /dev/null
+{
+ "topology": [
+ {
+ "node": [
+ {
+ "network-pcep-topology-stats:pcep-session-state": {
+ "delegated-lsps-count": "*",
+ "local-pref": {
+ "deadtimer": 120,
+ "ip-address": "$IP_ODL",
+ "keepalive": 30,
+ "session-id": "*"
+ },
+ "messages": {
+ "error-messages": {
+ "last-received-error": {},
+ "last-sent-error": {},
+ "received-error-msg-count": 0,
+ "sent-error-msg-count": 0
+ },
+ "last-sent-msg-timestamp": "*",
+ "odl-pcep-stateful-stats:last-received-rpt-msg-timestamp": "*",
+ "odl-pcep-stateful-stats:received-rpt-msg-count": 2,
+ "odl-pcep-stateful-stats:sent-init-msg-count": 0,
+ "odl-pcep-stateful-stats:sent-upd-msg-count": 0,
+ "received-msg-count": "*",
+ "reply-time": {
+ "average-time": 0,
+ "max-time": 0,
+ "min-time": 0
+ },
+ "sent-msg-count": "*",
+ "unknown-msg-received": 0
+ },
+ "peer-capabilities": {
+ "odl-pcep-stateful-stats:active": true,
+ "odl-pcep-stateful-stats:instantiation": true,
+ "odl-pcep-stateful-stats:stateful": true
+ },
+ "peer-pref": {
+ "deadtimer": 120,
+ "ip-address": "$IP",
+ "keepalive": 30,
+ "session-id": "*"
+ },
+ "session-duration": "*",
+ "synchronized": true
+ },
+ "network-topology-pcep:path-computation-client": {
+ "ip-address": "$IP",
+ "reported-lsp": [
+ {
+ "name": "$NAME",
+ "path": [
+ {
+ "ero": {
+ "ignore": false,
+ "processing-rule": false,
+ "subobject": [
+ {
+ "ip-prefix": {
+ "ip-prefix": "1.1.1.1/32"
+ },
+ "loose": false
+ }
+ ]
+ },
+ "lsp-id": 1,
+ "odl-pcep-ietf-stateful07:lsp": {
+ "administrative": true,
+ "delegate": "*",
+ "ignore": false,
+ "odl-pcep-ietf-initiated00:create": false,
+ "operational": "up",
+ "plsp-id": 1,
+ "processing-rule": false,
+ "remove": false,
+ "sync": true,
+ "tlvs": {
+ "lsp-identifiers": {
+ "ipv4": {
+ "ipv4-extended-tunnel-id": "$IP",
+ "ipv4-tunnel-endpoint-address": "1.1.1.1",
+ "ipv4-tunnel-sender-address": "$IP"
+ },
+ "lsp-id": 1,
+ "tunnel-id": 1
+ },
+ "symbolic-path-name": {
+ "path-name": "$CODE"
+ }
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "state-sync": "synchronized",
+ "stateful-tlv": {
+ "odl-pcep-ietf-stateful07:stateful": {
+ "lsp-update-capability": true,
+ "odl-pcep-ietf-initiated00:initiation": true
+ }
+ }
+ },
+ "node-id": "pcc://$IP"
+ }
+ ],
+ "topology-id": "pcep-topology",
+ "topology-types": {
+ "network-topology-pcep:topology-pcep": {}
+ }
+ }
+ ]
+}
--- /dev/null
+restconf/operational/network-topology:network-topology/topology/pcep-topology
--- /dev/null
+odl-pcep-stateful-stats:last-received-rpt-msg-timestamp
+session-duration
+session-id
+delegated-lsps-count
+received-msg-count
+sent-msg-count
+delegate
+last-sent-msg-timestamp
--- /dev/null
+restconf/operational/network-topology:network-topology/topology/pcep-topology