cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
222
Views
0
Helpful
1
Replies
Highlighted
Beginner

How to clear isis process using YDK xml RPC?

Hi,

        I tried to clear isis process using Yang xml RPC but facing some issues. Please do the needful.

def clear_isis(host, user, password):

    try:

        with manager.connect(host=host,  username=user, password=password, look_for_keys=False,hostkey_verify=False,timeout=150) as m:

           isis_filter = '''

<clear-isis-process xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-isis-act">

  <input>

    <instance>

       <instance-identifier>1000</instance-identifier>

    </instance>

  </input>

</clear-isis-process>

                         '''

            #cisco_isis = m.edit_config(target = 'candidate',config = isis_filter)

            #m.commit()

            cisco_isis = m.dispatch(isis_filter)

            print cisco_isis

            #m.get('subtree', isis_filter)

         

    except Exception as exe:

        print 'Exception caught in clear_isis()',exe

       

clear_isis('1.1.1.1', 'user', 'password')


Output:


Exception caught in clear_isis() Invalid tag name u'\n<clear-isis-process xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-isis-act">\n<input>\n<instance>\n<instance-identifier></instance-identifier>\n</instance>\n</input>\n</clear-isis-process>\n 


Thank you,

Divya    

Everyone's tags (6)
1 REPLY 1
Cisco Employee

Re: How to clear isis process using YDK xml RPC?

Hi,

I believe you cannot use the ncclient manager.get() (meant for netconf ‘get’ RPC) function for this RPC. But you can use YDK’s ExecutorService. For example,

from ydk.models.cisco_ios_xr import Cisco_IOS_XR_isis_act

from ydk.providers import NetconfServiceProvider

from ydk.services import ExecutorService

provider = NetconfServiceProvider(address=<host>,username=<username>, password=<password>)

ex = ExecutorService()

clear_rpc = Cisco_IOS_XR_isis_act.ClearIsisProcessRpc()

clear_rpc.input.instance. instance_identifier = '1000'

re = ex.execute_rpc(provider, clear_rpc)


Content for Community-Ad
August's Community Spotlight Awards