[asterisk-commits] pabelanger: branch pabelanger/sipp r1151 - in /asterisk/team/pabelanger/sipp:...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Dec 11 00:12:11 CST 2010


Author: pabelanger
Date: Sat Dec 11 00:12:04 2010
New Revision: 1151

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1151
Log:
Updates for Russells review

Modified:
    asterisk/team/pabelanger/sipp/lib/python/sipp/version.py
    asterisk/team/pabelanger/sipp/runtests.py
    asterisk/team/pabelanger/sipp/tests/cdr/app_dial_G_flag/test-config.yaml
    asterisk/team/pabelanger/sipp/tests/cdr/app_queue/test-config.yaml
    asterisk/team/pabelanger/sipp/tests/cdr/blind-transfer-accountcode/test-config.yaml
    asterisk/team/pabelanger/sipp/tests/cdr/originate-cdr-disposition/test-config.yaml
    asterisk/team/pabelanger/sipp/tests/queues/position_priority_maxlen/test-config.yaml
    asterisk/team/pabelanger/sipp/tests/queues/ringinuse_and_pause/test-config.yaml
    asterisk/team/pabelanger/sipp/tests/rfc2833_dtmf_detect/test-config.yaml
    asterisk/team/pabelanger/sipp/tests/sip/handle_response_refer/test-config.yaml
    asterisk/team/pabelanger/sipp/tests/sip/options/test-config.yaml
    asterisk/team/pabelanger/sipp/tests/sip_channel_params/test-config.yaml
    asterisk/team/pabelanger/sipp/tests/sip_outbound_address/test-config.yaml
    asterisk/team/pabelanger/sipp/tests/sip_register/test-config.yaml

Modified: asterisk/team/pabelanger/sipp/lib/python/sipp/version.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/sipp/lib/python/sipp/version.py?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- asterisk/team/pabelanger/sipp/lib/python/sipp/version.py (original)
+++ asterisk/team/pabelanger/sipp/lib/python/sipp/version.py Sat Dec 11 00:12:04 2010
@@ -28,10 +28,13 @@
         """
         self.version_str = None
         self.feature_str = None
+        self.concept = None
+        self.major = None
+        self.minor = None
         self.tls = False
         self.pcap = False
 
-        if version is None:
+        if version is None and feature is None:
             sipp = utils.which("sipp")
             if sipp is None:
                return
@@ -46,26 +49,35 @@
                 return
             for line in p.stdout:
                 if line.strip().startswith('SIPp'):
-                    ver = line.strip().lstrip('SIPp ')
-                    ver = ver.split(',', 1)
-                    self.version_str = ver[0]
-
-        if version[:1] == "v":
-            self.__parse_version(version, feature)
-        else:
-            self.__parse_feature(version)
+                    sipp = line.strip().lstrip('SIPp ')
+                    sipp = sipp.split(',', 1)
+                    sipp = sipp[0].split('-', 1)
+                    version = sipp[0]
+                    if len(sipp) > 1:
+                        feature = sipp[1]
+
+        if version is not None:
+            self.__parse_version(version)
+        if feature is not None:
+            self.__parse_feature(feature)
 
     def __str__(self):
-        return self.version_str
+        res = ''
+        if self.version_str is not None:
+            res = self.version_str
+        if self.feature_str is not None:
+            res = "%s-%s" % (res, self.feature_str)
+
+        return res.strip('-')
 
     def __int__(self):
         res = 0
-        if self.version_str:
-            concept = self.concept.strip('v')
-            res = int(concept) * 10000000 + int(self.major) * 100000
-            if self.minor is not None:
-                res += int(self.minor) * 1000
-
+        if self.concept is not None:
+            res = int(self.concept.strip('v')) * 10000000
+        if self.major is not None:
+            res += int(self.major) * 100000
+        if self.minor is not None:
+            res += int(self.minor) * 1000
         if self.tls:
             res += 100
         if self.pcap:
@@ -102,7 +114,7 @@
                 return True
         return False
 
-    def __parse_version(self, version, feature):
+    def __parse_version(self, version):
         self.version_str = version
         if version is not None:
             parts = self.version_str.split(".")
@@ -112,10 +124,8 @@
             if len(parts) >= 3:
                 self.minor = parts[2]
 
-        if feature is not None:
-            self.__parse_feature(feature)
-
     def __parse_feature(self, value):
+        self.feature_str = value
         if value == "TLS":
             self.tls = True
         elif value == "PCAP":
@@ -126,15 +136,16 @@
 
 class SIPpVersionTests(unittest.TestCase):
     def test_version(self):
-        v = SIPpVersion("v3.2")
+        v = SIPpVersion("v3.2", None)
         self.assertEqual(str(v), "v3.2")
         self.assertEqual(v.concept, "v3")
         self.assertEqual(v.major, "2")
+        self.assertEqual(v.minor, None)
         self.assertFalse(v.tls)
         self.assertFalse(v.pcap)
 
     def test_version2(self):
-        v = SIPpVersion("v2.0.1")
+        v = SIPpVersion("v2.0.1", None)
         self.assertEqual(str(v), "v2.0.1")
         self.assertEqual(v.concept, "v2")
         self.assertEqual(v.major, "0")
@@ -144,15 +155,16 @@
 
     def test_version3(self):
         v = SIPpVersion("v3.1", "TLS")
-        self.assertEqual(str(v), "v3.1")
+        self.assertEqual(str(v), "v3.1-TLS")
         self.assertEqual(v.concept, "v3")
         self.assertEqual(v.major, "1")
+        self.assertEqual(v.minor, None)
         self.assertTrue(v.tls)
         self.assertFalse(v.pcap)
 
     def test_version4(self):
         v = SIPpVersion("v2.0.1", "TLS-PCAP")
-        self.assertEqual(str(v), "v2.0.1")
+        self.assertEqual(str(v), "v2.0.1-TLS-PCAP")
         self.assertEqual(v.concept, "v2")
         self.assertEqual(v.major, "0")
         self.assertEqual(v.minor, "1")
@@ -161,45 +173,58 @@
 
     def test_version5(self):
         v = SIPpVersion("v3.2", "PCAP")
-        self.assertEqual(str(v), "v3.2")
+        self.assertEqual(str(v), "v3.2-PCAP")
         self.assertEqual(v.concept, "v3")
         self.assertEqual(v.major, "2")
+        self.assertEqual(v.minor, None)
         self.assertFalse(v.tls)
         self.assertTrue(v.pcap)
 
     def test_version6(self):
-        v = SIPpVersion("PCAP")
+        v = SIPpVersion(None, "PCAP")
+        self.assertEqual(str(v), "PCAP")
+        self.assertEqual(v.concept, None)
+        self.assertEqual(v.major, None)
+        self.assertEqual(v.minor, None)
         self.assertFalse(v.tls)
         self.assertTrue(v.pcap)
 
     def test_version6(self):
-        v = SIPpVersion("TLS")
+        v = SIPpVersion(None, "TLS")
+        self.assertEqual(str(v), "TLS")
+        self.assertEqual(v.concept, None)
+        self.assertEqual(v.major, None)
+        self.assertEqual(v.minor, None)
         self.assertTrue(v.tls)
         self.assertFalse(v.pcap)
 
     def test_version6(self):
-        v = SIPpVersion("TLS-PCAP")
+        v = SIPpVersion(None, "TLS-PCAP")
+        self.assertEqual(str(v), "TLS-PCAP")
+        self.assertEqual(v.concept, None)
+        self.assertEqual(v.major, None)
+        self.assertEqual(v.minor, None)
         self.assertTrue(v.tls)
         self.assertTrue(v.pcap)
 
     def test_cmp(self):
-        v1 = SIPpVersion("v3.2")
-        v2 = SIPpVersion("v3.1")
+        v1 = SIPpVersion("v3.2", None)
+        v2 = SIPpVersion("v3.1", None)
         self.assertTrue(v1 > v2)
 
     def test_cmp2(self):
-        v1 = SIPpVersion("v2.0.1")
-        v2 = SIPpVersion("v3.1")
+        v1 = SIPpVersion("v2.0.1", None)
+        v2 = SIPpVersion("v3.1", None)
         self.assertTrue(v1 < v2)
 
     def test_cmp3(self):
-        v1 = SIPpVersion("v3.1")
-        v2 = SIPpVersion("v3.1")
+        v1 = SIPpVersion("v3.1", None)
+        v2 = SIPpVersion("v3.1", None)
         self.assertTrue(v1 == v2)
 
     def test_cmp4(self):
-        v1 = SIPpVersion("v3.1")
-        v2 = SIPpVersion("v3.1")
+        v1 = SIPpVersion("v3.1", None)
+        v2 = SIPpVersion("v3.1", None)
         self.assertFalse(v1 != v2)
 
     def test_cmp5(self):
@@ -208,13 +233,13 @@
         self.assertTrue(v1 == v2)
 
     def test_cmp6(self):
-        v1 = SIPpVersion("TLS")
-        v2 = SIPpVersion("TLS")
+        v1 = SIPpVersion(None, "TLS")
+        v2 = SIPpVersion(None, "TLS")
         self.assertTrue(v1 == v2)
 
     def test_cmp7(self):
-        v1 = SIPpVersion("v2.0.1")
-        v2 = SIPpVersion("v2.0.1")
+        v1 = SIPpVersion("v2.0.1", None)
+        v2 = SIPpVersion("v2.0.1", None)
         self.assertTrue(v1 == v2)
 
     def test_cmp8(self):
@@ -223,8 +248,8 @@
         self.assertTrue(v1 != v2)
 
     def test_cmp9(self):
-        v1 = SIPpVersion("TLS")
-        v2 = SIPpVersion("PCAP")
+        v1 = SIPpVersion(None, "TLS")
+        v2 = SIPpVersion(None, "PCAP")
         self.assertTrue(v1 != v2)
 
     def test_cmp10(self):
@@ -233,8 +258,8 @@
         self.assertFalse(v1 == v2)
 
     def test_cmp11(self):
-        v1 = SIPpVersion("TLS")
-        v2 = SIPpVersion("PCAP")
+        v1 = SIPpVersion(None, "TLS")
+        v2 = SIPpVersion(None, "PCAP")
         self.assertFalse(v1 == v2)
 
     def test_cmp12(self):
@@ -244,7 +269,7 @@
 
     def test_cmp13(self):
         v1 = SIPpVersion("v3.2", "TLS-PCAP")
-        v2 = SIPpVersion("TLS")
+        v2 = SIPpVersion(None, "TLS")
         self.assertTrue(v1 >= v2)
 
     def test_cmp14(self):
@@ -254,7 +279,7 @@
 
     def test_cmp15(self):
         v1 = SIPpVersion("v3.2", "TLS-PCAP")
-        v2 = SIPpVersion("PCAP")
+        v2 = SIPpVersion(None, "PCAP")
         self.assertTrue(v1 >= v2)
 
     def test_cmp16(self):
@@ -264,7 +289,7 @@
 
     def test_cmp17(self):
         v1 = SIPpVersion("v3.2", "TLS-PCAP")
-        v2 = SIPpVersion("TLS")
+        v2 = SIPpVersion(None, "TLS")
         self.assertTrue(v1 != v2)
 
     def test_cmp18(self):
@@ -274,7 +299,7 @@
 
     def test_cmp19(self):
         v1 = SIPpVersion("v3.2", "TLS-PCAP")
-        v2 = SIPpVersion("TLS")
+        v2 = SIPpVersion(None, "TLS")
         self.assertFalse(v1 == v2)
 
     def test_cmp20(self):

Modified: asterisk/team/pabelanger/sipp/runtests.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/sipp/runtests.py?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- asterisk/team/pabelanger/sipp/runtests.py (original)
+++ asterisk/team/pabelanger/sipp/runtests.py Sat Dec 11 00:12:04 2010
@@ -44,10 +44,15 @@
                 pass
         elif "sipp" in dep:
             self.name = "SIPp"
-            self.version = SIPpVersion(dep["sipp"])
-            if str(self.sipp_version):
-                if self.sipp_version > self.version:
-                    self.met = True
+            version = None
+            feature = None
+            if 'version' in dep['sipp']:
+                version = dep['sipp']['version']
+            if 'feature' in dep['sipp']:
+                feature = dep['sipp']['feature']
+            self.version = SIPpVersion(version, feature)
+            if self.sipp_version >= self.version:
+                self.met = True
 
         elif "custom" in dep:
             self.name = dep["custom"]

Modified: asterisk/team/pabelanger/sipp/tests/cdr/app_dial_G_flag/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/sipp/tests/cdr/app_dial_G_flag/test-config.yaml?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- asterisk/team/pabelanger/sipp/tests/cdr/app_dial_G_flag/test-config.yaml (original)
+++ asterisk/team/pabelanger/sipp/tests/cdr/app_dial_G_flag/test-config.yaml Sat Dec 11 00:12:04 2010
@@ -11,4 +11,5 @@
     dependencies:
         - app : 'bash'
         - app : 'asttest'
-        - sipp : 'v3.0'
+        - sipp :
+            version : 'v3.0'

Modified: asterisk/team/pabelanger/sipp/tests/cdr/app_queue/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/sipp/tests/cdr/app_queue/test-config.yaml?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- asterisk/team/pabelanger/sipp/tests/cdr/app_queue/test-config.yaml (original)
+++ asterisk/team/pabelanger/sipp/tests/cdr/app_queue/test-config.yaml Sat Dec 11 00:12:04 2010
@@ -11,4 +11,5 @@
     dependencies:
         - app : 'bash'
         - app : 'asttest'
-        - sipp : 'v3.0'
+        - sipp :
+            version : 'v3.0'

Modified: asterisk/team/pabelanger/sipp/tests/cdr/blind-transfer-accountcode/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/sipp/tests/cdr/blind-transfer-accountcode/test-config.yaml?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- asterisk/team/pabelanger/sipp/tests/cdr/blind-transfer-accountcode/test-config.yaml (original)
+++ asterisk/team/pabelanger/sipp/tests/cdr/blind-transfer-accountcode/test-config.yaml Sat Dec 11 00:12:04 2010
@@ -14,4 +14,6 @@
     dependencies:
         - app : 'bash'
         - app : 'asttest'
-        - sipp : 'v3.0'
+        - sipp :
+            version : 'v3.0'
+            feature : 'TLS'

Modified: asterisk/team/pabelanger/sipp/tests/cdr/originate-cdr-disposition/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/sipp/tests/cdr/originate-cdr-disposition/test-config.yaml?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- asterisk/team/pabelanger/sipp/tests/cdr/originate-cdr-disposition/test-config.yaml (original)
+++ asterisk/team/pabelanger/sipp/tests/cdr/originate-cdr-disposition/test-config.yaml Sat Dec 11 00:12:04 2010
@@ -14,4 +14,5 @@
     dependencies:
         - app : 'bash'
         - app : 'asttest'
-        - sipp : 'v3.0'
+        - sipp :
+            version : 'v3.0'

Modified: asterisk/team/pabelanger/sipp/tests/queues/position_priority_maxlen/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/sipp/tests/queues/position_priority_maxlen/test-config.yaml?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- asterisk/team/pabelanger/sipp/tests/queues/position_priority_maxlen/test-config.yaml (original)
+++ asterisk/team/pabelanger/sipp/tests/queues/position_priority_maxlen/test-config.yaml Sat Dec 11 00:12:04 2010
@@ -10,4 +10,5 @@
     dependencies:
         - app : 'bash'
         - app : 'asttest'
-        - sipp : 'v3.0'
+        - sipp :
+            version : 'v3.0'

Modified: asterisk/team/pabelanger/sipp/tests/queues/ringinuse_and_pause/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/sipp/tests/queues/ringinuse_and_pause/test-config.yaml?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- asterisk/team/pabelanger/sipp/tests/queues/ringinuse_and_pause/test-config.yaml (original)
+++ asterisk/team/pabelanger/sipp/tests/queues/ringinuse_and_pause/test-config.yaml Sat Dec 11 00:12:04 2010
@@ -17,4 +17,5 @@
     dependencies:
         - app : 'bash'
         - app : 'asttest'
-        - sipp : 'v3.0'
+        - sipp :
+            version : 'v3.0'

Modified: asterisk/team/pabelanger/sipp/tests/rfc2833_dtmf_detect/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/sipp/tests/rfc2833_dtmf_detect/test-config.yaml?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- asterisk/team/pabelanger/sipp/tests/rfc2833_dtmf_detect/test-config.yaml (original)
+++ asterisk/team/pabelanger/sipp/tests/rfc2833_dtmf_detect/test-config.yaml Sat Dec 11 00:12:04 2010
@@ -26,4 +26,6 @@
     dependencies:
         - app : 'bash'
         - app : 'asttest'
-        - sipp : 'v3.0'
+        - sipp :
+            version : 'v3.0'
+            feature : 'PCAP'

Modified: asterisk/team/pabelanger/sipp/tests/sip/handle_response_refer/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/sipp/tests/sip/handle_response_refer/test-config.yaml?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- asterisk/team/pabelanger/sipp/tests/sip/handle_response_refer/test-config.yaml (original)
+++ asterisk/team/pabelanger/sipp/tests/sip/handle_response_refer/test-config.yaml Sat Dec 11 00:12:04 2010
@@ -12,4 +12,5 @@
     dependencies:
         - app : 'bash'
         - app : 'asttest'
-        - sipp : 'v3.0'
+        - sipp :
+            version : 'v3.0'

Modified: asterisk/team/pabelanger/sipp/tests/sip/options/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/sipp/tests/sip/options/test-config.yaml?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- asterisk/team/pabelanger/sipp/tests/sip/options/test-config.yaml (original)
+++ asterisk/team/pabelanger/sipp/tests/sip/options/test-config.yaml Sat Dec 11 00:12:04 2010
@@ -7,4 +7,5 @@
 properties:
     minversion: '1.4'
     dependencies:
-        - sipp : 'v3.0'
+        - sipp :
+            version : 'v3.0'

Modified: asterisk/team/pabelanger/sipp/tests/sip_channel_params/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/sipp/tests/sip_channel_params/test-config.yaml?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- asterisk/team/pabelanger/sipp/tests/sip_channel_params/test-config.yaml (original)
+++ asterisk/team/pabelanger/sipp/tests/sip_channel_params/test-config.yaml Sat Dec 11 00:12:04 2010
@@ -19,4 +19,5 @@
     dependencies:
         - app : 'bash'
         - app : 'asttest'
-        - sipp : 'v3.0'
+        - sipp :
+            version : 'v3.0'

Modified: asterisk/team/pabelanger/sipp/tests/sip_outbound_address/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/sipp/tests/sip_outbound_address/test-config.yaml?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- asterisk/team/pabelanger/sipp/tests/sip_outbound_address/test-config.yaml (original)
+++ asterisk/team/pabelanger/sipp/tests/sip_outbound_address/test-config.yaml Sat Dec 11 00:12:04 2010
@@ -19,4 +19,6 @@
     dependencies:
         - app : 'bash'
         - app : 'asttest'
-        - sipp : 'v3.0'
+        - sipp :
+            version : 'v3.0'
+            feature : 'PCAP'

Modified: asterisk/team/pabelanger/sipp/tests/sip_register/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/sipp/tests/sip_register/test-config.yaml?view=diff&rev=1151&r1=1150&r2=1151
==============================================================================
--- asterisk/team/pabelanger/sipp/tests/sip_register/test-config.yaml (original)
+++ asterisk/team/pabelanger/sipp/tests/sip_register/test-config.yaml Sat Dec 11 00:12:04 2010
@@ -13,4 +13,5 @@
         - python : 'twisted'
         - python : 'starpy'
         - custom : 'ipv6'
-        - sipp : 'v3.0'
+        - sipp :
+            version : 'v3.0'




More information about the asterisk-commits mailing list