gprs_ns2: add new vty2

Change-Id: I163279cf57e84198dc8c53e1c109f5a9474670e9
diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index f25d93a..4664a35 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -46,6 +46,7 @@
 #include <osmocom/core/fsm.h>
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/socket.h>
+#include <osmocom/core/sockaddr_str.h>
 #include <osmocom/gsm/tlv.h>
 #include <osmocom/gprs/gprs_msgb.h>
 #include <osmocom/gprs/gprs_ns2.h>
@@ -1534,6 +1535,25 @@
 	}
 }
 
+/*! write IP-SNS to a vty
+ *  \param[in] vty VTY to which the state shall be printed
+ *  \param[in] nse NS Entity whose IP-SNS state shall be printed */
+void gprs_ns2_sns_write_vty(struct vty *vty, const struct gprs_ns2_nse *nse)
+{
+	struct ns2_sns_state *gss;
+	struct osmo_sockaddr_str addr_str;
+	struct sns_endpoint *endpoint;
+
+	if (!nse->bss_sns_fi)
+		return;
+
+	gss = (struct ns2_sns_state *) nse->bss_sns_fi->priv;
+	llist_for_each_entry(endpoint, &gss->sns_endpoints, list) {
+		osmo_sockaddr_str_from_sockaddr(&addr_str, &endpoint->saddr.u.sas);
+		vty_out(vty, "  ip-sns %s %u%s", addr_str.ip, addr_str.port, VTY_NEWLINE);
+	}
+}
+
 static struct sns_endpoint *ns2_get_sns_endpoint(struct ns2_sns_state *state,
 						 const struct osmo_sockaddr *saddr)
 {