Skip to content

Issue with importing Yang file with Extensions #137

Description

@k-jay-c

@sekur

I am trying to import some Yang files which are part of an application that contains various extension.

When trying to import, I'm getting the following error:

unable to parse '/Volume/Samsung/yangTest/tailf-common.yang' YANG module from '/Volume/Samsung/yangTest/tailf-common.yang'
/Volumes/Samsung/code/node_modules/yang-js/lib/node.js:223
          throw e;
          ^

Error [ExpressionError]: [extension(export)/tailf:use-in(module)] encountered unknown extension 'tailf:use-in'
    at Function.error (/Volumes/Samsung/code/node_modules/yang-js/lib/element.js:74:17)
    at Function.error (/Volumes/Samsung/code/node_modules/yang-js/lib/expression.js:149:21)
    at Function.compile (/Volumes/Samsung/code/node_modules/yang-js/lib/yang.js:166:22)
    at /Volumes/Samsung/code/node_modules/yang-js/lib/expression.js:66:20
    at Array.forEach (<anonymous>)
    at Function.compile (/Volumes/Samsung/code/node_modules/yang-js/lib/expression.js:65:20)
    at Function.compile (/Volumes/Samsung/code/node_modules/yang-js/lib/yang.js:168:22)
    at Function.parse (/Volumes/Samsung/code/node_modules/yang-js/lib/yang.js:103:16)
    at /Volumes/Samsung/code/node_modules/yang-js/lib/yang.js:87:23
    at Array.map (<anonymous>) {
  uri: 'extension(export)/tailf:use-in(module)',
  src: <ref *1> [Function: evaluate] Yang {
    parent: <ref *2> [Function: evaluate] Yang {
      'tailf:use-in': [ [Circular *1] ],
      'tailf:occurence': [
        [Function: evaluate] Yang {
          parent: [Circular *2],
          [Symbol(element:index)]: 1
        }
      ],
      description: [Function: evaluate] Yang {
        parent: [Circular *2],
        [Symbol(element:index)]: 2
      },
      [Symbol(element:cache)]: [
        [Circular *1],
        [Function: evaluate] Yang {
          parent: [Circular *2],
          [Symbol(element:index)]: 1
        },
        [Function: evaluate] Yang {
          parent: [Circular *2],
          [Symbol(element:index)]: 2
        }
      ]
    },
    [Symbol(element:index)]: 0
  },
  ctx: undefined
}

[Done] exited with code=1 in 0.236 seconds

The script I'm executing is as follows:

const Yang = require('yang-js');

const imp = Yang.import('/Volume/Samsung/yangTest/tailf-common.yang');

Attached are the following yang files within the zip
yang.zip
: tailf-common.yang, tailf-cli-extensions.yang and tailf-meta-extensions.yang

Any help you can provide in understanding or enabling importing of the yang files will be of great help.

Kind Regards,
Jay.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions