from ncclient import manager
media_channel = '''
2
C_BAND
1
2
192006251
192056250
2
'''
disable_mc= '''
2
2
'''
create_ob= '''
1 C_BAND
1 192006252
192206250.0 ENABLED
101
'''
# Define device connection details
device = {
'host': '10.0.2.4', # replace with the target device's hostname or IP address
'port': 2025, # NETCONF default port
'username': 'admin', # replace with your username
'password': 'admin', # replace with your password
'hostkey_verify': False , # disable host key verification (use only for testing)
"look_for_keys": False,
"allow_agent": False,
"device_params": {
"name": "default"
},
}
# Establish a NETCONF connection
with manager.connect(**device) as m:
print("Connected to the device successfully!")
config = m.get_config(source='running').data_xml
print("Device Configuration:")
with open('d.log', 'w') as log_file:
print(config,file=log_file)
# result = m.edit_config(target='running', config=create_ob)
# print (result)