Add regex pattern case_insensitive param and underscore
Changes:
- Add "_" underscore in regex expression
- Add case_insensitive param to regex filtering inventory matches
Example:
"/xyz/openbmc_project/inventory/system/chassis/motherboard/CPU_0"
"/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0"
Tested Pattern such as:
- lower case "cpu"
- upper case "CPU"
- which has underscore in the endpoint e.g. "fan"
"/xyz/openbmc_project/sensors/fan_tach/fan0_0"
Example Robot test:
Example Inventory
[Documentation] Example inventory.
[Tags] Example_Inventory
${cpu_list}= Get Endpoint Paths /xyz/openbmc_project/inventory/ cpu
Log To Console \n Lower case(cpu): ${cpu_list}
${cpu_list}= Get Endpoint Paths /xyz/openbmc_project/inventory/ CPU
Log To Console \n Upper case(CPU): ${cpu_list}
${fan_list}= Get Endpoint Paths /xyz/openbmc_project/sensors/ fan
Log To Console \n ${fan_list}
Change-Id: I2345b780ee135c753fa9aaab901866abb232d3e8
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/utils.robot b/lib/utils.robot
index e4d812c..1c878c9 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -503,7 +503,7 @@
# For a given string, look for prefix and suffix for matching expression.
# Start of string followed by zero or more of any character followed by
# any digit or lower case character.
- ${resp}= Get Matches ${list} regexp=^.*[0-9a-z_].${endpoint}\[0-9a-z]*$
+ ${resp}= Get Matches ${list} regexp=^.*[0-9a-z_].${endpoint}\[_0-9a-z]*$ case_insensitive=${True}
[Return] ${resp}