Skip to contentSkip to conversation

Simplify network setup

RFC PATCH Superseded Petr Vorel 1 participant 5 messages Apr 3, 2017

v3 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

v3 cover Simplify network setup

From: Petr Vorel <[email protected]>

Changes v2->v3:
Fixed most of issues reported by Alexey.

Petr Vorel (3):
gitignore: Prefixing filenames
network: Add tool for setup IP variables
network: Use tst_net_vars to set up variables

 testcases/lib/.gitignore     |  13 +-
 testcases/lib/Makefile       |   2 +-
 testcases/lib/test_net.sh    |  33 +--
 testcases/lib/tst_net_vars.c | 597 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 613 insertions(+), 32 deletions(-)
 create mode 100644 testcases/lib/tst_net_vars.c
Signature · 1 line
2.11.0
author
#1 lore raw

RFC PATCH v3 1/3 gitignore: Prefixing filenames

---
 testcases/lib/.gitignore | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
testcases/lib/.gitignore +6 -6
index 920817cac..522889bed 100644
@@ -1,6 +1,6 @@
-tst_sleep
-tst_random
-tst_checkpoint
-tst_rod
-tst_kvcmp
-tst_device
+/tst_sleep
+/tst_random
+/tst_checkpoint
+/tst_rod
+/tst_kvcmp
+/tst_device
Signature · 1 line
2.11.0
author
#2 lore raw

RFC PATCH v3 2/3 network: Add tool for setup IP variables

In reply to Petr Vorel

These environment variables are defined by setup_network_variables:
IPV4_NETWORK
LHOST_IPV4_HOST
RHOST_IPV4_HOST
IPV4_NET_REV
IPV6_NETWORK
LHOST_IPV6_HOST
RHOST_IPV6_HOST
IPV6_NET_REV
LHOST_IPV6_REV
RHOST_IPV6_REV
IPV4_NET16_UNUSED
IPV6_NET32_UNUSED

---
 testcases/lib/.gitignore     |   1 +
 testcases/lib/Makefile       |   2 +-
 testcases/lib/tst_net_vars.c | 597 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 599 insertions(+), 1 deletion(-)
 create mode 100644 testcases/lib/tst_net_vars.c
testcases/lib/.gitignore +1 -0
index 522889bed..e1274df64 100644
@@ -4,3 +4,4 @@
 /tst_rod
 /tst_kvcmp
 /tst_device
+/tst_net_vars
testcases/lib/Makefile +1 -1
index 1127a59fe..49ef2ec01 100644
@@ -27,6 +27,6 @@ include $(top_srcdir)/include/mk/testcases.mk
 INSTALL_TARGETS		:= *.sh
 
 MAKE_TARGETS		:= tst_sleep tst_random tst_checkpoint tst_rod tst_kvcmp\
-			   tst_device
+			   tst_device tst_net_vars
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/lib/tst_net_vars.c new file +597 -0

597 lines not on this page · raw message

Signature · 1 line
2.11.0
author
#3 lore raw

RFC PATCH v3 3/3 network: Use tst_net_vars to set up variables

In reply to Petr Vorel

tst_net_vars simplifies setup as it only needs to have passed 4 IP addresses (2 IPv4 and 2 IPv6).

---
 testcases/lib/test_net.sh | 33 ++++++++-------------------------
 1 file changed, 8 insertions(+), 25 deletions(-)
testcases/lib/test_net.sh +8 -25
index f0e05b13d..4540694c7 100644
@@ -487,31 +487,14 @@ export PASSWD="${PASSWD:-}"
 # Don't use it in new tests, use tst_rhost_run() from test_net.sh instead.
 export LTP_RSH="${LTP_RSH:-rsh -n}"
 
-# Test Links
-# Set first three octets of the network address, default is '10.0.0'
-export IPV4_NETWORK="${IPV4_NETWORK:-10.0.0}"
-# Set local host last octet, default is '2'
-export LHOST_IPV4_HOST="${LHOST_IPV4_HOST:-2}"
-# Set remote host last octet, default is '1'
-export RHOST_IPV4_HOST="${RHOST_IPV4_HOST:-1}"
-# Set the reverse of IPV4_NETWORK
-export IPV4_NET_REV="${IPV4_NET_REV:-0.0.10}"
-# Set first three octets of the network address, default is 'fd00:1:1:1'
-export IPV6_NETWORK="${IPV6_NETWORK:-fd00:1:1:1}"
-# Set local host last octet, default is '2'
-export LHOST_IPV6_HOST="${LHOST_IPV6_HOST:-:2}"
-# Set remote host last octet, default is '1'
-export RHOST_IPV6_HOST="${RHOST_IPV6_HOST:-:1}"
-# Reverse network portion of the IPv6 address
-export IPV6_NET_REV="${IPV6_NET_REV:-1.0.0.0.1.0.0.0.1.0.0.0.0.0.d.f}"
-# Reverse host portion of the IPv6 address of the local host
-export LHOST_IPV6_REV="${LHOST_IPV6_REV:-2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0}"
-# Reverse host portion of the IPv6 address of the remote host
-export RHOST_IPV6_REV="${RHOST_IPV6_REV:-1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0}"
-
-# Networks that aren't reachable through the test links
-export IPV4_NET16_UNUSED="${IPV4_NET16_UNUSED:-10.23}"
-export IPV6_NET32_UNUSED="${IPV6_NET32_UNUSED:-fd00:23}"
+# set test links + networks that aren't reachable through the test links
+IPV4_LHOST="${IPV4_LHOST:-10.0.0.2/24}"
+IPV4_RHOST="${IPV4_RHOST:-10.0.0.1/24}"
+eval `tst_net_vars $IPV4_LHOST $IPV4_RHOST`
+
+IPV6_LHOST="${IPV6_LHOST:-fd00:1:1:1::2/64}"
+IPV6_RHOST="${IPV6_RHOST:-fd00:1:1:1::1/64}"
+eval `tst_net_vars $IPV6_LHOST $IPV6_RHOST`
 
 export HTTP_DOWNLOAD_DIR="${HTTP_DOWNLOAD_DIR:-/var/www/html}"
 export FTP_DOWNLOAD_DIR="${FTP_DOWNLOAD_DIR:-/var/ftp}"
Signature · 1 line
2.11.0