Hello,
This is a "what am I doing wrong?" question. Any hint would be appreciated ;))
The code works fine as long as I set GUA IPv6 addresses, but when I try to set a link-local IPv6 address with the code below, I get the following error :
$ python3 ./lab2.5-p2.py
ERROR CODE 400, reply {
"errors": {
"error": [
{
"error-message": "inconsistent value: Device refused one or more commands",
"error-path": "/ietf-interfaces:interfaces/interface=Loopback99",
"error-tag": "invalid-value",
"error-type": "application"
}
]
}
}
Here is the source code :
import json
import requests
requests.packages.urllib3.disable_warnings()
api_url = "https://172.16.13.4/restconf/data/ietf-interfaces:interfaces/interface=Loopback99"
headers = { "Accept": "application/yang-data+json",
"Content-type": "application/yang-data+json"
}
basicauth = ("etu", "-etu-")
yangConfig = {
"ietf-interfaces:interface": {
"name": "Loopback99",
"description": "WHATEVER99",
"type": "iana-if-type:softwareLoopback",
"enabled": True,
"ietf-ip:ipv4": {
"address": [
{
"ip": "99.99.99.99",
"netmask": "255.255.255.0"
}
]
},
"ietf-ip:ipv6": {
"address": [
{
"ip": "2001:db8:99::99",
"prefix-length": "64"
},
{
"ip": "fe80::99",
"prefix-length": "64",
}
]
}
}
}
resp = requests.put(api_url, data=json.dumps(yangConfig), auth=basicauth, headers=headers, verify=False)
if (resp.status_code >= 200 and resp.status_code <= 299):
print("STATUS OK: {}".format(resp.status_code))
else:
print("ERROR CODE {}, reply {}".format(resp.status_code, json.dumps(resp.json(), indent=4)))