提交 58dc659f authored 作者: kapil's avatar kapil

adding code based on modified xml and cli code changes (rename the m2ua cli command to

"xmlshow" and adding cli code to show sctp state also in m2ua peerstatus command)
上级 91f9374a
...@@ -2867,6 +2867,77 @@ static int add_config_list_nodes(switch_xml_t swnode, ftdm_conf_node_t *rootnode ...@@ -2867,6 +2867,77 @@ static int add_config_list_nodes(switch_xml_t swnode, ftdm_conf_node_t *rootnode
return 0; return 0;
} }
/* create ftdm_conf_node_t tree based on a fixed pattern XML configuration list
* last arg is to specify if we have any sublist for e.g.
* <list_name>
* <list_element_name>
* <param name="xxx" value="xxx"/>
* <sub-list>
* <param name="xxx" value="xxx"/>
* </sub-list>
* </list_element_name>
* </list_name>
* */
static int add_config_nodes(switch_xml_t swnode, ftdm_conf_node_t *rootnode,
const char *list_name, const char *list_element_name, const char *sub_list_name)
{
char *var, *val;
switch_xml_t list;
switch_xml_t sub_list;
switch_xml_t element;
switch_xml_t param;
ftdm_conf_node_t *n_list;
ftdm_conf_node_t *n_element;
list = switch_xml_child(swnode, list_name);
if (!list) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no list %s found\n", list_name);
return -1;
}
if ((FTDM_SUCCESS != ftdm_conf_node_create(list_name, &n_list, rootnode))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create %s node\n", list_name);
return -1;
}
for (element = switch_xml_child(list, list_element_name); element; element = element->next) {
char *element_name = (char *) switch_xml_attr(element, "name");
if (!element_name) {
continue;
}
if ((FTDM_SUCCESS != ftdm_conf_node_create(list_element_name, &n_element, n_list))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create %s node for %s\n", list_element_name, element_name);
return -1;
}
ftdm_conf_node_add_param(n_element, "name", element_name);
for (param = switch_xml_child(element, "param"); param; param = param->next) {
var = (char *) switch_xml_attr_soft(param, "name");
val = (char *) switch_xml_attr_soft(param, "value");
ftdm_conf_node_add_param(n_element, var, val);
}
/*If we have single node list */
if (sub_list_name ) {
sub_list = switch_xml_child(element, sub_list_name);
if (!sub_list) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no sub_list %s found\n", sub_list_name);
return -1;
}
for (param = switch_xml_child(sub_list, "param"); param; param = param->next) {
var = (char *) switch_xml_attr_soft(param, "name");
val = (char *) switch_xml_attr_soft(param, "value");
ftdm_conf_node_add_param(n_element, var, val);
}
}
}
return 0;
}
static ftdm_conf_node_t *_get_ss7_config_node(switch_xml_t cfg, const char *confname, const char *operatingMode) static ftdm_conf_node_t *_get_ss7_config_node(switch_xml_t cfg, const char *confname, const char *operatingMode)
{ {
switch_xml_t signode, ss7configs, isup, gen, param; switch_xml_t signode, ss7configs, isup, gen, param;
...@@ -2998,23 +3069,21 @@ static ftdm_conf_node_t *_get_ss7_config_node(switch_xml_t cfg, const char *conf ...@@ -2998,23 +3069,21 @@ static ftdm_conf_node_t *_get_ss7_config_node(switch_xml_t cfg, const char *conf
ftdm_conf_node_destroy(rootnode); ftdm_conf_node_destroy(rootnode);
return NULL; return NULL;
} }
}
/* add mtp linksets */ /* add mtp linksets */
if (add_config_list_nodes(isup, rootnode, "mtp_linksets", "mtp_linkset", NULL, NULL)) { if (add_config_list_nodes(isup, rootnode, "mtp_linksets", "mtp_linkset", NULL, NULL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp_linksets for sng_isup config %s\n", confname); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp_linksets for sng_isup config %s\n", confname);
ftdm_conf_node_destroy(rootnode); ftdm_conf_node_destroy(rootnode);
return NULL; return NULL;
} }
/* add mtp routes */ /* add mtp routes */
if (add_config_list_nodes(isup, rootnode, "mtp_routes", "mtp_route", "linksets", "linkset")) { if (add_config_list_nodes(isup, rootnode, "mtp_routes", "mtp_route", "linksets", "linkset")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp_routes for sng_isup config %s\n", confname); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp_routes for sng_isup config %s\n", confname);
ftdm_conf_node_destroy(rootnode); ftdm_conf_node_destroy(rootnode);
return NULL; return NULL;
} }
if(is_isup) {
/* add isup interfaces */ /* add isup interfaces */
if (add_config_list_nodes(isup, rootnode, "isup_interfaces", "isup_interface", NULL, NULL)) { if (add_config_list_nodes(isup, rootnode, "isup_interfaces", "isup_interface", NULL, NULL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process isup_interfaces for sng_isup config %s\n", confname); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process isup_interfaces for sng_isup config %s\n", confname);
...@@ -3049,13 +3118,14 @@ static ftdm_conf_node_t *_get_ss7_config_node(switch_xml_t cfg, const char *conf ...@@ -3049,13 +3118,14 @@ static ftdm_conf_node_t *_get_ss7_config_node(switch_xml_t cfg, const char *conf
return NULL; return NULL;
} }
if (add_config_list_nodes(isup, rootnode, "sng_m2ua_peer_interfaces", "sng_m2ua_peer_interface", NULL, NULL)) { if (add_config_nodes(isup, rootnode, "sng_m2ua_peer_interfaces", "sng_m2ua_peer_interface", "sng_destination_addresses")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process sng_m2ua_peer_interfaces for sng_isup config %s\n", confname); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process sng_m2ua_peer_interfaces for sng_isup config %s\n", confname);
ftdm_conf_node_destroy(rootnode); ftdm_conf_node_destroy(rootnode);
return NULL; return NULL;
} }
if (add_config_list_nodes(isup, rootnode, "sng_m2ua_cluster_interfaces", "sng_m2ua_cluster_interface", NULL, NULL)) {
if (add_config_nodes(isup, rootnode, "sng_m2ua_cluster_interfaces", "sng_m2ua_cluster_interface", "sng_m2ua_peers")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process sng_m2ua_cluster_interfaces for sng_isup config %s\n", confname); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process sng_m2ua_cluster_interfaces for sng_isup config %s\n", confname);
ftdm_conf_node_destroy(rootnode); ftdm_conf_node_destroy(rootnode);
return NULL; return NULL;
......
...@@ -870,6 +870,11 @@ void handle_sng_m2ua_alarm(Pst *pst, MwMgmt *sta) ...@@ -870,6 +870,11 @@ void handle_sng_m2ua_alarm(Pst *pst, MwMgmt *sta)
/* To print the event specific information */ /* To print the event specific information */
switch(sta->t.usta.alarm.event) switch(sta->t.usta.alarm.event)
{ {
case LMW_EVENT_TERM_OK:
{
ftdm_log(FTDM_LOG_INFO," M2UA : LMW_EVENT_TERM_OK: Association Terminated with PeerId[%d] \n",sta->t.usta.s.peerId);
break;
}
case LMW_EVENT_ENDPOPEN_OK: case LMW_EVENT_ENDPOPEN_OK:
{ {
ftdm_log(FTDM_LOG_INFO," M2UA : LMW_EVENT_ENDPOPEN_OK: \n"); ftdm_log(FTDM_LOG_INFO," M2UA : LMW_EVENT_ENDPOPEN_OK: \n");
......
...@@ -791,13 +791,13 @@ static int ftmod_m2ua_peer_config(int id) ...@@ -791,13 +791,13 @@ static int ftmod_m2ua_peer_config(int id)
ftdm_log (FTDM_LOG_ERROR, " ftmod_m2ua_sctsap_config: M2UA SCTSAP for M2UA Intf Id[%d] config FAILED \n", id); ftdm_log (FTDM_LOG_ERROR, " ftmod_m2ua_sctsap_config: M2UA SCTSAP for M2UA Intf Id[%d] config FAILED \n", id);
return 0x01; return 0x01;
}else{ }else{
ftdm_log (FTDM_LOG_ERROR, " ftmod_m2ua_sctsap_config: M2UA SCTSAP for M2UA Intf Id[%d] config SUCCESS \n", id); ftdm_log (FTDM_LOG_INFO, " ftmod_m2ua_sctsap_config: M2UA SCTSAP for M2UA Intf Id[%d] config SUCCESS \n", id);
} }
if(ftmod_m2ua_peer_config1(id, peer_id)){ if(ftmod_m2ua_peer_config1(id, peer_id)){
ftdm_log (FTDM_LOG_ERROR, " ftmod_m2ua_peer_config1: M2UA Peer configuration for M2UA Intf Id[%d] config FAILED \n", id); ftdm_log (FTDM_LOG_ERROR, " ftmod_m2ua_peer_config1: M2UA Peer configuration for M2UA Intf Id[%d] config FAILED \n", id);
return 0x01; return 0x01;
}else{ }else{
ftdm_log (FTDM_LOG_ERROR, " ftmod_m2ua_peer_config1: M2UA Peer configuration for M2UA Intf Id[%d] config SUCCESS \n", id); ftdm_log (FTDM_LOG_INFO, " ftmod_m2ua_peer_config1: M2UA Peer configuration for M2UA Intf Id[%d] config SUCCESS \n", id);
} }
...@@ -1639,10 +1639,9 @@ int ftmod_m2ua_ssta_req(int elemt, int id, MwMgmt* cfm) ...@@ -1639,10 +1639,9 @@ int ftmod_m2ua_ssta_req(int elemt, int id, MwMgmt* cfm)
{ {
MwMgmt ssta; MwMgmt ssta;
Pst pst; Pst pst;
int peerId = 0x01; sng_m2ua_cfg_t* m2ua = NULL;
sng_m2ua_cfg_t* m2ua = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[id]; sng_m2ua_cluster_cfg_t* clust = NULL;
sng_m2ua_cluster_cfg_t* clust = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[m2ua->clusterId]; sng_m2ua_peer_cfg_t* peer = NULL;
sng_m2ua_peer_cfg_t* peer = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[peerId]; /*TODO - KAPIL - need to add proper peerId*/
memset((U8 *)&pst, 0, sizeof(Pst)); memset((U8 *)&pst, 0, sizeof(Pst));
memset((U8 *)&ssta, 0, sizeof(MwMgmt)); memset((U8 *)&ssta, 0, sizeof(MwMgmt));
...@@ -1668,6 +1667,7 @@ int ftmod_m2ua_ssta_req(int elemt, int id, MwMgmt* cfm) ...@@ -1668,6 +1667,7 @@ int ftmod_m2ua_ssta_req(int elemt, int id, MwMgmt* cfm)
{ {
case STMWSCTSAP: case STMWSCTSAP:
{ {
m2ua = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[id];
ssta.t.ssta.id.suId = m2ua->id ; /* lower sap Id */ ssta.t.ssta.id.suId = m2ua->id ; /* lower sap Id */
break; break;
} }
...@@ -1678,11 +1678,13 @@ int ftmod_m2ua_ssta_req(int elemt, int id, MwMgmt* cfm) ...@@ -1678,11 +1678,13 @@ int ftmod_m2ua_ssta_req(int elemt, int id, MwMgmt* cfm)
} }
case STMWPEER: case STMWPEER:
{ {
peer = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[id];
ssta.t.ssta.id.peerId = peer->id ; /* peer Id */ ssta.t.ssta.id.peerId = peer->id ; /* peer Id */
break; break;
} }
case STMWCLUSTER: case STMWCLUSTER:
{ {
clust = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[id];
ssta.t.ssta.id.clusterId = clust->id ; /* cluster Id */ ssta.t.ssta.id.clusterId = clust->id ; /* cluster Id */
break; break;
} }
......
...@@ -71,8 +71,8 @@ typedef struct sng_m2ua_peer_cfg{ ...@@ -71,8 +71,8 @@ typedef struct sng_m2ua_peer_cfg{
uint16_t selfAspId; /* Self ASP ID. ASP identifier for this ASP node if the aspIdFlag is TRUE. */ uint16_t selfAspId; /* Self ASP ID. ASP identifier for this ASP node if the aspIdFlag is TRUE. */
uint32_t numDestAddr; /* Number of destination address defined */ uint32_t numDestAddr; /* Number of destination address defined */
uint16_t sctpId; /* idx to sctp profile */ uint16_t sctpId; /* idx to sctp profile */
uint16_t port; /* port */ uint16_t port;
uint32_t destAddrList[SCT_MAX_NET_ADDRS+1]; /* Destination adddress list */ uint32_t destAddrList[SCT_MAX_NET_ADDRS+1]; /* Destination adddress list */
uint16_t locOutStrms; /*Number of outgoing streams supported by this association*/ uint16_t locOutStrms; /*Number of outgoing streams supported by this association*/
int init_sctp_assoc; /* flag to tell if we need to initiate SCTP association */ int init_sctp_assoc; /* flag to tell if we need to initiate SCTP association */
}sng_m2ua_peer_cfg_t; }sng_m2ua_peer_cfg_t;
......
...@@ -223,7 +223,6 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa ...@@ -223,7 +223,6 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa
var = ftdm_parameters[i].var; var = ftdm_parameters[i].var;
val = ftdm_parameters[i].val; val = ftdm_parameters[i].val;
printf("var[%s], val[%s]\n",var,val);
/* confirm that the first parameter is the "operatingMode" */ /* confirm that the first parameter is the "operatingMode" */
if(!strcasecmp(var, "operatingMode")){ if(!strcasecmp(var, "operatingMode")){
/**********************************************************************/ /**********************************************************************/
...@@ -275,7 +274,7 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa ...@@ -275,7 +274,7 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa
/**********************************************************************/ /**********************************************************************/
/* don't care for now */ /* don't care for now */
/**********************************************************************/ /**********************************************************************/
} else if (!strcasecmp(var, "ccSpanId")) { } else if (!strcasecmp(var, "span-id")) {
/**********************************************************************/ /**********************************************************************/
sngSpan.ccSpanId = atoi(val); sngSpan.ccSpanId = atoi(val);
SS7_DEBUG("Found an ccSpanId = %d\n",sngSpan.ccSpanId); SS7_DEBUG("Found an ccSpanId = %d\n",sngSpan.ccSpanId);
...@@ -543,16 +542,6 @@ static int ftmod_ss7_parse_sng_isup(ftdm_conf_node_t *sng_isup) ...@@ -543,16 +542,6 @@ static int ftmod_ss7_parse_sng_isup(ftdm_conf_node_t *sng_isup)
} }
case SNG_SS7_OPR_MODE_M2UA_SG: case SNG_SS7_OPR_MODE_M2UA_SG:
{ {
if (ftmod_ss7_parse_mtp_linksets(mtp_linksets)) {
SS7_ERROR("Failed to parse \"mtp_linksets\"!\n");
return FTDM_FAIL;
}
if (ftmod_ss7_parse_mtp_routes(mtp_routes)) {
SS7_ERROR("Failed to parse \"mtp_routes\"!\n");
return FTDM_FAIL;
}
if (ftmod_ss7_parse_sctp_links(sctp_ifaces) != FTDM_SUCCESS) { if (ftmod_ss7_parse_sctp_links(sctp_ifaces) != FTDM_SUCCESS) {
SS7_ERROR("Failed to parse <sctp_links>!\n"); SS7_ERROR("Failed to parse <sctp_links>!\n");
return FTDM_FAIL; return FTDM_FAIL;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论