Change in mncc-python[master]: mncc_mt_loadgen.py: add codec arg

2020-05-01 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/mncc-python/+/17980 )

Change subject: mncc_mt_loadgen.py: add codec arg
..

mncc_mt_loadgen.py: add codec arg

Add codec parameter to start_call() and convenience functions mt_call()
and calls() with FR as default. While at it, update the help text.

Related: SYS#4924
Change-Id: I5879b8b9ccc63908b9f6629487e66eff1e4a1ab4
---
M mncc_mt_loadgen.py
1 file changed, 10 insertions(+), 7 deletions(-)

Approvals:
  osmith: Verified
  laforge: Looks good to me, approved



diff --git a/mncc_mt_loadgen.py b/mncc_mt_loadgen.py
index 5f15e3b..e401fcb 100755
--- a/mncc_mt_loadgen.py
+++ b/mncc_mt_loadgen.py
@@ -109,12 +109,11 @@
 self.state = 'NULL'
 self.rtp_msc = None

-def start_call(self, msisdn_called, msisdn_calling):
+def start_call(self, msisdn_called, msisdn_calling, codec):
 '''Start a MT call from given [external] calling party to given mobile 
party MSISDN'''
 self.msisdn_called = msisdn_called
 self.msisdn_calling = msisdn_calling
 # allocate a RTP connection @ rtpsource
-codec = "GSM_FR"  # FIXME: make configurable
 r = self.ctrl_act.ask({'type':'rtp_create', 'cname':self.callref, 
'codec':codec})
 self.ext_rtp_host = r['remote_host']
 self.ext_rtp_port = r['remote_port']
@@ -173,23 +172,27 @@
 rtpctrl_act = RtpSourceCtrlActor.start(RTPSOURCE_CTRL_IP, RTPSOURCE_CTRL_PORT)
 
 # convenience wrapper
-def mt_call(msisdn_called, msisdn_calling = '123456789', codecs = 
GSM48.AllCodecs):
+def mt_call(msisdn_called, msisdn_calling='123456789', codecs=GSM48.AllCodecs, 
codec='GSM_FR'):
 call_conn = MTCallRtpsource.start(mncc_act, rtpctrl_act, codecs).proxy()
-call_conn.start_call(msisdn_called, msisdn_calling)
+call_conn.start_call(msisdn_called, msisdn_calling, codec)
 return call_conn

-def calls(nr, ramp=1.0):
+def calls(nr, ramp=1.0, codec='GSM_FR'):
 for i in range(nr):
 a = 90001 + i
 a = str(a)
 print("%d: mt_call(%r)" % (i, a))
-mt_call(a)
+mt_call(a, codec=codec)
 time.sleep(ramp)

 log.info("")
 log.info("")
-log.info("Start calls by typing:")
+log.info("Start a single call by typing:")
 log.info("mt_call('90001')")
+log.info("With a specific codec (default is 'GSM_FR'):")
+log.info("mt_call('90001', codec='GSM_EFR')")
+log.info("Start multiple calls with (e.g. 4 calls with EFR):")
+log.info("calls(4, codec='GSM_EFR')")
 log.info("")
 log.info("")


--
To view, visit https://gerrit.osmocom.org/c/mncc-python/+/17980
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: mncc-python
Gerrit-Branch: master
Gerrit-Change-Id: I5879b8b9ccc63908b9f6629487e66eff1e4a1ab4
Gerrit-Change-Number: 17980
Gerrit-PatchSet: 3
Gerrit-Owner: osmith 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-MessageType: merged


Change in mncc-python[master]: mncc_mt_loadgen.py: add codec arg

2020-05-01 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/mncc-python/+/17980 )

Change subject: mncc_mt_loadgen.py: add codec arg
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/mncc-python/+/17980
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: mncc-python
Gerrit-Branch: master
Gerrit-Change-Id: I5879b8b9ccc63908b9f6629487e66eff1e4a1ab4
Gerrit-Change-Number: 17980
Gerrit-PatchSet: 3
Gerrit-Owner: osmith 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Comment-Date: Fri, 01 May 2020 14:28:32 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in mncc-python[master]: mncc_mt_loadgen.py: add codec arg

2020-04-30 Thread osmith
osmith has posted comments on this change. ( 
https://gerrit.osmocom.org/c/mncc-python/+/17980 )

Change subject: mncc_mt_loadgen.py: add codec arg
..


Patch Set 3: Verified+1


--
To view, visit https://gerrit.osmocom.org/c/mncc-python/+/17980
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: mncc-python
Gerrit-Branch: master
Gerrit-Change-Id: I5879b8b9ccc63908b9f6629487e66eff1e4a1ab4
Gerrit-Change-Number: 17980
Gerrit-PatchSet: 3
Gerrit-Owner: osmith 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Comment-Date: Thu, 30 Apr 2020 08:07:26 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in mncc-python[master]: mncc_mt_loadgen.py: add codec arg

2020-04-30 Thread osmith
osmith has posted comments on this change. ( 
https://gerrit.osmocom.org/c/mncc-python/+/17980 )

Change subject: mncc_mt_loadgen.py: add codec arg
..


Patch Set 2: Verified+1


--
To view, visit https://gerrit.osmocom.org/c/mncc-python/+/17980
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: mncc-python
Gerrit-Branch: master
Gerrit-Change-Id: I5879b8b9ccc63908b9f6629487e66eff1e4a1ab4
Gerrit-Change-Number: 17980
Gerrit-PatchSet: 2
Gerrit-Owner: osmith 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Comment-Date: Thu, 30 Apr 2020 08:01:45 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in mncc-python[master]: mncc_mt_loadgen.py: add codec arg

2020-04-30 Thread osmith
Hello laforge,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/mncc-python/+/17980

to look at the new patch set (#2).

Change subject: mncc_mt_loadgen.py: add codec arg
..

mncc_mt_loadgen.py: add codec arg

Add codec parameter to start_call() and convenience functions mt_call()
and calls() with FR as default. While at it, update the help text.

Related: SYS#4924
Change-Id: I5879b8b9ccc63908b9f6629487e66eff1e4a1ab4
---
M mncc_mt_loadgen.py
1 file changed, 10 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/mncc-python refs/changes/80/17980/2
--
To view, visit https://gerrit.osmocom.org/c/mncc-python/+/17980
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: mncc-python
Gerrit-Branch: master
Gerrit-Change-Id: I5879b8b9ccc63908b9f6629487e66eff1e4a1ab4
Gerrit-Change-Number: 17980
Gerrit-PatchSet: 2
Gerrit-Owner: osmith 
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in mncc-python[master]: mncc_mt_loadgen.py: add codec arg

2020-04-29 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/mncc-python/+/17980 )

Change subject: mncc_mt_loadgen.py: add codec arg
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/mncc-python/+/17980
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: mncc-python
Gerrit-Branch: master
Gerrit-Change-Id: I5879b8b9ccc63908b9f6629487e66eff1e4a1ab4
Gerrit-Change-Number: 17980
Gerrit-PatchSet: 1
Gerrit-Owner: osmith 
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Wed, 29 Apr 2020 16:21:22 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in mncc-python[master]: mncc_mt_loadgen.py: add codec arg

2020-04-29 Thread osmith
osmith has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/mncc-python/+/17980 )


Change subject: mncc_mt_loadgen.py: add codec arg
..

mncc_mt_loadgen.py: add codec arg

Add codec parameter to start_call() and convenience functions mt_call()
and calls() with FR as default. While at it, update the help text.

Duplicate enum codec_type into mncc_mt_loadgen.py, because the enum
values are different from the existing enum values in the python code
(GSM48_BCAP_SV_EFR etc.).

Related: SYS#4924
Change-Id: I5879b8b9ccc63908b9f6629487e66eff1e4a1ab4
---
M mncc_mt_loadgen.py
M rtpsource/rtp_provider.h
2 files changed, 27 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/mncc-python refs/changes/80/17980/1

diff --git a/mncc_mt_loadgen.py b/mncc_mt_loadgen.py
index fcae13f..da0e7fc 100755
--- a/mncc_mt_loadgen.py
+++ b/mncc_mt_loadgen.py
@@ -95,6 +95,22 @@
 else:
 raise Exception('ctrl', 'RtpSourceCtrlActor Received unhandled %s' 
% message)

+# Keep in sync with enum codec_type in rtpsource/rtp_provider.h
+CODEC_ULAW = 0
+CODEC_ALAW = 1
+CODEC_GSM_FR = 2
+CODEC_GSM_EFR = 3
+CODEC_GSM_HR = 4
+CODEC_AMR_4_75 = 5
+CODEC_AMR_5_15 = 6
+CODEC_AMR_5_90 = 7
+CODEC_AMR_6_70 = 8
+CODEC_AMR_7_40 = 9
+CODEC_AMR_7_95 = 10
+CODEC_AMR_10_2 = 11
+CODEC_AMR_12_2 = 12
+CODEC_AMR_SID = 13
+

 class MTCallRtpsource(pykka.ThreadingActor):
 '''Actor to start a network-initiated MT (mobile terminated) call to a 
given MSISDN,
@@ -109,12 +125,11 @@
 self.state = 'NULL'
 self.rtp_msc = None

-def start_call(self, msisdn_called, msisdn_calling):
+def start_call(self, msisdn_called, msisdn_calling, codec):
 '''Start a MT call from given [external] calling party to given mobile 
party MSISDN'''
 self.msisdn_called = msisdn_called
 self.msisdn_calling = msisdn_calling
 # allocate a RTP connection @ rtpsource
-codec = 2 # FR, FIXME: make configurable
 r = self.ctrl_act.ask({'type':'rtp_create', 'cname':self.callref, 
'codec':codec})
 self.ext_rtp_host = r['remote_host']
 self.ext_rtp_port = r['remote_port']
@@ -173,23 +188,27 @@
 rtpctrl_act = RtpSourceCtrlActor.start(RTPSOURCE_CTRL_IP, RTPSOURCE_CTRL_PORT)

 # convenience wrapper
-def mt_call(msisdn_called, msisdn_calling = '123456789', codecs = 
GSM48.AllCodecs):
+def mt_call(msisdn_called, msisdn_calling='123456789', codecs=GSM48.AllCodecs, 
codec=CODEC_GSM_FR):
 call_conn = MTCallRtpsource.start(mncc_act, rtpctrl_act, codecs).proxy()
-call_conn.start_call(msisdn_called, msisdn_calling)
+call_conn.start_call(msisdn_called, msisdn_calling, codec)
 return call_conn

-def calls(nr, ramp=1.0):
+def calls(nr, ramp=1.0, codec=CODEC_GSM_FR):
 for i in range(nr):
 a = 90001 + i
 a = str(a)
 print("%d: mt_call(%r)" % (i, a))
-mt_call(a)
+mt_call(a, codec=codec)
 time.sleep(ramp)

 log.info("")
 log.info("")
-log.info("Start calls by typing:")
+log.info("Start a single call by typing:")
 log.info("mt_call('90001')")
+log.info("With a specific codec (default is FR):")
+log.info("mt_call('90001', codec=CODEC_GSM_EFR)")
+log.info("Start multiple calls with (e.g. 4 calls with EFR):")
+log.info("calls(4, codec=CODEC_GSM_EFR)")
 log.info("")
 log.info("")

diff --git a/rtpsource/rtp_provider.h b/rtpsource/rtp_provider.h
index 7048a3e..3dd9fa8 100644
--- a/rtpsource/rtp_provider.h
+++ b/rtpsource/rtp_provider.h
@@ -2,6 +2,7 @@
 #include 
 #include 

+/* Keep in sync with CODEC_* in mncc_mt_loadgen.py */
 enum codec_type {
CODEC_ULAW,
CODEC_ALAW,

--
To view, visit https://gerrit.osmocom.org/c/mncc-python/+/17980
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: mncc-python
Gerrit-Branch: master
Gerrit-Change-Id: I5879b8b9ccc63908b9f6629487e66eff1e4a1ab4
Gerrit-Change-Number: 17980
Gerrit-PatchSet: 1
Gerrit-Owner: osmith 
Gerrit-MessageType: newchange