From 46900df85225784ae52512995411a5b8a0e6030c Mon Sep 17 00:00:00 2001 From: ygorelik Date: Sat, 7 Aug 2021 10:42:46 -0700 Subject: [PATCH] Fixing issue 053 --- sdk/go/core/tests/service_crud_test.go | 2 +- sdk/go/core/ydk/types/types.go | 21 ++++++++------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/sdk/go/core/tests/service_crud_test.go b/sdk/go/core/tests/service_crud_test.go index 23131fc3c..5e49cb7d1 100644 --- a/sdk/go/core/tests/service_crud_test.go +++ b/sdk/go/core/tests/service_crud_test.go @@ -146,7 +146,7 @@ func (suite *CrudTestSuite) TestReadVsReadConfig() { bgp = ysanity_bgp.Bgp{} bgpConfigEntity := suite.CRUD.ReadConfig(&suite.Provider, &bgp) bgpStatusEntity := suite.CRUD.Read(&suite.Provider, &bgp) - suite.NotEqual(GetEntityXMLString(bgpConfigEntity), GetEntityXMLString(bgpStatusEntity)) + suite.False(types.EntityEqual(bgpConfigEntity, bgpStatusEntity)) suite.CRUD.Delete(&suite.Provider, &bgp) } diff --git a/sdk/go/core/ydk/types/types.go b/sdk/go/core/ydk/types/types.go index 11bbf8a46..4440d78c7 100644 --- a/sdk/go/core/ydk/types/types.go +++ b/sdk/go/core/ydk/types/types.go @@ -889,33 +889,28 @@ func deepValueEqual(e1, e2 Entity) bool { marker := make(map[string]bool) - ret := true for k, c1 := range children1 { if c1.Value != nil { marker[k] = true - if HasDataOrFilter(c1.Value) { - c2, ok := children2[k] - if ok && deepValueEqual(c1.Value, c2.Value) { - ret = ret && nameValuesEqual(c1.Value, c2.Value) - } else { - ret = false - break - } + c2, ok := children2[k] + if ok && deepValueEqual(c1.Value, c2.Value) { + continue + } else { + return false } } } for k := range children2 { - if children2[k].Value != nil{ + if children2[k].Value != nil { _, ok := marker[k] if !ok { - ret = false - break + return false } } } - return ret + return nameValuesEqual(e1, e2) } // EntityEqual returns whether the entities x and y and their children are equal in value