Skip to content

Commit

Permalink
Fixing issue 053
Browse files Browse the repository at this point in the history
  • Loading branch information
ygorelik committed Aug 7, 2021
1 parent 1dd1503 commit 46900df
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion sdk/go/core/tests/service_crud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
21 changes: 8 additions & 13 deletions sdk/go/core/ydk/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 46900df

Please sign in to comment.