{
    "mode": "pydoc",
    "parameter": "netplan",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/netplan/json",
    "generated": "2026-11-21T19:56:48Z",
    "sections": {
        "NAME": {
            "content": "netplan\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "# Copyright (C) 2023 Canonical, Ltd.\n# Author: Lukas Märdian <slyon@ubuntu.com>\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; version 3.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n",
            "subsections": []
        },
        "PACKAGE CONTENTS": {
            "content": "netplancffi\nutils\nnetdef\nparser\nstate\n",
            "subsections": []
        },
        "CLASSES": {
            "content": "builtins.Exception(builtins.BaseException)\nnetplan.utils.NetplanException\nnetplan.utils.NetplanBackendException\nnetplan.utils.NetplanEmitterException\nnetplan.utils.NetplanFileException\nnetplan.utils.NetplanFormatException\nnetplan.utils.NetplanParserException\nnetplan.utils.NetplanParserFlagsException\nnetplan.utils.NetplanValidationException\nbuiltins.object\nnetplan.netdef.NetDefinition\nnetplan.netdef.NetDefinitionIterator\nnetplan.parser.Parser\nnetplan.state.State\n",
            "subsections": [
                {
                    "name": "class NetDefinition",
                    "content": "|  NetDefinition(npstate, ptr)\n|\n|  Methods defined here:\n|\n|  eq(self, other: 'NetDefinition') -> bool\n|      Return self==value.\n|\n|  init(self, npstate, ptr)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties defined here:\n|\n|  acceptra\n|\n|  addresses\n|\n|  backend\n|\n|  critical\n|\n|  dhcp4\n|\n|  dhcp6\n|\n|  filepath\n|\n|  id\n|\n|  linklocal\n|\n|  links\n|\n|  macaddress\n|\n|  nameserveraddresses\n|\n|  nameserversearch\n|\n|  routes\n|\n|  setname\n|\n|  type\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables\n|\n|  weakref\n|      list of weak references to the object\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  hash = None\n"
                },
                {
                    "name": "class NetDefinitionIterator",
                    "content": "|  NetDefinitionIterator(npstate, devtype: str = None)\n|\n|  Methods defined here:\n|\n|  del(self)\n|\n|  init(self, npstate, devtype: str = None)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  iter(self)\n|\n|  next(self)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables\n|\n|  weakref\n|      list of weak references to the object\n"
                },
                {
                    "name": "class NetplanBackendException",
                    "content": "|  NetplanBackendException(message=None, domain=None, error=None)\n|\n|  Method resolution order:\n|      NetplanBackendException\n|      NetplanException\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods inherited from NetplanException:\n|\n|  init(self, message=None, domain=None, error=None)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  str(self)\n|      Return str(self).\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from NetplanException:\n|\n|  weakref\n|      list of weak references to the object\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.Exception:\n|\n|  new(*args, kwargs) class method of builtins.Exception\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  addnote(...)\n|      Exception.addnote(note) --\n|      add a note to the exception\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class NetplanEmitterException",
                    "content": "|  NetplanEmitterException(message=None, domain=None, error=None)\n|\n|  Method resolution order:\n|      NetplanEmitterException\n|      NetplanException\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods inherited from NetplanException:\n|\n|  init(self, message=None, domain=None, error=None)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  str(self)\n|      Return str(self).\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from NetplanException:\n|\n|  weakref\n|      list of weak references to the object\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.Exception:\n|\n|  new(*args, kwargs) class method of builtins.Exception\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  addnote(...)\n|      Exception.addnote(note) --\n|      add a note to the exception\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class NetplanException",
                    "content": "|  NetplanException(message=None, domain=None, error=None)\n|\n|  Method resolution order:\n|      NetplanException\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, message=None, domain=None, error=None)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  str(self)\n|      Return str(self).\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  weakref\n|      list of weak references to the object\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.Exception:\n|\n|  new(*args, kwargs) class method of builtins.Exception\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  addnote(...)\n|      Exception.addnote(note) --\n|      add a note to the exception\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class NetplanFileException",
                    "content": "|  NetplanFileException(message=None, domain=None, error=None)\n|\n|  Method resolution order:\n|      NetplanFileException\n|      NetplanException\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Readonly properties defined here:\n|\n|  errno\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from NetplanException:\n|\n|  init(self, message=None, domain=None, error=None)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  str(self)\n|      Return str(self).\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from NetplanException:\n|\n|  weakref\n|      list of weak references to the object\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.Exception:\n|\n|  new(*args, kwargs) class method of builtins.Exception\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  addnote(...)\n|      Exception.addnote(note) --\n|      add a note to the exception\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class NetplanFormatException",
                    "content": "|  NetplanFormatException(message=None, domain=None, error=None)\n|\n|  Method resolution order:\n|      NetplanFormatException\n|      NetplanException\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods inherited from NetplanException:\n|\n|  init(self, message=None, domain=None, error=None)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  str(self)\n|      Return str(self).\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from NetplanException:\n|\n|  weakref\n|      list of weak references to the object\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.Exception:\n|\n|  new(*args, kwargs) class method of builtins.Exception\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  addnote(...)\n|      Exception.addnote(note) --\n|      add a note to the exception\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class NetplanParserException",
                    "content": "|  NetplanParserException(message=None, domain=None, error=None)\n|\n|  Netplan Parser errors are expected to contain the YAML file name\n|  and line and column numbers from where the error was found.\n|\n|  A parser error might happen during the parsing stage. Parsing errors\n|  might be due to invalid YAML files or invalid Netplan grammar. libnetplan\n|  will check for this kind of issues while it's walking through the YAML\n|  files, so it has access to the location where the error was found.\n|\n|  Method resolution order:\n|      NetplanParserException\n|      NetplanException\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, message=None, domain=None, error=None)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  SCHEMAPARSERERRORMSGREGEX = r'(?P<filepath>.*):(?P<errorline>\\d+...\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from NetplanException:\n|\n|  str(self)\n|      Return str(self).\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from NetplanException:\n|\n|  weakref\n|      list of weak references to the object\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.Exception:\n|\n|  new(*args, kwargs) class method of builtins.Exception\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  addnote(...)\n|      Exception.addnote(note) --\n|      add a note to the exception\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class NetplanParserFlagsException",
                    "content": "|  NetplanParserFlagsException(message=None, domain=None, error=None)\n|\n|  Method resolution order:\n|      NetplanParserFlagsException\n|      NetplanException\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods inherited from NetplanException:\n|\n|  init(self, message=None, domain=None, error=None)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  str(self)\n|      Return str(self).\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from NetplanException:\n|\n|  weakref\n|      list of weak references to the object\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.Exception:\n|\n|  new(*args, kwargs) class method of builtins.Exception\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  addnote(...)\n|      Exception.addnote(note) --\n|      add a note to the exception\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class NetplanValidationException",
                    "content": "|  NetplanValidationException(message=None, domain=None, error=None)\n|\n|  Netplan Validation errors are expected to contain the YAML file name\n|  from where the error was found.\n|\n|  A validation error might happen after the parsing stage. libnetplan walks\n|  through its internal representation of the network configuration and checks\n|  if all the requirements are met. For example, if it finds that the key\n|  \"set-name\" is used by an interface, it will check if \"match\" is present.\n|  As \"set-name\" requires \"match\" to work, it will emit a validation error\n|  if it's not found.\n|\n|  Method resolution order:\n|      NetplanValidationException\n|      NetplanException\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, message=None, domain=None, error=None)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  SCHEMAVALIDATIONERRORMSGREGEX = r'(?P<filepath>.*\\.yaml): (?P<mes...\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from NetplanException:\n|\n|  str(self)\n|      Return str(self).\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from NetplanException:\n|\n|  weakref\n|      list of weak references to the object\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.Exception:\n|\n|  new(*args, kwargs) class method of builtins.Exception\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  addnote(...)\n|      Exception.addnote(note) --\n|      add a note to the exception\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class Parser",
                    "content": "|  Methods defined here:\n|\n|  del(self)\n|\n|  init(self)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  loadkeyfile(self, inputfile: str)\n|\n|  loadnullablefields(self, inputfile: <class 'IO'>)\n|\n|  loadyaml(self, inputfile: Union[str, IO])\n|\n|  loadyamlhierarchy(self, rootdir: str = None)\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties defined here:\n|\n|  errorcount\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables\n|\n|  weakref\n|      list of weak references to the object\n|\n|  flags\n"
                },
                {
                    "name": "class State",
                    "content": "|  Methods defined here:\n|\n|  del(self)\n|\n|  getitem(self, netdefid: str)\n|\n|  init(self)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  len(self)\n|\n|  importparserresults(self, parser: netplan.parser.Parser)\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties defined here:\n|\n|  backend\n|\n|  bonds\n|\n|  bridges\n|\n|  dummydevices\n|\n|  ethernets\n|\n|  modems\n|\n|  netdefs\n|\n|  nmdevices\n|\n|  ovsports\n|\n|  tunnels\n|\n|  virtualethernets\n|\n|  vlans\n|\n|  vrfs\n|\n|  wifis\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables\n|\n|  weakref\n|      list of weak references to the object\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "createyamlpatch(patchobjectpath: List[str], patchpayload: Union[str, dict], patchoutput: <class 'IO'>)\n\ndumpyamlsubtree(prefix: List[str], inputfile: <class 'IO'>, outputfile: <class 'IO'>)\n",
            "subsections": []
        },
        "DATA": {
            "content": "all = ['Parser', 'State', 'NetDefinition', 'NetDefinitionIterator'...\n",
            "subsections": []
        },
        "FILE": {
            "content": "/usr/lib/python3/dist-packages/netplan/init.py\n\n",
            "subsections": []
        }
    },
    "summary": "netplan",
    "flags": [],
    "examples": [],
    "see_also": []
}