OSDN Git Service

Add l7directord scripts.
author0809216 <0809216@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Tue, 5 Oct 2010 11:46:24 +0000 (11:46 +0000)
committer0809216 <0809216@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Tue, 5 Oct 2010 11:46:24 +0000 (11:46 +0000)
git-svn-id: http://10.144.169.20/repos/um/branches/l7vsd-3.x-ramiel-epoll-cond@10330 1ed66053-1c2d-0410-8867-f7571e6e31d3

34 files changed:
test/script/common/backup_file.sh
test/script/common/check_env.sh
test/script/common/collect_file.sh
test/script/common/lighttpd_func.sh
test/script/common/logger.sh
test/script/common/restore_file.sh
test/script/common/set_default_conf.sh
test/script/common/stop_um_ps.sh
test/script/common/test_client.c
test/script/l7directord/l7directord-1-1-3.sh [new file with mode: 0755]
test/script/l7directord/l7directord-1-1-4.sh [new file with mode: 0755]
test/script/l7directord/l7directord-1-2-47.sh [new file with mode: 0755]
test/script/l7directord/l7directord-3-2-1.sh [new file with mode: 0755]
test/script/l7directord/l7directord-3-2-2.sh [new file with mode: 0755]
test/script/l7directord/l7directord-3-2-3.sh [new file with mode: 0755]
test/script/l7directord/l7directord-3-2-4.sh [new file with mode: 0755]
test/script/l7directord/l7directord-3-2-5.sh [new file with mode: 0755]
test/script/l7directord/l7directord-3-2-6.sh [new file with mode: 0755]
test/script/l7directord/l7directord-3-2-7.sh [new file with mode: 0755]
test/script/l7directord/l7directord-3-2-8.sh [new file with mode: 0755]
test/script/l7directord/l7directord-3-2-9.sh [new file with mode: 0755]
test/script/l7directord/materials/l7directord-1-1-3-l7directord.cf [new file with mode: 0644]
test/script/l7directord/materials/l7directord-1-1-4-l7directord.cf [new file with mode: 0644]
test/script/l7directord/materials/l7directord-1-2-47-l7directord.cf [new file with mode: 0644]
test/script/l7directord/materials/l7directord-3-2-1-l7directord.cf [new file with mode: 0644]
test/script/l7directord/materials/l7directord-3-2-2-l7directord.cf [new file with mode: 0644]
test/script/l7directord/materials/l7directord-3-2-3-l7directord.cf [new file with mode: 0644]
test/script/l7directord/materials/l7directord-3-2-4-l7directord.cf [new file with mode: 0644]
test/script/l7directord/materials/l7directord-3-2-5-l7directord.cf [new file with mode: 0644]
test/script/l7directord/materials/l7directord-3-2-6-l7directord.cf [new file with mode: 0644]
test/script/l7directord/materials/l7directord-3-2-7-l7directord.cf [new file with mode: 0644]
test/script/l7directord/materials/l7directord-3-2-8-l7directord.cf [new file with mode: 0644]
test/script/l7directord/materials/l7directord-3-2-9.log [new file with mode: 0644]
test/umtest.sh

index 0ab0b55..7686503 100755 (executable)
@@ -20,15 +20,15 @@ else
        LOG "/etc/hosts file was moved to ${TMP_DIR}/etc/hosts." 
 fi
 
-if [ -n ${L7VSD_CONF_DIR} -a ${L7VSD_CONF_DIR} != "/"  ]
+if [ -n ${L7VSD_CONF_DIR} -a ${L7VSD_CONF_DIR} != "/" ]
 then
        if [ ! -d ${TMP_DIR}/l7vs ]
        then
-               mkdir -p ${TMP_DIR}/l7vs
+               mkdir -p ${TMP_DIR}/l7vs
        fi
        mv ${L7VSD_CONF_DIR}/* ${TMP_DIR}/l7vs/ 2> /dev/null
 else
-        false
+       false
 fi
 if [ $? -ne 0 ]
 then
@@ -41,11 +41,11 @@ if [ -n ${L7DIRECTORD_CONF_DIR} -a ${L7DIRECTORD_CONF_DIR} != "/" ]
 then
        if [ ! -d ${TMP_DIR}/l7director ]
        then
-               mkdir -p ${TMP_DIR}/l7director
+               mkdir -p ${TMP_DIR}/l7director
        fi
        mv ${L7DIRECTORD_CONF_DIR}/* ${TMP_DIR}/l7director 2> /dev/null
 else
-        false
+       false
 fi
 if [ $? -ne 0 ]
 then
@@ -58,11 +58,11 @@ if [ -n ${L7VS_LOG_DIR} -a ${L7VS_LOG_DIR} != "/" ]
 then
        if [ ! -d ${TMP_DIR}/log ]
        then
-               mkdir -p ${TMP_DIR}/log
+               mkdir -p ${TMP_DIR}/log
        fi
        mv ${L7VS_LOG_DIR}/* ${TMP_DIR}/log 2> /dev/null
 else
-        false
+       false
 fi
 if [ $? -ne 0 ]
 then
index d3f4fab..4ea5d9a 100755 (executable)
@@ -2,7 +2,7 @@
 
 # Check UltraMonkey-L7 installed
 check_uml7 (){
-        L7VSD="/usr/sbin/l7vsd"
+       L7VSD="/usr/sbin/l7vsd"
        L7VSADM="/usr/sbin/l7vsadm"
        L7DIRECTORD="/usr/sbin/l7directord"
        INIT_L7VSD="/etc/init.d/l7vsd"
@@ -11,62 +11,62 @@ check_uml7 (){
        L7DIRECTORD_CONF_DIR="/etc/ha.d/conf"
        L7VS_LOG_DIR="/var/log/l7vs"
 
-       if [ !  -e ${L7VSD} ]
+       if [ ! -e ${L7VSD} ]
        then
                LOG_FATAL "${L7VSD} not exist. " 
                exit 1
        fi
 
-       if [ !  -e ${L7VSADM} ]
-       then       
-               LOG_FATAL "${L7VSADM} not exist." 
-               exit 1
+       if [ ! -e ${L7VSADM} ]
+       then
+               LOG_FATAL "${L7VSADM} not exist." 
+               exit 1
        fi
        
-       if [ !  -e ${L7DIRECTORD} ]
-       then       
-               LOG_FATAL "${L7DIRECTORD} not exist." 
-               exit 1
+       if [ ! -e ${L7DIRECTORD} ]
+       then
+               LOG_FATAL "${L7DIRECTORD} not exist." 
+               exit 1
        fi
 
-       if [ !  -e ${INIT_L7VSD} ]
+       if [ ! -e ${INIT_L7VSD} ]
        then
-               LOG_FATAL "${INIT_L7VSD} not exist. " 
-               exit 1
-       fi          
+               LOG_FATAL "${INIT_L7VSD} not exist. " 
+               exit 1
+       fi
 
-       if [ !  -e ${INIT_L7DIRECTORD} ]
-       then       
-               LOG_FATAL "${INIT_L7DIRECTORD} not exist." 
-               exit 1
+       if [ ! -e ${INIT_L7DIRECTORD} ]
+       then
+               LOG_FATAL "${INIT_L7DIRECTORD} not exist." 
+               exit 1
        fi
 
-       if [ !  -d ${L7VSD_CONF_DIR} ]
-       then       
-               LOG_WARN "${L7VSD_CONF_DIR} not exist. Create ${L7VSD_CONF_DIR} ." 
-               mkdir ${L7VSD_CONF_DIR}
+       if [ ! -d ${L7VSD_CONF_DIR} ]
+       then
+               LOG_WARN "${L7VSD_CONF_DIR} not exist. Create ${L7VSD_CONF_DIR} ." 
+               mkdir ${L7VSD_CONF_DIR}
        fi
 
-       if [ !  -d ${L7DIRECTORD_CONF_DIR} ]
+       if [ ! -d ${L7DIRECTORD_CONF_DIR} ]
        then
                LOG_WARM "${L7DIRECTORD_CONF_DIR} not exist. Create ${L7DIRECTORD_CONF_DIR} ." 
-               mkdir ${L7DIRECTORD_CONF_DIR}
+               mkdir ${L7DIRECTORD_CONF_DIR}
        fi
 
-       if [ !  -d ${L7VS_LOG_DIR} ]
+       if [ ! -d ${L7VS_LOG_DIR} ]
        then
                LOG_WARN "${L7VS_LOG_DIR} not exist. Create ${L7VS_LOG_DIR} ." 
-               mkdir ${L7VS_LOG_DIR}
+               mkdir ${L7VS_LOG_DIR}
        fi
 }
 
 # check lighttpd installed
 check_http_server (){
-        LIGHTTPD=`which lighttpd`
+       LIGHTTPD=`which lighttpd`
        if [ $? -ne 0 ]
        then
                LOG_FATAL "lighttpd not exist. "
-                exit 1
+               exit 1
        fi
 }
 
@@ -81,9 +81,9 @@ check_net_snmp (){
 
        INIT_SNMPD="/etc/init.d/snmpd"
        if [ ! -e ${INIT_SNMPD} ]
-       then       
-               LOG_FATAL "/etc/init.d/snmpd not exist." 
-               exit 1
+       then
+               LOG_FATAL "/etc/init.d/snmpd not exist." 
+               exit 1
        fi
        
        SNMPTRAPD=`which snmptrapd`
@@ -95,13 +95,12 @@ check_net_snmp (){
 
        INIT_SNMPTRAPD="/etc/init.d/snmptrapd"
        if [ ! -e ${INIT_SNMPTRAPD} ]
-       then       
-               LOG_FATAL "/etc/init.d/snmptrapd not exist." 
-               exit 1
+       then
+               LOG_FATAL "/etc/init.d/snmptrapd not exist." 
+               exit 1
        fi
 }
 
-       
 # check commands installed
 check_commands (){
        WGET="/usr/bin/wget"
@@ -145,6 +144,7 @@ check_original_tools (){
                fi
        fi
 }
+
 #check_env main
 LOG "check_env start."
 check_uml7
index d404089..8616e42 100755 (executable)
@@ -16,12 +16,11 @@ else
        LOG "l7vs config file moved ${TAR_DIR} ." 
 fi
 
-
 if [ -n ${L7DIRECTORD_CONF_DIR} -a ${L7DIRECTORD_CONF_DIR} != "/" ]
 then
-        mv ${L7DIRECTORD_CONF_DIR}/* ${TAR_DIR} 2> /dev/null
+       mv ${L7DIRECTORD_CONF_DIR}/* ${TAR_DIR} 2> /dev/null
 else
-        false
+       false
 fi
 if [ $? -ne 0 ]
 then
@@ -32,9 +31,9 @@ fi
 
 if [ -n ${L7VS_LOG_DIR} -a ${L7VS_LOG_DIR} != "/" ]
 then
-        mv ${L7VS_LOG_DIR}/* ${TAR_DIR} 2> /dev/null
+       mv ${L7VS_LOG_DIR}/* ${TAR_DIR} 2> /dev/null
 else
-        false
+       false
 fi
 if [ $? -ne 0 ]
 then
index 0aed2d5..0426b08 100755 (executable)
@@ -30,7 +30,6 @@ set_lighttpd_content (){
        return $?
 }
 
-
 up_lighttpd (){
        if [ -n "$1" -a -f "${LIGHTTPD_TMP_DIR}/$1.cf" ]
        then
@@ -71,60 +70,59 @@ make_lighttpd_tmpdir (){
 
 #make lighttpd_configfile
 start_lighttpd (){
-#Set default value
-template_file=${DEFAULT_CONF_DIR}/default.conf
-server_ipaddr=127.0.0.1
-OPTIND=1
-while getopts s:a:p:t:l:iS option
-do
-       case "$option" in
-         s)
-               LIGHTTPD_CONF_FILE="${LIGHTTPD_TMP_DIR}/${OPTARG}.cf"
-               if [ -e ${LIGHTTPD_CONF_FILE} ]
-               then
-                       echo "SERVERNAME:${OPTARG} is already exist."
-                       return 1
-               else
-                       SERVERNAME=${OPTARG}
-                       #declare        ${OPTARG}=${OPTARG}
-                       echo "server.name       = \"${OPTARG}\"" >> ${LIGHTTPD_CONF_FILE}
-                       echo "server.pid-file   = \"${LIGHTTPD_TMP_DIR}/$OPTARG.pid\"" >> ${LIGHTTPD_CONF_FILE}
-                       echo "server.document-root      = \"${LIGHTTPD_TMP_DIR}/${OPTARG}\"" >> ${LIGHTTPD_CONF_FILE}
-                       mkdir ${LIGHTTPD_TMP_DIR}/${OPTARG}
-                       echo "${OPTARG}" > ${LIGHTTPD_TMP_DIR}/${OPTARG}/index.html
-               fi
-               ;;
-         t)
-               template_file=${DEFAULT_CONF_DIR}/${OPTARG}
-               ;;
-         l)
-               echo "accesslog.filename = \"${OPTARG}\"" >> ${LIGHTTPD_CONF_FILE}
-               ;;
-
-         a)
-               server_ipaddr=${OPTARG}
-               ;;
-         p)
-               echo "server.port       = \"${OPTARG}\"" >> ${LIGHTTPD_CONF_FILE}
-               ;;
-         i)
-               echo "server.use-ipv6   = \"enable\"" >> ${LIGHTTPD_CONF_FILE}
-               ;;
-         S)
-               echo "ssl.engine        = \"enable\"" >> ${LIGHTTPD_CONF_FILE}
-               echo "ssl.pemfile       = \"${LIGHTTPD_TMP_DIR}/${SERVERNAME}/lighttpd.pem\"" >> ${LIGHTTPD_CONF_FILE}
-               cp ${DEFAULT_CONF_DIR}/lighttpd.pem ${LIGHTTPD_TMP_DIR}/${SERVERNAME}/lighttpd.pem
-               ;;
-         \?)
-               :
-               ;;
-       esac
-done
-
-echo "server.bind      = \"${server_ipaddr}\"" >>  ${LIGHTTPD_CONF_FILE}
-cat ${template_file} >> ${LIGHTTPD_CONF_FILE}
-
-up_lighttpd $SERVERNAME
-return $?
+       #Set default value
+       template_file=${DEFAULT_CONF_DIR}/default.conf
+       server_ipaddr=127.0.0.1
+       OPTIND=1
+       while getopts s:a:p:t:l:iS option
+       do
+               case "$option" in
+                 s)
+                       LIGHTTPD_CONF_FILE="${LIGHTTPD_TMP_DIR}/${OPTARG}.cf"
+                       if [ -e ${LIGHTTPD_CONF_FILE} ]
+                       then
+                               echo "SERVERNAME:${OPTARG} is already exist."
+                               return 1
+                       else
+                               SERVERNAME=${OPTARG}
+                               #declare        ${OPTARG}=${OPTARG}
+                               echo "server.name       = \"${OPTARG}\"" >> ${LIGHTTPD_CONF_FILE}
+                               echo "server.pid-file   = \"${LIGHTTPD_TMP_DIR}/$OPTARG.pid\"" >> ${LIGHTTPD_CONF_FILE}
+                               echo "server.document-root      = \"${LIGHTTPD_TMP_DIR}/${OPTARG}\"" >> ${LIGHTTPD_CONF_FILE}
+                               mkdir ${LIGHTTPD_TMP_DIR}/${OPTARG}
+                               echo "${OPTARG}" > ${LIGHTTPD_TMP_DIR}/${OPTARG}/index.html
+                       fi
+                       ;;
+                 t)
+                       template_file=${DEFAULT_CONF_DIR}/${OPTARG}
+                       ;;
+                 l)
+                       echo "accesslog.filename = \"${OPTARG}\"" >> ${LIGHTTPD_CONF_FILE}
+                       ;;
+       
+                 a)
+                       server_ipaddr=${OPTARG}
+                       ;;
+                 p)
+                       echo "server.port       = \"${OPTARG}\"" >> ${LIGHTTPD_CONF_FILE}
+                       ;;
+                 i)
+                       echo "server.use-ipv6   = \"enable\"" >> ${LIGHTTPD_CONF_FILE}
+                       ;;
+                 S)
+                       echo "ssl.engine        = \"enable\"" >> ${LIGHTTPD_CONF_FILE}
+                       echo "ssl.pemfile       = \"${LIGHTTPD_TMP_DIR}/${SERVERNAME}/lighttpd.pem\"" >> ${LIGHTTPD_CONF_FILE}
+                       cp ${DEFAULT_CONF_DIR}/lighttpd.pem ${LIGHTTPD_TMP_DIR}/${SERVERNAME}/lighttpd.pem
+                       ;;
+                 \?)
+                       :
+                       ;;
+               esac
+       done
+       
+       echo "server.bind       = \"${server_ipaddr}\"" >> ${LIGHTTPD_CONF_FILE}
+       cat ${template_file} >> ${LIGHTTPD_CONF_FILE}
+       
+       up_lighttpd $SERVERNAME
+       return $?
 }
-
index 76630ba..d034c82 100755 (executable)
@@ -3,25 +3,23 @@
 LOG_DIR="${LOG_BASE_DIR}/${DATE}"
 LOG_FILE="${LOG_DIR}/${DATE}.log"
 
-
 function LOG_ {
        echo "`date +'%Y/%m/%d %H:%M:%S'` [$1] $2 $3" >> ${LOG_FILE}
 }
 function LOG_FATAL {
-        LOG_ FATAL "$1" "umtest stoped."
-       echo "$1 umtest stoped."
+       LOG_ FATAL "$1" "umtest stopped."
+       echo "$1 umtest stopped."
 }
 function LOG_ERR {
-        LOG_ ERROR "$1"
+       LOG_ ERROR "$1"
 }
 function LOG_WARN {
-        LOG_ WARN "$1"
+       LOG_ WARN "$1"
 }
 function LOG {
-        LOG_ INFO "$1"
+       LOG_ INFO "$1"
 }
 
-
 mkdir -p ${LOG_DIR}
 if [ $? -eq 0 ]
 then
@@ -29,5 +27,3 @@ then
 else
        LOG_FATAL "Can not make log directory."
 fi
-
-
index d0c4abc..60a6dd5 100755 (executable)
@@ -8,7 +8,7 @@ if [ $? -ne 0 ]
 then
        LOG_ERR "Cannot move ${TMP_DIR}/etc/hosts file."
 else
-        LOG "/etc/hosts file was restored."
+       LOG "/etc/hosts file was restored."
 fi     
 
 mv ${TMP_DIR}/l7vs/* ${L7VSD_CONF_DIR} 2> /dev/null
@@ -16,7 +16,7 @@ if [ $? -ne 0 ]
 then
        LOG_ERR "Cannot move ${TMP_DIR}/l7vs/* files."
 else
-        LOG "${L7VSD_CONF_DIR}/* files were restored."
+       LOG "${L7VSD_CONF_DIR}/* files were restored."
 fi
 
 mv ${TMP_DIR}/l7director/* ${L7DIRECTORD_CONF_DIR} 2> /dev/null
@@ -24,7 +24,7 @@ if [ $? -ne 0 ]
 then
        LOG_ERR "Cannot move ${TMP_DIR}/l7director/* files."
 else
-        LOG "${L7DIRECTORD_CONF_DIR}/* files were restored."
+       LOG "${L7DIRECTORD_CONF_DIR}/* files were restored."
 fi
 
 mv ${TMP_DIR}/log/* ${L7VS_LOG_DIR} 2> /dev/null
@@ -32,7 +32,7 @@ if [ $? -ne 0 ]
 then
        LOG_ERR "Cannot move ${TMP_DIR}/log/* files."
 else
-        LOG "${L7VS_LOG_DIR}/* files were restored."
+       LOG "${L7VS_LOG_DIR}/* files were restored."
 fi
 
 LOG "restore_file end."
index a46aa4b..3b91298 100755 (executable)
@@ -5,5 +5,3 @@ UML7_DEFAULT_CONF_DIR="${CONF_DIR}/ultramonkey-l7"
 cp -bf ${UML7_DEFAULT_CONF_DIR}/l7directord.cf ${L7DIRECTORD_CONF_DIR} > /dev/null 2>&1
 cp -bf ${UML7_DEFAULT_CONF_DIR}/l7vs.cf ${L7VSD_CONF_DIR} > /dev/null 2>&1
 cp -bfr ${UML7_DEFAULT_CONF_DIR}/sslproxy ${L7VSD_CONF_DIR} > /dev/null 2>&1
-
-
index 8ef4ef6..a7f2bdc 100755 (executable)
@@ -4,7 +4,7 @@ LOG "stop_um_ps start."
 
 if [ -n "`pgrep l7vsd`" ]
 then
-       ${INIT_L7VSD} stop > /dev/null 2>&1
+       ${INIT_L7VSD} stop 2>&1
        if [ $? -ne 0 ]
        then
                LOG_FATAL "Can not stop l7vsd."
@@ -15,7 +15,7 @@ fi
 if [ -n "`pgrep l7directord`" ]
 then
        ${INIT_L7DIRECTORD} stop > /dev/null 2>&1
-       pgrep l7directord | xargs kill -KILL > /dev/null 2>&1
+       pkill -KILL l7directord > /dev/null 2>&1
        usleep 100000
        if [ -n "`pgrep l7directord`" ]
        then
index 451b626..eb2fd65 100644 (file)
@@ -1,33 +1,33 @@
-#include    <stdio.h>
-#include    <stdlib.h>
-#include    <strings.h>
-#include    <sys/types.h>
-#include    <sys/socket.h>
-#include    <netinet/in.h>
-#include    <arpa/inet.h>
-#include    <netdb.h>
-#include    <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <strings.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <signal.h>
 
 int sockfd;
 
 int main(int argc, char *argv[])
 {
     void sigend(void);
-    struct  sockaddr_in server;
+    struct sockaddr_in server;
 
     sockfd = socket(PF_INET, SOCK_STREAM, 0);
     bzero((char *)&server, sizeof(server));
     server.sin_family = PF_INET;
     server.sin_port   = htons(atoi(argv[2]));
     server.sin_addr.s_addr = inet_addr(argv[1]);
-    if( connect(sockfd, (struct sockaddr *)&server, sizeof(server)) == -1 ){
+    if (connect(sockfd, (struct sockaddr *)&server, sizeof(server)) == -1) {
         perror("connect failed");
         exit(1);
     }
 
-    if( signal(SIGTERM, (void *)sigend) == SIG_ERR){
-       perror("signal failed");
-       exit(1);
+    if (signal(SIGTERM, (void *)sigend) == SIG_ERR) {
+        perror("signal failed");
+        exit(1);
     }
 
     sleep(10);
@@ -36,8 +36,9 @@ int main(int argc, char *argv[])
     return(0);
 }
 
-void sigend(void){
-       close(sockfd);
-       exit(0);
+void sigend(void)
+{
+    close(sockfd);
+    exit(0);
 }
 
diff --git a/test/script/l7directord/l7directord-1-1-3.sh b/test/script/l7directord/l7directord-1-1-3.sh
new file mode 100755 (executable)
index 0000000..a869351
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+. ${SET_DEFAULT_CONF}
+\cp ./materials/l7directord-1-1-3-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
+
+# logging uuid
+uuid=`uuidgen`
+logger $uuid
+
+# log file
+logfile=/var/log/messages
+
+# Start l7directord
+$INIT_L7DIRECTORD start 
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $INIT_L7DIRECTORD start"
+        exit 1
+fi
+sleep 1
+
+RET=`grep -A 100 $uuid $logfile | grep l7directord | grep -v ": \[" | wc -l`
+if [ $RET -ne 0 ]
+then
+        echo "Test failed: $logfile has weird l7directord log."
+        exit 1
+fi
+
+RET=`grep l7directord $logfile | wc -l`
+if [ $RET -eq 0 ]
+then
+        echo "Test failed: $logfile does not have l7directord log."
+        exit 1
+fi
+
+exit 0
diff --git a/test/script/l7directord/l7directord-1-1-4.sh b/test/script/l7directord/l7directord-1-1-4.sh
new file mode 100755 (executable)
index 0000000..fd09315
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+. ${SET_DEFAULT_CONF}
+\cp ./materials/l7directord-1-1-4-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
+
+# logging uuid
+uuid=`uuidgen`
+logger -p mail.info $uuid
+
+# log file
+logfile="/var/log/maillog"
+
+# Start l7directord
+$INIT_L7DIRECTORD start 
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $INIT_L7DIRECTORD start"
+        exit 1
+fi
+sleep 1
+
+RET=`grep -A 100 $uuid $logfile | grep l7directord | grep -v ": \[" | wc -l`
+if [ $RET -ne 0 ]
+then
+        echo "Test failed: $logfile has weird l7directord log."
+        exit 1
+fi
+
+RET=`grep l7directord /var/log/messages | wc -l`
+if [ $RET -eq 0 ]
+then
+        echo "Test failed: $logfile does not have l7directord log."
+        exit 1
+fi
+
+exit 0
diff --git a/test/script/l7directord/l7directord-1-2-47.sh b/test/script/l7directord/l7directord-1-2-47.sh
new file mode 100755 (executable)
index 0000000..c8d714f
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/bash
+. ${SET_DEFAULT_CONF}
+\cp ./materials/l7directord-1-2-47-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
+
+# this config file has 89 errors
+error_count=89
+
+for i in `seq 1 $error_count`
+do
+       # l7directord config file syntax check
+       RET1=`$L7DIRECTORD configtest 2>&1`
+       if [ $? -eq 0 ]
+       then
+               echo "Test failed: $L7DIRECTORD configtest - no more error($i)"
+               exit 1
+       fi
+       RET2=`$L7DIRECTORD -t 2>&1`
+       if [ $? -eq 0 ]
+       then
+               echo "Test failed: $L7DIRECTORD -t - no more error($i)"
+               exit 1
+       fi
+       RET3=`$INIT_L7DIRECTORD configtest 2>&1`
+       
+       # all result should be same.
+       if [ "$RET1" != "$RET2" -o "$RET1" != "$RET3" ]
+       then
+               echo "Test failed: configtest result was not matched."
+               exit 1
+       fi
+       
+       # check the error line number
+       error_line=`echo $RET1 | sed -e "s/.*at line \([0-9]*\):.*/\1/"`
+       if [ "$error_line" = "$RET1" ]
+       then
+               echo "Test failed: Unknown error occurred - $RET1"
+               exit 1
+       fi
+
+       # delete syntax error line
+       sed -i -e ${error_line}d ${L7DIRECTORD_CONF_DIR}/l7directord.cf
+done
+
+# l7directord config file syntax check
+RET1=`$L7DIRECTORD configtest 2>&1`
+if [ $? -eq 1 ]
+then
+        echo "Test failed: $L7DIRECTORD configtest should be no error."
+        exit 1
+fi
+RET2=`$L7DIRECTORD -t 2>&1`
+if [ $? -eq 1 ]
+then
+        echo "Test failed: $L7DIRECTORD -t should be no error."
+        exit 1
+fi
+RET3=`$INIT_L7DIRECTORD configtest 2>&1`
+if [ "$RET1" != "$RET2" -o "$RET1" != "$RET3" ]
+then
+       echo "Test failed: configtest result was not matched."
+       exit 1
+fi
+       
+EXPECT="Syntax OK"
+if [ "$RET1" != "$EXPECT" ]
+then
+        echo "Test failed: $L7DIRECTORD configtest should be Syntax OK."
+        exit 1
+fi
+
+exit 0
diff --git a/test/script/l7directord/l7directord-3-2-1.sh b/test/script/l7directord/l7directord-3-2-1.sh
new file mode 100755 (executable)
index 0000000..0508764
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/bash
+. ${SET_DEFAULT_CONF}
+\cp ./materials/l7directord-3-2-1-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
+
+# create dummy l7vsadm
+dummy="/tmp/`uuidgen`.dummyadm"
+dummylog="/tmp/`uuidgen`.dummylog"
+cat > $dummy << END
+#!/bin/sh
+date=\`date\`
+echo "[\$date] \$0 \$@" >> $dummylog
+END
+chmod +x $dummy
+
+# backup l7vsadm
+bak="/tmp/`uuidgen`.l7vsadm"
+mv /usr/sbin/l7vsadm $bak
+
+# install dummy l7vsadm
+cp $dummy /usr/sbin/l7vsadm
+cp $dummy /sbin/l7vsadm
+
+function cleanup {
+       rm $dummy
+       rm $dummylog
+       mv $bak /usr/sbin/l7vsadm
+}
+
+# Start l7directord
+$INIT_L7DIRECTORD start 
+# stop l7directord
+$INIT_L7DIRECTORD stop 
+
+# /usr/sbin/l7vsadm should be used
+grep " /usr/sbin/l7vsadm -K -n" $dummylog > /dev/null 2>&1
+if [ $? -ne 0 ]
+then
+       cleanup
+        echo "Test failed: Cannot find '/usr/sbin/l7vsadm -K -n' in the log."
+        exit 1
+fi
+
+# remove dummy l7vsadm
+rm /usr/sbin/l7vsadm
+
+# Start l7directord
+$INIT_L7DIRECTORD start 
+# stop l7directord
+$INIT_L7DIRECTORD stop 
+
+# /sbin/l7vsadm should be used
+grep " /sbin/l7vsadm -K -n" $dummylog > /dev/null 2>&1
+if [ $? -ne 0 ]
+then
+       cleanup
+        echo "Test failed: Cannot find '/sbin/l7vsadm -K -n' in the log."
+        exit 1
+fi
+
+cleanup
+exit 0
diff --git a/test/script/l7directord/l7directord-3-2-2.sh b/test/script/l7directord/l7directord-3-2-2.sh
new file mode 100755 (executable)
index 0000000..4dd2d0f
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/bash
+. ${SET_DEFAULT_CONF}
+\cp ./materials/l7directord-3-2-2-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
+
+# create dummy l7vsadm
+dummy="/tmp/`uuidgen`.dummyadm"
+dummylog="/tmp/`uuidgen`.dummylog"
+cat > $dummy << END
+#!/bin/sh
+date=\`date\`
+echo "[\$date] \$0 \$@" >> $dummylog
+END
+chmod +x $dummy
+
+# backup l7vsadm
+bak="/tmp/`uuidgen`.l7vsadm"
+mv /usr/sbin/l7vsadm $bak
+
+# install dummy l7vsadm
+cp $dummy /usr/sbin/l7vsadm
+
+function cleanup {
+       rm $dummy
+       rm $dummylog
+       mv $bak /usr/sbin/l7vsadm
+}
+
+# Start l7directord
+$INIT_L7DIRECTORD start 
+# stop l7directord
+$INIT_L7DIRECTORD stop 
+
+# check /usr/sbin/l7vsadm -K -n
+grep " /usr/sbin/l7vsadm -K -n" $dummylog > /dev/null 2>&1
+if [ $? -ne 0 ]
+then
+       cleanup
+        echo "Test failed: Cannot find '/usr/sbin/l7vsadm -K -n' in the log."
+        exit 1
+fi
+
+cleanup
+exit 0
diff --git a/test/script/l7directord/l7directord-3-2-3.sh b/test/script/l7directord/l7directord-3-2-3.sh
new file mode 100755 (executable)
index 0000000..71b956c
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/bash
+. ${SET_DEFAULT_CONF}
+\cp ./materials/l7directord-3-2-3-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
+
+# create dummy l7vsadm
+dummy="/tmp/`uuidgen`.dummyadm"
+dummylog="/tmp/`uuidgen`.dummylog"
+cat > $dummy << END
+#!/bin/sh
+date=\`date\`
+echo "[\$date] \$0 \$@" >> $dummylog
+END
+chmod +x $dummy
+
+# backup l7vsadm
+bak="/tmp/`uuidgen`.l7vsadm"
+mv /usr/sbin/l7vsadm $bak
+
+# install dummy l7vsadm
+cp $dummy /usr/sbin/l7vsadm
+
+function cleanup {
+       rm $dummy
+       rm $dummylog
+       mv $bak /usr/sbin/l7vsadm
+}
+
+# Start l7directord
+$INIT_L7DIRECTORD start 
+# stop l7directord
+$INIT_L7DIRECTORD stop 
+
+# check /usr/sbin/l7vsadm -A -t
+grep " /usr/sbin/l7vsadm -A -t" $dummylog > /dev/null 2>&1
+if [ $? -ne 0 ]
+then
+       cleanup
+        echo "Test failed: Cannot find '/usr/sbin/l7vsadm -A -t' in the log."
+        exit 1
+fi
+
+cleanup
+exit 0
diff --git a/test/script/l7directord/l7directord-3-2-4.sh b/test/script/l7directord/l7directord-3-2-4.sh
new file mode 100755 (executable)
index 0000000..719b1a5
--- /dev/null
@@ -0,0 +1,63 @@
+#!/bin/bash
+. ${SET_DEFAULT_CONF}
+\cp ./materials/l7directord-3-2-4-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
+
+# create dummy l7vsadm
+dummy="/tmp/`uuidgen`.dummyadm"
+dummylog="/tmp/`uuidgen`.dummylog"
+cat > $dummy << END
+#!/bin/sh
+date=\`date\`
+echo "[\$date] \$0 \$@" >> $dummylog
+echo "Layer-7 Virtual Server version 3.0.0
+Prot LocalAddress:Port ProtoMod Scheduler
+     SSL_config_file
+     Socket option
+     Access_log_flag
+     Access_log_file
+     Access_log_rotate option
+  -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
+TCP 127.0.0.1:10000 sessionless rr
+    none
+    none
+    0
+    none
+    none
+TCP 127.0.0.1:10001 sessionless rr
+    none
+    none
+    0
+    none
+    none"
+END
+chmod +x $dummy
+
+# backup l7vsadm
+bak="/tmp/`uuidgen`.l7vsadm"
+mv /usr/sbin/l7vsadm $bak
+
+# install dummy l7vsadm
+cp $dummy /usr/sbin/l7vsadm
+
+function cleanup {
+       rm $dummy
+       rm $dummylog
+       mv $bak /usr/sbin/l7vsadm
+}
+
+# Start l7directord
+$INIT_L7DIRECTORD start 
+# stop l7directord
+$INIT_L7DIRECTORD stop 
+
+# check /usr/sbin/l7vsadm -E -t
+edit_line=`grep " /usr/sbin/l7vsadm -E -t" $dummylog | wc -l`
+if [ $edit_line -ne 2 ]
+then
+       cleanup
+        echo "Test failed: Cannot find '/usr/sbin/l7vsadm -E -t' in the log."
+        exit 1
+fi
+
+cleanup
+exit 0
diff --git a/test/script/l7directord/l7directord-3-2-5.sh b/test/script/l7directord/l7directord-3-2-5.sh
new file mode 100755 (executable)
index 0000000..bf3217d
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/bash
+. ${SET_DEFAULT_CONF}
+\cp ./materials/l7directord-3-2-5-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
+
+# create dummy l7vsadm
+dummy="/tmp/`uuidgen`.dummyadm"
+dummylog="/tmp/`uuidgen`.dummylog"
+cat > $dummy << END
+#!/bin/sh
+date=\`date\`
+echo "[\$date] \$0 \$@" >> $dummylog
+echo "Layer-7 Virtual Server version 3.0.0
+Prot LocalAddress:Port ProtoMod Scheduler
+     SSL_config_file
+     Socket option
+     Access_log_flag
+     Access_log_file
+     Access_log_rotate option
+  -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
+TCP 127.0.0.1:10000 sessionless rr
+    none
+    none
+    0
+    none
+    none"
+END
+chmod +x $dummy
+
+# backup l7vsadm
+bak="/tmp/`uuidgen`.l7vsadm"
+mv /usr/sbin/l7vsadm $bak
+
+# install dummy l7vsadm
+cp $dummy /usr/sbin/l7vsadm
+
+function cleanup {
+       rm $dummy
+       rm $dummylog
+       mv $bak /usr/sbin/l7vsadm
+}
+
+# Start l7directord
+$INIT_L7DIRECTORD start 
+
+# clear l7directord.cf
+cat /dev/null > ${L7DIRECTORD_CONF_DIR}/l7directord.cf
+
+# reload l7directord
+$INIT_L7DIRECTORD reload 
+
+# check /usr/sbin/l7vsadm -D -t
+grep " /usr/sbin/l7vsadm -D -t" $dummylog | wc -l
+if [ $? -ne 0 ]
+then
+       cleanup
+        echo "Test failed: Cannot find '/usr/sbin/l7vsadm -D -t' in the log."
+        exit 1
+fi
+
+cleanup
+exit 0
diff --git a/test/script/l7directord/l7directord-3-2-6.sh b/test/script/l7directord/l7directord-3-2-6.sh
new file mode 100755 (executable)
index 0000000..e84081c
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/bash
+. ${SET_DEFAULT_CONF}
+\cp ./materials/l7directord-3-2-6-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
+
+# create dummy l7vsadm
+dummy="/tmp/`uuidgen`.dummyadm"
+dummylog="/tmp/`uuidgen`.dummylog"
+cat > $dummy << END
+#!/bin/sh
+date=\`date\`
+echo "[\$date] \$0 \$@" >> $dummylog
+echo "Layer-7 Virtual Server version 3.0.0
+Prot LocalAddress:Port ProtoMod Scheduler
+     SSL_config_file
+     Socket option
+     Access_log_flag
+     Access_log_file
+     Access_log_rotate option
+  -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
+TCP 127.0.0.1:10000 sessionless rr
+    none
+    none
+    0
+    none
+    none"
+END
+chmod +x $dummy
+
+# backup l7vsadm
+bak="/tmp/`uuidgen`.l7vsadm"
+mv /usr/sbin/l7vsadm $bak
+
+# install dummy l7vsadm
+cp $dummy /usr/sbin/l7vsadm
+
+function cleanup {
+       rm $dummy
+       rm $dummylog
+       mv $bak /usr/sbin/l7vsadm
+}
+
+# Start l7directord
+$INIT_L7DIRECTORD start 
+# stop l7directord
+$INIT_L7DIRECTORD stop 
+
+# check /usr/sbin/l7vsadm -a -t
+add_line=`grep " /usr/sbin/l7vsadm -a -t" $dummylog | wc -l`
+if [ $add_line -ne 2 ]
+then
+       cleanup
+        echo "Test failed: Cannot find '/usr/sbin/l7vsadm -a -t' in the log."
+        exit 1
+fi
+
+cleanup
+exit 0
diff --git a/test/script/l7directord/l7directord-3-2-7.sh b/test/script/l7directord/l7directord-3-2-7.sh
new file mode 100755 (executable)
index 0000000..a0d353f
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/bash
+. ${SET_DEFAULT_CONF}
+\cp ./materials/l7directord-3-2-7-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
+
+# create dummy l7vsadm
+dummy="/tmp/`uuidgen`.dummyadm"
+dummylog="/tmp/`uuidgen`.dummylog"
+cat > $dummy << END
+#!/bin/sh
+date=\`date\`
+echo "[\$date] \$0 \$@" >> $dummylog
+echo "Layer-7 Virtual Server version 3.0.0
+Prot LocalAddress:Port ProtoMod Scheduler
+     SSL_config_file
+     Socket option
+     Access_log_flag
+     Access_log_file
+     Access_log_rotate option
+  -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
+TCP 127.0.0.1:10000 sessionless rr
+    none
+    none
+    0
+    none
+    none
+  -> 127.0.0.1:20000              Masq    1      0          0         
+  -> 127.0.0.1:30000              Masq    1      0          0         "
+END
+chmod +x $dummy
+
+# backup l7vsadm
+bak="/tmp/`uuidgen`.l7vsadm"
+mv /usr/sbin/l7vsadm $bak
+
+# install dummy l7vsadm
+cp $dummy /usr/sbin/l7vsadm
+
+function cleanup {
+       rm $dummy
+       rm $dummylog
+       mv $bak /usr/sbin/l7vsadm
+}
+
+# Start l7directord
+$INIT_L7DIRECTORD start 
+# Stop l7directord
+$INIT_L7DIRECTORD stop 
+
+# check /usr/sbin/l7vsadm -e -t
+edit_line=`grep " /usr/sbin/l7vsadm -e -t" $dummylog | wc -l`
+if [ $add_line -ne 2 ]
+then
+       cleanup
+        echo "Test failed: Cannot find '/usr/sbin/l7vsadm -e -t' in the log."
+        exit 1
+fi
+
+cleanup
+exit 0
diff --git a/test/script/l7directord/l7directord-3-2-8.sh b/test/script/l7directord/l7directord-3-2-8.sh
new file mode 100755 (executable)
index 0000000..5c4fe2a
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/bash
+. ${SET_DEFAULT_CONF}
+\cp ./materials/l7directord-3-2-8-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
+
+# create dummy l7vsadm
+dummy="/tmp/`uuidgen`.dummyadm"
+dummylog="/tmp/`uuidgen`.dummylog"
+cat > $dummy << END
+#!/bin/sh
+date=\`date\`
+echo "[\$date] \$0 \$@" >> $dummylog
+echo "Layer-7 Virtual Server version 3.0.0
+Prot LocalAddress:Port ProtoMod Scheduler
+     SSL_config_file
+     Socket option
+     Access_log_flag
+     Access_log_file
+     Access_log_rotate option
+  -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
+TCP 127.0.0.1:10000 sessionless rr
+    none
+    none
+    0
+    none
+    none
+  -> 127.0.0.1:20000              Masq    1      0          0         
+  -> 127.0.0.1:30000              Masq    1      0          0         "
+END
+chmod +x $dummy
+
+# backup l7vsadm
+bak="/tmp/`uuidgen`.l7vsadm"
+mv /usr/sbin/l7vsadm $bak
+
+# install dummy l7vsadm
+cp $dummy /usr/sbin/l7vsadm
+
+function cleanup {
+       rm $dummy
+       rm $dummylog
+       mv $bak /usr/sbin/l7vsadm
+}
+
+# Start l7directord
+$INIT_L7DIRECTORD start 
+# Stop l7directord
+$INIT_L7DIRECTORD stop 
+
+# check /usr/sbin/l7vsadm -d -t
+delete_line=`grep " /usr/sbin/l7vsadm -d -t" $dummylog | wc -l`
+if [ $delete_line -ne 2 ]
+then
+       cleanup
+        echo "Test failed: Cannot find '/usr/sbin/l7vsadm -d -t' in the log."
+        exit 1
+fi
+
+cleanup
+exit 0
diff --git a/test/script/l7directord/l7directord-3-2-9.sh b/test/script/l7directord/l7directord-3-2-9.sh
new file mode 100755 (executable)
index 0000000..fb7280c
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/bash
+. ${SET_DEFAULT_CONF}
+cat /dev/null > ${L7DIRECTORD_CONF_DIR}/l7directord.cf
+
+# backup l7directord
+bak="/tmp/`uuidgen`.l7directord"
+cp /usr/sbin/l7directord $bak
+
+# insert Dumper code
+sed -i -e "s/my \$current_service = ld_read_l7vsadm();/my \$current_service = ld_read_l7vsadm(); use Data::Dumper; ld_log(Dumper \$current_service); exit;/" $L7DIRECTORD
+
+function cleanup {
+       mv $bak /usr/sbin/l7directord
+}
+
+# Start l7vsd
+$L7VSD
+
+# sleep until l7vsd start
+while :
+do
+       if [ -e "/var/run/l7vs/l7vs" ]
+       then
+               break
+       fi
+       usleep 10000
+done
+
+# Add various service
+$L7VSADM -A -t 127.0.0.1:10000 -m sessionless -s wrr -q 100M -Q 200M -b 127.0.0.1:12345 -f 1
+$L7VSADM -a -t 127.0.0.1:10000 -m sessionless -r 127.0.0.2:20000 -w 10
+$L7VSADM -a -t 127.0.0.1:10000 -m sessionless -r 127.0.0.3:30000 -w 20
+$L7VSADM -A -t 127.0.0.1:10001 -m sslid --maxlist 100  -s lc -q 100G -Q 200G -b 127.0.0.1:11111
+$L7VSADM -A -t 127.0.0.1:20000 -m ip --forwarded-for --no-reschedule
+$L7VSADM -a -t 127.0.0.1:20000 -m ip -r 127.0.0.2:20000
+$L7VSADM -a -t 127.0.0.1:20000 -m ip -r 127.0.0.3:30000 -w 0
+$L7VSADM -A -t [::1]:10060 -m sessionless -s wrr -q 100M -Q 200M -b 127.0.0.1:12345 -f 1
+$L7VSADM -a -t [::1]:10060 -m sessionless -r [::2]:20000 -w 10
+$L7VSADM -a -t [::1]:10060 -m sessionless -r [::3]:30000 -w 20
+$L7VSADM -A -t [::1]:10061 -m sslid --maxlist 100  -s lc -q 100G -Q 200G -b 127.0.0.1:11111
+$L7VSADM -A -t [::1]:20060 -m ip --forwarded-for --no-reschedule
+$L7VSADM -a -t [::1]:20060 -m ip -r 127.0.0.1:20000
+$L7VSADM -a -t [::1]:20060 -m ip -r 127.0.0.1:30000 -w 0
+
+# Start l7directord
+$INIT_L7DIRECTORD start 
+
+# sleep until l7directord stop
+while :
+do
+       ps aux | grep /usr/sbin/l7directord | grep -v grep
+       if [ $? -ne 0 ]
+       then
+               break
+       fi
+       usleep 10000
+done
+
+# analyze result
+analyze="/tmp/`uuidgen`.log"
+grep -A 300 VAR /var/log/l7vs/l7directord.log | sed -e "s/^\[[^\]*\] //" > $analyze
+diff $analyze ./materials/l7directord-3-2-9.log
+if [ $? -ne 0 ]
+then
+       cleanup
+        echo "Test failed: Dumper result was not matched."
+       exit 1
+fi
+
+cleanup
+exit 0
diff --git a/test/script/l7directord/materials/l7directord-1-1-3-l7directord.cf b/test/script/l7directord/materials/l7directord-1-1-3-l7directord.cf
new file mode 100644 (file)
index 0000000..7bce52d
--- /dev/null
@@ -0,0 +1 @@
+logfile = local0
diff --git a/test/script/l7directord/materials/l7directord-1-1-4-l7directord.cf b/test/script/l7directord/materials/l7directord-1-1-4-l7directord.cf
new file mode 100644 (file)
index 0000000..5501d9e
--- /dev/null
@@ -0,0 +1,17 @@
+logfile=mail
+virtual=127.0.0.1:10000
+    real=127.0.0.2:80
+    real=127.0.0.3:80
+    service=http
+virtual=127.0.0.1:20000
+    real=127.0.0.2:80
+    real=127.0.0.3:80
+    service=https
+virtual=127.0.0.1:30000
+    real=127.0.0.2:80
+    real=127.0.0.3:80
+    checktype=connect
+virtual=127.0.0.1:40000
+    real=127.0.0.2:80
+    real=127.0.0.3:80
+    checktype=ping
diff --git a/test/script/l7directord/materials/l7directord-1-2-47-l7directord.cf b/test/script/l7directord/materials/l7directord-1-2-47-l7directord.cf
new file mode 100644 (file)
index 0000000..9d5554e
--- /dev/null
@@ -0,0 +1,108 @@
+# <- COMMENT
+checktimeout=0
+negotiatetimeout='1"
+ checkinterval="1"
+retryinterval     1
+configinterval   = '1O'
+checkcount=  (1)
+
+autoreload   = 1
+quiescent    = "0"
+
+fallback="1.1.1.1:foobar"
+fallback="foobar:ftp-data"
+
+callback  =  /proc/1
+
+execute=/proc/100000
+execute="/etc/sh@dow"
+
+logfile     =   "/proc/100000"
+
+ supervised
+
+virtual=1.1.1.1:80 masq
+virtual=1.1.1.1:httpd
+
+virtual=1.1.1.1:80 # <- DO NOT comment out
+   real=localhost
+    real=localtime
+    real=256.1.1.1
+    request = ""
+    receive = ''
+    login   =
+    passwd  = # comment
+    database    foobar
+    virtualhost "###"
+    checktype = connects
+    fallback="localhost:http'
+    module    =  'url'
+    sorryserver="localhost:65536"
+
+negotiatetimeout=100 # <- DO NOT comment out
+    real    =   '127.0.0.1->127.0.0.2:http'
+    real    =   '127.0.0.3:http masq'
+    real    =   '127.0.0.4:http 10 req, rec'
+    request     ='foobar'
+    receive     ='foobar'
+    login       ='foobar'
+    passwd      ='foobar'
+    database    ='foobar'
+    virtualhost ='foobar'
+    checktype   =negotiate
+    checkport   =   "1"
+    scheduler   =   'lc'
+    service='https'
+    httpmethod    =  HEAD
+    fallback = 1.1.1.1:80
+    quiescent    = "yes"
+    module    =  'sessionless --other option'
+    sorryserver    =       localhost:http
+    qosup    =  '1G'
+    qosdown    =  1M
+
+virtual    =    "localhost:80" # <- DO NOT comment out
+    real   =   localhost:80 gate 10
+    real   =   "localhost:25 -1"
+    checktype  =pong
+    checktimeout    =   one
+    negotiatetimeout=   two
+    checkinterval   =   three
+    retryinterval   =   four
+    checkcount      =   five
+    maxconn         =   six
+    scheduler   =   "wlc"
+    protocol = 'udp'
+    quiescent    = "N0"
+    module    =  crewrite --other option
+    sorryserver  =   "2.256.2.2:http"
+    qosup="010M"
+    qosdown    =  100
+    realrecovercallback="/bin/wsh"
+    realdowncallback    =  /etc/passwd
+    unknown
+
+unknown
+
+virtual    =    localhost:http # <- DO NOT comment out
+    real="1.1.1.1->0.0.0.0:80 masq 100 request receive"
+    real   =    "1.1.1.1:80 masq request "
+    real   =    "2.2.2.2->2.2.2.5 masq 'request' receive "
+    request     =   ''
+    receive     =   ''
+    checktype=0
+    maxconn=0
+    checkport   =   65536
+    scheduler   =   fast
+    protocol="ICMP"
+    service="Oracle"
+    fallback   =     'localhost:0'
+    quiescent yes
+    module="url --other option --pattern-match ''"
+    qosup='999T'
+    qosdown    =  0M
+    realdowncallback="/proc/1"
+    realrecovercallback=/bin/qsh
+/*
+COMMENT
+*/
diff --git a/test/script/l7directord/materials/l7directord-3-2-1-l7directord.cf b/test/script/l7directord/materials/l7directord-3-2-1-l7directord.cf
new file mode 100644 (file)
index 0000000..f75ba16
--- /dev/null
@@ -0,0 +1 @@
+virtual=127.0.0.1:10000
diff --git a/test/script/l7directord/materials/l7directord-3-2-2-l7directord.cf b/test/script/l7directord/materials/l7directord-3-2-2-l7directord.cf
new file mode 100644 (file)
index 0000000..2c621d1
--- /dev/null
@@ -0,0 +1,2 @@
+virtual=127.0.0.1:10000
+       real=127.0.0.2:10000
diff --git a/test/script/l7directord/materials/l7directord-3-2-3-l7directord.cf b/test/script/l7directord/materials/l7directord-3-2-3-l7directord.cf
new file mode 100644 (file)
index 0000000..f75ba16
--- /dev/null
@@ -0,0 +1 @@
+virtual=127.0.0.1:10000
diff --git a/test/script/l7directord/materials/l7directord-3-2-4-l7directord.cf b/test/script/l7directord/materials/l7directord-3-2-4-l7directord.cf
new file mode 100644 (file)
index 0000000..c4d0b8f
--- /dev/null
@@ -0,0 +1,8 @@
+virtual=127.0.0.1:10000
+       sorryserver=127.0.0.2:20000 masq
+       qosup=100M
+       qosdown=1G
+virtual=127.0.0.1:10001
+       sorryserver=127.0.0.2:20000 tproxy
+       qosup=100M
+       qosdown=1G
diff --git a/test/script/l7directord/materials/l7directord-3-2-5-l7directord.cf b/test/script/l7directord/materials/l7directord-3-2-5-l7directord.cf
new file mode 100644 (file)
index 0000000..f75ba16
--- /dev/null
@@ -0,0 +1 @@
+virtual=127.0.0.1:10000
diff --git a/test/script/l7directord/materials/l7directord-3-2-6-l7directord.cf b/test/script/l7directord/materials/l7directord-3-2-6-l7directord.cf
new file mode 100644 (file)
index 0000000..db53fa5
--- /dev/null
@@ -0,0 +1,3 @@
+virtual=127.0.0.1:10000
+    real=127.0.0.1:20000
+    real=127.0.0.1:30000 tproxy 3
diff --git a/test/script/l7directord/materials/l7directord-3-2-7-l7directord.cf b/test/script/l7directord/materials/l7directord-3-2-7-l7directord.cf
new file mode 100644 (file)
index 0000000..59951a1
--- /dev/null
@@ -0,0 +1,3 @@
+virtual=127.0.0.1:10000
+    real=127.0.0.1:20000 2
+    real=127.0.0.1:30000 tproxy 3
diff --git a/test/script/l7directord/materials/l7directord-3-2-8-l7directord.cf b/test/script/l7directord/materials/l7directord-3-2-8-l7directord.cf
new file mode 100644 (file)
index 0000000..f75ba16
--- /dev/null
@@ -0,0 +1 @@
+virtual=127.0.0.1:10000
diff --git a/test/script/l7directord/materials/l7directord-3-2-9.log b/test/script/l7directord/materials/l7directord-3-2-9.log
new file mode 100644 (file)
index 0000000..24f07e7
--- /dev/null
@@ -0,0 +1,116 @@
+$VAR1 = {
+          'tcp:[::1]:10061:sslid' => {
+                                       'other_virtual_option' => ' none none none none'
+                                     },
+          'tcp:127.0.0.1:20000:ip' => {
+                                        'other_virtual_option' => ' none none none none',
+                                        '127.0.0.3:30000' => {
+                                                               'forward' => 'Masq',
+                                                               'weight' => '0',
+                                                               'option' => {
+                                                                             'flags' => '-r 127.0.0.3:30000',
+                                                                             'forward' => '-M'
+                                                                           },
+                                                               'server' => {
+                                                                             'ip' => '127.0.0.3',
+                                                                             'port' => '30000'
+                                                                           }
+                                                             },
+                                        '127.0.0.2:20000' => {
+                                                               'forward' => 'Masq',
+                                                               'weight' => '1',
+                                                               'option' => {
+                                                                             'flags' => '-r 127.0.0.2:20000',
+                                                                             'forward' => '-M'
+                                                                           },
+                                                               'server' => {
+                                                                             'ip' => '127.0.0.2',
+                                                                             'port' => '20000'
+                                                                           }
+                                                             }
+                                      },
+          'tcp:127.0.0.1:10000:sessionless' => {
+                                                 'other_virtual_option' => ' none none none none',
+                                                 '127.0.0.3:30000' => {
+                                                                        'forward' => 'Masq',
+                                                                        'weight' => '20',
+                                                                        'option' => {
+                                                                                      'flags' => '-r 127.0.0.3:30000',
+                                                                                      'forward' => '-M'
+                                                                                    },
+                                                                        'server' => {
+                                                                                      'ip' => '127.0.0.3',
+                                                                                      'port' => '30000'
+                                                                                    }
+                                                                      },
+                                                 '127.0.0.2:20000' => {
+                                                                        'forward' => 'Masq',
+                                                                        'weight' => '10',
+                                                                        'option' => {
+                                                                                      'flags' => '-r 127.0.0.2:20000',
+                                                                                      'forward' => '-M'
+                                                                                    },
+                                                                        'server' => {
+                                                                                      'ip' => '127.0.0.2',
+                                                                                      'port' => '20000'
+                                                                                    }
+                                                                      }
+                                               },
+          'tcp:127.0.0.1:10001:sslid' => {
+                                           'other_virtual_option' => ' none none none none'
+                                         },
+          'tcp:[::1]:20060:ip' => {
+                                    'other_virtual_option' => ' none none none none',
+                                    '127.0.0.1:30000' => {
+                                                           'forward' => 'Masq',
+                                                           'weight' => '0',
+                                                           'option' => {
+                                                                         'flags' => '-r 127.0.0.1:30000',
+                                                                         'forward' => '-M'
+                                                                       },
+                                                           'server' => {
+                                                                         'ip' => '127.0.0.1',
+                                                                         'port' => '30000'
+                                                                       }
+                                                         },
+                                    '127.0.0.1:20000' => {
+                                                           'forward' => 'Masq',
+                                                           'weight' => '1',
+                                                           'option' => {
+                                                                         'flags' => '-r 127.0.0.1:20000',
+                                                                         'forward' => '-M'
+                                                                       },
+                                                           'server' => {
+                                                                         'ip' => '127.0.0.1',
+                                                                         'port' => '20000'
+                                                                       }
+                                                         }
+                                  },
+          'tcp:[::1]:10060:sessionless' => {
+                                             'other_virtual_option' => ' none none none none',
+                                             '[::3]:30000' => {
+                                                                'forward' => 'Masq',
+                                                                'weight' => '20',
+                                                                'option' => {
+                                                                              'flags' => '-r [::3]:30000',
+                                                                              'forward' => '-M'
+                                                                            },
+                                                                'server' => {
+                                                                              'ip' => '[::3]',
+                                                                              'port' => '30000'
+                                                                            }
+                                                              },
+                                             '[::2]:20000' => {
+                                                                'forward' => 'Masq',
+                                                                'weight' => '10',
+                                                                'option' => {
+                                                                              'flags' => '-r [::2]:20000',
+                                                                              'forward' => '-M'
+                                                                            },
+                                                                'server' => {
+                                                                              'ip' => '[::2]',
+                                                                              'port' => '20000'
+                                                                            }
+                                                              }
+                                           }
+        };
index 9b543e2..db7caed 100755 (executable)
@@ -201,7 +201,7 @@ LOG "Test scripts end."
 # Aftertreatment
 ###################
 # Stop UltraMonkey-L7.
-. ${STOP_MONKEY}
+#. ${STOP_MONKEY}
 # Restore log and config files.
 . ${RESTORE_FILE}
 # Delete temp directory