I'm trying to activate OSPF routing protocol in a router using a python script with restconf. I send the request to this url https://(router ip)/restconf/data/Cisco-IOS-XE-ospf-native-router:10 but i get this return message: { "errors": { "error": [ { "error-message": "uri keypath not found", "error-tag": "invalid-value", "error-type": "application" } ] } }
I tried with differents urls but no one was the correct and i don't know what is wrong, the url or the content of the body , can someone help me?
This is the content of my script:
import json
import requests
requests.packages.urllib3.disable_warnings()
api_url = "https://(ip)/restconf/data/Cisco-IOS-XE-ospf-native-router:10"
headers = {"Accept": "application/yang-data+json",
"Content-type": "application/yang-data+json"}
basicauth = ("user", "password")
body = '{"router":{"ospf":[{"id":10, "router-id":"1.1.1.1", "network":[{"ip": "172.16.199.1", "mask": "0.0.0.0", "area": 0},{"ip":"192.168.56.101", "mask": "0.0.0.0", "area":0}]}]}}'
requests.put(api_url, auth=basicauth, headers=headers, data=body, verify=False)
resp = requests.get(api_url, auth=basicauth, headers=headers, verify=False)
response_json = resp.json()
print(json.dumps(response_json, indent=5))
OSPF config with RESTCONF can just be modify, not create.