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

(*yang.Entry).Find() fails to find valid schema node identifiers #87

Open
andaru opened this issue Nov 28, 2018 · 1 comment
Open

(*yang.Entry).Find() fails to find valid schema node identifiers #87

andaru opened this issue Nov 28, 2018 · 1 comment

Comments

@andaru
Copy link
Contributor

andaru commented Nov 28, 2018

The new deviation support doesn't work with remote paths for us at all. Every one of our valid deviations fail to parse.

e.g.,

cannot find target node to deviate, /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:state/oc-acl:matched-octets

This deviation is found in a module importing openconfig-acl with prefix oc-acl. This is the simplest example, but we see similar issues with augmented paths (where the namespace prefix change).

RFC7950 section 6.5 says that:

   References to identifiers defined in external modules MUST be
   qualified with appropriate prefixes, and references to identifiers
   defined in the current module and its submodules MAY use a prefix.

As deviations are typically produced by a third-party to the original module author, this is the most common use case.

If you add some test cases to the previous change which include prefixes, you should see the error message above. e.g. a basic deviation module like this;

module foo {
  import "external-module" { prefix extern; }
  deviation /extern:some-top-level-node/extern:some-second-level-node/ { deviate not-supported; }
}
@aslam4g
Copy link

aslam4g commented Apr 22, 2022

I am testing this with sonic but , did not see this problem with openconfig-acl.yang , But I am seeing this problem with other yang file .

My yang file and annotation are as below
module ultraconfig-interfaces {

yang-version 1.1;

namespace
"http://ultraconfig.com.au/ns/yang/ultraconfig-interfaces";

prefix if;

organization
"Ultra Config Pty Ltd";

contact
"Support: https://ultraconfig.com.au/contact/";

description
"This YANG module has been created for the purpose of a tutorial.
It defines the model for a basic ethernet interface";

revision "2020-01-03" {
description
"Initial Revision";
reference
"Learn YANG - Full Tutorial for Beginners";
}
typedef dotted-quad {
type string {
pattern
'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).){3}'

  • '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
    }
    description
    "Four octets written as decimal numbers and
    separated with the '.' (full stop) character.";
    }

container interfaces-ultra {
list interface {
key "name";
leaf name {
type string;
mandatory "true";
description
"Interface name. Example value: GigabitEthernet 0/0/0";
}
leaf address {
type dotted-quad;
mandatory "true";
description
"Interface IP address. Example value: 10.10.10.1";
leaf subnet-mask {
type dotted-quad;
mandatory "true";
description
"Interface subnet mask. Example value: 255.255.255.0";
}
leaf enabled {
type boolean;
default "false";
description
"Enable or disable the interface. Example value: true";
}
}
list interface-state {
config false;
key "name";
leaf name {
type string;
description
"Interface name. Example value: GigabitEthernet 0/0/0";
}
leaf oper-status {
type enumeration {
enum up;
enum down;mandatory "true";
description
"Describes whether the interface is physically up or down";
}
}
}
}

Annotation file is
module ultraconfig-interfaces-annot {

yang-version "1.1";

//namespace "http://openconfig.net/yang/annotation/if-annot";
namespace "http://ultraconfig.com.au/ns/yang/ultraconfig-interfaces/if-annot";
prefix "if-annot";

import ultraconfig-interfaces { prefix if; }
import sonic-extensions { prefix sonic-ext; }

deviation /if:interfaces-ultra {
deviate add {
sonic-ext:table-name "ULTRA_TABLE1";
}

}

deviation /if:interfaces-ultra/if:interface {
deviate add {
sonic-ext:table-name "ULTRA_TABLE2";
}
}

deviation /if:interfaces-ultra/if:interface/if:name {

deviation /if:interfaces-ultra/if:interface/if:address {
deviate add {
sonic-ext:field-name "address2";
}
}

deviation /if:interfaces-ultra/if:interface/if:subnet-mask {
deviate add {
sonic-ext:field-name "subnet-mask2";
}
}

deviation /if:interfaces-ultra/if:interface/if:enabled {
deviate add {
sonic-ext:field-name "enabled2";
}

}

deviation /if:interfaces-ultra/if:interface-state {
deviate add {
sonic-ext:field-name "interface-state2";
}
}
deviation /if:interfaces-ultra/if:interface-state/if:name {
deviate add {
sonic-ext:field-name "state-name2";
}
}

deviation /if:interfaces-ultra/if:interface-state/if:oper-status {
deviate add {
sonic-ext:field-name "oper-status";
}
}

}


Error seen
Apr 22 06:50:12.200330 ip-172-26-8-32 INFO #/supervisord: rest-server cannot find target n
ode to deviate, /if:interfaces-ultra/if:interface/if:address
Apr 22 06:50:12.200334 ip-172-26-8-32 INFO #/supervisord: rest-server cannot find target n
ode to deviate, /if:interfaces-ultra/if:interface/if:enabled
Apr 22 06:50:12.200338 ip-172-26-8-32 INFO #/supervisord: rest-server cannot find target n
ode to deviate, /if:interfaces-ultra/if:interface/if:name
Apr 22 06:50:12.200341 ip-172-26-8-32 INFO #/supervisord: rest-server cannot find target n
ode to deviate, /if:interfaces-ultra/if:interface/if:subnet-mask
Apr 22 06:50:12.200767 ip-172-26-8-32 INFO #/supervisord: rest-server Found version 1.0.2
for yang module openconfig-acl


Please let us know how to fix this issue .

Thanks in advance

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

2 participants