Fix ifconfig parsing in onos-setup-karaf
ifconfig output in CentOS7 is different from Ubuntu.
This one should work with OS X, Ubuntu and CentOS.
Change-Id: I2ec43db5af6f90b87b4def1a7654e4c8ad0bd253
diff --git a/tools/test/bin/onos-setup-karaf b/tools/test/bin/onos-setup-karaf
index 9cf4318..19a7879 100755
--- a/tools/test/bin/onos-setup-karaf
+++ b/tools/test/bin/onos-setup-karaf
@@ -17,9 +17,7 @@
# Validates the specified IP regular expression against existing adapters.
# Excludes local-loopback.
function validateIp {
- [ $(uname) = "Darwin" ] && \
- ifconfig | grep 'inet ' | cut -d\ -f2 | grep -v "127\.0\.0\.1" | grep $1 || \
- ifconfig | grep 'inet addr:' | cut -d: -f2 | cut -d\ -f1 | grep -v "127\.0\.0\.1" | grep $1
+ ifconfig | awk '{ print $2}' | grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" | grep -v "127\.0\.0\.1" | grep $1
}
# Clean the previous Karaf directory if requested and if it exists.