TestPrepaidClir.py

Go to the documentation of this file.
00001 #
00002 # Test Environment for VoIP Networks (TestEnv)
00003 #
00004 # Copyright (C) 2008  Enrico Hartung <enrico@iptel.org>
00005 #
00006 # This program is free software: you can redistribute it and/or modify
00007 # it under the terms of the GNU General Public License as published by
00008 # the Free Software Foundation, either version 3 of the License, or
00009 # (at your option) any later version.
00010 #
00011 # This program is distributed in the hope that it will be useful,
00012 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 # GNU General Public License for more details.
00015 #
00016 # You should have received a copy of the GNU General Public License
00017 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 
00019 from testenv.core.TestCase import TestCase
00020 
00021 
00022 ##
00023 # 
00024 #       Scenario: prepaid test to pstn with clir
00025 #                                                                                                               
00026 #       This scenario simulates ordinary call into pstn. 
00027 #       The caller is a prepaid customer with clir enabled.
00028 #       So the call is routed over an application server (as) running a prepaid application.
00029 # 
00030 #       Call flow Part1:
00031 #       @verbatim
00032 #               caller a      sipProxy + as        pstn
00033 #               |               |               |
00034 #               | (1) INVITE    |               |
00035 #               | =============>|               |
00036 #               |               | (2) INVITE    |
00037 #               |               | ============> |
00038 #               | (3) 100       |               |
00039 #               | <=============|               |
00040 #               |               | (4) 180       |
00041 #               |               | <============ |
00042 #               | (5) 180       |               |
00043 #               | <=============|               |
00044 #               |               | (6) 200 OK    |
00045 #               |               | <============ |
00046 #               | (7) 200 OK    |               |
00047 #               | <=============|               |
00048 #               | (8) ACK       |               |
00049 #               | ============> |               |
00050 #               |               | (9) ACK       |
00051 #               |               | ============> |
00052 #               |               | (10) BYE      |
00053 #               |               | <============ |
00054 #               | (11) BYE      |               |
00055 #               | <============ |               |
00056 #               | (12) 200 OK   |               |
00057 #               | =============>|               |
00058 #               |               | (13) 200 OK   |
00059 #               |               | ============> |
00060 #       @endverbatim
00061 #       
00062 #       @author Enrico Hartung <enrico@iptel.org>
00063 #       @license GPL
00064 #       
00065 class TestPrepaidClir(TestCase):
00066         
00067         def initTestCase(self):
00068                 "this function is called by the __init__ function from the parent. Don't define your own __init__ here!" 
00069         
00070                 #set description to identify test case in output
00071                 self.setDescription("prepaid clir")
00072         
00073                 #files to be updated with test users data
00074                 self.addFile("basic_caller.csv")
00075                 
00076         
00077         def test(self):
00078                 "implementation of test case: prepaid clir"    
00079                 
00080                 #get parameters
00081                 scenarioPath = self.getResourcesPath() + "/"
00082                 targetIp = self.getParameter("configuration.local.target.ip")
00083                 #get network interface to use from config
00084                 localDevice = self.getParameter("configuration.local.interface")
00085                 #get IP address of network interface
00086                 localIp = self.getIpAddress(localDevice)
00087                 
00088                 #build SIPp parameter list for starting caller
00089                 argsCaller1 = []
00090                 argsCaller1.extend(["-sf",  scenarioPath + "basic_caller.xml"])
00091                 argsCaller1.extend([targetIp])
00092                 argsCaller1.extend(["-i", localIp])
00093                 argsCaller1.extend(["-p", "5063"])
00094                 argsCaller1.extend(["-inf", scenarioPath + "basic_caller.csv"])
00095                 argsCaller1.extend(["-m", "1"])
00096                 
00097                 #build SIPp parameter list for starting caller
00098                 argsCaller2 = []
00099                 argsCaller2.extend(["-sf",  scenarioPath + "basic_bye_callee_caller.xml"])
00100                 argsCaller2.extend([targetIp])
00101                 argsCaller2.extend(["-i", localIp])
00102                 argsCaller2.extend(["-p", "5063"])
00103                 argsCaller2.extend(["-inf", scenarioPath + "basic_caller.csv"])
00104                 argsCaller2.extend(["-m", "1"])
00105         
00106                 #scenario caller sends BYE
00107                 test1 = self.newTest("sipp", "caller1", {'arguments' : argsCaller1}, 180)
00108                 
00109                 #set scenario path because the sipp module needs to get the log files from there
00110                 test1.set("scenarioPath", self.getResourcesPath())
00111                 
00112                 test1.start()
00113                 test1.join()
00114 
00115                 #scenario callee sends BYE
00116                 test2 = self.newTest("sipp", "caller2", {'arguments' : argsCaller2}, 180)
00117                 
00118                 #set scenario path because the sipp module needs to get the log files from there
00119                 test2.set("scenarioPath", self.getResourcesPath())
00120                 
00121                 test2.start()
00122                 test2.join()
00123 
00124 
00125 

Generated on Mon Aug 11 17:28:22 2008 for TestEnv by  doxygen 1.5.5