From a17e61de8d4fff44debda8b11fd5e8b65988f3ac Mon Sep 17 00:00:00 2001 From: peusterm Date: Tue, 5 Mar 2019 17:00:40 +0100 Subject: [PATCH] More work on #73 but the mandataory and min-elemnt fields seem to be not validated :-( Signed-off-by: peusterm --- models/Makefile | 12 +- models/doc/ietf-ped.html | 295 ------------------ models/doc/ietf-ped.tree | 8 - models/doc/ietf-ped.uml | 31 -- models/examples/basic-ped.yml | 49 ++- models/ietf-ped.yang | 72 ----- models/ietf_ped_model.py | 564 +++++++++++++++++++++++++++++----- models/test_model.py | 18 +- 8 files changed, 553 insertions(+), 496 deletions(-) delete mode 100644 models/doc/ietf-ped.html delete mode 100644 models/doc/ietf-ped.tree delete mode 100644 models/doc/ietf-ped.uml delete mode 100644 models/ietf-ped.yang diff --git a/models/Makefile b/models/Makefile index 3b21a15..c73a17c 100644 --- a/models/Makefile +++ b/models/Makefile @@ -31,19 +31,19 @@ PYBINDPLUGIN := $(shell python -c 'import pyangbind; import os; print("{}/plugin validate: # generate doc - pyang ietf-ped.yang -f tree -o "$(DOC_DIR)/ietf-ped.tree" - pyang ietf-ped.yang -f jstree -o "$(DOC_DIR)/ietf-ped.html" - pyang ietf-ped.yang -f uml -o "$(DOC_DIR)/ietf-ped.uml" + pyang ietf-ped-catalog.yang -f tree -o "$(DOC_DIR)/ietf-ped-catalog.tree" + pyang ietf-ped-catalog.yang -f jstree -o "$(DOC_DIR)/ietf-ped-catalog.html" + pyang ietf-ped-catalog.yang -f uml -o "$(DOC_DIR)/ietf-ped-catalog.uml" # finally validate - pyang ietf-ped.yang --ietf + pyang ietf-ped-catalog.yang --ietf build: # generate / compile python model - pyang --plugindir $(PYBINDPLUGIN) -f pybind -o ietf_ped_model.py ietf-ped.yang + pyang --plugindir $(PYBINDPLUGIN) -f pybind -o ietf_ped_model.py ietf-ped-catalog.yang test: # test the example ped files against the model - pytest -v + pytest -s -v all: validate build test diff --git a/models/doc/ietf-ped.html b/models/doc/ietf-ped.html deleted file mode 100644 index e3d2aa0..0000000 --- a/models/doc/ietf-ped.html +++ /dev/null @@ -1,295 +0,0 @@ - ietf-ped - - - - - - - - - -
-
-

Module: ietf-ped, Namespace: - urn:ietf:params:xml:ns:yang:ietf-ped, Prefix: - pe

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Element - [+]Expand all - [-]Collapse all - SchemaTypeFlagsOptsStatusPath
-
-   - - ietf-ped -
-
module -
-
-   - - ped -
-
containerconfigcurrent/pe:ped
-
-   - descriptor-schema -
-
leafstringconfig?current/pe:ped/pe:descriptor-schema -
-
-   - vendor -
-
leafstringconfig?current/pe:ped/pe:vendor -
-
-   - name -
-
leafstringconfig?current/pe:ped/pe:name -
-
-   - version -
-
leafstringconfig?current/pe:ped/pe:version -
-
-   - author -
-
leafstringconfig?current/pe:ped/pe:author -
-
-   - description -
-
leafstringconfig?current/pe:ped/pe:description - -
-
- - - diff --git a/models/doc/ietf-ped.tree b/models/doc/ietf-ped.tree deleted file mode 100644 index 4be90b7..0000000 --- a/models/doc/ietf-ped.tree +++ /dev/null @@ -1,8 +0,0 @@ -module: ietf-ped - +--rw ped - +--rw descriptor-schema? string - +--rw vendor? string - +--rw name? string - +--rw version? string - +--rw author? string - +--rw description? string diff --git a/models/doc/ietf-ped.uml b/models/doc/ietf-ped.uml deleted file mode 100644 index 85afa09..0000000 --- a/models/doc/ietf-ped.uml +++ /dev/null @@ -1,31 +0,0 @@ -'Download plantuml from http://plantuml.sourceforge.net/ -'Generate png with java -jar plantuml.jar -'Output in img/.png -'If Java spits out memory error increase heap size with java -Xmx1024m -jar plantuml.jar -@startuml img/ietf-ped.png -hide empty fields -hide empty methods -hide <> circle -hide <> circle -hide <> circle -hide <> stereotype -hide <> circle -page 1x1 -Title ietf-ped -note top of pe_ietf_ped : Namespace: urn:ietf:params:xml:ns:yang:ietf-ped \nPrefix: pe \nOrganization : \nPaderborn University \nContact : \nManuel Peuster \nRevision : 2019-02-21 \n -package "pe:ietf-ped" as pe_ietf_ped { -class "ietf-ped" as ietf_ped << (M, #33CCFF) module>> -class "ped" as ietf_ped_I_ped <> -ietf_ped *-- "1" ietf_ped_I_ped -ietf_ped_I_ped : descriptor-schema : string = https://github.com/mpeuster/tng-sdk-benchmark/raw/feature-73/models/ped.yang -ietf_ped_I_ped : vendor : string -ietf_ped_I_ped : name : string -ietf_ped_I_ped : version : string -ietf_ped_I_ped : author : string -ietf_ped_I_ped : description : string -} - -center footer - UML Generated : 2019-03-05 14:57 - endfooter -@enduml diff --git a/models/examples/basic-ped.yml b/models/examples/basic-ped.yml index 98f39c5..e4be7e6 100644 --- a/models/examples/basic-ped.yml +++ b/models/examples/basic-ped.yml @@ -1,10 +1,45 @@ +# Copyright (c) 2019 Manuel Peuster " - description: "Example PED." +ped-catalog: # we need this construct to build an IETF 6087 4.9 compatible data model which can even contain no PED. + peds: # a single file can specify multiple PEDs. + - id: "my_first_ped" + descriptor-schema: "https://github.com/sonata-nfv/tng-sdk-benchmark/blob/master/models/" + vendor: "com.vendor" + # name: "my_example_ped" # this should produce an error + version: "0.1" + author: "Manuel Peuster " + description: "Example PED." + targets: + - id: "first_vnf" + name: "myvnf" + - id: "first_vnf2" + name: "myvnf" + + \ No newline at end of file diff --git a/models/ietf-ped.yang b/models/ietf-ped.yang deleted file mode 100644 index 0972413..0000000 --- a/models/ietf-ped.yang +++ /dev/null @@ -1,72 +0,0 @@ -/* -* Copyright (c) 2019 Manuel Peuster "; - description "Performance Experiment Descriptor (PED) model."; - - revision 2019-02-21 { - description - "Initial revision. This YANG file defines - the Performance Experiment Descriptor (PED)"; - reference ""; - } - container ped { - description - "Performance Experiment Descriptor (PED)"; - leaf descriptor-schema { - type string; - default "https://github.com/mpeuster/tng-sdk-benchmark/raw/feature-73/models/ped.yang"; // update this - description "Pointer to this data model."; - } - leaf vendor { - type string; - description "Vendor of the described experiments."; - } - leaf name { - type string; - description "Name of the described experiments."; - } - leaf version { - type string; - description "Version of the described experiments."; - } - leaf author { - type string; - description "Author of the described experiments."; - } - leaf description { - type string; - description "Generic description text."; - } - } -} \ No newline at end of file diff --git a/models/ietf_ped_model.py b/models/ietf_ped_model.py index 08f7953..c0cb3ff 100644 --- a/models/ietf_ped_model.py +++ b/models/ietf_ped_model.py @@ -20,18 +20,18 @@ elif six.PY2: import __builtin__ -class yc_ped_ietf_ped__ped(PybindBase): +class yc_targets_ietf_ped_catalog__ped_catalog_peds_targets(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG - from YANG module ietf-ped - based on the path /ped. Each member element of + from YANG module ietf-ped-catalog - based on the path /ped-catalog/peds/targets. Each member element of the container is represented as a class variable - with a specific YANG type. - YANG Description: Performance Experiment Descriptor (PED) + YANG Description: List of target SUTs. """ - __slots__ = ('_path_helper', '_extmethods', '__descriptor_schema','__vendor','__name','__version','__author','__description',) + __slots__ = ('_path_helper', '_extmethods', '__id','__uri','__vendor','__name','__version',) - _yang_name = 'ped' + _yang_name = 'targets' _pybind_generated_by = 'container' @@ -40,12 +40,11 @@ def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False - self.__descriptor_schema = YANGDynClass(base=six.text_type, default=six.text_type("https://github.com/mpeuster/tng-sdk-benchmark/raw/feature-73/models/ped.yang"), is_leaf=True, yang_name="descriptor-schema", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) - self.__vendor = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="vendor", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) - self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) - self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) - self.__author = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="author", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) - self.__description = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) + self.__id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + self.__uri = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="uri", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + self.__vendor = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="vendor", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) load = kwargs.pop("load", None) if args: @@ -72,11 +71,308 @@ def _path(self): if hasattr(self, "_parent"): return self._parent._path()+[self._yang_name] else: - return ['ped'] + return ['ped-catalog', 'peds', 'targets'] + + def _get_id(self): + """ + Getter method for id, mapped from YANG variable /ped_catalog/peds/targets/id (string) + + YANG Description: Identifier. + """ + return self.__id + + def _set_id(self, v, load=False): + """ + Setter method for id, mapped from YANG variable /ped_catalog/peds/targets/id (string) + If this variable is read-only (config: false) in the + source YANG file, then _set_id is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_id() directly. + + YANG Description: Identifier. + """ + parent = getattr(self, "_parent", None) + if parent is not None and load is False: + raise AttributeError("Cannot set keys directly when" + + " within an instantiated list") + + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """id must be of a type compatible with string""", + 'defined-type': "string", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True)""", + }) + + self.__id = t + if hasattr(self, '_set'): + self._set() + + def _unset_id(self): + self.__id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + + + def _get_uri(self): + """ + Getter method for uri, mapped from YANG variable /ped_catalog/peds/targets/uri (string) + + YANG Description: Path/URL pointing to the SUT's location. + """ + return self.__uri + + def _set_uri(self, v, load=False): + """ + Setter method for uri, mapped from YANG variable /ped_catalog/peds/targets/uri (string) + If this variable is read-only (config: false) in the + source YANG file, then _set_uri is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_uri() directly. + + YANG Description: Path/URL pointing to the SUT's location. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="uri", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """uri must be of a type compatible with string""", + 'defined-type': "string", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="uri", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True)""", + }) + + self.__uri = t + if hasattr(self, '_set'): + self._set() + + def _unset_uri(self): + self.__uri = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="uri", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + + + def _get_vendor(self): + """ + Getter method for vendor, mapped from YANG variable /ped_catalog/peds/targets/vendor (string) + + YANG Description: Vendor part of the identifier. + """ + return self.__vendor + + def _set_vendor(self, v, load=False): + """ + Setter method for vendor, mapped from YANG variable /ped_catalog/peds/targets/vendor (string) + If this variable is read-only (config: false) in the + source YANG file, then _set_vendor is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_vendor() directly. + + YANG Description: Vendor part of the identifier. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="vendor", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """vendor must be of a type compatible with string""", + 'defined-type': "string", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="vendor", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True)""", + }) + + self.__vendor = t + if hasattr(self, '_set'): + self._set() + + def _unset_vendor(self): + self.__vendor = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="vendor", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + + + def _get_name(self): + """ + Getter method for name, mapped from YANG variable /ped_catalog/peds/targets/name (string) + + YANG Description: Name part of the identifier. + """ + return self.__name + + def _set_name(self, v, load=False): + """ + Setter method for name, mapped from YANG variable /ped_catalog/peds/targets/name (string) + If this variable is read-only (config: false) in the + source YANG file, then _set_name is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_name() directly. + + YANG Description: Name part of the identifier. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """name must be of a type compatible with string""", + 'defined-type': "string", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True)""", + }) + + self.__name = t + if hasattr(self, '_set'): + self._set() + + def _unset_name(self): + self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + + + def _get_version(self): + """ + Getter method for version, mapped from YANG variable /ped_catalog/peds/targets/version (string) + + YANG Description: Version part of the identifier + """ + return self.__version + + def _set_version(self, v, load=False): + """ + Setter method for version, mapped from YANG variable /ped_catalog/peds/targets/version (string) + If this variable is read-only (config: false) in the + source YANG file, then _set_version is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_version() directly. + + YANG Description: Version part of the identifier + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """version must be of a type compatible with string""", + 'defined-type': "string", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True)""", + }) + + self.__version = t + if hasattr(self, '_set'): + self._set() + + def _unset_version(self): + self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + + id = __builtin__.property(_get_id, _set_id) + uri = __builtin__.property(_get_uri, _set_uri) + vendor = __builtin__.property(_get_vendor, _set_vendor) + name = __builtin__.property(_get_name, _set_name) + version = __builtin__.property(_get_version, _set_version) + + + _pyangbind_elements = OrderedDict([('id', id), ('uri', uri), ('vendor', vendor), ('name', name), ('version', version), ]) + + +class yc_peds_ietf_ped_catalog__ped_catalog_peds(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module ietf-ped-catalog - based on the path /ped-catalog/peds. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: List of PEDs. + """ + __slots__ = ('_path_helper', '_extmethods', '__id','__descriptor_schema','__vendor','__name','__version','__author','__description','__targets',) + + _yang_name = 'peds' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + self.__descriptor_schema = YANGDynClass(base=six.text_type, default=six.text_type("https://github.com/mpeuster/tng-sdk-benchmark/raw/feature-73/models/ped.yang"), is_leaf=True, yang_name="descriptor-schema", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + self.__vendor = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="vendor", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + self.__author = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="author", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + self.__description = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + self.__targets = YANGDynClass(base=YANGListType("id",yc_targets_ietf_ped_catalog__ped_catalog_peds_targets, yang_name="targets", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="targets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='list', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return ['ped-catalog', 'peds'] + + def _get_id(self): + """ + Getter method for id, mapped from YANG variable /ped_catalog/peds/id (string) + + YANG Description: Identifier. + """ + return self.__id + + def _set_id(self, v, load=False): + """ + Setter method for id, mapped from YANG variable /ped_catalog/peds/id (string) + If this variable is read-only (config: false) in the + source YANG file, then _set_id is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_id() directly. + + YANG Description: Identifier. + """ + parent = getattr(self, "_parent", None) + if parent is not None and load is False: + raise AttributeError("Cannot set keys directly when" + + " within an instantiated list") + + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """id must be of a type compatible with string""", + 'defined-type': "string", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True)""", + }) + + self.__id = t + if hasattr(self, '_set'): + self._set() + + def _unset_id(self): + self.__id = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + def _get_descriptor_schema(self): """ - Getter method for descriptor_schema, mapped from YANG variable /ped/descriptor_schema (string) + Getter method for descriptor_schema, mapped from YANG variable /ped_catalog/peds/descriptor_schema (string) YANG Description: Pointer to this data model. """ @@ -84,7 +380,7 @@ def _get_descriptor_schema(self): def _set_descriptor_schema(self, v, load=False): """ - Setter method for descriptor_schema, mapped from YANG variable /ped/descriptor_schema (string) + Setter method for descriptor_schema, mapped from YANG variable /ped_catalog/peds/descriptor_schema (string) If this variable is read-only (config: false) in the source YANG file, then _set_descriptor_schema is considered as a private method. Backends looking to populate this variable should @@ -95,12 +391,12 @@ def _set_descriptor_schema(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=six.text_type, default=six.text_type("https://github.com/mpeuster/tng-sdk-benchmark/raw/feature-73/models/ped.yang"), is_leaf=True, yang_name="descriptor-schema", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) + t = YANGDynClass(v,base=six.text_type, default=six.text_type("https://github.com/mpeuster/tng-sdk-benchmark/raw/feature-73/models/ped.yang"), is_leaf=True, yang_name="descriptor-schema", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """descriptor_schema must be of a type compatible with string""", 'defined-type': "string", - 'generated-type': """YANGDynClass(base=six.text_type, default=six.text_type("https://github.com/mpeuster/tng-sdk-benchmark/raw/feature-73/models/ped.yang"), is_leaf=True, yang_name="descriptor-schema", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, default=six.text_type("https://github.com/mpeuster/tng-sdk-benchmark/raw/feature-73/models/ped.yang"), is_leaf=True, yang_name="descriptor-schema", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True)""", }) self.__descriptor_schema = t @@ -108,36 +404,36 @@ def _set_descriptor_schema(self, v, load=False): self._set() def _unset_descriptor_schema(self): - self.__descriptor_schema = YANGDynClass(base=six.text_type, default=six.text_type("https://github.com/mpeuster/tng-sdk-benchmark/raw/feature-73/models/ped.yang"), is_leaf=True, yang_name="descriptor-schema", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) + self.__descriptor_schema = YANGDynClass(base=six.text_type, default=six.text_type("https://github.com/mpeuster/tng-sdk-benchmark/raw/feature-73/models/ped.yang"), is_leaf=True, yang_name="descriptor-schema", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) def _get_vendor(self): """ - Getter method for vendor, mapped from YANG variable /ped/vendor (string) + Getter method for vendor, mapped from YANG variable /ped_catalog/peds/vendor (string) - YANG Description: Vendor of the described experiments. + YANG Description: Vendor part of the identifier. """ return self.__vendor def _set_vendor(self, v, load=False): """ - Setter method for vendor, mapped from YANG variable /ped/vendor (string) + Setter method for vendor, mapped from YANG variable /ped_catalog/peds/vendor (string) If this variable is read-only (config: false) in the source YANG file, then _set_vendor is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_vendor() directly. - YANG Description: Vendor of the described experiments. + YANG Description: Vendor part of the identifier. """ if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="vendor", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="vendor", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """vendor must be of a type compatible with string""", 'defined-type': "string", - 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="vendor", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="vendor", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True)""", }) self.__vendor = t @@ -145,36 +441,36 @@ def _set_vendor(self, v, load=False): self._set() def _unset_vendor(self): - self.__vendor = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="vendor", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) + self.__vendor = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="vendor", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) def _get_name(self): """ - Getter method for name, mapped from YANG variable /ped/name (string) + Getter method for name, mapped from YANG variable /ped_catalog/peds/name (string) - YANG Description: Name of the described experiments. + YANG Description: Name part of the identifier. """ return self.__name def _set_name(self, v, load=False): """ - Setter method for name, mapped from YANG variable /ped/name (string) + Setter method for name, mapped from YANG variable /ped_catalog/peds/name (string) If this variable is read-only (config: false) in the source YANG file, then _set_name is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_name() directly. - YANG Description: Name of the described experiments. + YANG Description: Name part of the identifier. """ if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """name must be of a type compatible with string""", 'defined-type': "string", - 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True)""", }) self.__name = t @@ -182,36 +478,36 @@ def _set_name(self, v, load=False): self._set() def _unset_name(self): - self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) + self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) def _get_version(self): """ - Getter method for version, mapped from YANG variable /ped/version (string) + Getter method for version, mapped from YANG variable /ped_catalog/peds/version (string) - YANG Description: Version of the described experiments. + YANG Description: Version part of the identifier """ return self.__version def _set_version(self, v, load=False): """ - Setter method for version, mapped from YANG variable /ped/version (string) + Setter method for version, mapped from YANG variable /ped_catalog/peds/version (string) If this variable is read-only (config: false) in the source YANG file, then _set_version is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_version() directly. - YANG Description: Version of the described experiments. + YANG Description: Version part of the identifier """ if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """version must be of a type compatible with string""", 'defined-type': "string", - 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True)""", }) self.__version = t @@ -219,12 +515,12 @@ def _set_version(self, v, load=False): self._set() def _unset_version(self): - self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) + self.__version = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) def _get_author(self): """ - Getter method for author, mapped from YANG variable /ped/author (string) + Getter method for author, mapped from YANG variable /ped_catalog/peds/author (string) YANG Description: Author of the described experiments. """ @@ -232,7 +528,7 @@ def _get_author(self): def _set_author(self, v, load=False): """ - Setter method for author, mapped from YANG variable /ped/author (string) + Setter method for author, mapped from YANG variable /ped_catalog/peds/author (string) If this variable is read-only (config: false) in the source YANG file, then _set_author is considered as a private method. Backends looking to populate this variable should @@ -243,12 +539,12 @@ def _set_author(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="author", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="author", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """author must be of a type compatible with string""", 'defined-type': "string", - 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="author", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="author", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True)""", }) self.__author = t @@ -256,12 +552,12 @@ def _set_author(self, v, load=False): self._set() def _unset_author(self): - self.__author = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="author", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) + self.__author = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="author", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) def _get_description(self): """ - Getter method for description, mapped from YANG variable /ped/description (string) + Getter method for description, mapped from YANG variable /ped_catalog/peds/description (string) YANG Description: Generic description text. """ @@ -269,7 +565,7 @@ def _get_description(self): def _set_description(self, v, load=False): """ - Setter method for description, mapped from YANG variable /ped/description (string) + Setter method for description, mapped from YANG variable /ped_catalog/peds/description (string) If this variable is read-only (config: false) in the source YANG file, then _set_description is considered as a private method. Backends looking to populate this variable should @@ -280,12 +576,12 @@ def _set_description(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) + t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) except (TypeError, ValueError): raise ValueError({ 'error-string': """description must be of a type compatible with string""", 'defined-type': "string", - 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True)""", + 'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True)""", }) self.__description = t @@ -293,31 +589,161 @@ def _set_description(self, v, load=False): self._set() def _unset_description(self): - self.__description = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='string', is_config=True) + self.__description = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='string', is_config=True) + + + def _get_targets(self): + """ + Getter method for targets, mapped from YANG variable /ped_catalog/peds/targets (list) + + YANG Description: List of target SUTs. + """ + return self.__targets + + def _set_targets(self, v, load=False): + """ + Setter method for targets, mapped from YANG variable /ped_catalog/peds/targets (list) + If this variable is read-only (config: false) in the + source YANG file, then _set_targets is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_targets() directly. + YANG Description: List of target SUTs. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=YANGListType("id",yc_targets_ietf_ped_catalog__ped_catalog_peds_targets, yang_name="targets", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="targets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='list', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """targets must be of a type compatible with list""", + 'defined-type': "list", + 'generated-type': """YANGDynClass(base=YANGListType("id",yc_targets_ietf_ped_catalog__ped_catalog_peds_targets, yang_name="targets", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="targets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='list', is_config=True)""", + }) + + self.__targets = t + if hasattr(self, '_set'): + self._set() + + def _unset_targets(self): + self.__targets = YANGDynClass(base=YANGListType("id",yc_targets_ietf_ped_catalog__ped_catalog_peds_targets, yang_name="targets", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="targets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='list', is_config=True) + + id = __builtin__.property(_get_id, _set_id) descriptor_schema = __builtin__.property(_get_descriptor_schema, _set_descriptor_schema) vendor = __builtin__.property(_get_vendor, _set_vendor) name = __builtin__.property(_get_name, _set_name) version = __builtin__.property(_get_version, _set_version) author = __builtin__.property(_get_author, _set_author) description = __builtin__.property(_get_description, _set_description) + targets = __builtin__.property(_get_targets, _set_targets) + + + _pyangbind_elements = OrderedDict([('id', id), ('descriptor_schema', descriptor_schema), ('vendor', vendor), ('name', name), ('version', version), ('author', author), ('description', description), ('targets', targets), ]) + + +class yc_ped_catalog_ietf_ped_catalog__ped_catalog(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module ietf-ped-catalog - based on the path /ped-catalog. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Performance Experiment Descriptor (PED) + """ + __slots__ = ('_path_helper', '_extmethods', '__peds',) + + _yang_name = 'ped-catalog' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__peds = YANGDynClass(base=YANGListType("id",yc_peds_ietf_ped_catalog__ped_catalog_peds, yang_name="peds", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="peds", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='list', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return ['ped-catalog'] + + def _get_peds(self): + """ + Getter method for peds, mapped from YANG variable /ped_catalog/peds (list) + + YANG Description: List of PEDs. + """ + return self.__peds + + def _set_peds(self, v, load=False): + """ + Setter method for peds, mapped from YANG variable /ped_catalog/peds (list) + If this variable is read-only (config: false) in the + source YANG file, then _set_peds is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_peds() directly. + + YANG Description: List of PEDs. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=YANGListType("id",yc_peds_ietf_ped_catalog__ped_catalog_peds, yang_name="peds", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="peds", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='list', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """peds must be of a type compatible with list""", + 'defined-type': "list", + 'generated-type': """YANGDynClass(base=YANGListType("id",yc_peds_ietf_ped_catalog__ped_catalog_peds, yang_name="peds", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="peds", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='list', is_config=True)""", + }) + + self.__peds = t + if hasattr(self, '_set'): + self._set() + + def _unset_peds(self): + self.__peds = YANGDynClass(base=YANGListType("id",yc_peds_ietf_ped_catalog__ped_catalog_peds, yang_name="peds", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="peds", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='list', is_config=True) + + peds = __builtin__.property(_get_peds, _set_peds) - _pyangbind_elements = OrderedDict([('descriptor_schema', descriptor_schema), ('vendor', vendor), ('name', name), ('version', version), ('author', author), ('description', description), ]) + _pyangbind_elements = OrderedDict([('peds', peds), ]) -class ietf_ped(PybindBase): +class ietf_ped_catalog(PybindBase): """ This class was auto-generated by the PythonClass plugin for PYANG - from YANG module ietf-ped - based on the path /ietf-ped. Each member element of + from YANG module ietf-ped-catalog - based on the path /ietf-ped-catalog. Each member element of the container is represented as a class variable - with a specific YANG type. YANG Description: Performance Experiment Descriptor (PED) model. """ - __slots__ = ('_path_helper', '_extmethods', '__ped',) + __slots__ = ('_path_helper', '_extmethods', '__ped_catalog',) - _yang_name = 'ietf-ped' + _yang_name = 'ietf-ped-catalog' _pybind_generated_by = 'container' @@ -326,7 +752,7 @@ def __init__(self, *args, **kwargs): self._path_helper = False self._extmethods = False - self.__ped = YANGDynClass(base=yc_ped_ietf_ped__ped, is_container='container', yang_name="ped", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='container', is_config=True) + self.__ped_catalog = YANGDynClass(base=yc_ped_catalog_ietf_ped_catalog__ped_catalog, is_container='container', yang_name="ped-catalog", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='container', is_config=True) load = kwargs.pop("load", None) if args: @@ -355,45 +781,45 @@ def _path(self): else: return [] - def _get_ped(self): + def _get_ped_catalog(self): """ - Getter method for ped, mapped from YANG variable /ped (container) + Getter method for ped_catalog, mapped from YANG variable /ped_catalog (container) YANG Description: Performance Experiment Descriptor (PED) """ - return self.__ped + return self.__ped_catalog - def _set_ped(self, v, load=False): + def _set_ped_catalog(self, v, load=False): """ - Setter method for ped, mapped from YANG variable /ped (container) + Setter method for ped_catalog, mapped from YANG variable /ped_catalog (container) If this variable is read-only (config: false) in the - source YANG file, then _set_ped is considered as a private + source YANG file, then _set_ped_catalog is considered as a private method. Backends looking to populate this variable should - do so via calling thisObj._set_ped() directly. + do so via calling thisObj._set_ped_catalog() directly. YANG Description: Performance Experiment Descriptor (PED) """ if hasattr(v, "_utype"): v = v._utype(v) try: - t = YANGDynClass(v,base=yc_ped_ietf_ped__ped, is_container='container', yang_name="ped", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='container', is_config=True) + t = YANGDynClass(v,base=yc_ped_catalog_ietf_ped_catalog__ped_catalog, is_container='container', yang_name="ped-catalog", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='container', is_config=True) except (TypeError, ValueError): raise ValueError({ - 'error-string': """ped must be of a type compatible with container""", + 'error-string': """ped_catalog must be of a type compatible with container""", 'defined-type': "container", - 'generated-type': """YANGDynClass(base=yc_ped_ietf_ped__ped, is_container='container', yang_name="ped", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='container', is_config=True)""", + 'generated-type': """YANGDynClass(base=yc_ped_catalog_ietf_ped_catalog__ped_catalog, is_container='container', yang_name="ped-catalog", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='container', is_config=True)""", }) - self.__ped = t + self.__ped_catalog = t if hasattr(self, '_set'): self._set() - def _unset_ped(self): - self.__ped = YANGDynClass(base=yc_ped_ietf_ped__ped, is_container='container', yang_name="ped", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:ietf:params:xml:ns:yang:ietf-ped', defining_module='ietf-ped', yang_type='container', is_config=True) + def _unset_ped_catalog(self): + self.__ped_catalog = YANGDynClass(base=yc_ped_catalog_ietf_ped_catalog__ped_catalog, is_container='container', yang_name="ped-catalog", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='urn:ietf:params:xml:ns:yang:ietf-ped-catalog', defining_module='ietf-ped-catalog', yang_type='container', is_config=True) - ped = __builtin__.property(_get_ped, _set_ped) + ped_catalog = __builtin__.property(_get_ped_catalog, _set_ped_catalog) - _pyangbind_elements = OrderedDict([('ped', ped), ]) + _pyangbind_elements = OrderedDict([('ped_catalog', ped_catalog), ]) diff --git a/models/test_model.py b/models/test_model.py index a250b4b..91db59d 100644 --- a/models/test_model.py +++ b/models/test_model.py @@ -1,4 +1,5 @@ -# Copyright (c) 2019 Manuel Peuster, 5GTANGO, Paderborn University +# Copyright (c) 2019 Manuel Peuster