Change in osmo-gsm-manuals[master]: Makefile.asciidoc.inc: make clean: also rm *.html

2018-11-12 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/11723 )

Change subject: Makefile.asciidoc.inc: make clean: also rm *.html
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/11723
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I4d5e9c36f75141ce88d11b16c89809be4dce87d8
Gerrit-Change-Number: 11723
Gerrit-PatchSet: 1
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Mon, 12 Nov 2018 18:00:05 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-sip-connector[master]: Allow GSM340_PLAN_UNKNOWN on MNCC originated leg.

2018-11-12 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/11716 )

Change subject: Allow GSM340_PLAN_UNKNOWN on MNCC originated leg.
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/11716
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8d71cac5b169e3b19675b9b9626e6993f3acd979
Gerrit-Change-Number: 11716
Gerrit-PatchSet: 3
Gerrit-Owner: Keith Whyte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Keith Whyte 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Mon, 12 Nov 2018 16:37:42 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-gsm-tester[master]: default-suites: Enable tests for LimeSDR-USB

2018-11-12 Thread Pau Espin Pedrol
Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/11745


Change subject: default-suites: Enable tests for LimeSDR-USB
..

default-suites: Enable tests for LimeSDR-USB

Change-Id: I896ea76f1d2847ec014a62c87220d184b95d1dd2
---
M example/default-suites.conf
1 file changed, 20 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester 
refs/changes/45/11745/1

diff --git a/example/default-suites.conf b/example/default-suites.conf
index df79232..07b8a5f 100644
--- a/example/default-suites.conf
+++ b/example/default-suites.conf
@@ -74,6 +74,26 @@
 - dynts:trx-umtrx+mod-bts0-dynts67-ipa+cfg-codec-fr-any
 - dynts:trx-umtrx+mod-bts0-dynts67-osmo

+- nitb_sms:trx-lms
+- sms:trx-lms
+- nitb_ussd:trx-lms
+- ussd:trx-lms
+- voice:trx-lms+mod-bts0-ts-tchf+cfg-codec-fr1
+- voice:trx-lms+mod-bts0-ts-tchf+cfg-codec-fr2
+- voice:trx-lms+mod-bts0-ts-tchf+cfg-codec-fr3
+- voice:trx-lms+mod-bts0-ts-tchh+cfg-codec-hr1
+- voice:trx-lms+mod-bts0-ts-tchh+cfg-codec-hr3
+- voice:trx-lms+mod-bts0-dynts-ipa+cfg-codec-fr-any
+- voice:trx-lms+mod-bts0-dynts-osmo
+- voice:trx-lms+mod-bts0-numtrx2+mod-bts0-chanallocdescend
+- gprs:trx-lms
+- gprs:trx-lms+mod-bts0-egprs
+- gprs:trx-lms+mod-bts0-dynts-ipa
+- gprs:trx-lms+mod-bts0-dynts-osmo
+- gprs:trx-lms+mod-bts0-numtrx2+mod-bts0-chanallocdescend
+- dynts:trx-lms+mod-bts0-dynts67-ipa+cfg-codec-fr-any
+- dynts:trx-lms+mod-bts0-dynts67-osmo
+
 - nitb_sms:nanobts
 - sms:nanobts+band-1900
 - nitb_ussd:nanobts+band-1900

--
To view, visit https://gerrit.osmocom.org/11745
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I896ea76f1d2847ec014a62c87220d184b95d1dd2
Gerrit-Change-Number: 11745
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 


Change in osmo-bsc[master]: handover_fsm: send HANDOVER PERFORMED msg on internal ho

2018-11-12 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/11734 )

Change subject: handover_fsm: send HANDOVER PERFORMED msg on internal ho
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/11734/1/src/osmo-bsc/handover_fsm.c
File src/osmo-bsc/handover_fsm.c:

https://gerrit.osmocom.org/#/c/11734/1/src/osmo-bsc/handover_fsm.c@792
PS1, Line 792:  send_handover_performed(conn);
should we *always* send a handover performed, or only when the codec changed? 
IIUC the MSC need not be bothered with it if the RTP remains identical.



--
To view, visit https://gerrit.osmocom.org/11734
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If26e5807280e0f75a423b3b04f8e3c698c82a351
Gerrit-Change-Number: 11734
Gerrit-PatchSet: 1
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-CC: Pau Espin Pedrol 
Gerrit-Comment-Date: Mon, 12 Nov 2018 17:17:27 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-ttcn3-hacks[master]: BSC_Tests: expect a HANDOVER PERFORMED message on internal handover

2018-11-12 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/11733 )

Change subject: BSC_Tests: expect a HANDOVER PERFORMED message on internal 
handover
..


Patch Set 1: Code-Review+1

(1 comment)

https://gerrit.osmocom.org/#/c/11733/1/bsc/BSC_Tests.ttcn
File bsc/BSC_Tests.ttcn:

https://gerrit.osmocom.org/#/c/11733/1/bsc/BSC_Tests.ttcn@2192
PS1, Line 2192: BSSAP.receive(tr_BSSMAP_HandoverPerformed);
will we *always* send a handover performed, or only when the codec changed? 
IIUC the MSC need not be bothered with it if the RTP remains identical.



--
To view, visit https://gerrit.osmocom.org/11733
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I10f4e578c96a90317939ba49b61b14a3c7e488a7
Gerrit-Change-Number: 11733
Gerrit-PatchSet: 1
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Comment-Date: Mon, 12 Nov 2018 17:16:51 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: BSC_ConnectionHandler: introduce ctrl interface

2018-11-12 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/11697 )

Change subject: BSC_ConnectionHandler: introduce ctrl interface
..


Patch Set 4:

added bonus if you include the change-id of a patch using this in the commit log


--
To view, visit https://gerrit.osmocom.org/11697
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie3caf7a449311e7687670cadfa27818635d25aa4
Gerrit-Change-Number: 11697
Gerrit-PatchSet: 4
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: dexter 
Gerrit-Comment-Date: Mon, 12 Nov 2018 17:25:20 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-ttcn3-hacks[master]: MSC_Tests: remove unused control interface

2018-11-12 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/11690 )

Change subject: MSC_Tests: remove unused control interface
..


Patch Set 2: Code-Review-1

Then the test startup should be able to decide which handler has a CTRL 
interface and which doesn't. Also related, I remember the VTY implementation in 
ttcn also first had this limitation, and fairly recently was extended to be 
able to work with multiple VTY at the same time. Please take a look whether 
that can be applied to CTRL as well, it's both essentially telnet, after all.


--
To view, visit https://gerrit.osmocom.org/11690
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I204b2e96057d13342f4bd4fdaf08fb7b88b6b11d
Gerrit-Change-Number: 11690
Gerrit-PatchSet: 2
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: dexter 
Gerrit-Comment-Date: Mon, 12 Nov 2018 17:30:12 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: BSC_ConnectionHandler: introduce ctrl interface

2018-11-12 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/11697 )

Change subject: BSC_ConnectionHandler: introduce ctrl interface
..


Patch Set 4: Code-Review+1

removing my +2 again to resolve the conflict between MSC and BSC handlers' ctrl 
interface usage first.


--
To view, visit https://gerrit.osmocom.org/11697
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie3caf7a449311e7687670cadfa27818635d25aa4
Gerrit-Change-Number: 11697
Gerrit-PatchSet: 4
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: dexter 
Gerrit-Comment-Date: Mon, 12 Nov 2018 17:30:52 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-gsm-manuals[master]: move project specific files to their own repos

2018-11-12 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/11738 )

Change subject: move project specific files to their own repos
..


Patch Set 3: Code-Review+2

it might be a bit much to ask, but code management wise it would make huge 
sense to include the commit-ids in the commit log, of the corresponding patches 
that add the files in separate repositories.


--
To view, visit https://gerrit.osmocom.org/11738
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib234fe4f4ac36c27a4ad8a8d0050c1d6874232bc
Gerrit-Change-Number: 11738
Gerrit-PatchSet: 3
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Mon, 12 Nov 2018 17:48:51 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-remsim[master]: minor: show USB error message instead of number

2018-11-12 Thread Kévin Redon
Kévin Redon has uploaded this change for review. ( 
https://gerrit.osmocom.org/11754


Change subject: minor: show USB error message instead of number
..

minor: show USB error message instead of number

Change-Id: I272ac1be82b7432934969ea4d204dd20067d9428
---
M src/simtrace2-remsim_client.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/54/11754/1

diff --git a/src/simtrace2-remsim_client.c b/src/simtrace2-remsim_client.c
index f033e7d..1cf09a6 100644
--- a/src/simtrace2-remsim_client.c
+++ b/src/simtrace2-remsim_client.c
@@ -465,7 +465,7 @@
if (rc < 0 && rc != LIBUSB_ERROR_TIMEOUT &&
rc != LIBUSB_ERROR_INTERRUPTED &&
rc != LIBUSB_ERROR_IO) {
-   fprintf(stderr, "BULK IN transfer error; rc=%d\n", rc);
+   fprintf(stderr, "BULK IN transfer error: %s\n", 
libusb_error_name(rc));
return;
}
/* dispatch any incoming data */

--
To view, visit https://gerrit.osmocom.org/11754
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I272ac1be82b7432934969ea4d204dd20067d9428
Gerrit-Change-Number: 11754
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon 


Change in osmo-remsim[master]: add ATR as command line argument

2018-11-12 Thread Kévin Redon
Kévin Redon has uploaded this change for review. ( 
https://gerrit.osmocom.org/11753


Change subject: add ATR as command line argument
..

add ATR as command line argument

we could add a function checking the ATR validity
also before updating the (conditional) checksum we should check if
it is actually present in the ATR

Change-Id: Id1084abdf2318e96c22f8e69cc1ef161b12ef5ea
---
M src/simtrace2-remsim_client.c
1 file changed, 16 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/53/11753/1

diff --git a/src/simtrace2-remsim_client.c b/src/simtrace2-remsim_client.c
index 365acb4..f033e7d 100644
--- a/src/simtrace2-remsim_client.c
+++ b/src/simtrace2-remsim_client.c
@@ -245,6 +245,7 @@
return st_slot_tx_msg(ci->slot, msg, SIMTRACE_MSGC_CARDEM, 
SIMTRACE_MSGT_DT_CEMU_TX_DATA);
 }

+// FIXME check if the ATR actually includes a checksum
 static void atr_update_csum(uint8_t *atr, unsigned int atr_len)
 {
uint8_t csum = 0;
@@ -617,6 +618,7 @@
"\t-S\t--usb-altsetting ALTSETTING_ID\n"
"\t-A\t--usb-address\tADDRESS\n"
"\t-H\t--usb-path\tPATH\n"
+   "\t-a\t--atr\tATR\n"
"\n"
);
 }
@@ -636,6 +638,7 @@
{ "usb-altsetting", 1, 0, 'S' },
{ "usb-address", 1, 0, 'A' },
{ "usb-path", 1, 0, 'H' },
+   { "atr", 1, 0, 'a' },
{ NULL, 0, 0, 0 }
 };

@@ -652,13 +655,15 @@
int config_id = -1, altsetting = 0, addr = -1;
char *bankd_host = "127.0.0.1";
char *path = NULL;
+   uint8_t atr_data[33] = { 0x3B, 0x00 }; // the shortest simplest ATR 
possible
+   uint8_t atr_len = 2;

print_welcome();

while (1) {
int option_index = 0;

-   c = getopt_long(argc, argv, "b:p:c:s:hi:V:P:C:I:S:A:H:k", opts, 
_index);
+   c = getopt_long(argc, argv, "b:p:c:s:hi:V:P:C:I:S:A:H:a:k", 
opts, _index);
if (c == -1)
break;
switch (c) {
@@ -705,6 +710,14 @@
case 'H':
path = optarg;
break;
+   case 'a':
+   rc = osmo_hexparse(optarg, atr_data, 
ARRAY_SIZE(atr_data));
+   if (rc < 2 || rc > ARRAY_SIZE(atr_data)) {
+   fprintf(stderr, "ATR matlformed\n");
+   goto do_exit;
+   }
+   atr_len = rc;
+   break;
}
}

@@ -839,9 +852,8 @@
st_modem_sim_select_remote(ci->slot);

/* set the ATR */
-   uint8_t real_atr[] = { 0x3B, 0x00 }; // the shortest simplest 
ATR possible
-   atr_update_csum(real_atr, sizeof(real_atr));
-   cardem_request_set_atr(ci, real_atr, sizeof(real_atr));
+   //atr_update_csum(real_atr, sizeof(real_atr));
+   cardem_request_set_atr(ci, atr_data, atr_len);

/* select remote (forwarded) SIM */
st_modem_reset_pulse(ci->slot, 300);

--
To view, visit https://gerrit.osmocom.org/11753
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id1084abdf2318e96c22f8e69cc1ef161b12ef5ea
Gerrit-Change-Number: 11753
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon 


Change in osmo-ttcn3-hacks[master]: library/GSUP_Types.ttcn: add READY-FOR-SM message

2018-11-12 Thread Vadim Yanitskiy
Vadim Yanitskiy has uploaded this change for review. ( 
https://gerrit.osmocom.org/11752


Change subject: library/GSUP_Types.ttcn: add READY-FOR-SM message
..

library/GSUP_Types.ttcn: add READY-FOR-SM message

According to 3GPP TS 29.002, section 12.4, MAP-READY-FOR-SM is
used between the MSC and VLR as well as between the VLR and the
HLR to indicate that a subscriber has memory available for SMS.

This change replicates this service in GSUP as READY_FOR_SM_*.
The only mandatory IE for this service (excluding Invoke ID) is
'Alert Reason' which is replicated as OSMO_GSUP_SM_AL_REAS_IE.

Change-Id: If2256607527ecfcb10285583332fb8b0515d7c78
---
M library/GSUP_Types.ttcn
1 file changed, 54 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/52/11752/1

diff --git a/library/GSUP_Types.ttcn b/library/GSUP_Types.ttcn
index f3d05e5..447dee9 100644
--- a/library/GSUP_Types.ttcn
+++ b/library/GSUP_Types.ttcn
@@ -49,7 +49,8 @@
OSMO_GSUP_SM_RP_MR_IE   ('40'O),
OSMO_GSUP_SM_RP_DA_IE   ('41'O),
OSMO_GSUP_SM_RP_OA_IE   ('42'O),
-   OSMO_GSUP_SM_RP_UI_IE   ('43'O)
+   OSMO_GSUP_SM_RP_UI_IE   ('43'O),
+   OSMO_GSUP_SM_AL_REAS_IE ('44'O)
 } with { variant "FIELDLENGTH(8)" };

 type enumerated GSUP_MessageType {
@@ -89,7 +90,11 @@

OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST('00101000'B),
OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR  ('00101001'B),
-   OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT ('00101010'B)
+   OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT ('00101010'B),
+
+   OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST ('00101100'B),
+   OSMO_GSUP_MSGT_READY_FOR_SM_ERROR   ('00101101'B),
+   OSMO_GSUP_MSGT_READY_FOR_SM_RESULT  ('00101110'B)
 } with { variant "FIELDLENGTH(8)" };

 type enumerated GSUP_CancelType {
@@ -146,6 +151,7 @@
 sm_rp_da, tag = OSMO_GSUP_SM_RP_DA_IE;
 sm_rp_oa, tag = OSMO_GSUP_SM_RP_OA_IE;
 sm_rp_ui, tag = OSMO_GSUP_SM_RP_UI_IE;
+sm_al_reas, tag = OSMO_GSUP_SM_AL_REAS_IE;
)"
 };

@@ -184,7 +190,8 @@
OCT1sm_rp_mr,
GSUP_SM_RP_DA   sm_rp_da,
GSUP_SM_RP_OA   sm_rp_oa,
-   octetstring sm_rp_ui
+   octetstring sm_rp_ui,
+   GSUP_SM_AL_REAS_Typesm_al_reas
 };

 type record GSUP_PDU {
@@ -815,6 +822,29 @@
}
 }

+/* SM Alert Reason types, see 7.6.8.8 */
+type enumerated GSUP_SM_AL_REAS_Type {
+   GSUP_SM_AL_REAS_TYPE_NONE   ('00'O),
+   GSUP_SM_AL_REAS_TYPE_MS_PRESENT ('01'O),
+   GSUP_SM_AL_REAS_TYPE_MEM_AVAIL  ('02'O)
+} with { variant "FIELDLENGTH(8)" };
+
+/* SM Alert Reason IE (used in READY-FOR-SM), see 7.6.8.8 */
+template (value) GSUP_IE ts_GSUP_IE_SM_AL_REAS(GSUP_SM_AL_REAS_Type reas) := {
+   tag := OSMO_GSUP_SM_AL_REAS_IE,
+   len := 0, /* overwritten */
+   val := {
+   sm_al_reas := reas
+   }
+}
+template GSUP_IE tr_GSUP_IE_SM_AL_REAS(template GSUP_SM_AL_REAS_Type reas) := {
+   tag := OSMO_GSUP_SM_AL_REAS_IE,
+   len := ?,
+   val := {
+   sm_al_reas := reas
+   }
+}
+
 template (value) GSUP_IE ts_GSUP_IE_SSInfo(octetstring ss) := {
tag := OSMO_GSUP_SS_INFO_IE,
len := 0, /* overwritten */
@@ -1154,6 +1184,27 @@
}
 );

+template (value) GSUP_PDU ts_GSUP_MT_READY_FOR_SM_REQ(
+   hexstring imsi,
+   GSUP_SM_AL_REAS_Type reas /* SM Alert Reason, see 7.6.8.8 */
+) := ts_GSUP(
+   OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST,
+   {
+   valueof(ts_GSUP_IE_IMSI(imsi)),
+   valueof(ts_GSUP_IE_SM_AL_REAS(reas))
+   }
+);
+template GSUP_PDU tr_GSUP_MT_READY_FOR_SM_REQ(
+   template hexstring imsi := ?,
+   template GSUP_SM_AL_REAS_Type reas := ? /* SM Alert Reason, see 7.6.8.8 
*/
+) := tr_GSUP(
+   OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST,
+   {
+   tr_GSUP_IE_IMSI(imsi),
+   tr_GSUP_IE_SM_AL_REAS(reas)
+   }
+);
+
 function f_gsup_find_ie(GSUP_PDU msg, GSUP_IEI iei, out GSUP_IeValue ret) 
return boolean {
for (var integer i := 0; i < sizeof(msg.ies); i := i+1) {
if (msg.ies[i].tag == iei) {

--
To view, visit https://gerrit.osmocom.org/11752
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If2256607527ecfcb10285583332fb8b0515d7c78
Gerrit-Change-Number: 11752
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 


Change in osmo-gsm-tester[master]: process: launch_sync: allow non success return

2018-11-12 Thread Pau Espin Pedrol
Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/11748


Change subject: process: launch_sync: allow non success return
..

process: launch_sync: allow non success return

Change-Id: I0617335b594ba565cf2e5ffd0edfb8bffa398c48
---
M src/osmo_gsm_tester/process.py
1 file changed, 4 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester 
refs/changes/48/11748/1

diff --git a/src/osmo_gsm_tester/process.py b/src/osmo_gsm_tester/process.py
index 40d0cc1..b1769f8 100644
--- a/src/osmo_gsm_tester/process.py
+++ b/src/osmo_gsm_tester/process.py
@@ -77,7 +77,7 @@
 self.set_name(self.name_str, pid=self.process_obj.pid)
 self.log('Launched')

-def launch_sync(self):
+def launch_sync(self, raise_nonsuccess=True):
 '''
 calls launch() method and block waiting for it to finish, serving the
 mainloop meanwhile.
@@ -88,9 +88,10 @@
 except Exception as e:
 self.terminate()
 raise e
-if self.result != 0:
+if raise_nonsuccess and self.result != 0:
 log.ctx(self)
-raise log.Error('Exited in error')
+raise log.Error('Exited in error %d' % self.result)
+return self.result

 def respawn(self):
 self.dbg('respawn')

--
To view, visit https://gerrit.osmocom.org/11748
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0617335b594ba565cf2e5ffd0edfb8bffa398c48
Gerrit-Change-Number: 11748
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 


Change in osmo-gsm-tester[master]: process: Move standalone run_local_sync as method of Process

2018-11-12 Thread Pau Espin Pedrol
Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/11747


Change subject: process: Move standalone run_local_sync as method of Process
..

process: Move standalone run_local_sync as method of Process

Change-Id: Ib2b3fd39db5400a93a8caabae367dac3e3250247
---
M src/osmo_gsm_tester/iperf3.py
M src/osmo_gsm_tester/modem.py
M src/osmo_gsm_tester/process.py
3 files changed, 20 insertions(+), 16 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester 
refs/changes/47/11747/1

diff --git a/src/osmo_gsm_tester/iperf3.py b/src/osmo_gsm_tester/iperf3.py
index e1ed6ff..894b10f 100644
--- a/src/osmo_gsm_tester/iperf3.py
+++ b/src/osmo_gsm_tester/iperf3.py
@@ -105,7 +105,7 @@
 self.process = process.NetNSProcess(self.name(), self.run_dir, 
netns, popen_args, env={})
 else:
 self.process = process.Process(self.name(), self.run_dir, 
popen_args, env={})
-process.run_proc_sync(self.process)
+self.process.launch_sync()
 return self.get_results()

 def get_results(self):
diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py
index d35933a..5106702 100644
--- a/src/osmo_gsm_tester/modem.py
+++ b/src/osmo_gsm_tester/modem.py
@@ -636,7 +636,7 @@
 def run_netns_wait(self, name, popen_args):
 proc = process.NetNSProcess(name, self.run_dir.new_dir(name), 
self.netns(), popen_args,
env={})
-process.run_proc_sync(proc)
+proc.launch_sync()

 def setup_context_data_plane(self, ctx_id):
 self.dbg('setup_context_data', path=ctx_id)
diff --git a/src/osmo_gsm_tester/process.py b/src/osmo_gsm_tester/process.py
index a845f7f..40d0cc1 100644
--- a/src/osmo_gsm_tester/process.py
+++ b/src/osmo_gsm_tester/process.py
@@ -77,6 +77,21 @@
 self.set_name(self.name_str, pid=self.process_obj.pid)
 self.log('Launched')

+def launch_sync(self):
+'''
+calls launch() method and block waiting for it to finish, serving the
+mainloop meanwhile.
+'''
+try:
+self.launch()
+self.wait()
+except Exception as e:
+self.terminate()
+raise e
+if self.result != 0:
+log.ctx(self)
+raise log.Error('Exited in error')
+
 def respawn(self):
 self.dbg('respawn')
 assert not self.is_running()
@@ -255,31 +270,20 @@
 run_local_netns_sync(self.run_dir, self.name()+"-kill", self.netns, 
kill_cmd)


-def run_proc_sync(proc):
-try:
-proc.launch()
-proc.wait()
-except Exception as e:
-proc.terminate()
-raise e
-if proc.result != 0:
-log.ctx(proc)
-raise log.Error('Exited in error')
-
 def run_local_sync(run_dir, name, popen_args):
 run_dir =run_dir.new_dir(name)
 proc = Process(name, run_dir, popen_args)
-run_proc_sync(proc)
+proc.launch_sync()

 def run_local_netns_sync(run_dir, name, netns, popen_args):
 run_dir =run_dir.new_dir(name)
 proc = NetNSProcess(name, run_dir, netns, popen_args)
-run_proc_sync(proc)
+proc.launch_sync()

 def run_remote_sync(run_dir, remote_user, remote_addr, name, popen_args, 
remote_cwd=None):
 run_dir = run_dir.new_dir(name)
 proc = RemoteProcess(name, run_dir, remote_user, remote_addr, remote_cwd, 
popen_args)
-run_proc_sync(proc)
+proc.launch_sync()

 def scp(run_dir, remote_user, remote_addr, name, local_path, remote_path):
 run_local_sync(run_dir, name, ('scp', '-r', local_path, '%s@%s:%s' % 
(remote_user, remote_addr, remote_path)))

--
To view, visit https://gerrit.osmocom.org/11747
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib2b3fd39db5400a93a8caabae367dac3e3250247
Gerrit-Change-Number: 11747
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 


Change in osmo-gsm-tester[master]: nanobts: Use -G parameter of ipaccess-config to avoid need to restart...

2018-11-12 Thread Pau Espin Pedrol
Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/11750


Change subject: nanobts: Use -G parameter of ipaccess-config to avoid need to 
restart nanoBTS
..

nanobts: Use -G parameter of ipaccess-config to avoid need to restart nanoBTS

If OML IP doesn't need to be changed because it's the one already
configured, then there's no need to set + restart the nanoBTS, which
means we can speed up a test running a nanoBTS by aprox 2 minutes per
nanoBTS used.

Change-Id: I2871dee3de11512250445127f0b807a8990fd4c6
---
M src/osmo_gsm_tester/bts_nanobts.py
1 file changed, 33 insertions(+), 18 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester 
refs/changes/50/11750/1

diff --git a/src/osmo_gsm_tester/bts_nanobts.py 
b/src/osmo_gsm_tester/bts_nanobts.py
index ab75b16..80f65f4 100644
--- a/src/osmo_gsm_tester/bts_nanobts.py
+++ b/src/osmo_gsm_tester/bts_nanobts.py
@@ -19,6 +19,7 @@

 import os
 import re
+import json
 from . import log, config, util, process, pcap_recorder, bts, pcu
 from . import powersupply
 from .event_loop import MainLoop
@@ -122,24 +123,30 @@
 ipfind.stop()

 ipconfig = IpAccessConfig(self.suite_run, self.run_dir, bts_trx_ip)
+running_oml_ip = ipconfig.get_oml_ip()
+
 if running_unitid != unitid or running_trx != trx_i:
 if not ipconfig.set_unit_id(unitid, trx_i, False):
 raise log.Error('Failed configuring unit id %d trx %d' % 
(unitid, trx_i))
-# Apply OML IP and restart nanoBTS as it is required to apply the 
changes.
-if not ipconfig.set_oml_ip(self.bsc.addr(), True):
-raise log.Error('Failed configuring OML IP %s' % bts_trx_ip)

-# Let some time for BTS to restart. It takes much more than 20 
secs, and
-# this way we make sure we don't catch responses in abisip-find 
prior to
-# BTS restarting.
-MainLoop.sleep(self, 20)
+if running_oml_ip != self.bsc.addr():
+# Apply OML IP and restart nanoBTS as it is required to apply 
the changes.
+if not ipconfig.set_oml_ip(self.bsc.addr(), True):
+raise log.Error('Failed configuring OML IP %s' % 
bts_trx_ip)

-self.log('Starting to connect id %d trx %d to' % (unitid, trx_i), 
self.bsc)
-ipfind = AbisIpFind(self.suite_run, self.run_dir, local_bind_ip, 
'postconf')
-ipfind.start()
-ipfind.wait_bts_ready(bts_trx_ip)
-self.log('nanoBTS id %d trx %d configured and running' % (unitid, 
trx_i))
-ipfind.stop()
+# Let some time for BTS to restart. It takes much more than 20 
secs, and
+# this way we make sure we don't catch responses in 
abisip-find prior to
+# BTS restarting.
+MainLoop.sleep(self, 20)
+
+self.log('Starting to connect id %d trx %d to' % (unitid, 
trx_i), self.bsc)
+ipfind = AbisIpFind(self.suite_run, self.run_dir, 
local_bind_ip, 'postconf')
+ipfind.start()
+ipfind.wait_bts_ready(bts_trx_ip)
+self.log('nanoBTS id %d trx %d configured and running' % 
(unitid, trx_i))
+ipfind.stop()
+else:
+self.log('nanoBTS id %d trx %d no need to change OML IP and 
restart' % (unitid, trx_i))

 MainLoop.wait(self, self.bsc.bts_is_connected, self, timeout=600)
 self.log('nanoBTS connected to BSC')
@@ -274,20 +281,28 @@
 def set_unit_id(self, unitid, trx_num, restart=False):
 uid_str = '%d/0/%d' % (unitid, trx_num)
 if restart:
-retcode = self.run('unitid', '--restart', '--unit-id', '%s' % 
uid_str, self.bts_ip)
+retcode = self.run('setunitid', '--restart', '--unit-id', '%s' % 
uid_str, self.bts_ip)
 else:
-retcode = self.run('unitid', '--unit-id', '%s' % uid_str, 
self.bts_ip)
+retcode = self.run('setunitid', '--unit-id', '%s' % uid_str, 
self.bts_ip)
 if retcode != 0:
-log.err('ipaccess-config --unit-id %s returned error code %d' % 
(uid_str, retcode))
+self.err('ipaccess-config --unit-id %s returned error code %d' % 
(uid_str, retcode))
 return retcode == 0

 def set_oml_ip(self, omlip, restart=False):
 if restart:
-retcode = self.run('oml', '--restart', '--oml-ip', omlip, 
self.bts_ip)
+retcode = self.run('setoml', '--restart', '--oml-ip', omlip, 
self.bts_ip)
 else:
-retcode = self.run('oml', '--oml-ip', omlip, self.bts_ip)
+retcode = self.run('setoml', '--oml-ip', omlip, self.bts_ip)
 if retcode != 0:
 self.error('ipaccess-config --oml-ip %s returned error code %d' % 
(omlip, retcode))
 return retcode == 0

+def 

Change in osmo-gsm-tester[master]: nanobts: ipacces-config: Use process.launch_sync helper

2018-11-12 Thread Pau Espin Pedrol
Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/11749


Change subject: nanobts: ipacces-config: Use process.launch_sync helper
..

nanobts: ipacces-config: Use process.launch_sync helper

Change-Id: I986ba81d766240d4f11c079d90b126bf96d776b9
---
M src/osmo_gsm_tester/bts_nanobts.py
1 file changed, 3 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester 
refs/changes/49/11749/1

diff --git a/src/osmo_gsm_tester/bts_nanobts.py 
b/src/osmo_gsm_tester/bts_nanobts.py
index bec2433..ab75b16 100644
--- a/src/osmo_gsm_tester/bts_nanobts.py
+++ b/src/osmo_gsm_tester/bts_nanobts.py
@@ -253,7 +253,7 @@
 self.bts_ip = bts_ip
 self.env = {}

-def launch_process(self, binary_name, *args):
+def create_process(self, binary_name, *args):
 binary = os.path.abspath(self.inst.child('bin', binary_name))
 run_dir = self.run_dir.new_dir(binary_name)
 if not os.path.isfile(binary):
@@ -261,7 +261,6 @@
 proc = process.Process(binary_name, run_dir,
(binary,) + args,
env=self.env)
-proc.launch()
 return proc

 def run(self, name_suffix, *args):
@@ -269,13 +268,8 @@
 self.inst = 
util.Dir(os.path.abspath(self.suite_run.trial.get_inst('osmo-bsc')))
 lib = self.inst.child('lib')
 self.env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) }
-self.proc = self.launch_process(IpAccessConfig.BIN_IPACCESS_CONFIG, 
*args)
-try:
-MainLoop.wait(self, self.proc.terminated)
-except Exception as e:
-self.proc.terminate()
-raise e
-return self.proc.result
+self.proc = self.create_process(IpAccessConfig.BIN_IPACCESS_CONFIG, 
*args)
+return self.proc.launch_sync(raise_nonsuccess=False)

 def set_unit_id(self, unitid, trx_num, restart=False):
 uid_str = '%d/0/%d' % (unitid, trx_num)

--
To view, visit https://gerrit.osmocom.org/11749
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I986ba81d766240d4f11c079d90b126bf96d776b9
Gerrit-Change-Number: 11749
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 


Change in osmo-dev[master]: gitignore: add make/ and net/ (with exceptions)

2018-11-12 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/11741 )

Change subject: gitignore: add make/ and net/ (with exceptions)
..


Patch Set 1: Code-Review+2

(2 comments)

https://gerrit.osmocom.org/#/c/11741/1/.gitignore
File .gitignore:

https://gerrit.osmocom.org/#/c/11741/1/.gitignore@6
PS1, Line 6: make/
(should this be 'make/*' ? I'm not sure...)


https://gerrit.osmocom.org/#/c/11741/1/.gitignore@8
PS1, Line 8: !src/g
ah we should drop these since 'gits' is here instead



--
To view, visit https://gerrit.osmocom.org/11741
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I62277f973cc8f1ee61c5244c9d8cc75775c7cfd9
Gerrit-Change-Number: 11741
Gerrit-PatchSet: 1
Gerrit-Owner: osmith 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Comment-Date: Mon, 12 Nov 2018 17:46:56 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in osmo-msc[master]: move project specific manuals to their own repos

2018-11-12 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/11726 )

Change subject: move project specific manuals to their own repos
..


Patch Set 1: Code-Review+1

(3 comments)

I associate 'man' with the unix manpages. IIUC we are generating / going to 
generate manpages from this, but IMHO this should be called 'manuals'; or 
rather, just be directly in the doc/ dir, after all, "documentation / manuals" 
is redundant.

https://gerrit.osmocom.org/#/c/11726/1/.gitignore
File .gitignore:

https://gerrit.osmocom.org/#/c/11726/1/.gitignore@66
PS1, Line 66: *.html
Seems that the manuals get generated in the root dir of the {source,build} 
tree? I would prefer a subdir


https://gerrit.osmocom.org/#/c/11726/1/doc/man/chapters/counters_generated.adoc
File doc/man/chapters/counters_generated.adoc:

https://gerrit.osmocom.org/#/c/11726/1/doc/man/chapters/counters_generated.adoc@6
PS1, Line 6: .msc - mobile switching center
whitespace


https://gerrit.osmocom.org/#/c/11726/1/doc/man/chapters/counters_generated.adoc@37
PS1, Line 37: | msc.active_calls | <> |
whitespace



--
To view, visit https://gerrit.osmocom.org/11726
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I2f9c27f81940b02414f0e618483bffade72e8cf7
Gerrit-Change-Number: 11726
Gerrit-PatchSet: 1
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Mon, 12 Nov 2018 17:54:31 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in libosmocore[master]: merge_doc.xsl: move to osmo-gsm-manuals.git

2018-11-12 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/11739 )

Change subject: merge_doc.xsl: move to osmo-gsm-manuals.git
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/11739
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb81b18422987cdf36b75993d2782abf93b5f48c
Gerrit-Change-Number: 11739
Gerrit-PatchSet: 1
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: osmith 
Gerrit-Comment-Date: Mon, 12 Nov 2018 17:55:05 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-gsm-manuals[master]: unix-time-to-fmt.py: fix crash without argument

2018-11-12 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/11724 )

Change subject: unix-time-to-fmt.py: fix crash without argument
..


Patch Set 1: Code-Review+1

(leaving to Pau to CR)


--
To view, visit https://gerrit.osmocom.org/11724
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3ba27cc23543e47cc8a1e494c35cc33f1dc8f297
Gerrit-Change-Number: 11724
Gerrit-PatchSet: 1
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: osmith 
Gerrit-Comment-Date: Mon, 12 Nov 2018 17:59:11 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-dev[master]: gits: fix git_can_fast_forward: use arg instead of HEAD

2018-11-12 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/11755


Change subject: gits: fix git_can_fast_forward: use arg instead of HEAD
..

gits: fix git_can_fast_forward: use arg instead of HEAD

Change-Id: Idec9c9b9b7eddea2dc574fe41f73c0ac570630ca
---
M src/gits
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/55/11755/1

diff --git a/src/gits b/src/gits
index 8b75278..490a6af 100755
--- a/src/gits
+++ b/src/gits
@@ -103,7 +103,7 @@


 def git_can_fast_forward(git_dir, branch='master', remote='origin'):
-return git_bool(git_dir, 'merge-base', '--is-ancestor', 'HEAD', remote + 
'/' + branch)
+return git_bool(git_dir, 'merge-base', '--is-ancestor', branch, remote + 
'/' + branch)


 def format_branch_ahead_behind(branch, ahead, behind):

--
To view, visit https://gerrit.osmocom.org/11755
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idec9c9b9b7eddea2dc574fe41f73c0ac570630ca
Gerrit-Change-Number: 11755
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 


Change in osmo-dev[master]: gits: use @{u} to get upstream branch, not origin/%s

2018-11-12 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/11756


Change subject: gits: use @{u} to get upstream branch, not origin/%s
..

gits: use @{u} to get upstream branch, not origin/%s

git has an internal concept of a branch's upstream branch, and the remote need
not be 'origin', and also, the upstream branch name may differ completely. So,
use git's {u} keyword to obtain the upstream branch name.

This removes all 'origin' strings from gits. Also, git_branch_exists() is no
longer needed, drop it.

Also remove a couple of default arguments which aren't ever used because we
always pass arguments anyway.

In the case of git_ahead_behind(), we would have use for a default
branch_upstream=None to imply calling git_branch_upstream(), but then during
rebase, if no upstream exists, we would invoke it twice to get None a second
time. So just call the function explicitly. I thought about returning an empty
string instead of None, but it's too convoluted.

Change-Id: Ife146903ae1323a4e568587ccfd4018725e9d719
---
M src/gits
1 file changed, 30 insertions(+), 22 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/56/11756/1

diff --git a/src/gits b/src/gits
index 490a6af..681082d 100755
--- a/src/gits
+++ b/src/gits
@@ -58,7 +58,7 @@


 def git_output(git_dir, *args):
-return subprocess.check_output(['git', '-C', git_dir, ] + 
list(args)).decode('utf-8')
+return subprocess.check_output(['git', '-C', git_dir, ] + list(args), 
stderr=subprocess.STDOUT).decode('utf-8')


 def git_bool(git_dir, *args):
@@ -69,20 +69,16 @@
 return False


-def git_branch_exists(git_dir, branch='origin/master'):
-return git_bool(git_dir, 'rev-parse', '--quiet', '--verify', branch)
-
-
-def git_ahead_behind(git_dir, branch='master', remote='origin'):
+def git_ahead_behind(git_dir, branch, branch_upstream):
 ''' Count revisions ahead/behind of the remote branch.
 returns: (ahead, behind) (e.g. (0, 5)) '''

 # Missing remote branch
-if not git_branch_exists(git_dir, remote + '/' + branch):
+if not branch_upstream:
 return (0, 0)

-behind = git_output(git_dir, 'rev-list', '--count', '%s..%s/%s' % (branch, 
remote, branch))
-ahead = git_output(git_dir, 'rev-list', '--count', '%s/%s..%s' % (remote, 
branch, branch))
+behind = git_output(git_dir, 'rev-list', '--count', '%s..%s' % (branch, 
branch_upstream))
+ahead = git_output(git_dir, 'rev-list', '--count', '%s..%s' % 
(branch_upstream, branch))
 return (int(ahead.rstrip()), int(behind.rstrip()))


@@ -98,12 +94,20 @@
 return ret


+def git_branch_upstream(git_dir, branch_name='HEAD'):
+'''Return an upstream branch name, or an None if there is none.'''
+try:
+return git_output(git_dir, 'rev-parse', '--abbrev-ref', '%s@{u}' % 
branch_name).rstrip()
+except subprocess.CalledProcessError:
+return None
+
+
 def git_has_modifications(git_dir):
 return not git_bool(git_dir, 'diff-index', '--quiet', 'HEAD')


-def git_can_fast_forward(git_dir, branch='master', remote='origin'):
-return git_bool(git_dir, 'merge-base', '--is-ancestor', branch, remote + 
'/' + branch)
+def git_can_fast_forward(git_dir, branch, branch_upstream):
+return git_bool(git_dir, 'merge-base', '--is-ancestor', branch, 
branch_upstream)


 def format_branch_ahead_behind(branch, ahead, behind):
@@ -142,12 +146,14 @@
 if not is_current and branch not in interesting_branch_names:
 continue

-ahead, behind = git_ahead_behind(git_dir, branch)
+ahead, behind = git_ahead_behind(git_dir, branch,
+ git_branch_upstream(git_dir, branch))
+
 if not ahead and not behind and not is_current:
 # skip branches that are "not interesting"
 continue

-# Branch with ahead/behind origin info ("master[+1|-5]")
+# Branch with ahead/behind upstream info ("master[+1|-5]")
 strs.append(format_branch_ahead_behind(branch, ahead, behind))
 return strs

@@ -238,8 +244,10 @@
 print('Not on a branch: %s' % git_dir)
 raise SkipThisRepo()

-print('Rebasing branch: ' + orig_branch)
-ahead, behind = git_ahead_behind(git_dir, orig_branch)
+upstream_branch = git_branch_upstream(git_dir, orig_branch)
+
+print('Rebasing %r onto %r' % (orig_branch, upstream_branch))
+ahead, behind = git_ahead_behind(git_dir, orig_branch, upstream_branch)

 if git_has_modifications(git_dir):
 do_commit = ask(git_dir, 'Local mods.',
@@ -262,24 +270,24 @@
 raise SkipThisRepo()

 # Missing upstream branch
-if not git_branch_exists(git_dir, 'origin/' + orig_branch):
+if not upstream_branch:
 print('there is no upstream branch for %r' % orig_branch)

 # Diverged
 elif ahead and behind:
 do_reset = ask(git_dir, 'Diverged.',
-

Change in osmo-dev[master]: gits: remove code dup: ask_reset_hard()

2018-11-12 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/11757


Change subject: gits: remove code dup: ask_reset_hard()
..

gits: remove code dup: ask_reset_hard()

The diff may look a bit weird, but this really just moves a bit of code that
existed twice into a local function.

Change-Id: I741aa6ca29370f26a724f5b4b9c6e7f8ac3f282a
---
M src/gits
1 file changed, 11 insertions(+), 12 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/57/11757/1

diff --git a/src/gits b/src/gits
index 681082d..bd3e3f2 100755
--- a/src/gits
+++ b/src/gits
@@ -269,12 +269,8 @@
 print('There still are local modifications')
 raise SkipThisRepo()

-# Missing upstream branch
-if not upstream_branch:
-print('there is no upstream branch for %r' % orig_branch)

-# Diverged
-elif ahead and behind:
+def ask_reset_hard():
 do_reset = ask(git_dir, 'Diverged.',
'%s: git reset --hard %s?' % (
orig_branch, upstream_branch),
@@ -285,6 +281,15 @@
 if do_reset == 'OK':
 git(git_dir, 'reset', '--hard', upstream_branch)

+
+# Missing upstream branch
+if not upstream_branch:
+print('there is no upstream branch for %r' % orig_branch)
+
+# Diverged
+elif ahead and behind:
+ask_reset_hard()
+
 # Behind
 elif behind:
 if git_can_fast_forward(git_dir, orig_branch, upstream_branch):
@@ -311,13 +316,7 @@
 git(git_dir, 'commit', '-am', 'wip', may_fail=True)
 git(git_dir, 'checkout', orig_branch)

-do_reset = ask(git_dir, '%s: git reset --hard %s?' % (orig_branch, 
upstream_branch),
-   '  no',
-   'OK  yes (write OK in caps!)',
-   valid_answers=('', 'OK'))
-
-if do_reset == 'OK':
-git(git_dir, 'reset', '--hard', upstream_branch)
+ask_reset_hard()

 return orig_branch


--
To view, visit https://gerrit.osmocom.org/11757
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I741aa6ca29370f26a724f5b4b9c6e7f8ac3f282a
Gerrit-Change-Number: 11757
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 


Change in osmo-dev[master]: gits: when asking for reset --hard, also offer push -f

2018-11-12 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/11758


Change subject: gits: when asking for reset --hard, also offer push -f
..

gits: when asking for reset --hard, also offer push -f

Change-Id: Iab38229ee7deaec91c342fa114028e222e652b60
---
M src/gits
1 file changed, 8 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/58/11758/1

diff --git a/src/gits b/src/gits
index bd3e3f2..2c25129 100755
--- a/src/gits
+++ b/src/gits
@@ -270,16 +270,19 @@
 raise SkipThisRepo()


-def ask_reset_hard():
+def ask_reset_hard_or_push_f():
 do_reset = ask(git_dir, 'Diverged.',
'%s: git reset --hard %s?' % (
orig_branch, upstream_branch),
'  no',
-   'OK  yes (write OK in caps!)',
-   valid_answers=('', 'OK'))
+   'OK  yes, reset to upstream (write OK in caps!)',
+   'P   `push -f` to overwrite upstream (P in caps!)',
+   valid_answers=('', 'OK', 'P'))

 if do_reset == 'OK':
 git(git_dir, 'reset', '--hard', upstream_branch)
+elif do_reset == 'P':
+git(git_dir, 'push', '-f')


 # Missing upstream branch
@@ -288,7 +291,7 @@

 # Diverged
 elif ahead and behind:
-ask_reset_hard()
+ask_reset_hard_or_push_f()

 # Behind
 elif behind:
@@ -316,7 +319,7 @@
 git(git_dir, 'commit', '-am', 'wip', may_fail=True)
 git(git_dir, 'checkout', orig_branch)

-ask_reset_hard()
+ask_reset_hard_or_push_f()

 return orig_branch


--
To view, visit https://gerrit.osmocom.org/11758
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab38229ee7deaec91c342fa114028e222e652b60
Gerrit-Change-Number: 11758
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 


<    1   2