aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ipa_proxy_test.c
blob: 6288a3a9f18618de6012f02052b277b4d097eb19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <stdio.h>
#include <osmocom/core/talloc.h>
#include <osmocom/abis/abis.h>
#include <osmocom/abis/e1_input.h>
#include <osmocom/abis/ipa_proxy.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/application.h>
#include <osmocom/vty/vty.h>
#include <osmocom/vty/command.h>
#include <osmocom/vty/telnet_interface.h>
#include "internal.h"
#include "config.h"

static void *tall_test;

#define DIPA_PROXY_TEST 0

struct log_info_cat ipa_proxy_test_cat[] = {
	[DIPA_PROXY_TEST] = {
		.name = "DLINP_IPA_PROXY_TEST",
		.description = "IPA proxy test",
		.color = "\033[1;35m",
		.enabled = 1, .loglevel = LOGL_NOTICE,
	},
};

const struct log_info ipa_proxy_test_log_info = {
	.filter_fn = NULL,
	.cat = ipa_proxy_test_cat,
	.num_cat = ARRAY_SIZE(ipa_proxy_test_cat),
};

static int bsc_vty_is_config_node(struct vty *vty, int node)
{
	switch(node) {
	case L_IPA_NODE:
		return 1;
		break;
	}
	return 0;
}

static enum node_type bsc_vty_go_parent(struct vty *vty)
{
	switch (vty->node) {
	case L_IPA_NODE:
		vty->node = VIEW_NODE;
		break;
	}
	return vty->node;
}

static struct vty_app_info vty_info = {
	.name		= "ipa-proxy-test",
	.version	= PACKAGE_VERSION,
	.go_parent_cb	= bsc_vty_go_parent,
	.is_config_node	= bsc_vty_is_config_node,
};

#define IPA_PROXY_TEST_TELNET_PORT	4260

int main(void)
{
	tall_test = talloc_named_const(NULL, 1, "ipa proxy test");
	libosmo_abis_init(tall_test);

	osmo_init_logging(&ipa_proxy_test_log_info);

	vty_init(&vty_info);
	ipa_proxy_vty_init();

	telnet_init(tall_test, NULL, IPA_PROXY_TEST_TELNET_PORT);

	LOGP(DIPA_PROXY_TEST, LOGL_NOTICE, "entering main loop\n");

	while (1) {
		osmo_select_main(0);
	}
}