Skip to content

Commit

Permalink
CVL Changes #11: Enabling mandatory node check (#40)
Browse files Browse the repository at this point in the history
Enabling mandatory node check and related test cases.
  • Loading branch information
dutta-partha authored Mar 17, 2021
1 parent d90d239 commit cfc86de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
6 changes: 1 addition & 5 deletions cvl/cvl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,6 @@ func TestValidateEditConfig_Create_Semantic_AdditionalInvalidNode_Negative(t *te
unloadConfigDB(rclient, depDataMap)
}

/*
func TestValidateEditConfig_Create_Semantic_MissingMandatoryNode_Negative(t *testing.T) {

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

func TestValidateEditConfig_Create_Syntax_Invalid_Negative(t *testing.T) {

Expand Down Expand Up @@ -3819,7 +3817,6 @@ func TestValidateEditConfig_Multi_Delete_MultiKey_Same_Session_Positive(t *testi
unloadConfigDB(rclient, depDataMap)
}

/*
func TestValidateEditConfig_Update_Leaf_List_Max_Elements_Negative(t *testing.T) {
depDataMap := map[string]interface{}{
"VLAN": map[string]interface{} {
Expand Down Expand Up @@ -3860,7 +3857,6 @@ func TestValidateEditConfig_Update_Leaf_List_Max_Elements_Negative(t *testing.T)
cvl.ValidationSessClose(cvSess)
unloadConfigDB(rclient, depDataMap)
}
*/

func TestValidationTimeStats(t *testing.T) {
cvl.ClearValidationTimeStats()
Expand Down Expand Up @@ -3904,4 +3900,4 @@ func TestValidationTimeStats(t *testing.T) {
if (stats.Hits != 0 || stats.Time != 0 || stats.Peak != 0) {
t.Errorf("TestValidationTimeStats : clearing stats failed")
}
}
}
5 changes: 2 additions & 3 deletions cvl/internal/yparser/yparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
#include <stdio.h>
#include <string.h>
//extern int lyd_check_mandatory_tree(struct lyd_node *root, struct ly_ctx *ctx, const struct lys_module **modules, int mod_count, int options);
extern int lyd_check_mandatory_tree(struct lyd_node *root, struct ly_ctx *ctx, const struct lys_module **modules, int mod_count, int options);
struct lyd_node* lyd_parse_data_path(struct ly_ctx *ctx, const char *path, LYD_FORMAT format, int options) {
return lyd_parse_path(ctx, path, format, options);
Expand All @@ -54,8 +54,7 @@ int lyd_data_validate(struct lyd_node **node, int options, struct ly_ctx *ctx)
int ret = -1;
//Check mandatory elements as it is skipped for LYD_OPT_EDIT
//ret = lyd_check_mandatory_tree(*node, ctx, NULL, 0, LYD_OPT_CONFIG | LYD_OPT_NOEXTDEPS);
ret = 0;
ret = lyd_check_mandatory_tree(*node, ctx, NULL, 0, LYD_OPT_CONFIG | LYD_OPT_NOEXTDEPS);
if (ret != 0)
{
Expand Down

0 comments on commit cfc86de

Please sign in to comment.