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

Issue in referencing definitions from the same module when using submodules. #54

Closed
davidmat50 opened this issue Jun 15, 2023 · 2 comments

Comments

@davidmat50
Copy link
Contributor

davidmat50 commented Jun 15, 2023

Prior to #50, the yang files mentioned below were getting loaded succesfuly without any errors. But after #50, the following error is thrown.

module_core/submodule_1/root-list-submodule1/leaf-B - typedef new-type-submodule2 not found

As per RFC7950 section , When an external module referece from an imported module is used, then we must use prefix followed by ":" , BUT If there are references to definitions in the same local module or submodules , then it is not mandatory that we use prefix followed by ": " to refer to local referecnes within the module of submodule. We MAY or MAY NOT use ":" . So, in case of included submodules, we should support referencing in both ways by a) by using ";" and b) without using ":'

image

Previous to #50, we were able to load below yang files succesfully. Is it possible to maintain the same behaviour now too?

module_core.yang

module module_core {
	
	namespace "urn:netcracker:params:module_core";
	prefix module_core;
	yang-version 1.1;
	description "This is main Module";
	
	include submodule_1;
	include submodule_2;

}		

submodule1.yang

submodule submodule_1 {
	
	yang-version 1.1;
	description "Submodule-1 with list";
	belongs-to "module_core" {
		prefix "module_core";
	}
	
	list root-list-submodule1 {
		leaf leaf-A {
			type string;
			default "Success";
		}
		leaf leaf-B {
			type new-type-submodule2;
		}
		uses the_only_group; 
	}
	
	grouping the_only_group {
		leaf leaf-from-group {
			type new-type-submodule2;
		}
		leaf-list leaf-list-from-group {
			type string;
			default "ok";
		}
	}
}		

submodule2.yang

submodule submodule_2 {
	
	yang-version 1.1;
	description "Submodule-2 with typedef";
	belongs-to "module_core" {
		prefix "module_core";
	}

	typedef new-type-submodule2 {
		description "New type definition";
		type uint16 {
			range "10 .. 2000";
		}
		default 100;
		units parrots;
	}
}
@dhubler
Copy link
Collaborator

dhubler commented Jun 20, 2023 via email

@dhubler
Copy link
Collaborator

dhubler commented Jun 20, 2023

i found the problem, hopefully this will work for you
ba7fb88

@dhubler dhubler closed this as completed Jun 20, 2023
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