Use ALPHA value received in SI13 from PCUIF

The old VTY command is marked as deprecated and still overrides the use
in case it's used.

Related: SYS#5358
Depends: libosmocore.git Change-Id I74fb0a3afc1ac4aadbfc609b882d929401f790eb
Depends: osmo-bsc.git Change-Id I8b97ea11bad5fe05f2f634945b5703ee9abde81d
Change-Id: I46f2a955b157a409055fca7fb917dc4f75482426
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index 92ff8eb..c2de92c 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -230,7 +230,8 @@
 		vty_out(vty, " alloc-algorithm dynamic%s", VTY_NEWLINE);
 	if (the_pcu->vty.force_two_phase)
 		vty_out(vty, " two-phase-access%s", VTY_NEWLINE);
-	vty_out(vty, " alpha %d%s", the_pcu->vty.alpha, VTY_NEWLINE);
+	if (the_pcu->vty.force_alpha != (uint8_t)-1)
+		vty_out(vty, " alpha %u%s", the_pcu->vty.force_alpha, VTY_NEWLINE);
 	vty_out(vty, " gamma %d%s", the_pcu->vty.gamma * 2, VTY_NEWLINE);
 	if (!the_pcu->vty.dl_tbf_preemptive_retransmission)
 		vty_out(vty, " no dl-tbf-preemptive-retransmission%s", VTY_NEWLINE);
@@ -735,13 +736,19 @@
 
 DEFUN_ATTR(cfg_pcu_alpha,
 	   cfg_pcu_alpha_cmd,
-	   "alpha <0-10>",
+	   "alpha (si13|<0-10>)",
 	   "Alpha parameter for MS power control in units of 0.1 (see TS 05.08) "
 	   "NOTE: Be sure to set Alpha value at System information 13 too.\n"
-	   "Alpha in units of 0.1\n",
-	   CMD_ATTR_IMMEDIATE)
+	   "Use value received from BSC in System Intormation 13 (default)\n"
+	   "Force Alpha in units of 0.1\n",
+	   CMD_ATTR_IMMEDIATE | CMD_ATTR_DEPRECATED)
 {
-	the_pcu->vty.alpha = atoi(argv[0]);
+	vty_out(vty, "%% 'alpha <0-10>' is now deprecated: use osmo-bsc's 'gprs power-control alpha <0-10>' instead%s",
+		VTY_NEWLINE);
+	if (strcmp(argv[0], "si13") == 0)
+		the_pcu->vty.force_alpha = (uint8_t) -1;
+	else
+		the_pcu->vty.force_alpha = atoi(argv[0]);
 	return CMD_SUCCESS;
 }