gprs_bssgp_pcu: explicit allocate & initialize bssgp_nsi instance

The instance bssgp_nsi is a global instance to be used by all
NS related functions. Previous the PCU allocated and initialized
the bssgp_nsi instance when (re-)connecting and freeing on disconnect.
The problem of the implicit initialisation is gprs_ns_vty_init(bssgp_nsi).
All vty init functions must be called before the configuration is read,
otherwise a previous vty written configuration is invalid.
Furthermore the vty modifications to the `ns` object were lost when the PCU has to
reconnect to the SGSN.

Fixes: OS#4024
Change-Id: I2aa53ea54e9352577f6280ad7b9d1d9da9f57eaf
diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp
index 1003e3c..fa075cd 100644
--- a/src/pcu_main.cpp
+++ b/src/pcu_main.cpp
@@ -33,6 +33,8 @@
 #include <bts.h>
 #include <gprs_coding_scheme.h>
 #include <osmocom/pcu/pcuif_proto.h>
+#include "gprs_bssgp_pcu.h"
+
 extern "C" {
 #include "pcu_vty.h"
 #include <osmocom/gprs/gprs_bssgp.h>
@@ -291,6 +293,13 @@
 	else
 		fprintf(stderr, "Failed to initialize GSMTAP for %s\n", gsmtap_addr);
 
+	bssgp_nsi = gprs_ns_instantiate(&gprs_bssgp_ns_cb, tall_pcu_ctx);
+	if (!bssgp_nsi) {
+		LOGP(DBSSGP, LOGL_ERROR, "Failed to create NS instance\n");
+		exit(1);
+	}
+	gprs_ns_vty_init(bssgp_nsi);
+
 	rc = vty_read_config_file(config_file, NULL);
 	if (rc < 0 && config_given) {
 		fprintf(stderr, "Failed to parse the config file: '%s'\n",