Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using extensions to enable substatements #140

Open
lgifre opened this issue Aug 29, 2017 · 0 comments
Open

Using extensions to enable substatements #140

lgifre opened this issue Aug 29, 2017 · 0 comments

Comments

@lgifre
Copy link
Contributor

lgifre commented Aug 29, 2017

Dear Rob,

I'm figuring out how to use extensions to enable statements as in the model defined in RFC 8040 Section 8 (https://tools.ietf.org/html/rfc8040#section-8). A simplification of the model is provided below where definitions of errors and descriptions have been removed for simplicity:

module ietf-restconf {
	yang-version 1.1;
	namespace "urn:ietf:params:xml:ns:yang:ietf-restconf";
	prefix "rc";

	extension yang-data {
		argument name { yin-element true; }
	}

	rc:yang-data yang-api { uses restconf; }

	grouping restconf {
		container restconf {
			container data { }
			container operations { }
		}
	}
}

The command used to generate the bindings is provided below (note the --interesting-extension="ietf-restconf" flag):

export PYBINDPLUGIN=`/usr/bin/env python -c 'import pyangbind; import os; print "%s/plugin" % os.path.dirname(pyangbind.__file__)'`
pyang --plugindir $PYBINDPLUGIN -f pybind --interesting-extension="ietf-restconf" -o binding.py ietf-restconf.yang

In my understanding, the generated bindings should define the restconf container with an empty data and an empty operations containers. However, the resulting file is "empty". See resulting binding below:

from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListType
from pyangbind.lib.yangtypes import YANGDynClass
from pyangbind.lib.yangtypes import ReferenceType
from pyangbind.lib.base import PybindBase
from decimal import Decimal
from bitarray import bitarray
import six

# PY3 support of some PY2 keywords (needs improved)
if six.PY3:
  import builtins as __builtin__
  long = int
  unicode = str
elif six.PY2:
  import __builtin__

class ietf_restconf(PybindBase):
  """
  This class was auto-generated by the PythonClass plugin for PYANG
  from YANG module ietf-restconf - based on the path /ietf-restconf. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.
  """
  _pyangbind_elements = {}

Am I doing something wrong?

TIA,
Lluís

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant