cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
597
Views
2
Helpful
2
Replies

"FAILURE: no_networking commit failed with exception: wrong state (17)

gkhaled
Level 1
Level 1

hello all , 

i am trying to send commit no-networking  via commit param then i need to do reconcile after it , but when i tested that i received the following error :

"FAILURE: no_networking commit failed with exception: operation in wrong state (17): ",
 
elif input.commit_type == "no_networking":
                                try:
                                    # Validate the transaction
                                    t.validate(unlock=False)
                                    self.response_log(output, "Transaction validated successfully.")
                                   
                                   
                                    t.validate(unlock=False)
                                    self.response_log(output, "Transaction validated successfully.")
                                    params = ncs.maapi.CommitParams()
                                    params.no_networking()
                                    result_no_networking = t.apply_params(True, params)
                                    if result_no_networking != 0:
                                        output.result = f"FAILURE: no_networking commit failed with code {result_no_networking}"
                                    else:
                                        output.result = "SUCCESS"
                                except Exception as e:
                                    output.result = f"FAILURE: no_networking commit failed with exception: {str(e)}"
                                    return
                                # New transaction for reconcile_keep_non_service_config
                                try:
                                    with ncs.maapi.single_write_trans(m, uinfo.username, db=ncs.RUNNING) as t2:
                                        params_reconcile = ncs.maapi.CommitParams()
                                        params_reconcile.reconcile_keep_non_service_config()
                                        result_reconcile = t2.apply_params(True, params_reconcile)
                                        if result_reconcile != 0:
                                            output.result = f"FAILURE: Reconcile commit failed with code {result_reconcile}"
                                            return
                                except Exception as e:
                                    output.result = f"FAILURE: Reconcile commit failed with exception: {str(e)}"
                                    return

                                output.result = "SUCCESS"
 
 
so can any one help please .
2 Replies 2

cohult
Cisco Employee
Cisco Employee

Hi, usually there is an error message after the comma in "operation in the wrong state (17):"
The most common reasons for this error message when applying/committing configuration are that NSO is in read-only mode in an HA setup or that NSO is in a startup phase.

hi , 

it worked fine with me now when change  the single write trans to the following :

try:
                                    with ncs.maapi.single_write_trans(uinfo.username, 'python') as t2:
                                        params_reconcile = ncs.maapi.CommitParams()
                                        params_reconcile.reconcile_keep_non_service_config()
                                        result_reconcile = t2.apply_params(True, params_reconcile)
                                        self.response_log(output, f"Reconcile result is : {result_reconcile}")

                                        if result_reconcile != {}:
                                            output.result = f"FAILURE: Reconcile commit failed with code {result_reconcile}"
                                        else:
                                            self.response_log(output, f"SUCCESS: Commit Reconcile Keep service config succeeded.")    
                                except Exception as e:
                                    output.result = f"FAILURE: Reconcile commit failed with exception: {str(e)}"
                                    return
Polls
AI-powered tools for network troubleshooting are likely to be part of everyone’s workflow sooner or later. What is the single biggest challenge or concern you see with adopting these tools in your organization?