-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
I am trying to shutdown an interface using Python ncclient. But I am getting the following error.
Traceback (most recent call last):
.... in intefaceShutdown
edited_config = m.edit_config(config=shutdown_intf, target='candidate')
File "/home/user/.local/lib/python3.8/site-packages/ncclient/manager.py", line 246, in execute
return cls(self._session,
File "/home/user/.local/lib/python3.8/site-packages/ncclient/operations/edit.py", line 65, in request
node.append(validated_element(config, ("config", qualify("config"))))
File "/home/user/.local/lib/python3.8/site-packages/ncclient/xml_.py", line 150, in validated_element
ele = to_ele(x)
File "/home/user/.local/lib/python3.8/site-packages/ncclient/xml_.py", line 129, in to_ele
return x if etree.iselement(x) else etree.fromstring(x.encode('UTF-8'), parser=_get_parser(huge_tree))
File "src/lxml/etree.pyx", line 3257, in lxml.etree.fromstring
File "src/lxml/parser.pxi", line 1916, in lxml.etree._parseMemoryDocument
File "src/lxml/parser.pxi", line 1803, in lxml.etree._parseDoc
File "src/lxml/parser.pxi", line 1144, in lxml.etree._BaseParser._parseDoc
File "src/lxml/parser.pxi", line 618, in lxml.etree._ParserContext._handleParseResultDoc
File "src/lxml/parser.pxi", line 728, in lxml.etree._handleParseResult
File "src/lxml/parser.pxi", line 657, in lxml.etree._raiseParseError
File "<string>", line 9
lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: interface line 4 and shutdown, line 9, column 28
Code:
def intefaceShutdown():
shutdown_intf = '''
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<interfaces xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-interface">
<interface>
<name>ce8/1</name>
<config>
<name>ce8/1</name>
</config>
</shutdown>
</interface>
</interfaces>
</config>
'''
m = manager.connect(host=HOST, port=PORT, username=USER, password=PASSWORD, hostkey_verify=False, device_params={'name': 'default'})
edited_config = m.edit_config(config=shutdown_intf, target='candidate')
print(edited_config)
result = m.commit()
print(result)
m.close_session()
OS version:
Software Product: OcNOS, Version: 5.3, Build Number: 54
Hardware Model: Wistron Galileo 1
Software Feature Code: OTN-IPBASE
System Configuration Code: S0
Software Baseline Version: 5.0.145
Metadata
Metadata
Assignees
Labels
No labels