From 6d45e41ed14c1a1480f016c27c3bdf580b3a0ede Mon Sep 17 00:00:00 2001 From: Oleksandr Zharov Date: Wed, 3 Jan 2024 20:58:40 +0100 Subject: [PATCH] Remove remnants of sfc project Removed remnants of sfc project. JIRA: INTTEST-140 Change-Id: I2045d33434b890fb39dbc4491e1ee5c9ae95081b Signed-off-by: Oleksandr Zharov --- csit/libraries/SFC/DockerSfc.robot | 110 --------------------- csit/libraries/SFC/SfcKeywords.robot | 124 ------------------------ csit/libraries/SFC/SfcUtils.py | 34 ------- tools/distchanges/distcompare.py | 1 - tools/distchanges/tests/test_changes.py | 1 - 5 files changed, 270 deletions(-) delete mode 100644 csit/libraries/SFC/DockerSfc.robot delete mode 100644 csit/libraries/SFC/SfcKeywords.robot delete mode 100755 csit/libraries/SFC/SfcUtils.py diff --git a/csit/libraries/SFC/DockerSfc.robot b/csit/libraries/SFC/DockerSfc.robot deleted file mode 100644 index 59eb36d6cc..0000000000 --- a/csit/libraries/SFC/DockerSfc.robot +++ /dev/null @@ -1,110 +0,0 @@ -*** Settings *** -Library SSHLibrary - - -*** Variables *** -${INTEGRATION_BRIDGE} br-int - - -*** Keywords *** -Docker Ovs Start - [Documentation] Run the docker-ovs.sh script with specific input arguments. Run ./docker-ovs.sh --help for more info. - [Arguments] ${nodes} ${guests} ${tunnel} ${odl_ip} ${log_file}=myFile2.log - ${result} SSHLibrary.Execute Command - ... ./docker-ovs.sh spawn --nodes=${nodes} --guests=${guests} --tun=${tunnel} --odl=${odl_ip} > >(tee ${log_file}) 2> >(tee ${log_file}) - ... return_stderr=True - ... return_stdout=True - ... return_rc=True - log ${result} - Should be equal as integers ${result[2]} 0 - -Docker Ovs Clean - [Documentation] Run the docker-ovs.sh script with --clean option to clean up all containers deployment. Run ./docker-ovs.sh --help for more info. - [Arguments] ${log_file}=myFile3.log - ${result} SSHLibrary.Execute Command - ... ./docker-ovs.sh clean > >(tee ${log_file}) 2> >(tee ${log_file}) - ... return_stderr=True - ... return_stdout=True - ... return_rc=True - log ${result} - Should be equal as integers ${result[2]} 0 - -Get Docker Ids - [Documentation] Execute command docker ps and retrieve the existing containers ids - ${output} ${rc} SSHLibrary.Execute Command - ... sudo docker ps -q -a - ... return_stdout=True - ... return_stderr=False - ... return_rc=True - Should Be Equal As Numbers ${rc} 0 - RETURN ${output} - -Get Docker Ids Formatted - [Documentation] Execute command docker ps with --format argument and retrieve the existing containers names - [Arguments] ${format} - ${output} ${rc} SSHLibrary.Execute Command - ... sudo docker ps -a --format ${format} - ... return_stdout=True - ... return_stderr=False - ... return_rc=True - Should Be Equal As Numbers ${rc} 0 - RETURN ${output} - -Get Docker Names As List - [Documentation] Returns a list with the names of all running containers inside the tools system - ${docker_ps} DockerSfc.Get Docker Ids Formatted "{{.Names}}" -f status=running - ${docker_name_list} Split String ${docker_ps} \n - RETURN ${docker_name_list} - -Get Docker IP - [Documentation] Obtain the IP address from a given container - [Arguments] ${docker_name} - ${output} ${rc} SSHLibrary.Execute Command - ... sudo docker inspect -f '{{.NetworkSettings.IPAddress }}' ${docker_name} - ... return_stdout=True - ... return_stderr=False - ... return_rc=True - Should Be Equal As Numbers ${rc} 0 - RETURN ${output} - -Docker Exec - [Documentation] Execute a command into a docker container. - [Arguments] ${docker_name} ${command} ${return_contains}=${EMPTY} ${result_code}=0 - ${output} ${rc} SSHLibrary.Execute Command - ... sudo docker exec ${docker_name} ${command} - ... return_stdout=True - ... return_stderr=False - ... return_rc=True - IF '${return_contains}'!='${EMPTY}' - Should Contain ${output} ${return_contains} - END - Should Be Equal As Numbers ${rc} ${result_code} - RETURN ${output} - -Multiple Docker Exec - [Documentation] Execute a command in a list of dockers and return all the outputs in a list - [Arguments] ${docker_name_list} ${command} ${return_contains}=${EMPTY} ${result_code}=0 - @{list_output} Create List - FOR ${docker_id} IN @{docker_name_list} - ${exec_output} Docker Exec ${docker_id} ${command} ${return_contains} ${result_code} - Append To List ${list_output} ${exec_output} - END - RETURN ${list_output} - -Get Flows In Docker Containers - ${docker_list} DockerSfc.Get Docker Names As List - ${docker_flows} DockerSfc.Multiple Docker Exec - ... ${docker_list} - ... ovs-ofctl dump-flows -OOpenflow13 ${INTEGRATION_BRIDGE} - ... OFPST_FLOW - RETURN ${docker_flows} - -Get Docker Bridge Subnet - [Documentation] Obtain the subnet used by docker bridge using the docker inspect tool - ${output} ${rc} SSHLibrary.Execute Command - ... sudo docker network inspect bridge --format {{.IPAM.Config}} | grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}[\/][0-9]{1,2}" - ... return_stdout=True - ... return_stderr=False - ... return_rc=True - Should Be Equal As Numbers ${rc} 0 - RETURN ${output} diff --git a/csit/libraries/SFC/SfcKeywords.robot b/csit/libraries/SFC/SfcKeywords.robot deleted file mode 100644 index 30d483e929..0000000000 --- a/csit/libraries/SFC/SfcKeywords.robot +++ /dev/null @@ -1,124 +0,0 @@ -*** Settings *** -Documentation Common Keywords for the SFC Test suites. - -Library Collections -Resource ../CompareStream.robot -Resource ../Utils.robot - - -*** Keywords *** -Get JSON Elements From URI - [Arguments] ${uri} - ${resp} = RequestsLibrary.Get Request session ${uri} - RETURN ${resp.json()} - -Check Classifier Flows - ${flowList} = DockerSfc.Get Flows In Docker Containers - BuiltIn.log ${flowList} - ${expected_nsh_pop} = BuiltIn.Set_Variable *actions=decap(),decap(),* - ${expected_nsh_push} = BuiltIn.Set_Variable *actions=encap(nsh* - Collections.Should Contain Match ${flowList} ${expected_nsh_pop} - Collections.Should Contain Match ${flowList} ${expected_nsh_push} - -Check Service Function Types Added - [Documentation] Check that the service function types are updated with the service function names - [Arguments] ${elements} - Utils.Check For Elements At URI ${SERVICE_FUNCTION_TYPES_URI} ${elements} - -Check Service Function Types Removed - [Documentation] Check that the service function names are removed from the service function types - [Arguments] ${elements} - Utils.Check For Elements Not At URI ${SERVICE_FUNCTION_TYPES_URI} ${elements} - -Check Empty Service Function Paths State - [Documentation] Check that the service function paths state is empty after deleting SFPs - Utils.No Content From URI session ${SERVICE_FUNCTION_PATH_STATE_URI} - -Check Rendered Service Path Created - [Documentation] Check that the Rendered Service Path is created - [Arguments] ${sfp_name} - ${sfp_name_elements_list} = BuiltIn.Create List ${sfp_name} - Utils.Check For Elements At URI ${SERVICE_FUNCTION_PATHS_STATE_URI} ${sfp_name_elements_list} - -Check Rendered Service Path Deleted - [Documentation] Check that the Rendered Service Path is deleted - [Arguments] ${sfp_name} - Utils.No Content From URI session ${SERVICE_FUNCTION_PATH_STATE_URI}/${sfp_name} - -Get Rendered Service Path Name - [Documentation] Given an SFP name, do a get on ${SERVICE_FUNCTION_PATH_STATE_URI} to get the RSP name - [Arguments] ${sfp_name} ${get_reverse}=False - ${resp} = RequestsLibrary.Get Request session ${SERVICE_FUNCTION_PATH_STATE_URI}/${sfp_name} - BuiltIn.Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code} - # should be like this: {"service-function-path-state":[{"name":"SFC1-100","sfp-rendered-service-path":[{"name":"SFC1-100-Path-183"}]}]} - ${sfp_rendered_service_path_list} = Collections.Get_From_Dictionary - ... ${resp.json()} - ... service-function-path-state - ${sfp_rendered_service_path_dict} = Collections.Get_From_List ${sfp_rendered_service_path_list} 0 - ${sfp_state_list} = Collections.Get_From_Dictionary - ... ${sfp_rendered_service_path_dict} - ... sfp-rendered-service-path - ${list_length} = BuiltIn.Get Length ${sfp_state_list} - # The "sfp-rendered-service-path" will only have 1 or 2 entries, depending on chain symmetry config. - # The RSP name will be "-Path-" and the optional symmetric name will be -Path--Reverse" - ${value} = BuiltIn.Set Variable None - FOR ${i} IN RANGE ${list_length} - ${rsp_name_dict} = Collections.Get From List ${sfp_state_list} ${i} - ${name} = Collections.Get_From_Dictionary ${rsp_name_dict} name - @{matches} = String.Get Regexp Matches ${name} .*Reverse$ - ${matches_length} = BuiltIn.Get Length ${matches} - ${value} = BuiltIn.Set Variable If - ... "${get_reverse}" == "False" and 0 == ${matches_length} - ... ${name} - ... "${get_reverse}" == "True" and 0 < ${matches_length} - ... ${name} - ... "${value}" != "None" - ... ${value} - END - RETURN ${value} - -Create Sfp And Wait For Rsp Creation - [Documentation] Given an SFP name, create it and wait for the associated RSPs to be created - [Arguments] ${sfp_file_name} - Utils.Add Elements To URI From File And Verify ${SERVICE_FUNCTION_PATHS_URI} ${sfp_file_name} - ${sfp_dict} = Utils.Json Parse From File ${sfp_file_name} - ${sfps} = Collections.Get_From_Dictionary ${sfp_dict} service-function-paths - ${sfp_json_list} = Collections.Get_From_Dictionary ${sfps} service-function-path - ${list_length} = BuiltIn.Get Length ${sfp_json_list} - # Each SFP state entry returned from ODL will have either 2 or 3 name elements, 2 for non-symmetric 3 for symmetric RSP - FOR ${i} IN RANGE ${list_length} - ${sfp_entry_dict} = Collections.Get From List ${sfp_json_list} ${i} - ${sfp_name} = Collections.Get_From_Dictionary ${sfp_entry_dict} name - ${status} ${symmetric} = BuiltIn.Run Keyword And Ignore Error - ... Collections.Get_From_Dictionary - ... ${sfp_entry_dict} - ... symmetric - ${symmetric} = BuiltIn.Set Variable If "${status}" == "FAIL" False ${symmetric} - ${num_names} = BuiltIn.Set Variable If "${symmetric}" == "False" 2 3 - BuiltIn.Wait Until Keyword Succeeds - ... 60s - ... 2s - ... Utils.Check For Specific Number Of Elements At URI - ... ${SERVICE_FUNCTION_PATH_STATE_URI}/${sfp_name} - ... name - ... ${num_names} - END - -Delete Sfp And Wait For Rsps Deletion - [Documentation] Given an SFP name, delete it and wait for the associated SFP state and RSPs to be deleted - [Arguments] ${sfp_name} - Utils.Remove All Elements At URI And Verify ${SERVICE_FUNCTION_PATH_URI}/${sfp_name} - BuiltIn.Wait Until Keyword Succeeds 60s 2s Check Rendered Service Path Deleted ${sfp_name} - -Delete All Sfps And Wait For Rsps Deletion - [Documentation] Delete all SFPs and wait for the RSPs to be deleted - Utils.Remove All Elements At URI And Verify ${SERVICE_FUNCTION_PATHS_URI} - BuiltIn.Wait Until Keyword Succeeds 60s 2s Check Empty Service Function Paths State - -Switch Ips In Json Files - [Arguments] ${json_dir} ${container_names} - ${normalized_dir} = OperatingSystem.Normalize Path ${json_dir}/*.json - FOR ${cont_name} IN @{container_names} - ${cont_ip} = Get Docker IP ${cont_name} - OperatingSystem.Run sudo sed -i 's/${cont_name}/${cont_ip}/g' ${normalized_dir} - END diff --git a/csit/libraries/SFC/SfcUtils.py b/csit/libraries/SFC/SfcUtils.py deleted file mode 100755 index b671cff960..0000000000 --- a/csit/libraries/SFC/SfcUtils.py +++ /dev/null @@ -1,34 +0,0 @@ -import ipaddr - -__author__ = "Jose Luis Franco Arza" -__copyright__ = "Copyright(c) 2016, Ericsson." -__license__ = "New-style BSD" -__email__ = "jose.luis.franco.arza@ericsson.com" - - -def get_network_from_cidr(cidr): - """ - Returns the subnetwork part from a given subnet in CIDR format, - like 192.168.1.0/24. Returning 192.168.1.0. - """ - o = ipaddr.IPv4Network(cidr) - return str(o.network) - - -def get_mask_from_cidr(cidr): - """ - Returns a subnet mask from a given subnet in CIDR format, - like 192.168.1.0/24. Returning 255.255.255.0. - """ - o = ipaddr.IPv4Network(cidr) - return str(o.netmask) - - -def get_ip_address_first_octets(ip, n_octets): - """ - Given an IP address, this function returns the number - of octets determined as argument. If 4 are specified, then the output - is the whole IP - """ - - return ".".join(ip.split(".")[: int(n_octets)]) diff --git a/tools/distchanges/distcompare.py b/tools/distchanges/distcompare.py index 9171c22d43..8efbd17d0b 100644 --- a/tools/distchanges/distcompare.py +++ b/tools/distchanges/distcompare.py @@ -29,7 +29,6 @@ class DistCompare(object): "integration/distribution", "mdsal", "alto", - "sfc", "bier", "serviceutils", "usc", diff --git a/tools/distchanges/tests/test_changes.py b/tools/distchanges/tests/test_changes.py index 1667f8ec4e..21f45b7fbd 100644 --- a/tools/distchanges/tests/test_changes.py +++ b/tools/distchanges/tests/test_changes.py @@ -19,7 +19,6 @@ PROJECT_NAMES = [ "odlparent", "openflowplugin", "ovsdb", - "sfc", "yangtools", ] DISTRO_PATH = "/tmp/distribution-karaf" -- 2.36.6