Start maapi user session failed:operation in wrong state

Hi,

I am facing a new issue it was not seen before.

Nov 14 02:12:26: %LOG-6-PRI_ACTIVE: Nov 14 02:12:26: %NETCONF-YANG-3-ERR: cmns Start maapi user session failed:operation in wrong state(17),errmsg:No usersessions if no startphase2

Is failing …

After enabling CONFD_TRACE i can see this

[13-11-2017 12:32:49] CONFD:getConfig called
[13-11-2017 12:32:49] Entered : maapi_conn
TRACE MAAPI_START_USER_SESSION DEBUG operation in wrong state - No usersessions if no startphase2
–> CONFD_ERR

Code used :

static const char *groups[] = {“admin”};

    if(maapi_start_user_session(eb_maapi_sock, "admin", "maapi", groups, 1,
                            &ip, CONFD_PROTO_TCP) != CONFD_OK )
  {
    DBG_WTF("CONFD:Failed to maapi_start_user_session\n");
    return FAILURE_VAL;
  }

Can you please suggest any thing i need to add or change to overcome this issue.

Regards,
Bibin

It looks like ConfD hasn’t completely started, in phase 2.

Run: “ConfD —status” to check.

Hi,

As Nabil writes, ConfD is not up and running yet. You can either time your application to connect to ConfD earlier than start-phase 2, using maapi_attach_init() or wait until ConfD has reached start-phase 2 using maapi_wait_start().

For documentation on ConfD start-phases:

  • ConfD UG / man pages under “COMMUNICATING WITH CONFD”
  • confd_lib_maapi man page, maapi_attach_init() maapi_start_phase() and maapi_wait_start()

Hi,

Thanks for the response…

Should i use all of them maapi_attach_init() maapi_start_phase() and maapi_wait_start()

Or i can use maapi_wait_start() itself …

Regards,
Bibin

Hi,

One more doubt … as we have implemented rule-list and added the our module(.yang) under some group,

So do i need to change this code snippet

if(maapi_start_user_session(eb_maapi_sock, “admin”, “maapi”, groups, 1,
&ip, CONFD_PROTO_TCP) != CONFD_OK )
{
DBG_WTF(“CONFD:Failed to maapi_start_user_session\n”);
return FAILURE_VAL;
}

Eg: in my rule-list it is group is [ApplicationAccess] then do i need to change in int maapi_start_user_session(int sock, const char *username, const char *context, const char **groups, int numgroups, const struct confd_ip *src_addr, enum confd_proto prot);
to that group(ApplicationAccess)…??

Regards,
Bibin