<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Unable to set a link-local IPv6 address with yang + restconf in Tools</title>
    <link>https://community.cisco.com/t5/tools/unable-to-set-a-link-local-ipv6-address-with-yang-restconf/m-p/4101568#M1932</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a "what am I doing wrong?" question. Any hint would be appreciated ;))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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 :&lt;/P&gt;&lt;PRE&gt;$ 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"
            }
        ]
    }
}&lt;/PRE&gt;&lt;P&gt;Here is the source code :&lt;/P&gt;&lt;PRE&gt;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 &amp;gt;= 200 and resp.status_code &amp;lt;= 299):
    print("STATUS OK: {}".format(resp.status_code))
else:
    print("ERROR CODE {}, reply {}".format(resp.status_code, json.dumps(resp.json(), indent=4)))&lt;/PRE&gt;</description>
    <pubDate>Thu, 11 Jun 2020 14:08:05 GMT</pubDate>
    <dc:creator>Philippe Latu</dc:creator>
    <dc:date>2020-06-11T14:08:05Z</dc:date>
    <item>
      <title>Unable to set a link-local IPv6 address with yang + restconf</title>
      <link>https://community.cisco.com/t5/tools/unable-to-set-a-link-local-ipv6-address-with-yang-restconf/m-p/4101568#M1932</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a "what am I doing wrong?" question. Any hint would be appreciated ;))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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 :&lt;/P&gt;&lt;PRE&gt;$ 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"
            }
        ]
    }
}&lt;/PRE&gt;&lt;P&gt;Here is the source code :&lt;/P&gt;&lt;PRE&gt;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 &amp;gt;= 200 and resp.status_code &amp;lt;= 299):
    print("STATUS OK: {}".format(resp.status_code))
else:
    print("ERROR CODE {}, reply {}".format(resp.status_code, json.dumps(resp.json(), indent=4)))&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jun 2020 14:08:05 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/unable-to-set-a-link-local-ipv6-address-with-yang-restconf/m-p/4101568#M1932</guid>
      <dc:creator>Philippe Latu</dc:creator>
      <dc:date>2020-06-11T14:08:05Z</dc:date>
    </item>
  </channel>
</rss>

