Convert Citrix Xen image (.xva) to KVM Image (.img)

March 20th, 2014 No comments

You have a .xva file (Citrix XEN image) and you want to convert it to raw .img file (to be used with kvm i.e.).

Here is how you can do it:

[root@linux XEN]# ls -lh
-rw-r--r-- 1 root root  24G Feb 24 12:44 template_win7.xva
[root@linux XEN]# tar xvf template_win7.xva
...
Ref:5/00024095.checksum
tar: Ref:5/00024095.checksum: implausibly old time stamp 1970-01-01 02:00:00
Ref:5/00024096
tar: Ref:5/00024096: implausibly old time stamp 1970-01-01 02:00:00
Ref:5/00024096.checksum
...
[root@linux XEN]# ls -l
---------- 1 root root   30251 Jan  1  1970 ova.xml
drwxr-xr-x 2 root root 1527808 Feb 24 11:10 Ref:5

Now, you have a folder Ref:5 and ova.xml file (The folder name might be different for you). It’s time to get the conversion tool:

[root@linux XEN]# wget -O xenmigrate.py http://jolokianetworks.com/@api/deki/files/29/=xenmigrate.py?revision=11
--2014-02-24 12:49:03--  http://jolokianetworks.com/@api/deki/files/29/=xenmigrate.py?revision=11
Resolving jolokianetworks.com... 70.42.141.51, 2604:1900:0:10:a800:c7ff:fe81:2a02
Connecting to jolokianetworks.com|70.42.141.51|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19883 (19K) [text/plain]
Saving to: “xenmigrate.py”
 
100%[=====================================================================================>] 19,883      18.9K/s   in 1.0s
 
2014-02-24 12:49:06 (18.9 KB/s) - “xenmigrate.py” saved [19883/19883]

I had problems with the latest version, therefore I got the version 11. You may also check the website for the latest one.

Run the script (Ref:5 is used since the extracted directory name was that):

[root@linux XEN]# python xenmigrate.py --debug --convert=Ref\:5/ win7_template.img
xenmigrate 0.7.2 -- 2010.01.01
(c)2010 Jolokia Networks and Mark Pace -- jolokianetworks.com
convert ref dir   : Ref:5/
to raw file       : win7_template.img
ref dir           : Ref:5/
to raw file       : win7_template.img
gzip              : False
last file         : 48531
disk image size   : 47 GB
RW notification every: 1.0GB
Converting:
 1.0GBrw 2.0GBrw 3.0GBrw 4.0GBrw 5.0GBrw 6.0GBrw 7.0GBrw 8.0GBrw 9.0GBrw
 10.0GBrw 11.0GBrw 12.0GBrw 13.0GBrw 14.0GBrw 15.0GBrw 16.0GBrw 17.0GBrw
 18.0GBrw 19.0GBrw 20.0GBrw 21.0GBrw 22.0GBrw 23.0GBrw 24.0GBrw 25.0GBrw
 26.0GBrw 27.0GBrw 28.0GBrw 29.0GBrw 30.0GBrw 31.0GBrw 32.0GBrw 33.0GBrw
 34.0GBrw 35.0GBrw 36.0GBrw 37.0GBrw 38.0GBrw 39.0GBrw 40.0GBrw 41.0GBrw
 42.0GBrw 43.0GBrw 44.0GBrw 45.0GBrw 46.0GBrw 47.0GBrw
Successful convert

Voila, you have the .img file, you may use it with your KVM:

[root@linux XEN]# ls -lh
-rw-r--r-- 1 root root  40G Feb 24 12:44 win7_template.img
---------- 1 root root  30K Jan  1  1970 ova.xml
drwxr-xr-x 2 root root 1.5M Feb 24 11:10 Ref:5
-rw-r--r-- 1 root root  20K Jan  1  2010 xenmigrate.py
Categories: Unix/Linux Tags:

vsftpd Virtual Users with BerkeleyDB and PAM

February 4th, 2014 No comments

You have a ftp server and don’t want to add new users to your system. Therefore, you decided to provide virtual users which is supported by vsftpd using PAM. You will need bdb, here is how to install it on RHEL/Centos:

[root@linux ~]# yum install db4-utils db4

Later, you will need python and python-libs if you want to use a simple script that I wrote to manage the users.

In order to create a db4 database file, we will need a text file with username and password on each line. For example:

[root@linux ~]# cat virtual_users.txt
user1
pass1
user2
pass2

After you have that file, you can create the db4 database with the following command:

[root@linux ~]# db_load -T -t hash -f /tmp/virtual_users.txt /etc/vsftpd/vsftpd-virtual-user.db
[root@linux ~]# chmod 600 /etc/vsftpd/vsftpd-virtual-user.db
[root@linux ~]# rm /tmp/virtual_users.txt

We need to create a PAM file to read our database: (here I wrote the related parameters with virtual users, you may need more settings depending on your needs)

[root@linux ~]# cat /etc/pam.d/vsftpd.virtual
#%PAM-1.0
auth       required     pam_userdb.so db=/etc/vsftpd/vsftpd-virtual-user
account    required     pam_userdb.so db=/etc/vsftpd/vsftpd-virtual-user
session    required     pam_loginuid.so

Now, we will edit vsftpd configuration file to use our virtual user database:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
[root@linux ~]# cat /etc/vsftpd/vsftpd.conf
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Virtual users will use the same privileges as local users.
# It will grant write access to virtual users. Virtual users will use the
# same privileges as anonymous users, which tends to be more restrictive
# (especially in terms of write access).
virtual_use_local_privs=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# The target log file can be vsftpd_log_file or xferlog_file.
# This depends on setting xferlog_std_format parameter
xferlog_enable=YES
#
# The name of log file when xferlog_enable=YES and xferlog_std_format=YES
# WARNING - changing this filename affects /etc/logrotate.d/vsftpd.log
xferlog_file=/var/log/xferlog
#
# Switches between logging into vsftpd_log_file and xferlog_file files.
# NO writes to vsftpd_log_file, YES to xferlog_file
xferlog_std_format=YES
#
# You may fully customise the login banner string:
ftpd_banner=Welcome to our FTP service.
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
chroot_local_user=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#
# PAM file that was created for virtual users
pam_service_name=vsftpd.virtual
userlist_enable=YES
tcp_wrappers=YES
#
# Activates virtual users
guest_enable=YES
#
# Automatically generate a home directory for each virtual user, based on a template.
# For example, if the home directory of the real user specified via guest_username is
# /home/virtual/$USER, and user_sub_token is set to $USER, then when virtual user vivek
# logs in, he will end up (usually chroot()'ed) in the directory /home/virtual/vivek.
# This option also takes affect if local_root contains user_sub_token.
user_sub_token=$USER
#
# Usually this is mapped to Apache virtual hosting docroot, so that
# Users can upload files
local_root=/home/vftp/$USER
#
# Hide ids from user
hide_ids=YES
[root@linux ~]# cat /etc/vsftpd/vsftpd.conf
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Virtual users will use the same privileges as local users.
# It will grant write access to virtual users. Virtual users will use the
# same privileges as anonymous users, which tends to be more restrictive
# (especially in terms of write access).
virtual_use_local_privs=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# The target log file can be vsftpd_log_file or xferlog_file.
# This depends on setting xferlog_std_format parameter
xferlog_enable=YES
#
# The name of log file when xferlog_enable=YES and xferlog_std_format=YES
# WARNING - changing this filename affects /etc/logrotate.d/vsftpd.log
xferlog_file=/var/log/xferlog
#
# Switches between logging into vsftpd_log_file and xferlog_file files.
# NO writes to vsftpd_log_file, YES to xferlog_file
xferlog_std_format=YES
#
# You may fully customise the login banner string:
ftpd_banner=Welcome to our FTP service.
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
chroot_local_user=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#
# PAM file that was created for virtual users
pam_service_name=vsftpd.virtual
userlist_enable=YES
tcp_wrappers=YES
#
# Activates virtual users
guest_enable=YES
#
# Automatically generate a home directory for each virtual user, based on a template.
# For example, if the home directory of the real user specified via guest_username is
# /home/virtual/$USER, and user_sub_token is set to $USER, then when virtual user vivek
# logs in, he will end up (usually chroot()'ed) in the directory /home/virtual/vivek.
# This option also takes affect if local_root contains user_sub_token.
user_sub_token=$USER
#
# Usually this is mapped to Apache virtual hosting docroot, so that
# Users can upload files
local_root=/home/vftp/$USER
#
# Hide ids from user
hide_ids=YES

We provided our PAM file on the 51st line. Our FTP home directory is /home/vftp according to line 67. Therefore, we need to create those directories:

[root@linux ~]# mkdir /home/vftp
[root@linux ~]# mkdir /home/vftp/user1
[root@linux ~]# mkdir /home/vftp/user2
[root@linux ~]# chown -R ftp:ftp /home/vftp

Now, all we need is to restart vsftpd:

[root@linux ~]# service vsftpd restart
Shutting down vsftpd:                                      [  OK  ]
Starting vsftpd for vsftpd:                                [  OK  ]

In order to add or remove users, you may use this script. It does simple job, you may change is as you want:

[root@linux ~]# ./virtual_ftp_user.py -a user3 -p pass3
user3 was added successfully...
[root@linux ~]# ./virtual_ftp_user.py -d user1
Username user1 was deleted successfully...
[root@linux ~]# ./virtual_ftp_user.py -d user1
No such user user1
[root@linux ~]# ./virtual_ftp_user.py -s True
user2 : pass2
user3 : pass3
[root@linux ~]# ./virtual_ftp_user.py -a user3 -p password3
user3 was updated successfully...
[root@linux ~]# ./virtual_ftp_user.py -s True
user2 : pass2
user3 : password3
[root@linux ~]# ./virtual_ftp_user.py -h
Usage: virtual_ftp_user.py (-a <USERNAME> -p <PASSWORD> || -d <USERNAME> || -s (True|False) ) -f <VIRTUALDB_FILE>

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -a USERNAME, --add=USERNAME
                        Username to add
  -d DEL_USER, --delete=DEL_USER
                        Username to delete
  -p PASSWORD, --password=PASSWORD
                        User Password
  -s SHOWDB, --showdb=SHOWDB
                        Show Virtual User Database Content
  -f BSDDB_FILE, --file=BSDDB_FILE
                        Virtual User Database. Default is /etc/vsftpd/vsftpd-virtual-user.db

After adding a new user (user3 in the above example), you need to create the home directory manually: (I plan to add this to the python script)

[root@linux ~]# mkdir /home/vftp/user3
[root@linux ~]# chown -R ftp:ftp /home/vftp/user3

When a virtual user logs in, it will be written on the /var/log/secure file:

[root@linux ~]# grep vsftpd /var/log/secure
Feb  3 14:09:36 linux vsftpd[5168]: pam_userdb(vsftpd.virtual:auth): user 'user3' granted access
Categories: Unix/Linux Tags:

Difference between du and df outputs in Linux

May 13th, 2013 No comments

You’ve got an alarm from your server in the middle of the night that the /global/logs partition is 97% is full. You logged in and run the following commands and see this:

[root@linux ~ ]# df -h /global/logs 
Filesystem      size   used  avail capacity  Mounted on
/dev/sda3        98G    96G     2G    77%    /global/logs
[root@linux ~ ]# cd /global/logs/
[root@linux ~ ]# du -ksh
  74G   .

df tells that 96 GB is in use under /global/logs, but when you checked it there, you see that only 74 GB is in use. This is due to a deletion of a file which was was still opened by a process. du gets its data from directory listing, however df gets the data from the kernel. The easiest way to get your space back is to restart the process. Here is how you can find it:

[root@linux ~ ]# lsof +L1     
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NLINK NODE NAME
test.sh 30497 root    1w   REG    8,3        5     0 4826 /global/logs/test.log (deleted)

+L1 to lsof shows the files which have less than 1 link, which means files without link.

You can see the file deleted under the file descriptors of the process:

[root@linux ~ ]# cd /proc/30497/fd
[root@linux fd ]# ls -l
total 0
lrwx------. 1 root root 64 May 13 09:20 0 -> /dev/pts/0
l-wx------. 1 root root 64 May 13 09:20 1 -> /global/logs/test.log (deleted)
lrwx------. 1 root root 64 May 13 09:20 2 -> /dev/pts/0
lr-x------. 1 root root 64 May 13 09:20 255 -> /root/test.sh

When you kill the PID of 30497, you will get back the space used by test.log file.

If you cannot kill that process, you can empty the file, so that you can get your space back for some time. Of course, the process will continue to write to there, so you will need to perform this again:

[root@linux fd ]# pwd
/proc/30497/fd
[root@linux fd ]# cat /dev/null > 1
Categories: Unix/Linux Tags:

Java Garbage Collection (GC) Tuning

January 26th, 2012 No comments

Recently, I attended a training which was held by a colleague. I’m not expert on JVM parameters and you may find many documents on the internet about it. I just want to share what we use and working fine on our systems. To understand the java garbage collection, you may check out that guide.

Here is some important parameters that needs to be configured to get good performance on garbage collection. These are what we use in our applications and I will try to explain them one by one:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
JVM_OPTS="-server -d64 
-Xloggc:./logs/gc_"$DATE".log 
-XX:+PrintGCDetails 
-XX:+PrintGCTimeStamps 
-XX:+PrintTenuringDistribution 
-XX:+PrintHeapAtGC 
-XX:+PrintGCTaskTimeStamps 
-XX:+UseConcMarkSweepGC 
-XX:+UseParNewGC 
-XX:+CMSClassUnloadingEnabled 
-Xms8192m -Xmx8192m 
-Xss192k 
-XX:NewSize=4096m 
-XX:MaxNewSize=4096m 
-XX:PermSize=256m -XX:MaxPermSize=256m 
-XX:ParallelGCThreads=16 
-XX:ParallelCMSThreads=12 
-XX:SurvivorRatio=8 
-XX:MaxTenuringThreshold=15 
-XX:CMSInitiatingOccupancyFraction=70 
-XX:-OmitStackTraceInFastThrow"
JVM_OPTS="-server -d64 
-Xloggc:./logs/gc_"$DATE".log 
-XX:+PrintGCDetails 
-XX:+PrintGCTimeStamps 
-XX:+PrintTenuringDistribution 
-XX:+PrintHeapAtGC 
-XX:+PrintGCTaskTimeStamps 
-XX:+UseConcMarkSweepGC 
-XX:+UseParNewGC 
-XX:+CMSClassUnloadingEnabled 
-Xms8192m -Xmx8192m 
-Xss192k 
-XX:NewSize=4096m 
-XX:MaxNewSize=4096m 
-XX:PermSize=256m -XX:MaxPermSize=256m 
-XX:ParallelGCThreads=16 
-XX:ParallelCMSThreads=12 
-XX:SurvivorRatio=8 
-XX:MaxTenuringThreshold=15 
-XX:CMSInitiatingOccupancyFraction=70 
-XX:-OmitStackTraceInFastThrow"

Line 1: Our application runs on server mod as 64 bit.

Line 2: We set the gc.log file name which will have the application start time. (You may define $DATE as DATE=`date ++%Y%m%d_%H%M` on the previous lines)

Line 3-7: The “print” lines are for what is written on the gc.log file. GC details will be written with time stamps which is number of seconds from the start time of the application. You may also use -XX:+PrintGCDateStamps instead of line 3.

Line 8: Since response time is more important for our real-time charging applications, we use the concurrent collector.

Line 9: For the new generation collection, we enable parallel new generation collector.

Line 10: By default, the classes will stay in the memory forever. Using CMSClassUnloadingEnabled will enable the class unloading from the memory which means that the GC will sweep the perm generation.

Generations

Line 11: The total “on heap” size (young+tenured) will be 8GB. Since min and max values are given the same, there will be any grow/shrink operations on the heap. Thus, the virtual boxes on the above image will not exist.

Line 12: Stack size is given as 192K. We use this on T series Sun (oracle) servers and it seems fine.

Line 13-14: New Generation size is given as 4GB. There will not be any grow/shrink operation since the min and max sizes are the same.

Line 15: Permanent size is given as 256MB. This is where the java classes and methods exist.

Line 16: Default is the number of processors on the system. On T Series, there are 256 cores, which means that there will be 256 GC threads by default. This is unnecessary, and also cause trouble of having no idle CPU on the system from time to time. Thus, the number of threads is set to 16.

Line 17: Because of this bug, the number of parallel CMS threads is set to 12.

Line 18: This parameter is a little tricky. There are 2 survivor spaces and this parameter says that the Eden will be (1_survivor_space_size * 8). Assuming that the young generation is 100 MB; 80 MB will be Eden and 10 MB will be each survivor space. Since we had set YG as 4GB, Eden will be ~3.2GB, “from” survivor space will be ~410MB and “to” survivor space will also be ~410MB.

Line 19: This parameter decides when to promote (move from young to tenured) the live object. After that number of minor collections, the object will be promoted.

Line 20: CMS will be started when 70% of the Old (tenured) generation is full.

Line 21: This line will enable correct stack backtrace when there is an exception. This is helpful when debugging the problem.

Categories: Unix/Linux Tags:

Generating Diameter Traffic Using Seagull

October 23rd, 2011 9 comments

If you work with Diameter Protocol, for example supporting diameter credit-control application as I do, then you will need to generate some diameter packages for functional or load testing. Seagull is the perfect tool for both purposes.

I will try to explain how I use it for my functional tests (creating CCR messages).

First of all, you need to install seagull. Downloading options are limited to the source code, Windows, redhat and HP-UX. I could not manage to build it on a solaris machine from the sources, so I use it on redhat Linux box. However, the configuration that I use, should be fine with windows or HP-UX as well.

After downloading the redhat package and untar it, you will have some rpm files, install them all:

[root@redhat tmp]# gunzip -c seagull-1.8.2-Linux_RHEL5U2.tar.gz | tar xvf -
packages/
packages/seagull-h248-protocol-1.8.2-linux-2.6-intel.rpm
packages/seagull-core-1.8.2-linux-2.6-intel.rpm
packages/seagull-dcc-protocol-1.8.2-linux-2.6-intel.rpm
packages/seagull-synchro-protocol-1.8.2-linux-2.6-intel.rpm
packages/seagull-diameter-protocol-1.8.2-linux-2.6-intel.rpm
packages/seagull-trans-tls-1.8.2-linux-2.6-intel.rpm
packages/seagull-msrp-protocol-1.8.2-linux-2.6-intel.rpm
packages/seagull-library-java-synchro-1.8.2-linux-2.6-intel.rpm
packages/seagull-sip-protocol-1.8.2-linux-2.6-intel.rpm
packages/seagull-trans-sctp-1.8.2-linux-2.6-intel.rpm
packages/seagull-mbi-protocol-1.8.2-linux-2.6-intel.rpm
packages/seagull-binary-body-not-interp-protocol-1.8.2-linux-2.6-intel.rpm
packages/seagull-radius-protocol-1.8.2-linux-2.6-intel.rpm
packages/seagull-tcap-ip-protocol-1.8.2-linux-2.6-intel.rpm
packages/seagull-orga-protocol-1.8.2-linux-2.6-intel.rpm
packages/seagull-external-lib-sctp-1.8.2-linux-2.6-intel.rpm
packages/seagull-xcap-protocol-1.8.2-linux-2.6-intel.rpm
packages/seagull-h323-registration-protocol-1.8.2-linux-2.6-intel.rpm
packages/seagull-crypto-1.8.2-linux-2.6-intel.rpm
packages/seagull-octcap-protocol-1.8.2-linux-2.6-intel.rpm
[root@redhat tmp]# cd packages/
[root@redhat packages]# rpm -ivh *.rpm

If you have trouble installing because of dependencies, installing seagull-core and seagull-diameter-protocol packages would also be fine.

Now, you have seagull installed under /opt :

[root@redhat packages]# cd /opt/seagull/diameter/
[root@redhat diameter]# ls
config  logs  run  scenario

Here is the files that you may use for generating one session (CCR messages) with one MSISDN. Under the config directory, you will have configuration files for diameter protocol, like AVP definitions and client/server configurations. (how many sessions to create, which server to connect, etc.)

cat config/conf.client.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?xml version="1.0" encoding="ISO-8859-1"?>
<configuration name="Simple IP Client Conf">
 
  <define entity="transport"
    name="trans-1"
    file="libtrans_ip.so"
    create_function="create_cipio_instance"
    delete_function="delete_cipio_instance"
    init-args="type=tcp">
  </define>
 
  <define entity="channel"
    name="channel-1"
    protocol="diameter-v1"
    transport="trans-1"
    open-args="mode=client;dest=192.168.1.2:3868"> 
  </define>
 
  <define entity="traffic-param" name="call-rate" value="1"></define>
  <define entity="traffic-param" name="display-period" value="1"></define>
  <define entity="traffic-param" name="log-stat-period" value="1"></define>
  <define entity="traffic-param" name="log-stat-file" value="../logs/client-stat.csv"></define>
  <define entity="traffic-param" name="call-timeout-ms" value="60000"></define>
  <define entity="traffic-param" name="display-scenario-stat" value="true"></define>
  <define entity="traffic-param" name="display-protocol-stat" value="true"></define>
  <define entity="traffic-param" name="log-protocol-stat-period" value="5"></define>
  <define entity="traffic-param" name="log-protocol-stat-name" value="all"></define>
  <define entity="traffic-param" name="log-protocol-stat-file" value="../logs/client-protocol-stat.csv"></define>
 
  <define entity="traffic-param" name="max-send" value="1440000"></define>
  <define entity="traffic-param" name="max-receive" value="1440000"></define>
  <define entity="traffic-param" name="max-simultaneous-calls" value="5000"></define>
  <define entity="traffic-param" name="select-timeout-ms" value="1000"></define>
 
  <define entity="traffic-param" name="number-calls" value="1"></define> 
  <define entity="traffic-param" name="external-data-file" value="../scenario/msisdn.csv"> </define>
<!--  <define entity="traffic-param" name="external-data-select" value="random"> </define> -->
<!--  <define entity="traffic-param" name="model-traffic-select" value="poisson"> </define> -->
  
</configuration>
<?xml version="1.0" encoding="ISO-8859-1"?>
<configuration name="Simple IP Client Conf">

  <define entity="transport"
    name="trans-1"
    file="libtrans_ip.so"
    create_function="create_cipio_instance"
    delete_function="delete_cipio_instance"
    init-args="type=tcp">
  </define>

  <define entity="channel"
    name="channel-1"
    protocol="diameter-v1"
    transport="trans-1"
    open-args="mode=client;dest=192.168.1.2:3868"> 
  </define>

  <define entity="traffic-param" name="call-rate" value="1"></define>
  <define entity="traffic-param" name="display-period" value="1"></define>
  <define entity="traffic-param" name="log-stat-period" value="1"></define>
  <define entity="traffic-param" name="log-stat-file" value="../logs/client-stat.csv"></define>
  <define entity="traffic-param" name="call-timeout-ms" value="60000"></define>
  <define entity="traffic-param" name="display-scenario-stat" value="true"></define>
  <define entity="traffic-param" name="display-protocol-stat" value="true"></define>
  <define entity="traffic-param" name="log-protocol-stat-period" value="5"></define>
  <define entity="traffic-param" name="log-protocol-stat-name" value="all"></define>
  <define entity="traffic-param" name="log-protocol-stat-file" value="../logs/client-protocol-stat.csv"></define>

  <define entity="traffic-param" name="max-send" value="1440000"></define>
  <define entity="traffic-param" name="max-receive" value="1440000"></define>
  <define entity="traffic-param" name="max-simultaneous-calls" value="5000"></define>
  <define entity="traffic-param" name="select-timeout-ms" value="1000"></define>

  <define entity="traffic-param" name="number-calls" value="1"></define> 
  <define entity="traffic-param" name="external-data-file" value="../scenario/msisdn.csv"> </define>
<!--  <define entity="traffic-param" name="external-data-select" value="random"> </define> -->
<!--  <define entity="traffic-param" name="model-traffic-select" value="poisson"> </define> -->
  
</configuration>

On the 16th line, the mode is defined as “client” and the destination is given (The IP address and Port of the Diameter Server). The number of sessions is defined on the 36th line as 1. This means that we will need one MSISDN, and this will be read from “../scenario/msisdn.csv” file given on the 37th line. Explanations for the other parameters can be found here.

The config directory also includes the AVP definitions. If your application has some vendor specific AVPs, they must be defined here. Below are some example from my Vodafone dcca application on base_cc.xml file:

1
2
3
4
5
6
7
8
9
10
    <define name="Radio-Access-Technology" type="Unsigned32">
      <setfield name="avp-code" value="260"></setfield>
      <setfield name="flags" value="192"></setfield>
      <setfield name="Vendor-ID" value="12645"></setfield>
    </define>
    <define name="RulebaseId" type="OctetString">
     <setfield name="avp-code" value="262"></setfield>
     <setfield name="flags" value="192"></setfield>
     <setfield name="Vendor-ID" value="12645"></setfield>
    </define>
    <define name="Radio-Access-Technology" type="Unsigned32">
      <setfield name="avp-code" value="260"></setfield>
      <setfield name="flags" value="192"></setfield>
      <setfield name="Vendor-ID" value="12645"></setfield>
    </define>
    <define name="RulebaseId" type="OctetString">
     <setfield name="avp-code" value="262"></setfield>
     <setfield name="flags" value="192"></setfield>
     <setfield name="Vendor-ID" value="12645"></setfield>
    </define>

Logs and run directories are self-explanatory. The run directory has the start scripts, you will need the CC starter.

cat run/start_client_cc.ksh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/ksh
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# (c)Copyright 2006 Hewlett-Packard Development Company, LP.
#
#
 
export LD_LIBRARY_PATH=/usr/local/bin
 
seagull -conf ../config/conf.client.xml -dico ../config/base_cc.xml -scen ../scenario/ccr-cca.client.xml \
-log ../logs/ccr-cca.client.log -llevel A
#!/bin/ksh
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# (c)Copyright 2006 Hewlett-Packard Development Company, LP.
#
#

export LD_LIBRARY_PATH=/usr/local/bin

seagull -conf ../config/conf.client.xml -dico ../config/base_cc.xml -scen ../scenario/ccr-cca.client.xml \
-log ../logs/ccr-cca.client.log -llevel A

The scenario directory will have traffic configuration: which AVPs to send, how many update requests, wait period between messages, etc. That is the most important part. First of all, the msisdn.csv file which was mentioned on conf.client.xml:

[root@redhat scenario]# cat msisdn.csv 
"string";
"905425020100";

If you will have load testing, then you may add new MSISDNs on the new lines:

"string";
"905425020100";
"905425020101";
"905425020102";
"905425020103";
"905425020104";
"905425020105";

In the scenario file, there will be one CER and some CCR messages. Here is the file that I use, I will try to explain the important lines later.

cat scenario/ccr-cca.client.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
<?xml version="1.0" encoding="ISO-8859-1" ?>
<scenario>
 
<counter>
  <counterdef name="HbH-counter" init="1000"> </counterdef>
  <counterdef name="EtE-counter" init="2000"> </counterdef>
  <counterdef name="session-counter" init="5"> </counterdef>
</counter>
 
<init>
  <send channel="channel-1">
    <command name="CER">
      <avp name="Origin-Host" value="c0-10-182-7-131-gggnse99"> </avp>
      <avp name="Origin-Realm" value="charge.se"> </avp>
      <avp name="Host-IP-Address" value="0x0001AC191768"> </avp> <!-- 172.25.23.104 -->
      <avp name="Vendor-Id" value="193"> </avp>
      <avp name="Product-Name" value="Ericsson J20 GGSN"> </avp>
      <avp name="Origin-State-Id" value="14"> </avp>
      <avp name="Supported-Vendor-Id" value="10415"> </avp>
      <avp name="Supported-Vendor-Id" value="12645"> </avp>
      <avp name="Auth-Application-Id" value="4"> </avp>
    </command>
  </send>
  
  <receive channel="channel-1">
    <command name="CEA"> </command>
  </receive>
</init>
 
<!-- Traffic -->
<traffic>
 
  <!--  ###### INITIAL REQUEST ###### -->
  <send channel="channel-1">
    <action>
      <!-- select MSISDN from msisdn.csv file -->
      <restore-from-external field="0" entity="Subscription-Id-Data"> </restore-from-external> 
 
      <!-- For each new call, increment the session-ID counter -->
      <inc-counter name="HbH-counter"> </inc-counter>
      <inc-counter name="EtE-counter"> </inc-counter>
      <inc-counter name="session-counter"> </inc-counter>
      <set-value name="HbH-id" format="$(HbH-counter)"></set-value>
      <set-value name="EtE-id" format="$(EtE-counter)"></set-value>
      <set-value name="Session-Id" format="c1-10-125-146-242-koraytste01;;109641;$(session-counter)"></set-value>
    </action>
 
    <command name="CCR">
      <avp name="Session-Id" value="value_is_replaced"> </avp>
      <avp name="Origin-Host" value="c0-10-182-7-131-gggnse01"> </avp>
      <avp name="Origin-Realm" value="charge.se"> </avp>
      <avp name="Destination-Realm" value="vodafone1.com"> </avp>
      <avp name="Destination-Host" value="dccaapp4"> </avp>
      <avp name="Auth-Application-Id" value="4"> </avp>
      <avp name="CC-Request-Type" value="1"> </avp>
      <avp name="CC-Request-Number" value="0"> </avp>
      <avp name="Event-Timestamp" value="1289667045000"></avp>
      <avp name="Multiple-Services-Indicator" value="1"> </avp>
      <avp name="Service-Context-Id" value="version2.clci.ipc@vodafone.com" > </avp>
      <avp name="RequestedServiceUnit" value="" > </avp>
      <avp name="3gppChargingId" value="15201085"> </avp>
      <avp name="3gppPdpType" value="0"> </avp>
      <avp name="3gppGPRSQoSNegotiatedProfile" value="05-23921f9396b1977481ffff000000"> </avp>
      <avp name="3gppNsapi" value="5"> </avp>
      <avp name="3gppSelectionMode" value="0"> </avp>
      <avp name="3gppChargingCharacteristics" value="400"> </avp>
      <avp name="3gppSGSNAddress" value="0xd91fe723"> </avp>
      <avp name="FramedIpAddress" value="0x510663c2"> </avp>
      <avp name="3gppImsi" value="286026470059101"> </avp>
      <avp name="3gppImsiMccMnc" value="286026"> </avp>
      <avp name="3gppGprsMccMnc" value="25099"> </avp>
      <avp name="Bearer-Usage" value="0"> </avp>
      <avp name="RulebaseId" value="56465F525333"> </avp>
      <avp name="CalledStationId" value="internettest"> </avp>
      <avp name="Radio-Access-Technology" value="1"> </avp>
<!-- mcc:286 mnc:02 - VFTR 
      <avp name="User-Location-Information" value="0x0182f620281fdaaf"> </avp> -->
<!-- mcc:222 mnc:10
      <avp name="User-Location-Information" value="0x0122f201281fdaaf"> </avp> -->
<!-- mcc:206 mnc: 01 - Belgacom mobile - Belgium -->
      <avp name="User-Location-Information" value="0x0102f610281fdaaf"> </avp>
      <avp name="MultipleServicesCreditControl">
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="RatingGroup" value="14"> </avp>
      </avp>
      <avp name="Subscription-Id">
        <avp name="Subscription-Id-Type" value="0"> </avp>
        <avp name="Subscription-Id-Data" value=""> </avp> 
      </avp>
    </command>
    
    <action>
      <start-timer></start-timer>
      <store name="msisdn" entity="Subscription-Id-Data"> </store> 
    </action>
  </send>
  
  <receive channel="channel-1">
    <command name="CCA">
      <avp name="Result-Code" value="2001"> </avp>
    </command>
    <action>      
      <stop-timer></stop-timer>
      <check-value name="Result-Code" behaviour="error"> </check-value>
      <store name="sid" entity="Session-Id"> </store>
    </action>  
  </receive>
 
  <wait-ms value="2000"></wait-ms>
  
  <!--  ###### UPDATE REQUEST ###### -->
  <send channel="channel-1">
    <action>
    <!-- For each new call, increment the session-ID counter -->
      <inc-counter name="HbH-counter"></inc-counter>
      <inc-counter name="EtE-counter"></inc-counter>
      <restore name="sid" entity="Session-Id"></restore>
      <restore name="msisdn" entity="Subscription-Id-Data"></restore>
      <set-value name="HbH-id" format="$(HbH-counter)"></set-value>
      <set-value name="EtE-id" format="$(EtE-counter)"></set-value>
    </action>
 
    <command name="CCR">
      <avp name="Session-Id" value="value_is_replaced"> </avp>
      <avp name="Origin-Host" value="c0-10-182-7-131-gggnse01"> </avp>
      <avp name="Origin-Realm" value="charge.se"> </avp>
      <avp name="Destination-Realm" value="vodafone1.com"> </avp>
      <avp name="Destination-Host" value="dccaapp4"> </avp>
      <avp name="Auth-Application-Id" value="4"> </avp>
      <avp name="CC-Request-Type" value="2"> </avp>
      <avp name="CC-Request-Number" value="1"> </avp>
      <avp name="Event-Timestamp" value="1290501100000"></avp>
      <avp name="Multiple-Services-Indicator" value="1"> </avp>
      <avp name="Service-Context-Id" value="version2.clci.ipc@vodafone.com" > </avp>
      <avp name="MultipleServicesCreditControl"> 
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="Used-Service-Unit" value="">
          <avp name="CC-Input-Octets"  value="23360"></avp>
          <avp name="CC-Output-Octets" value="1400000"></avp>
          <avp name="CC-Total-Octets"  value="1423360"></avp>
        </avp>
        <avp name="RatingGroup" value="14"> </avp>
      </avp>
      <avp name="MultipleServicesCreditControl">
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="RatingGroup" value="2"> </avp>
      </avp>
      <avp name="3gppChargingId" value="15201085"> </avp>
      <avp name="3gppPdpType" value="0"> </avp>
      <avp name="3gppGPRSQoSNegotiatedProfile" value="05-23921f9396b1977481ffff000000"> </avp>
      <avp name="3gppNsapi" value="5"> </avp>
      <avp name="3gppSelectionMode" value="9"> </avp>
      <avp name="3gppChargingCharacteristics" value="0400"> </avp>
      <avp name="3gppSGSNAddress" value="0xd97645b5"> </avp> 
      <avp name="FramedIpAddress" value="0x510663c2"> </avp>
      <avp name="3gppImsi" value="286026470059101"> </avp>
      <avp name="3gppImsiMccMnc" value="286026"> </avp>
      <avp name="3gppGprsMccMnc" value="25099"> </avp>
      <avp name="Bearer-Usage" value="0"> </avp>
      <avp name="RulebaseId" value="56465F525333"> </avp>
      <avp name="CalledStationId" value="internettest"> </avp>
      <avp name="Radio-Access-Technology" value="1"> </avp>
<!-- mcc:286 mnc:02 - VFTR 
      <avp name="User-Location-Information" value="0x0182f620281fdaaf"> </avp> -->
<!-- mcc:222 mnc:10
      <avp name="User-Location-Information" value="0x0122f201281fdaaf"> </avp> -->
<!-- mcc:206 mnc: 01 - Belgacom mobile - Belgium -->
      <avp name="User-Location-Information" value="0x0102f610281fdaaf"> </avp>
      <avp name="Subscription-Id">
        <avp name="Subscription-Id-Type" value="0"> </avp>
        <avp name="Subscription-Id-Data" value="value_is_replaced"></avp> 
      </avp>
    </command>
    
    <action>
      <start-timer></start-timer>
    </action>
  </send>
  
  <receive channel="channel-1">
    <action>
      <stop-timer></stop-timer>
    </action>
    <command name="CCA">
      <avp name="Result-Code" value="2001"> </avp>
    </command>
    <action>
      <check-value name="Result-Code" behaviour="error"></check-value>
    </action>
  </receive>
  
 <wait-ms value="3000"></wait-ms>
 
  <!--  ###### UPDATE REQUEST 2 ###### -->
  <send channel="channel-1">
    <action>
    <!-- For each new call, increment the session-ID counter -->
      <inc-counter name="HbH-counter"></inc-counter>
      <inc-counter name="EtE-counter"></inc-counter>
      <restore name="sid" entity="Session-Id"></restore>
      <restore name="msisdn" entity="Subscription-Id-Data"></restore>
      <set-value name="HbH-id" format="$(HbH-counter)"></set-value>
      <set-value name="EtE-id" format="$(EtE-counter)"></set-value>
    </action>
 
    <command name="CCR">
      <avp name="Session-Id" value="value_is_replaced"> </avp>
      <avp name="Origin-Host" value="c0-10-182-7-131-gggnse01"> </avp>
      <avp name="Origin-Realm" value="charge.se"> </avp>
      <avp name="Destination-Realm" value="vodafone1.com"> </avp>
      <avp name="Destination-Host" value="dccaapp4"> </avp>
      <avp name="Auth-Application-Id" value="4"> </avp>
      <avp name="CC-Request-Type" value="2"> </avp>
      <avp name="CC-Request-Number" value="2"> </avp>
      <avp name="Event-Timestamp" value="1290501100000"></avp>
      <avp name="Multiple-Services-Indicator" value="1"> </avp>
      <avp name="Service-Context-Id" value="version2.clci.ipc@vodafone.com" > </avp>
      <avp name="MultipleServicesCreditControl"> 
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="Used-Service-Unit" value="">
          <avp name="CC-Input-Octets" value="1200"></avp>
          <avp name="CC-Output-Octets" value="8600"></avp>
          <avp name="CC-Total-Octets" value="9800"></avp>
        </avp>
      <avp name="RatingGroup" value="2"> </avp>
      </avp>
      <avp name="MultipleServicesCreditControl">
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="RatingGroup" value="14"> </avp>
      </avp>
      <avp name="3gppChargingId" value="15201085"> </avp>
      <avp name="3gppPdpType" value="0"> </avp>
      <avp name="3gppGPRSQoSNegotiatedProfile" value="05-23921f9396b1977481ffff000000"> </avp>
      <avp name="3gppNsapi" value="5"> </avp>
      <avp name="3gppSelectionMode" value="9"> </avp>
      <avp name="3gppChargingCharacteristics" value="0400"> </avp>
      <avp name="3gppSGSNAddress" value="0xd97645b5"> </avp> 
      <avp name="3gppImsi" value="286026470059101"> </avp>
      <avp name="3gppImsiMccMnc" value="286026"> </avp>
      <avp name="3gppGprsMccMnc" value="25099"> </avp>
      <avp name="Bearer-Usage" value="0"> </avp>
      <avp name="RulebaseId" value="56465F525333"> </avp>
      <avp name="CalledStationId" value="internettest"> </avp>
      <avp name="Radio-Access-Technology" value="1"> </avp>
<!-- mcc:286 mnc:02 - VFTR 
      <avp name="User-Location-Information" value="0x0182f620281fdaaf"> </avp> -->
<!-- mcc:222 mnc:10
      <avp name="User-Location-Information" value="0x0122f201281fdaaf"> </avp> -->
<!-- mcc:206 mnc: 01 - Belgacom mobile - Belgium -->
        <avp name="User-Location-Information" value="0x0102f610281fdaaf"> </avp>
      <avp name="Subscription-Id">
        <avp name="Subscription-Id-Type" value="0"> </avp>
        <avp name="Subscription-Id-Data" value="value_is_replaced"></avp> 
      </avp>
    </command>
    
    <action>
      <start-timer></start-timer>
    </action>
  </send>
  
  <receive channel="channel-1">
    <action>
      <stop-timer></stop-timer>
    </action>
    <command name="CCA">
      <avp name="Result-Code" value="2001"> </avp>
    </command>
    <action>
      <check-value name="Result-Code" behaviour="error"></check-value>
    </action>
  </receive>
 
  <wait-ms value="3000"></wait-ms> 
  
  <!--  ###### UPDATE REQUEST 3 ###### -->
  <send channel="channel-1">
    <action>
    <!-- For each new call, increment the session-ID counter -->
      <inc-counter name="HbH-counter"></inc-counter>
      <inc-counter name="EtE-counter"></inc-counter>
      <restore name="sid" entity="Session-Id"></restore>
      <restore name="msisdn" entity="Subscription-Id-Data"></restore>
      <set-value name="HbH-id" format="$(HbH-counter)"></set-value>
      <set-value name="EtE-id" format="$(EtE-counter)"></set-value>
 
    </action>
 
    <command name="CCR">
      <avp name="Session-Id" value="value_is_replaced"> </avp>
      <avp name="Origin-Host" value="c0-10-182-7-131-gggnse01"> </avp>
      <avp name="Origin-Realm" value="charge.se"> </avp>
      <avp name="Destination-Realm" value="vodafone1.com"> </avp>
      <avp name="Destination-Host" value="dccaapp4"> </avp>
      <avp name="Auth-Application-Id" value="4"> </avp>
      <avp name="CC-Request-Type" value="2"> </avp>
      <avp name="CC-Request-Number" value="3"> </avp>
      <avp name="Event-Timestamp" value="1290501100000"></avp>
      <avp name="Multiple-Services-Indicator" value="1"> </avp>
      <avp name="Service-Context-Id" value="version2.clci.ipc@vodafone.com" > </avp>
      <avp name="MultipleServicesCreditControl"> 
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="Used-Service-Unit" value="">
          <avp name="CC-Input-Octets" value="4080"></avp>
          <avp name="CC-Output-Octets" value="73092"></avp>
          <avp name="CC-Total-Octets" value="77172"></avp>
        </avp>
        <avp name="RatingGroup" value="14"> </avp>
      </avp>
      <avp name="MultipleServicesCreditControl">
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="RatingGroup" value="14"> </avp>
      </avp>
      <avp name="3gppChargingId" value="15201085"> </avp>
      <avp name="3gppPdpType" value="0"> </avp>
      <avp name="3gppGPRSQoSNegotiatedProfile" value="05-23921f9396b1977481ffff000000"> </avp>
      <avp name="3gppNsapi" value="5"> </avp>
      <avp name="3gppSelectionMode" value="9"> </avp>
      <avp name="3gppChargingCharacteristics" value="0400"> </avp>
      <avp name="3gppSGSNAddress" value="0xd97645b5"> </avp> 
      <avp name="FramedIpAddress" value="0x510663c2"> </avp>
      <avp name="3gppImsi" value="286026470059101"> </avp>
      <avp name="3gppImsiMccMnc" value="286026"> </avp>
      <avp name="3gppGprsMccMnc" value="25099"> </avp>
      <avp name="Bearer-Usage" value="0"> </avp>
      <avp name="RulebaseId" value="56465F525333"> </avp>
      <avp name="CalledStationId" value="internettest"> </avp>
      <avp name="Radio-Access-Technology" value="1"> </avp>
<!-- mcc:286 mnc:02 - VFTR 
      <avp name="User-Location-Information" value="0x0182f620281fdaaf"> </avp> -->
<!-- mcc:222 mnc:10
      <avp name="User-Location-Information" value="0x0122f201281fdaaf"> </avp> -->
<!-- mcc:206 mnc: 01 - Belgacom mobile - Belgium -->
      <avp name="User-Location-Information" value="0x0102f610281fdaaf"> </avp>
      <avp name="Subscription-Id">
        <avp name="Subscription-Id-Type" value="0"> </avp>
        <avp name="Subscription-Id-Data" value="value_is_replaced"></avp> 
      </avp>
    </command>
    
    <action>
      <start-timer></start-timer>
    </action>
  </send>
  
  <receive channel="channel-1">
    <action>
      <stop-timer></stop-timer>
    </action>
    <command name="CCA">
      <avp name="Result-Code" value="2001"> </avp>
    </command>
    <action>
      <check-value name="Result-Code" behaviour="error"></check-value>
    </action>
  </receive>
  
  <wait-ms value="3000"></wait-ms> 
 
  <!--  ###### UPDATE REQUEST 4 ###### -->
  <send channel="channel-1">
    <action>
    <!-- For each new call, increment the session-ID counter -->
      <inc-counter name="HbH-counter"></inc-counter>
      <inc-counter name="EtE-counter"></inc-counter>
      <restore name="sid" entity="Session-Id"></restore>
      <restore name="msisdn" entity="Subscription-Id-Data"></restore>
      <set-value name="HbH-id" format="$(HbH-counter)"></set-value>
      <set-value name="EtE-id" format="$(EtE-counter)"></set-value>
    </action>
 
    <command name="CCR">
      <avp name="Session-Id" value="value_is_replaced"> </avp>
      <avp name="Origin-Host" value="c0-10-182-7-131-gggnse01"> </avp>
      <avp name="Origin-Realm" value="charge.se"> </avp>
      <avp name="Destination-Realm" value="vodafone1.com"> </avp>
      <avp name="Destination-Host" value="dccaapp4"> </avp>
      <avp name="Auth-Application-Id" value="4"> </avp>
      <avp name="CC-Request-Type" value="2"> </avp>
      <avp name="CC-Request-Number" value="4"> </avp>
      <avp name="Event-Timestamp" value="1290501100000"></avp>
      <avp name="Multiple-Services-Indicator" value="1"> </avp>
      <avp name="Service-Context-Id" value="version2.clci.ipc@vodafone.com" > </avp>
      <avp name="MultipleServicesCreditControl"> 
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="Used-Service-Unit" value="">
          <avp name="CC-Input-Octets" value="1000"></avp>
          <avp name="CC-Output-Octets" value="8600"></avp>
          <avp name="CC-Total-Octets" value="9600"></avp>
        </avp>
        <avp name="RatingGroup" value="14"> </avp>
      </avp>
      <avp name="MultipleServicesCreditControl">
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="RatingGroup" value="1"> </avp>
      </avp>
      <avp name="3gppChargingId" value="15201085"> </avp>
      <avp name="3gppPdpType" value="0"> </avp>
      <avp name="3gppGPRSQoSNegotiatedProfile" value="05-23921f9396b1977481ffff000000"> </avp>
      <avp name="3gppNsapi" value="5"> </avp>
      <avp name="3gppSelectionMode" value="9"> </avp>
      <avp name="3gppChargingCharacteristics" value="0400"> </avp>
      <avp name="3gppSGSNAddress" value="0xd97645b5"> </avp>
      <avp name="FramedIpAddress" value="0x510663c2"> </avp>
      <avp name="3gppImsi" value="286026470059101"> </avp>
      <avp name="3gppImsiMccMnc" value="286026"> </avp>
      <avp name="3gppGprsMccMnc" value="25099"> </avp>
      <avp name="Bearer-Usage" value="0"> </avp>
      <avp name="RulebaseId" value="56465F525333"> </avp>
      <avp name="CalledStationId" value="internettest"> </avp>
      <avp name="Radio-Access-Technology" value="1"> </avp> 
<!-- mcc:286 mnc:02 - VFTR 
      <avp name="User-Location-Information" value="0x0182f620281fdaaf"> </avp> -->
<!-- mcc:222 mnc:10
      <avp name="User-Location-Information" value="0x0122f201281fdaaf"> </avp> -->
<!-- mcc:206 mnc: 01 - Belgacom mobile - Belgium -->
      <avp name="User-Location-Information" value="0x0102f610281fdaaf"> </avp>
      <avp name="Subscription-Id">
        <avp name="Subscription-Id-Type" value="0"> </avp>
        <avp name="Subscription-Id-Data" value="value_is_replaced"></avp> 
      </avp>
    </command>
    
    <action>
      <start-timer></start-timer>
    </action>
  </send>
  
  <receive channel="channel-1">
    <action>
      <stop-timer></stop-timer>
    </action>
    <command name="CCA">
      <avp name="Result-Code" value="2001"> </avp>
    </command>
    <action>
      <check-value name="Result-Code" behaviour="error"></check-value>
    </action>
  </receive>
  
  <wait-ms value="3000"></wait-ms>
 
  <!--  ###### TERMINATE REQUEST ###### -->
  <send channel="channel-1">
    <action>
      <!-- For each new call, increment the session-ID counter -->
      <inc-counter name="HbH-counter"></inc-counter>
      <inc-counter name="EtE-counter"></inc-counter>
      <restore name="sid" entity="Session-Id"></restore>
      <restore name="msisdn" entity="Subscription-Id-Data"></restore>
      <set-value name="HbH-id" format="$(HbH-counter)"></set-value>
      <set-value name="EtE-id" format="$(EtE-counter)"></set-value>
    </action>
    
    <command name="CCR">
      <avp name="Session-Id" value="value_is_replaced"> </avp>
      <avp name="Origin-Host" value="c0-10-182-7-131-gggnse01"> </avp>
      <avp name="Origin-Realm" value="charge.se"> </avp>
      <avp name="Destination-Realm" value="vodafone1.com"> </avp>
      <avp name="Destination-Host" value="dccaapp4"> </avp>
      <avp name="Auth-Application-Id" value="4"> </avp>
      <avp name="CC-Request-Type" value="3"> </avp>
      <avp name="CC-Request-Number" value="5"> </avp>
      <avp name="Event-Timestamp" value="1290501100000"></avp>
      <avp name="Multiple-Services-Indicator" value="1"> </avp>
      <avp name="Service-Context-Id" value="version2.clci.ipc@vodafone.com" > </avp>
      <avp name="MultipleServicesCreditControl"> 
        <avp name="Used-Service-Unit" value="">
          <avp name="CC-Input-Octets" value="138387"></avp>
          <avp name="CC-Output-Octets" value="855816"></avp>
          <avp name="CC-Total-Octets" value="994203"></avp>
        </avp>
        <avp name="RatingGroup" value="1"> </avp>
      </avp>
      <avp name="3gppChargingId" value="15201085"> </avp>
      <avp name="3gppPdpType" value="0"> </avp>
      <avp name="3gppGPRSQoSNegotiatedProfile" value="05-23921f9396b1977481ffff000000"> </avp>
      <avp name="3gppNsapi" value="5"> </avp>
      <avp name="3gppSelectionMode" value="0"> </avp>
      <avp name="3gppChargingCharacteristics" value="0400"> </avp> 
      <avp name="3gppSGSNAddress" value="0xd97645b5"> </avp>
      <avp name="FramedIpAddress" value="0x510663c2"> </avp>
      <avp name="3gppImsi" value="286026470059101"> </avp>
      <avp name="3gppImsiMccMnc" value="286026"> </avp>
      <avp name="3gppGprsMccMnc" value="25099"> </avp>
      <avp name="Bearer-Usage" value="0"> </avp>
      <avp name="RulebaseId" value="56465F525333"> </avp>
      <avp name="CalledStationId" value="internettest"> </avp>
      <avp name="Radio-Access-Technology" value="1"> </avp>
<!-- mcc:286 mnc:02 - VFTR 
      <avp name="User-Location-Information" value="0x0182f620281fdaaf"> </avp> -->
<!-- mcc:222 mnc:10
      <avp name="User-Location-Information" value="0x0122f201281fdaaf"> </avp> -->
<!-- mcc:206 mnc: 01 - Belgacom mobile - Belgium -->
      <avp name="User-Location-Information" value="0x0102f610281fdaaf"> </avp>
      <avp name="Subscription-Id">
        <avp name="Subscription-Id-Type" value="0"> </avp>
        <avp name="Subscription-Id-Data" value="value_is_replaced"></avp>
      </avp>
      <avp name="Termination-Cause" value="1"> </avp>
    </command>
    <action>
      <start-timer></start-timer>
    </action>
  </send>
  
  <receive channel="channel-1">
    <action>
      <stop-timer></stop-timer>
    </action>
    <command name="CCA">
      <avp name="Result-Code" value="2001"> </avp>
    </command>
    <action>
      <check-value name="Result-Code" behaviour="error"></check-value>
    </action>
  </receive>
 
</traffic>
</scenario>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<scenario>

<counter>
  <counterdef name="HbH-counter" init="1000"> </counterdef>
  <counterdef name="EtE-counter" init="2000"> </counterdef>
  <counterdef name="session-counter" init="5"> </counterdef>
</counter>

<init>
  <send channel="channel-1">
    <command name="CER">
      <avp name="Origin-Host" value="c0-10-182-7-131-gggnse99"> </avp>
      <avp name="Origin-Realm" value="charge.se"> </avp>
      <avp name="Host-IP-Address" value="0x0001AC191768"> </avp> <!-- 172.25.23.104 -->
      <avp name="Vendor-Id" value="193"> </avp>
      <avp name="Product-Name" value="Ericsson J20 GGSN"> </avp>
      <avp name="Origin-State-Id" value="14"> </avp>
      <avp name="Supported-Vendor-Id" value="10415"> </avp>
      <avp name="Supported-Vendor-Id" value="12645"> </avp>
      <avp name="Auth-Application-Id" value="4"> </avp>
    </command>
  </send>
  
  <receive channel="channel-1">
    <command name="CEA"> </command>
  </receive>
</init>

<!-- Traffic -->
<traffic>

  <!--  ###### INITIAL REQUEST ###### -->
  <send channel="channel-1">
    <action>
      <!-- select MSISDN from msisdn.csv file -->
      <restore-from-external field="0" entity="Subscription-Id-Data"> </restore-from-external> 

      <!-- For each new call, increment the session-ID counter -->
      <inc-counter name="HbH-counter"> </inc-counter>
      <inc-counter name="EtE-counter"> </inc-counter>
      <inc-counter name="session-counter"> </inc-counter>
      <set-value name="HbH-id" format="$(HbH-counter)"></set-value>
      <set-value name="EtE-id" format="$(EtE-counter)"></set-value>
      <set-value name="Session-Id" format="c1-10-125-146-242-koraytste01;;109641;$(session-counter)"></set-value>
    </action>

    <command name="CCR">
      <avp name="Session-Id" value="value_is_replaced"> </avp>
      <avp name="Origin-Host" value="c0-10-182-7-131-gggnse01"> </avp>
      <avp name="Origin-Realm" value="charge.se"> </avp>
      <avp name="Destination-Realm" value="vodafone1.com"> </avp>
      <avp name="Destination-Host" value="dccaapp4"> </avp>
      <avp name="Auth-Application-Id" value="4"> </avp>
      <avp name="CC-Request-Type" value="1"> </avp>
      <avp name="CC-Request-Number" value="0"> </avp>
      <avp name="Event-Timestamp" value="1289667045000"></avp>
      <avp name="Multiple-Services-Indicator" value="1"> </avp>
      <avp name="Service-Context-Id" value="version2.clci.ipc@vodafone.com" > </avp>
      <avp name="RequestedServiceUnit" value="" > </avp>
      <avp name="3gppChargingId" value="15201085"> </avp>
      <avp name="3gppPdpType" value="0"> </avp>
      <avp name="3gppGPRSQoSNegotiatedProfile" value="05-23921f9396b1977481ffff000000"> </avp>
      <avp name="3gppNsapi" value="5"> </avp>
      <avp name="3gppSelectionMode" value="0"> </avp>
      <avp name="3gppChargingCharacteristics" value="400"> </avp>
      <avp name="3gppSGSNAddress" value="0xd91fe723"> </avp>
      <avp name="FramedIpAddress" value="0x510663c2"> </avp>
      <avp name="3gppImsi" value="286026470059101"> </avp>
      <avp name="3gppImsiMccMnc" value="286026"> </avp>
      <avp name="3gppGprsMccMnc" value="25099"> </avp>
      <avp name="Bearer-Usage" value="0"> </avp>
      <avp name="RulebaseId" value="56465F525333"> </avp>
      <avp name="CalledStationId" value="internettest"> </avp>
      <avp name="Radio-Access-Technology" value="1"> </avp>
<!-- mcc:286 mnc:02 - VFTR 
      <avp name="User-Location-Information" value="0x0182f620281fdaaf"> </avp> -->
<!-- mcc:222 mnc:10
      <avp name="User-Location-Information" value="0x0122f201281fdaaf"> </avp> -->
<!-- mcc:206 mnc: 01 - Belgacom mobile - Belgium -->
      <avp name="User-Location-Information" value="0x0102f610281fdaaf"> </avp>
      <avp name="MultipleServicesCreditControl">
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="RatingGroup" value="14"> </avp>
      </avp>
      <avp name="Subscription-Id">
        <avp name="Subscription-Id-Type" value="0"> </avp>
        <avp name="Subscription-Id-Data" value=""> </avp> 
      </avp>
    </command>
    
    <action>
      <start-timer></start-timer>
      <store name="msisdn" entity="Subscription-Id-Data"> </store> 
    </action>
  </send>
  
  <receive channel="channel-1">
    <command name="CCA">
      <avp name="Result-Code" value="2001"> </avp>
    </command>
    <action>      
      <stop-timer></stop-timer>
      <check-value name="Result-Code" behaviour="error"> </check-value>
      <store name="sid" entity="Session-Id"> </store>
    </action>  
  </receive>

  <wait-ms value="2000"></wait-ms>
  
  <!--  ###### UPDATE REQUEST ###### -->
  <send channel="channel-1">
    <action>
    <!-- For each new call, increment the session-ID counter -->
      <inc-counter name="HbH-counter"></inc-counter>
      <inc-counter name="EtE-counter"></inc-counter>
      <restore name="sid" entity="Session-Id"></restore>
      <restore name="msisdn" entity="Subscription-Id-Data"></restore>
      <set-value name="HbH-id" format="$(HbH-counter)"></set-value>
      <set-value name="EtE-id" format="$(EtE-counter)"></set-value>
    </action>

    <command name="CCR">
      <avp name="Session-Id" value="value_is_replaced"> </avp>
      <avp name="Origin-Host" value="c0-10-182-7-131-gggnse01"> </avp>
      <avp name="Origin-Realm" value="charge.se"> </avp>
      <avp name="Destination-Realm" value="vodafone1.com"> </avp>
      <avp name="Destination-Host" value="dccaapp4"> </avp>
      <avp name="Auth-Application-Id" value="4"> </avp>
      <avp name="CC-Request-Type" value="2"> </avp>
      <avp name="CC-Request-Number" value="1"> </avp>
      <avp name="Event-Timestamp" value="1290501100000"></avp>
      <avp name="Multiple-Services-Indicator" value="1"> </avp>
      <avp name="Service-Context-Id" value="version2.clci.ipc@vodafone.com" > </avp>
      <avp name="MultipleServicesCreditControl"> 
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="Used-Service-Unit" value="">
          <avp name="CC-Input-Octets"  value="23360"></avp>
          <avp name="CC-Output-Octets" value="1400000"></avp>
          <avp name="CC-Total-Octets"  value="1423360"></avp>
        </avp>
        <avp name="RatingGroup" value="14"> </avp>
      </avp>
      <avp name="MultipleServicesCreditControl">
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="RatingGroup" value="2"> </avp>
      </avp>
      <avp name="3gppChargingId" value="15201085"> </avp>
      <avp name="3gppPdpType" value="0"> </avp>
      <avp name="3gppGPRSQoSNegotiatedProfile" value="05-23921f9396b1977481ffff000000"> </avp>
      <avp name="3gppNsapi" value="5"> </avp>
      <avp name="3gppSelectionMode" value="9"> </avp>
      <avp name="3gppChargingCharacteristics" value="0400"> </avp>
      <avp name="3gppSGSNAddress" value="0xd97645b5"> </avp> 
      <avp name="FramedIpAddress" value="0x510663c2"> </avp>
      <avp name="3gppImsi" value="286026470059101"> </avp>
      <avp name="3gppImsiMccMnc" value="286026"> </avp>
      <avp name="3gppGprsMccMnc" value="25099"> </avp>
      <avp name="Bearer-Usage" value="0"> </avp>
      <avp name="RulebaseId" value="56465F525333"> </avp>
      <avp name="CalledStationId" value="internettest"> </avp>
      <avp name="Radio-Access-Technology" value="1"> </avp>
<!-- mcc:286 mnc:02 - VFTR 
      <avp name="User-Location-Information" value="0x0182f620281fdaaf"> </avp> -->
<!-- mcc:222 mnc:10
      <avp name="User-Location-Information" value="0x0122f201281fdaaf"> </avp> -->
<!-- mcc:206 mnc: 01 - Belgacom mobile - Belgium -->
      <avp name="User-Location-Information" value="0x0102f610281fdaaf"> </avp>
      <avp name="Subscription-Id">
        <avp name="Subscription-Id-Type" value="0"> </avp>
        <avp name="Subscription-Id-Data" value="value_is_replaced"></avp> 
      </avp>
    </command>
    
    <action>
      <start-timer></start-timer>
    </action>
  </send>
  
  <receive channel="channel-1">
    <action>
      <stop-timer></stop-timer>
    </action>
    <command name="CCA">
      <avp name="Result-Code" value="2001"> </avp>
    </command>
    <action>
      <check-value name="Result-Code" behaviour="error"></check-value>
    </action>
  </receive>
  
 <wait-ms value="3000"></wait-ms>

  <!--  ###### UPDATE REQUEST 2 ###### -->
  <send channel="channel-1">
    <action>
    <!-- For each new call, increment the session-ID counter -->
      <inc-counter name="HbH-counter"></inc-counter>
      <inc-counter name="EtE-counter"></inc-counter>
      <restore name="sid" entity="Session-Id"></restore>
      <restore name="msisdn" entity="Subscription-Id-Data"></restore>
      <set-value name="HbH-id" format="$(HbH-counter)"></set-value>
      <set-value name="EtE-id" format="$(EtE-counter)"></set-value>
    </action>

    <command name="CCR">
      <avp name="Session-Id" value="value_is_replaced"> </avp>
      <avp name="Origin-Host" value="c0-10-182-7-131-gggnse01"> </avp>
      <avp name="Origin-Realm" value="charge.se"> </avp>
      <avp name="Destination-Realm" value="vodafone1.com"> </avp>
      <avp name="Destination-Host" value="dccaapp4"> </avp>
      <avp name="Auth-Application-Id" value="4"> </avp>
      <avp name="CC-Request-Type" value="2"> </avp>
      <avp name="CC-Request-Number" value="2"> </avp>
      <avp name="Event-Timestamp" value="1290501100000"></avp>
      <avp name="Multiple-Services-Indicator" value="1"> </avp>
      <avp name="Service-Context-Id" value="version2.clci.ipc@vodafone.com" > </avp>
      <avp name="MultipleServicesCreditControl"> 
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="Used-Service-Unit" value="">
          <avp name="CC-Input-Octets" value="1200"></avp>
          <avp name="CC-Output-Octets" value="8600"></avp>
          <avp name="CC-Total-Octets" value="9800"></avp>
        </avp>
      <avp name="RatingGroup" value="2"> </avp>
      </avp>
      <avp name="MultipleServicesCreditControl">
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="RatingGroup" value="14"> </avp>
      </avp>
      <avp name="3gppChargingId" value="15201085"> </avp>
      <avp name="3gppPdpType" value="0"> </avp>
      <avp name="3gppGPRSQoSNegotiatedProfile" value="05-23921f9396b1977481ffff000000"> </avp>
      <avp name="3gppNsapi" value="5"> </avp>
      <avp name="3gppSelectionMode" value="9"> </avp>
      <avp name="3gppChargingCharacteristics" value="0400"> </avp>
      <avp name="3gppSGSNAddress" value="0xd97645b5"> </avp> 
      <avp name="3gppImsi" value="286026470059101"> </avp>
      <avp name="3gppImsiMccMnc" value="286026"> </avp>
      <avp name="3gppGprsMccMnc" value="25099"> </avp>
      <avp name="Bearer-Usage" value="0"> </avp>
      <avp name="RulebaseId" value="56465F525333"> </avp>
      <avp name="CalledStationId" value="internettest"> </avp>
      <avp name="Radio-Access-Technology" value="1"> </avp>
<!-- mcc:286 mnc:02 - VFTR 
      <avp name="User-Location-Information" value="0x0182f620281fdaaf"> </avp> -->
<!-- mcc:222 mnc:10
      <avp name="User-Location-Information" value="0x0122f201281fdaaf"> </avp> -->
<!-- mcc:206 mnc: 01 - Belgacom mobile - Belgium -->
        <avp name="User-Location-Information" value="0x0102f610281fdaaf"> </avp>
      <avp name="Subscription-Id">
        <avp name="Subscription-Id-Type" value="0"> </avp>
        <avp name="Subscription-Id-Data" value="value_is_replaced"></avp> 
      </avp>
    </command>
    
    <action>
      <start-timer></start-timer>
    </action>
  </send>
  
  <receive channel="channel-1">
    <action>
      <stop-timer></stop-timer>
    </action>
    <command name="CCA">
      <avp name="Result-Code" value="2001"> </avp>
    </command>
    <action>
      <check-value name="Result-Code" behaviour="error"></check-value>
    </action>
  </receive>

  <wait-ms value="3000"></wait-ms> 
  
  <!--  ###### UPDATE REQUEST 3 ###### -->
  <send channel="channel-1">
    <action>
    <!-- For each new call, increment the session-ID counter -->
      <inc-counter name="HbH-counter"></inc-counter>
      <inc-counter name="EtE-counter"></inc-counter>
      <restore name="sid" entity="Session-Id"></restore>
      <restore name="msisdn" entity="Subscription-Id-Data"></restore>
      <set-value name="HbH-id" format="$(HbH-counter)"></set-value>
      <set-value name="EtE-id" format="$(EtE-counter)"></set-value>

    </action>

    <command name="CCR">
      <avp name="Session-Id" value="value_is_replaced"> </avp>
      <avp name="Origin-Host" value="c0-10-182-7-131-gggnse01"> </avp>
      <avp name="Origin-Realm" value="charge.se"> </avp>
      <avp name="Destination-Realm" value="vodafone1.com"> </avp>
      <avp name="Destination-Host" value="dccaapp4"> </avp>
      <avp name="Auth-Application-Id" value="4"> </avp>
      <avp name="CC-Request-Type" value="2"> </avp>
      <avp name="CC-Request-Number" value="3"> </avp>
      <avp name="Event-Timestamp" value="1290501100000"></avp>
      <avp name="Multiple-Services-Indicator" value="1"> </avp>
      <avp name="Service-Context-Id" value="version2.clci.ipc@vodafone.com" > </avp>
      <avp name="MultipleServicesCreditControl"> 
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="Used-Service-Unit" value="">
          <avp name="CC-Input-Octets" value="4080"></avp>
          <avp name="CC-Output-Octets" value="73092"></avp>
          <avp name="CC-Total-Octets" value="77172"></avp>
        </avp>
        <avp name="RatingGroup" value="14"> </avp>
      </avp>
      <avp name="MultipleServicesCreditControl">
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="RatingGroup" value="14"> </avp>
      </avp>
      <avp name="3gppChargingId" value="15201085"> </avp>
      <avp name="3gppPdpType" value="0"> </avp>
      <avp name="3gppGPRSQoSNegotiatedProfile" value="05-23921f9396b1977481ffff000000"> </avp>
      <avp name="3gppNsapi" value="5"> </avp>
      <avp name="3gppSelectionMode" value="9"> </avp>
      <avp name="3gppChargingCharacteristics" value="0400"> </avp>
      <avp name="3gppSGSNAddress" value="0xd97645b5"> </avp> 
      <avp name="FramedIpAddress" value="0x510663c2"> </avp>
      <avp name="3gppImsi" value="286026470059101"> </avp>
      <avp name="3gppImsiMccMnc" value="286026"> </avp>
      <avp name="3gppGprsMccMnc" value="25099"> </avp>
      <avp name="Bearer-Usage" value="0"> </avp>
      <avp name="RulebaseId" value="56465F525333"> </avp>
      <avp name="CalledStationId" value="internettest"> </avp>
      <avp name="Radio-Access-Technology" value="1"> </avp>
<!-- mcc:286 mnc:02 - VFTR 
      <avp name="User-Location-Information" value="0x0182f620281fdaaf"> </avp> -->
<!-- mcc:222 mnc:10
      <avp name="User-Location-Information" value="0x0122f201281fdaaf"> </avp> -->
<!-- mcc:206 mnc: 01 - Belgacom mobile - Belgium -->
      <avp name="User-Location-Information" value="0x0102f610281fdaaf"> </avp>
      <avp name="Subscription-Id">
        <avp name="Subscription-Id-Type" value="0"> </avp>
        <avp name="Subscription-Id-Data" value="value_is_replaced"></avp> 
      </avp>
    </command>
    
    <action>
      <start-timer></start-timer>
    </action>
  </send>
  
  <receive channel="channel-1">
    <action>
      <stop-timer></stop-timer>
    </action>
    <command name="CCA">
      <avp name="Result-Code" value="2001"> </avp>
    </command>
    <action>
      <check-value name="Result-Code" behaviour="error"></check-value>
    </action>
  </receive>
  
  <wait-ms value="3000"></wait-ms> 

  <!--  ###### UPDATE REQUEST 4 ###### -->
  <send channel="channel-1">
    <action>
    <!-- For each new call, increment the session-ID counter -->
      <inc-counter name="HbH-counter"></inc-counter>
      <inc-counter name="EtE-counter"></inc-counter>
      <restore name="sid" entity="Session-Id"></restore>
      <restore name="msisdn" entity="Subscription-Id-Data"></restore>
      <set-value name="HbH-id" format="$(HbH-counter)"></set-value>
      <set-value name="EtE-id" format="$(EtE-counter)"></set-value>
    </action>

    <command name="CCR">
      <avp name="Session-Id" value="value_is_replaced"> </avp>
      <avp name="Origin-Host" value="c0-10-182-7-131-gggnse01"> </avp>
      <avp name="Origin-Realm" value="charge.se"> </avp>
      <avp name="Destination-Realm" value="vodafone1.com"> </avp>
      <avp name="Destination-Host" value="dccaapp4"> </avp>
      <avp name="Auth-Application-Id" value="4"> </avp>
      <avp name="CC-Request-Type" value="2"> </avp>
      <avp name="CC-Request-Number" value="4"> </avp>
      <avp name="Event-Timestamp" value="1290501100000"></avp>
      <avp name="Multiple-Services-Indicator" value="1"> </avp>
      <avp name="Service-Context-Id" value="version2.clci.ipc@vodafone.com" > </avp>
      <avp name="MultipleServicesCreditControl"> 
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="Used-Service-Unit" value="">
          <avp name="CC-Input-Octets" value="1000"></avp>
          <avp name="CC-Output-Octets" value="8600"></avp>
          <avp name="CC-Total-Octets" value="9600"></avp>
        </avp>
        <avp name="RatingGroup" value="14"> </avp>
      </avp>
      <avp name="MultipleServicesCreditControl">
        <avp name="RequestedServiceUnit" value=""> </avp>
        <avp name="RatingGroup" value="1"> </avp>
      </avp>
      <avp name="3gppChargingId" value="15201085"> </avp>
      <avp name="3gppPdpType" value="0"> </avp>
      <avp name="3gppGPRSQoSNegotiatedProfile" value="05-23921f9396b1977481ffff000000"> </avp>
      <avp name="3gppNsapi" value="5"> </avp>
      <avp name="3gppSelectionMode" value="9"> </avp>
      <avp name="3gppChargingCharacteristics" value="0400"> </avp>
      <avp name="3gppSGSNAddress" value="0xd97645b5"> </avp>
      <avp name="FramedIpAddress" value="0x510663c2"> </avp>
      <avp name="3gppImsi" value="286026470059101"> </avp>
      <avp name="3gppImsiMccMnc" value="286026"> </avp>
      <avp name="3gppGprsMccMnc" value="25099"> </avp>
      <avp name="Bearer-Usage" value="0"> </avp>
      <avp name="RulebaseId" value="56465F525333"> </avp>
      <avp name="CalledStationId" value="internettest"> </avp>
      <avp name="Radio-Access-Technology" value="1"> </avp> 
<!-- mcc:286 mnc:02 - VFTR 
      <avp name="User-Location-Information" value="0x0182f620281fdaaf"> </avp> -->
<!-- mcc:222 mnc:10
      <avp name="User-Location-Information" value="0x0122f201281fdaaf"> </avp> -->
<!-- mcc:206 mnc: 01 - Belgacom mobile - Belgium -->
      <avp name="User-Location-Information" value="0x0102f610281fdaaf"> </avp>
      <avp name="Subscription-Id">
        <avp name="Subscription-Id-Type" value="0"> </avp>
        <avp name="Subscription-Id-Data" value="value_is_replaced"></avp> 
      </avp>
    </command>
    
    <action>
      <start-timer></start-timer>
    </action>
  </send>
  
  <receive channel="channel-1">
    <action>
      <stop-timer></stop-timer>
    </action>
    <command name="CCA">
      <avp name="Result-Code" value="2001"> </avp>
    </command>
    <action>
      <check-value name="Result-Code" behaviour="error"></check-value>
    </action>
  </receive>
  
  <wait-ms value="3000"></wait-ms>

  <!--  ###### TERMINATE REQUEST ###### -->
  <send channel="channel-1">
    <action>
      <!-- For each new call, increment the session-ID counter -->
      <inc-counter name="HbH-counter"></inc-counter>
      <inc-counter name="EtE-counter"></inc-counter>
      <restore name="sid" entity="Session-Id"></restore>
      <restore name="msisdn" entity="Subscription-Id-Data"></restore>
      <set-value name="HbH-id" format="$(HbH-counter)"></set-value>
      <set-value name="EtE-id" format="$(EtE-counter)"></set-value>
    </action>
    
    <command name="CCR">
      <avp name="Session-Id" value="value_is_replaced"> </avp>
      <avp name="Origin-Host" value="c0-10-182-7-131-gggnse01"> </avp>
      <avp name="Origin-Realm" value="charge.se"> </avp>
      <avp name="Destination-Realm" value="vodafone1.com"> </avp>
      <avp name="Destination-Host" value="dccaapp4"> </avp>
      <avp name="Auth-Application-Id" value="4"> </avp>
      <avp name="CC-Request-Type" value="3"> </avp>
      <avp name="CC-Request-Number" value="5"> </avp>
      <avp name="Event-Timestamp" value="1290501100000"></avp>
      <avp name="Multiple-Services-Indicator" value="1"> </avp>
      <avp name="Service-Context-Id" value="version2.clci.ipc@vodafone.com" > </avp>
      <avp name="MultipleServicesCreditControl"> 
        <avp name="Used-Service-Unit" value="">
          <avp name="CC-Input-Octets" value="138387"></avp>
          <avp name="CC-Output-Octets" value="855816"></avp>
          <avp name="CC-Total-Octets" value="994203"></avp>
        </avp>
        <avp name="RatingGroup" value="1"> </avp>
      </avp>
      <avp name="3gppChargingId" value="15201085"> </avp>
      <avp name="3gppPdpType" value="0"> </avp>
      <avp name="3gppGPRSQoSNegotiatedProfile" value="05-23921f9396b1977481ffff000000"> </avp>
      <avp name="3gppNsapi" value="5"> </avp>
      <avp name="3gppSelectionMode" value="0"> </avp>
      <avp name="3gppChargingCharacteristics" value="0400"> </avp> 
      <avp name="3gppSGSNAddress" value="0xd97645b5"> </avp>
      <avp name="FramedIpAddress" value="0x510663c2"> </avp>
      <avp name="3gppImsi" value="286026470059101"> </avp>
      <avp name="3gppImsiMccMnc" value="286026"> </avp>
      <avp name="3gppGprsMccMnc" value="25099"> </avp>
      <avp name="Bearer-Usage" value="0"> </avp>
      <avp name="RulebaseId" value="56465F525333"> </avp>
      <avp name="CalledStationId" value="internettest"> </avp>
      <avp name="Radio-Access-Technology" value="1"> </avp>
<!-- mcc:286 mnc:02 - VFTR 
      <avp name="User-Location-Information" value="0x0182f620281fdaaf"> </avp> -->
<!-- mcc:222 mnc:10
      <avp name="User-Location-Information" value="0x0122f201281fdaaf"> </avp> -->
<!-- mcc:206 mnc: 01 - Belgacom mobile - Belgium -->
      <avp name="User-Location-Information" value="0x0102f610281fdaaf"> </avp>
      <avp name="Subscription-Id">
        <avp name="Subscription-Id-Type" value="0"> </avp>
        <avp name="Subscription-Id-Data" value="value_is_replaced"></avp>
      </avp>
      <avp name="Termination-Cause" value="1"> </avp>
    </command>
    <action>
      <start-timer></start-timer>
    </action>
  </send>
  
  <receive channel="channel-1">
    <action>
      <stop-timer></stop-timer>
    </action>
    <command name="CCA">
      <avp name="Result-Code" value="2001"> </avp>
    </command>
    <action>
      <check-value name="Result-Code" behaviour="error"></check-value>
    </action>
  </receive>

</traffic>
</scenario>

For the initilization of the Diameter session, first CER message is sent by Seagull. On the 11th line, chanel-1 is used, which was already defined on conf.client.xml file. Capabilities Exchange Request message consists of necessary AVPs. On the 26th line, Seagull waits for CEA message from the same channel.

After that, the traffic is started. The MSISDN is taken from the file (msisdn.csv) which was defined on conf.client.xml and it is sent on Subscription-Id-Data AVP. The session counter is needed for load tests, each session will have increased counter at the end of SessionId. This counter will start from 5 as defined on the 7th line. Since this is initial request, the CC-Request-Type AVP is set to 1. CC-Request-Number is set to 0 and this will be increased in the following update and terminate requests. SGSN address is set to 217.31.231.35 on the 69th line (as Hex number). Radio-Access-Technology is set to 1 which means 3G. MCC/MNC and CellId information is taken from User-Location-Information AVP. ServiceUnit is requested for Rating Group 14 on lines between 84 and 87 using Multiple-Services-Credit-Control AVP. The used msisdn from msisdn.csv file (this will be important in case more than 1 msisdn is defined on msisdn.csv file) will be stored on msisdn parameter on 96th line.

On the receive channel, CCA with the result code 2001 (DIAMETER_SUCCESS) is expected. For other result codes, seagull will close the session. Session-id is also stored on sid variable on the 108th line to be used on the update and terminate requests. Before the first update request, Seagull waits for 2 seconds which is defined on the 112th line.

In the first update request, CC-Request-Type is set to 2 which means update and this will have the same value for all the update requests. CC-Request-Number is increased and set to 1. Usage of 1423360 bytes are reported for Rating Group 14 (between line 141 and 146), then units are requested for Rating Group 2. The values are replaced with sid and msisdn variables on the lines 127 and 176 respectively.

The same logic continues for the next 3 update requests. On the terminate request, 994203 byte usage is reported for Rating Group 1 and the session is closed, the traffic is finished and the scenario ends. Termination-Cause is set to 1 which means DIAMETER_LOGOUT (the user disconnected).

Since all the configuration is ready, just start the client and check your diameter server log and/or CDR files:

[root@redhat diameter]# cd run
[root@redhat run]# pwd
/opt/seagull/diameter/run
[root@redhat diameter]# ./start_client_cc.ksh
|------------------------+---------------------------+-------------------------|
| Start/Current Time     |       2011-10-23 22:22:03 |     2011-10-23 22:22:03 |
|------------------------+---------------------------+-------------------------|
|    Counter Name        |      Periodic value       |     Cumulative value    |
|------------------------+---------------------------+-------------------------|
| Elapsed Time           | 00:00:00:001              | 00:00:00:001            |
| Call rate (/s)         |    0.000                  |    0.000                |
|------------------------+---------------------------+-------------------------|
| Incoming calls         |        0                  |        0                |
| Outgoing calls         |        0                  |        0                |
| Msg Recv/s             |    0.000                  |    0.000                |
| Msg Sent/s             |    0.000                  |    0.000                |
| Unexpected msg         |        0                  |        0                |
| Current calls          |        0                  |    0.000                |
|------------------------+---------------------------+-------------------------|
| Successful calls       |        0                  |        0                |
| Failed calls           |        0                  |        0                |
| Refused calls          |        0                  |        0                |
| Aborted calls          |        0                  |        0                |
| Timeout calls          |        0                  |        0                |
|------------------------+---------------------------+-------------------------|
| Last Info              | Outgoing traffic                                    |
| Last Error             | No error                                            |
|--- Next screen : Press key 1 ----------------------- [h]: Display help ------|

...

|------------------------+---------------------------+-------------------------|
| Start/Current Time     |       2011-10-23 22:22:03 |     2011-10-23 22:22:25 |
|------------------------+---------------------------+-------------------------|
|    Counter Name        |      Periodic value       |     Cumulative value    |
|------------------------+---------------------------+-------------------------|
| Elapsed Time           | 00:00:00:822              | 00:00:21:871            |
| Call rate (/s)         |    0.000                  |    0.091                |
|------------------------+---------------------------+-------------------------|
| Incoming calls         |        0                  |        0                |
| Outgoing calls         |        0                  |        2                |
| Msg Recv/s             |    0.000                  |    0.320                |
| Msg Sent/s             |    0.000                  |    0.320                |
| Unexpected msg         |        0                  |        0                |
| Current calls          |        0                  |    0.000                |
|------------------------+---------------------------+-------------------------|
| Successful calls       |        0                  |        2                |
| Failed calls           |        0                  |        0                |
| Refused calls          |        0                  |        0                |
| Aborted calls          |        0                  |        0                |
| Timeout calls          |        0                  |        0                |
|------------------------+---------------------------+-------------------------|
| Last Info              | Stopping traffic                                    |
| Last Error             | No error                                            |
|--- Next screen : Press key 1 ----------------------- [h]: Display help ------|

For the commands during load, please refer to the documentation

Categories: Unix/Linux Tags:

Memcached-1.4.7 64 bit Installation on Solaris 10

October 6th, 2011 No comments

You need to install memcache on solaris, but you can’t find the latest version on sunfreeware.
Here is how you can compile it 64 bit on Solaris 10:

Memcached needs libevent, first download and compile it as an ordinary user:

koray@solaris ~ $ cd /tmp
koray@solaris ~ $ wget http://monkey.org/~provos/libevent-2.0.13-stable.tar.gz
koray@solaris ~ $ gunzip -c libevent-2.0.13-stable.tar.gz | tar xvf  -
koray@solaris ~ $ cd libevent-2.0.13-stable

Change the configure settings for 64 bit and then configure and make:

koray@solaris ~ $ sed 's/CFLAGS="-g/CFLAGS="-g -m64/g' configure > /tmp/configure.1
koray@solaris ~ $ sed 's/CXXFLAGS="-g/CXXFLAGS="-g -m64/g' /tmp/configure.1 > /tmp/configure.2
koray@solaris ~ $ cp /tmp/configure.2 configure
koray@solaris ~ $ ./configure --prefix=/usr/local
koray@solaris ~ $ make all

Install it as root:

koray@solaris ~ $ su -
root@solaris ~ # cd /tmp/libevent-2.0.13-stable; make install

You will have those libraries under /usr/local/lib:

root@solaris:/usr/local/lib # ls -l
lrwxrwxrwx   1 root     root          21 Sep 24 12:38 libevent-2.0.so.5 -> libevent-2.0.so.5.1.2
-rwxr-xr-x   1 root     root      903136 Sep 24 12:06 libevent-2.0.so.5.1.2
-rw-r--r--   1 root     root     1809560 Sep 24 12:06 libevent.a
-rwxr-xr-x   1 root     root         978 Sep 24 12:06 libevent.la
lrwxrwxrwx   1 root     root          21 Sep 24 12:38 libevent.so -> libevent-2.0.so.5.1.2
lrwxrwxrwx   1 root     root          26 Sep 24 12:38 libevent_core-2.0.so.5 -> libevent_core-2.0.so.5.1.2
-rwxr-xr-x   1 root     root      578520 Sep 24 12:06 libevent_core-2.0.so.5.1.2
-rw-r--r--   1 root     root     1141720 Sep 24 12:06 libevent_core.a
-rwxr-xr-x   1 root     root        1013 Sep 24 12:06 libevent_core.la
lrwxrwxrwx   1 root     root          26 Sep 24 12:38 libevent_core.so -> libevent_core-2.0.so.5.1.2
lrwxrwxrwx   1 root     root          27 Sep 24 12:38 libevent_extra-2.0.so.5 -> libevent_extra-2.0.so.5.1.2
-rwxr-xr-x   1 root     root      346688 Sep 24 12:06 libevent_extra-2.0.so.5.1.2
-rw-r--r--   1 root     root      667968 Sep 24 12:07 libevent_extra.a
-rwxr-xr-x   1 root     root        1020 Sep 24 12:06 libevent_extra.la
lrwxrwxrwx   1 root     root          27 Sep 24 12:38 libevent_extra.so -> libevent_extra-2.0.so.5.1.2
lrwxrwxrwx   1 root     root          29 Sep 24 12:38 libevent_openssl-2.0.so.5 -> libevent_openssl-2.0.so.5.1.2
-rwxr-xr-x   1 root     root       76712 Sep 24 12:06 libevent_openssl-2.0.so.5.1.2
-rw-r--r--   1 root     root      106816 Sep 24 12:07 libevent_openssl.a
-rwxr-xr-x   1 root     root        1049 Sep 24 12:06 libevent_openssl.la
lrwxrwxrwx   1 root     root          29 Sep 24 12:38 libevent_openssl.so -> libevent_openssl-2.0.so.5.1.2
lrwxrwxrwx   1 root     root          30 Sep 24 12:38 libevent_pthreads-2.0.so.5 -> libevent_pthreads-2.0.so.5.1.2
-rwxr-xr-x   1 root     root       19000 Sep 24 12:06 libevent_pthreads-2.0.so.5.1.2
-rw-r--r--   1 root     root       16408 Sep 24 12:07 libevent_pthreads.a
-rwxr-xr-x   1 root     root        1041 Sep 24 12:06 libevent_pthreads.la
lrwxrwxrwx   1 root     root          30 Sep 24 12:38 libevent_pthreads.so -> libevent_pthreads-2.0.so.5.1.2
drwxr-xr-x   2 root     root         512 Sep 24 12:07 pkgconfig

Now, it is time to compile memcached:

koray@solaris ~ $ cd /tmp
koray@solaris ~ $ wget http://memcached.googlecode.com/files/memcached-1.4.7.tar.gz
koray@solaris ~ $ gunzip -c memcached-1.4.7.tar.gz | tar xvf  -
koray@solaris ~ $ cd memcached-1.4.7

Export some variables and then configure:

koray@solaris ~ $ export PATH=$PATH:/usr/perl5/bin
koray@solaris ~ $ export LD_LIBRARY_PATH_64=/usr/local/lib:/usr/local/lib/sparcv9

koray@solaris ~ $ ./configure --enable-64bit --prefix=/usr/local --with-libevent=/usr/local
koray@solaris ~ $ sed 's/^LDFLAGS =/LDFLAGS = -Bstatic/' Makefile > /tmp/Makefile.1
koray@solaris ~ $ sed 's/-levent/-lrt/' /tmp/Makefile.1 > /tmp/Makefile.2
koray@solaris ~ $ sed 's/^LIBS =/LIBS = -levent -Bdynamic/' /tmp/Makefile.2 > /tmp/Makefile.3
koray@solaris ~ $ sed 's/pthread/pthreads/' /tmp/Makefile.3 > /tmp/Makefile.4
koray@solaris ~ $ cp /tmp/Makefile.4 Makefile

Make all and test by ordinary user:

koray@solaris ~ $ make all 
koray@solaris ~ $ make test
./sizes 
Slab Stats 56 
Thread stats 176 
Global stats 116 
Settings 88 
Item (no cas) 32 
Item (cas) 40 
Libevent thread 96 
Connection 320 
---------------------------------------- 
libevent thread cumulative 11472 
Thread stats cumulative 11376 
./testapp 
1..46 
ok 1 - cache_create 
ok 2 - cache_constructor 
ok 3 - cache_constructor_fail 
ok 4 - cache_destructor 
ok 5 - cache_reuse 

... 

All tests successful, 2 tests skipped. 
Files=39, Tests=6475, 141 wallclock secs ( 4.94 cusr + 3.35 csys = 8.29 CPU) 
File `assoc.c' Lines executed:54.72% of 106 
File `daemon.c' Lines executed:11.11% of 27 
File `hash.c' Lines executed:73.74% of 99 
File `items.c' Lines executed:80.92% of 283 
File `memcached.c' Lines executed:71.77% of 2412 
File `slabs.c' Lines executed:88.51% of 174 
File `solaris_priv.c' Lines executed:61.90% of 21 
File `stats.c' Lines executed:89.13% of 92 
File `thread.c' Lines executed:86.58% of 298 
File `util.c' Lines executed:76.62% of 77 

If you see the “All tests successful” output, then it is time to install memcached:

koray@solaris ~ $ su -
root@solaris ~ # cd /tmp/memcached-1.4.7; make install

You can test it as below:

koray@solaris: ~ $ memcached -h
memcached 1.4.7 
-p <num>      TCP port number to listen on (default: 11211)
-U <num>      UDP port number to listen on (default: 11211, 0 is off)
-s <file>     UNIX socket path to listen on (disables network support)
-a <mask>     access mask for UNIX socket, in octal (default: 0700)

Some other data tests:

koray@solaris: ~ $ memcached -p 12345 & 
koray@solaris: ~ $ telnet 0 12345
Trying 0.0.0.0...
Connected to 0.
Escape character is '^]'.
stats
STAT pid 5840
STAT uptime 87018
STAT time 1317890071
STAT version 1.4.7
STAT libevent 2.0.13-stable
STAT pointer_size 64
STAT rusage_user 244.684613
...
STAT total_items 90663
STAT evictions 0
STAT reclaimed 0
END
set testkey 1 0 11 
Hello world  
STORED 
get testkey 
VALUE testkey 1 11
Hello world
END
delete testkey
DELETED
quit
Categories: Unix/Linux Tags:

Get Yesterday on Solaris

November 11th, 2010 Comments off

If you have chance to install GNU date on your solaris box, you can easily skip the rest of this entry and run any of the following commands:

date --date='yesterday'
date --date='1 days ago'

However, on Solaris, the date command does not have this option, so you need a little trick:

koray@solaris $ date
Thu Nov 11 10:25:45 EET 2010
koray@solaris $ YESTERDAY=`TZ=GMT+22 date`; echo $YESTERDAY
Wed Nov 10 10:25:47 GMT 2010

I’m already on GMT+2, so I used 22 above.

PS: You can go back maximum 7 days: (again I used 166 since I’m already on GMT+2)

koray@solaris $ WEEKAGO=`TZ=GMT+166 date`; echo $WEEKAGO
Thu Nov 4 10:25:49 GMT 2010
Categories: Unix/Linux Tags:

Install TOra with Oracle Support on Ubuntu 10.04

August 28th, 2010 Comments off

If you have installed TOra on Ubuntu using apt-get, you should have already noticed that the package does not contain Oracle support. Follow the instructions below to enable it. Please note that the directory and file names below are written for linux x86. In case you have 64 bit installation, be careful about the file/directory names.

We need to compile TOra from the source code, so that run the following commands to be able to compile new packages. The alien package will be needed to create deb packages for Oracle instant client deb package.

$> sudo apt-get install alien
$> sudo apt-get install autoconf automake flex zlib1g-dev docbook-xsl dpatch
$> sudo apt-get install cdbs cmake
$> sudo apt-get install qt4-qmake libqt4-dev
$> sudo apt-get install libqscintilla2-dev

The build-essentials, gcc and g++ should have been installed as dependency of alien package, if not add them to the above list. Visit Oracle’s web site to download instant client packages. You will need the following packages: oracle-instantclient11.2-basic-11.2.0.1.0-1.i386.rpm, oracle-instantclient11.2-sqlplus-11.2.0.1.0-1.i386.rpm and oracle-instantclient11.2-devel-11.2.0.1.0-1.i386.rpm.

When the downloads finish, convert and install them via alien:

$> sudo alien -i oracle-instantclient11.2-basic-11.2.0.1.0-1.i386.rpm
$> sudo alien -i oracle-instantclient11.2-sqlplus-11.2.0.1.0-1.i386.rpm
$> sudo alien -i oracle-instantclient11.2-devel-11.2.0.1.0-1.i386.rpm

Prepare the environment settings for Oracle:

$> export ORACLE_HOME="/usr/lib/oracle/11.2/client"
$> export LD_LIBRARY_PATH="${ORACLE_HOME}/lib"
$> export TNS_ADMIN="${ORACLE_HOME}"
$> echo export "ORACLE_HOME=/usr/lib/oracle/11.2/client" >> ~/.bashrc
$> echo export "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ORACLE_HOME}/lib" >> ~/.bashrc
$> echo export "TNS_ADMIN=${ORACLE_HOME}" >> ~/.bashrc

Create a link to the include directory and add lib directory to the dynamic linker run-time bindings:

$> sudo ln -s /usr/include/oracle/11.2/client ${ORACLE_HOME}/include

$> sudo vi /etc/ld.so.conf.d/oracle.conf
<span style="color: #000080;">/usr/lib/oracle/11.2/client/lib/</span>
$> sudo ldconfig
$> sudo apt-get install libaio1

Now, the Oracle client is ready, it is time to compile TOra. Create a temporary directory in your home folder, or some place that you like:

$> mkdir -p ~/src/tora
$> cd ~/src/tora
$> apt-get source tora
$> cd tora-2.1.1
$> fakeroot debian/rules binary

When the compilation finishes, you will see a message like this:

dpkg-deb: building package `tora’ in `../tora_2.1.1-1_i386.deb’.

Tora package can be installed:

$> sudo dpkg -i ../tora_2.1.1-1_i386.deb

Do not forget to create or copy tnsnames.ora file under $ORACLE_HOME. After that, run tora:

$> tora

If you don’t want your tora to be updated by apt-get, run this command:

$> echo 'tora hold' | sudo dpkg --set-selections
Categories: Unix/Linux Tags:

Jboss – Change BindAddress from localhost to all interfaces

July 22nd, 2010 Comments off

You have started your new jboss application but see that the port is binded to 127.0.0.1 and want it to listen to all interfaces. Let’s assume that the port number is 18080:

$> netstat -an | grep 18080
127.0.0.1.18080       *.*                0      0 49152      0 LISTEN

You need to add “-b <host>” or “–host=<host>” parameter to run.sh (or run.bat for windows). Edit jboss_init_solaris.sh for solaris and update the JBOSSSH variable as follows:

#define the script to use to start jboss
JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh <span style="color: #ff0000;">-b 0.0.0.0</span> -c $JBOSSCFG"}

After restarting it, jboss should be listening to all interfaces:

$> netstat -an | grep 18080
*.18080               *.*                0      0 49152      0 LISTEN
Categories: Unix/Linux Tags:

Open in Terminal on Ubuntu and Fedora 12

March 12th, 2010 Comments off

If you are familiar with Redhat/Fedora, you probably use right click on the desktop and “Open In Terminal” functionality. Well, this does not exist by default on Ubuntu as well as Fedora 12. What you need to do is installing nautilus-open-terminal package. Just run one of the following commands depending on your distro:

$> sudo apt-get install nautilus-open-terminal
#> yum install nautilus-open-terminal

After the installation, nautilus must be restarted, the best way is logging out from the gnome session and login again.

Open In Terminal

You might be frustrated when you see that the working directory of the terminal starts with ~/Desktop (or the directory you clicked the right button). If you want to change this behaviour, run this command or update it using gconf-editor:

gconftool-2 -s /apps/nautilus-open-terminal/desktop_opens_home_dir true -t bool

In addition, “Open Midnight Commander” can be enabled as well and the settings can be checked:

gconftool-2 -s /apps/nautilus-open-terminal/display_mc_item true -t bool
gconftool-2 -R /apps/nautilus-open-terminal

I did not have the mc item in the menu just after changing above setting. Restarting the gnome session solved the issue.

Categories: Unix/Linux Tags: