Review Board 1.7.16


Use spaces to format XML and create SIPpVersion class

Review Request #1049 - Created Dec. 7, 2010 and submitted

Paul Belanger
team/pabelanger/sipp
Reviewers
asterisk-dev
testsuite
After running into some issue getting the testsuite running under Ubuntu 8.04, it seemed older versions of SIPp fail to parse tabs (/t) properly. So, I replaced them with 4 spaces.

I then ran into an issue of failing tests because my SIPp version did not have the appropriate compile time flags enabled, so I created a new SIPpVersion parser.  I used the AsteriskVersion class as a template, also creating various unit tests to test the parser (very cool and fun BTW).  I've defaulted our SIPp based tests to 'v3.0' however I know some will require TLS, PCAP or both.  Will need help to confirm which will use it.

Feedback is required :)
local Ubuntu, FreeBSD and CentOS system.
asterisk/trunk/runtests.py asterisk/runtests.py
Revision 1127 New Change
[20] 18 lines
[+20]
19
sys.path.append("lib/python")
19
sys.path.append("lib/python")
20

    
   
20

   
21
from asterisk.version import AsteriskVersion
21
from asterisk.version import AsteriskVersion
22
from asterisk.asterisk import Asterisk
22
from asterisk.asterisk import Asterisk
23
from asterisk import utils
23
from asterisk import utils

    
   
24
from sipp.version import SIPpVersion
24

    
   
25

   
25
TESTS_CONFIG = "tests.yaml"
26
TESTS_CONFIG = "tests.yaml"
26
TEST_RESULTS = "asterisk-test-suite-report.xml"
27
TEST_RESULTS = "asterisk-test-suite-report.xml"
27

    
   
28

   
28
class Dependency:
29
class Dependency:
29
    def __init__(self, dep):
30
    def __init__(self, dep):
30
        self.name = ""
31
        self.name = ""

    
   
32
        self.version = ""
31
        self.met = False
33
        self.met = False

    
   
34
        self.sipp_version = SIPpVersion()
32
        if "app" in dep:
35
        if "app" in dep:
33
            self.name = dep["app"]
36
            self.name = dep["app"]
34
            self.met = utils.which(self.name) is not None
37
            self.met = utils.which(self.name) is not None
35
        elif "python" in dep:
38
        elif "python" in dep:
36
            self.name = dep["python"]
39
            self.name = dep["python"]
37
            try:
40
            try:
38
                __import__(self.name)
41
                __import__(self.name)
39
                self.met = True
42
                self.met = True
40
            except ImportError:
43
            except ImportError:
41
                pass
44
                pass

    
   
45
        elif "sipp" in dep:

    
   
46
            self.name = "SIPp"

    
   
47
            self.version = SIPpVersion(dep["sipp"])

    
   
48
            if str(self.sipp_version):

    
   
49
                if self.sipp_version > self.version:

    
   
50
                    self.met = True

    
   
51

   
42
        elif "custom" in dep:
52
        elif "custom" in dep:
43
            self.name = dep["custom"]
53
            self.name = dep["custom"]
44
            method = "depend_%s" % self.name
54
            method = "depend_%s" % self.name
45
            found = False
55
            found = False
46
            for m in dir(self):
56
            for m in dir(self):
[+20] [20] 217 lines
[+20] [+] def list_tests(self):
264
                         (str(t.minversion), str(t.minversion_check))
274
                         (str(t.minversion), str(t.minversion_check))
265
            if t.maxversion is not None:
275
            if t.maxversion is not None:
266
                print "      --> Maximum Version: %s (%s)" % \
276
                print "      --> Maximum Version: %s (%s)" % \
267
                             (str(t.maxversion), str(t.maxversion_check))
277
                             (str(t.maxversion), str(t.maxversion_check))
268
            for d in t.deps:
278
            for d in t.deps:

    
   
279
                if d.version:

    
   
280
                    print "      --> Dependency: %s" % (d.name)

    
   
281
                    print "        --> Version: %s -- Met: %s" % (d.version,

    
   
282
                            str(d.met))

    
   
283
                else:
269
                print "      --> Dependency: %s -- Met: %s" % (d.name,
284
                    print "      --> Dependency: %s -- Met: %s" % (d.name,
270
                             str(d.met))
285
                             str(d.met))
271
            i += 1
286
            i += 1
272

    
   
287

   
273
    def run(self):
288
    def run(self):
[+20] [20] 139 lines
asterisk/trunk/lib/python/sipp/version.py
New File
 
asterisk/trunk/tests/cdr/app_dial_G_flag/test-config.yaml
Revision 1127 New Change
 
asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/call.xml
Revision 1127 New Change
 
asterisk/trunk/tests/cdr/app_dial_G_flag/sipp/wait-for-call.xml
Revision 1127 New Change
 
asterisk/trunk/tests/cdr/app_queue/test-config.yaml
Revision 1127 New Change
 
asterisk/trunk/tests/cdr/app_queue/sipp/call.xml
Revision 1127 New Change
 
asterisk/trunk/tests/cdr/app_queue/sipp/call-then-hangup.xml
Revision 1127 New Change
 
asterisk/trunk/tests/cdr/app_queue/sipp/wait-for-call-hangup.xml
Revision 1127 New Change
 
asterisk/trunk/tests/cdr/blind-transfer-accountcode/test-config.yaml
Revision 1127 New Change
 
asterisk/trunk/tests/cdr/blind-transfer-accountcode/sipp/call-then-blind-transfer.xml
Revision 1127 New Change
 
asterisk/trunk/tests/cdr/blind-transfer-accountcode/sipp/register.xml
Revision 1127 New Change
 
asterisk/trunk/tests/cdr/blind-transfer-accountcode/sipp/wait-for-call.xml
Revision 1127 New Change
 
asterisk/trunk/tests/cdr/blind-transfer-accountcode/sipp/wait-for-call-do-hangup.xml
Revision 1127 New Change
 
asterisk/trunk/tests/cdr/originate-cdr-disposition/test-config.yaml
Revision 1127 New Change
 
asterisk/trunk/tests/cdr/originate-cdr-disposition/sipp/wait-for-call.xml
Revision 1127 New Change
 
asterisk/trunk/tests/cdr/originate-cdr-disposition/sipp/wait-for-call-busy.xml
Revision 1127 New Change
 
asterisk/trunk/tests/cdr/originate-cdr-disposition/sipp/wait-for-call-congestion.xml
Revision 1127 New Change
 
asterisk/trunk/tests/cdr/originate-cdr-disposition/sipp/wait-for-call-timeout.xml
Revision 1127 New Change
 
asterisk/trunk/tests/queues/position_priority_maxlen/test-config.yaml
Revision 1127 New Change
 
  1. asterisk/runtests.py: Loading...
  2. asterisk/lib/python/sipp/version.py: Loading...
  3. asterisk/tests/cdr/app_dial_G_flag/test-config.yaml: Loading...
  4. asterisk/tests/cdr/app_dial_G_flag/sipp/call.xml: Loading...
  5. asterisk/tests/cdr/app_dial_G_flag/sipp/wait-for-call.xml: Loading...
  6. asterisk/tests/cdr/app_queue/test-config.yaml: Loading...
  7. asterisk/tests/cdr/app_queue/sipp/call.xml: Loading...
  8. asterisk/tests/cdr/app_queue/sipp/call-then-hangup.xml: Loading...
  9. asterisk/tests/cdr/app_queue/sipp/wait-for-call-hangup.xml: Loading...
  10. asterisk/tests/cdr/blind-transfer-accountcode/test-config.yaml: Loading...
  11. asterisk/tests/cdr/blind-transfer-accountcode/sipp/call-then-blind-transfer.xml: Loading...
  12. asterisk/tests/cdr/blind-transfer-accountcode/sipp/register.xml: Loading...
  13. asterisk/tests/cdr/blind-transfer-accountcode/sipp/wait-for-call.xml: Loading...
  14. asterisk/tests/cdr/blind-transfer-accountcode/sipp/wait-for-call-do-hangup.xml: Loading...
  15. asterisk/tests/cdr/originate-cdr-disposition/test-config.yaml: Loading...
  16. asterisk/tests/cdr/originate-cdr-disposition/sipp/wait-for-call.xml: Loading...
  17. asterisk/tests/cdr/originate-cdr-disposition/sipp/wait-for-call-busy.xml: Loading...
  18. asterisk/tests/cdr/originate-cdr-disposition/sipp/wait-for-call-congestion.xml: Loading...
  19. asterisk/tests/cdr/originate-cdr-disposition/sipp/wait-for-call-timeout.xml: Loading...
  20. asterisk/tests/queues/position_priority_maxlen/test-config.yaml: Loading...
This diff has been split across 2 pages: 1 2 >

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.