Browse code

Tools for automated network profiling.

Jiri Kuthan authored on 06/10/2001 22:20:55
Showing 2 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,103 @@
1
+#!/bin/sh -x
2
+
3
+# profile filename
4
+PREF=$1
5
+# number of cycles
6
+NROFCYCLES=4
7
+# functions to go into report
8
+MYFN="eat_line|eat_space|eat_token"
9
+# set to non-zero if only a report is to be generated
10
+#REPONLY=tru
11
+
12
+SRD=${HOME}/sip_router
13
+PRO=${SRD}/profile
14
+REP=$PRO/$PREF.txt
15
+
16
+
17
+function usage()
18
+{
19
+cat << EOF
20
+usage: $0 profile_name
21
+
22
+currently, this script starts a remote sender at alioth.
23
+The sender iterates through all messages available in its
24
+directory and send them many times (should be configurable).
25
+Sip-router is configured to relay requests to benetnash:sink
26
+and responses are built to be routed there too.
27
+This repeats NROFCYCLES-times. Results of all cycles are then
28
+dumped into <profile_name>-<cycle number>.txt and a
29
+report <profile_name>.txt is generated.
30
+
31
+EOF
32
+
33
+exit 1
34
+}
35
+
36
+if [ "$#" -ne 1 ] ; then
37
+	usage
38
+fi
39
+
40
+cd $SRD
41
+
42
+function run()
43
+{
44
+j=0
45
+while [ $j -lt "$NROFCYCLES" ] ; do
46
+i=`printf "%.3d" $j`
47
+j=`expr $j + 1`
48
+
49
+echo "*** Entering cycle $j"
50
+
51
+/usr/bin/time --output="$PRO/${PREF}-${i}-time.txt" ${SRD}/sip_router  -l 192.168.99.100 -D -E -d -f ${PRO}/profile.cfg  &
52
+
53
+#rsh -l jku benetnash.fokus.gmd.de 'nohup bin/sock -s -u 5060 '
54
+
55
+rsh -l jku alioth.fokus.gmd.de 'nohup tmp/sipp/start.sh '
56
+
57
+killall -INT sip_router
58
+
59
+gprof sip_router > $PRO/${PREF}-${i}.txt
60
+
61
+done
62
+}
63
+
64
+function report()
65
+{
66
+cat > $REP << EOF
67
+first line ... time spent in tested procedure
68
+second line (yyrestart) ... total time
69
+third line (receive_msg) ... numer of calls
70
+   %   cumulative   self              self     total
71
+ time   seconds   seconds    calls  ms/call  ms/call  name
72
+EOF
73
+
74
+j=0
75
+while [ $j -lt "$NROFCYCLES" ] ; do
76
+i=`printf "%.3d" $j`
77
+j=`expr $j + 1`
78
+  FN="${PRO}/${PREF}-${i}.txt"
79
+  echo >> $REP
80
+  echo >> $REP
81
+  echo $FN >> $REP
82
+  egrep "($MYFN|yyrestart)" $FN | grep -v '\[' >> $REP
83
+  grep 'receive_msg \[.\]' $FN | grep -v '\/' >> $REP
84
+  echo >> $REP
85
+  cat $PRO/${PREF}-${i}-time.txt >> $REP
86
+
87
+done
88
+
89
+cat >> $REP << EOF
90
+
91
+
92
+Execution environment:
93
+EOF
94
+cat /proc/cpuinfo /proc/meminfo >> $REP
95
+}
96
+
97
+if [ -z "$REPONLY" ] ; then
98
+	run
99
+fi
100
+report
101
+
102
+echo '*** finished ***'
103
+echo
0 104
new file mode 100644
... ...
@@ -0,0 +1,68 @@
1
+# first sort out iptel.org requests from those destined somewhere else
2
+####################################################################################
3
+
4
+route[0] {
5
+# request for iptel.org with IP address in it ... fix it and proceed
6
+# note: may result in troubles as authentication covers URI
7
+uri=~"^sip:.*195\.37\.77\.101" rewritehost("iptel.org"); route(1);
8
+
9
+# request for iptel.org ... proceed
10
+uri=~"iptel.org" route(1);
11
+
12
+# requests to somewhere else
13
+# - REGISTERs denied
14
+method=="REGISTER" log("attempt to relay REGISTERs"); drop;
15
+
16
+# - anything else relayed via our outbound proxy
17
+uri=~"."  forward("benetnash.fokus.gmd.de", 9);
18
+}
19
+
20
+
21
+# iptel.org traffic
22
+####################################################################################
23
+
24
+route [1] {
25
+
26
+# recognize traffic we want to authenticate -- handled first to make sure 
27
+# it will be captured before we proceed to non-authenticating routes;
28
+# authentication for registrations or calls via Telekom which start
29
+# with optional + and 0
30
+
31
+#PROFILE
32
+(method=='REGISTER' | uri=~"sip:+?0[0-9]*@iptel\.org") forward("benetnash.fokus.gmd.de", 9);
33
+
34
+# dealing with voicemail 
35
+# we need to switch traffic to voicemail directly before CSPS
36
+# would screw it up -- it cannot deal with port numbers
37
+
38
+(uri=~'mail.iptel.org' | uri=~'iptel.org:6060' ) forward("benetnash.fokus.gmd.de", 9);
39
+
40
+# default route: go to non-authenicating proxy
41
+#PROFILE
42
+(method=~".")					forward("benetnash.fokus.gmd.de", 9 );
43
+
44
+}
45
+
46
+# We split traffic to authenticating and non-authenticating
47
+# SIP proxies here using sip_router. We only authenticate REGISTERs
48
+# and PSTN destinations, everything else is not authenticated.
49
+#
50
+# This is a work-around for CSPS's authenticate all-or-nothing
51
+# policy which would eliminate non-iptel.org users calling us.
52
+# Both proxies run at separate hosts (because they would otherwise
53
+# conflict with each other).
54
+#
55
+# I chose to put the non-authentication proxy on the public host
56
+# because we use it for outbound routing -- that would not work
57
+# if the proxy would be in non-routable realm. Drawback:
58
+# SQL and Cisco synchronization noise between dog and fox.
59
+# Note that this
60
+# leaves a non-authenticating port 5060 which could be misued
61
+# to steal REGISTERs. It would be perhaps a good idea to make
62
+# it available only for requests from sip_router.
63
+#
64
+#                        /--REGISTERs----dog:5061,w/auth
65
+#      iptel.org:5060---/                             ||   proprietary Cisco contact DB sharing
66
+#                        \                            ||   and MySQL
67
+#                        \---anything_else----iptel.org:5061,w/o/auth
68
+