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