Skip to content

Commit cfc86de

Browse files
authored
CVL Changes sonic-net#11: Enabling mandatory node check (sonic-net#40)
Enabling mandatory node check and related test cases.
1 parent d90d239 commit cfc86de

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

cvl/cvl_test.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,6 @@ func TestValidateEditConfig_Create_Semantic_AdditionalInvalidNode_Negative(t *te
11881188
unloadConfigDB(rclient, depDataMap)
11891189
}
11901190

1191-
/*
11921191
func TestValidateEditConfig_Create_Semantic_MissingMandatoryNode_Negative(t *testing.T) {
11931192

11941193
cfgData := []cvl.CVLEditConfigData{
@@ -1214,7 +1213,6 @@ func TestValidateEditConfig_Create_Semantic_MissingMandatoryNode_Negative(t *tes
12141213
t.Errorf("Config Validation failed -- error details %v", cvlErrInfo)
12151214
}
12161215
}
1217-
*/
12181216

12191217
func TestValidateEditConfig_Create_Syntax_Invalid_Negative(t *testing.T) {
12201218

@@ -3819,7 +3817,6 @@ func TestValidateEditConfig_Multi_Delete_MultiKey_Same_Session_Positive(t *testi
38193817
unloadConfigDB(rclient, depDataMap)
38203818
}
38213819

3822-
/*
38233820
func TestValidateEditConfig_Update_Leaf_List_Max_Elements_Negative(t *testing.T) {
38243821
depDataMap := map[string]interface{}{
38253822
"VLAN": map[string]interface{} {
@@ -3860,7 +3857,6 @@ func TestValidateEditConfig_Update_Leaf_List_Max_Elements_Negative(t *testing.T)
38603857
cvl.ValidationSessClose(cvSess)
38613858
unloadConfigDB(rclient, depDataMap)
38623859
}
3863-
*/
38643860

38653861
func TestValidationTimeStats(t *testing.T) {
38663862
cvl.ClearValidationTimeStats()
@@ -3904,4 +3900,4 @@ func TestValidationTimeStats(t *testing.T) {
39043900
if (stats.Hits != 0 || stats.Time != 0 || stats.Peak != 0) {
39053901
t.Errorf("TestValidationTimeStats : clearing stats failed")
39063902
}
3907-
}
3903+
}

cvl/internal/yparser/yparser.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import (
3838
#include <stdio.h>
3939
#include <string.h>
4040
41-
//extern int lyd_check_mandatory_tree(struct lyd_node *root, struct ly_ctx *ctx, const struct lys_module **modules, int mod_count, int options);
41+
extern int lyd_check_mandatory_tree(struct lyd_node *root, struct ly_ctx *ctx, const struct lys_module **modules, int mod_count, int options);
4242
4343
struct lyd_node* lyd_parse_data_path(struct ly_ctx *ctx, const char *path, LYD_FORMAT format, int options) {
4444
return lyd_parse_path(ctx, path, format, options);
@@ -54,8 +54,7 @@ int lyd_data_validate(struct lyd_node **node, int options, struct ly_ctx *ctx)
5454
int ret = -1;
5555
5656
//Check mandatory elements as it is skipped for LYD_OPT_EDIT
57-
//ret = lyd_check_mandatory_tree(*node, ctx, NULL, 0, LYD_OPT_CONFIG | LYD_OPT_NOEXTDEPS);
58-
ret = 0;
57+
ret = lyd_check_mandatory_tree(*node, ctx, NULL, 0, LYD_OPT_CONFIG | LYD_OPT_NOEXTDEPS);
5958
6059
if (ret != 0)
6160
{

0 commit comments

Comments
 (0)