from netconf_client.connect import connect_ssh from netconf_client.ncclient import Manager from xml.etree import ElementTree # Interface OMS xml_body_OMS = ''' OMS-DEG1-TTP-TXRX inService 111 L1 2/0 NewText x:openROADMOpticalMultiplex ''' xml_root_OMS = ElementTree.fromstring(xml_body_OMS) with connect_ssh(host='127.0.0.1', port=17831, username='admin', password='admin') as session: mgr = Manager(session, timeout=120) # print(mgr.get_config("candidate").data_xml) mgr.edit_config(xml_body_OMS, target="candidate", default_operation="merge") mgr.commit(True) session.close() #print(etree.tostring(config)) #print(etree.tostring(edit)) #session.close()