diff options
-rw-r--r-- | config/bgp_configs.go | 72 | ||||
-rw-r--r-- | tools/pyang_plugins/bgpyang2golang.py | 4 |
2 files changed, 38 insertions, 38 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go index 16968123..0b5297d1 100644 --- a/config/bgp_configs.go +++ b/config/bgp_configs.go @@ -1489,8 +1489,8 @@ func (lhs *PeerGroup) Equal(rhs *PeerGroup) bool { } { lmap := make(map[string]*AfiSafi) - for _, l := range lhs.AfiSafis { - lmap[string(l.Config.AfiSafiName)] = &l + for i, l := range lhs.AfiSafis { + lmap[string(l.Config.AfiSafiName)] = &lhs.AfiSafis[i] } for _, r := range rhs.AfiSafis { if l, y := lmap[string(r.Config.AfiSafiName)]; !y { @@ -2575,8 +2575,8 @@ func (lhs *Neighbor) Equal(rhs *Neighbor) bool { } { lmap := make(map[string]*AfiSafi) - for _, l := range lhs.AfiSafis { - lmap[string(l.Config.AfiSafiName)] = &l + for i, l := range lhs.AfiSafis { + lmap[string(l.Config.AfiSafiName)] = &lhs.AfiSafis[i] } for _, r := range rhs.AfiSafis { if l, y := lmap[string(r.Config.AfiSafiName)]; !y { @@ -4032,8 +4032,8 @@ func (lhs *Global) Equal(rhs *Global) bool { } { lmap := make(map[string]*AfiSafi) - for _, l := range lhs.AfiSafis { - lmap[string(l.Config.AfiSafiName)] = &l + for i, l := range lhs.AfiSafis { + lmap[string(l.Config.AfiSafiName)] = &lhs.AfiSafis[i] } for _, r := range rhs.AfiSafis { if l, y := lmap[string(r.Config.AfiSafiName)]; !y { @@ -4084,8 +4084,8 @@ func (lhs *Bgp) Equal(rhs *Bgp) bool { } { lmap := make(map[string]*Neighbor) - for _, l := range lhs.Neighbors { - lmap[string(l.Config.NeighborAddress)] = &l + for i, l := range lhs.Neighbors { + lmap[string(l.Config.NeighborAddress)] = &lhs.Neighbors[i] } for _, r := range rhs.Neighbors { if l, y := lmap[string(r.Config.NeighborAddress)]; !y { @@ -4100,8 +4100,8 @@ func (lhs *Bgp) Equal(rhs *Bgp) bool { } { lmap := make(map[string]*PeerGroup) - for _, l := range lhs.PeerGroups { - lmap[string(l.Config.PeerGroupName)] = &l + for i, l := range lhs.PeerGroups { + lmap[string(l.Config.PeerGroupName)] = &lhs.PeerGroups[i] } for _, r := range rhs.PeerGroups { if l, y := lmap[string(r.Config.PeerGroupName)]; !y { @@ -4116,8 +4116,8 @@ func (lhs *Bgp) Equal(rhs *Bgp) bool { } { lmap := make(map[string]*RpkiServer) - for _, l := range lhs.RpkiServers { - lmap[string(l.Config.Address)] = &l + for i, l := range lhs.RpkiServers { + lmap[string(l.Config.Address)] = &lhs.RpkiServers[i] } for _, r := range rhs.RpkiServers { if l, y := lmap[string(r.Config.Address)]; !y { @@ -4132,8 +4132,8 @@ func (lhs *Bgp) Equal(rhs *Bgp) bool { } { lmap := make(map[string]*BmpServer) - for _, l := range lhs.BmpServers { - lmap[string(l.Config.Address)] = &l + for i, l := range lhs.BmpServers { + lmap[string(l.Config.Address)] = &lhs.BmpServers[i] } for _, r := range rhs.BmpServers { if l, y := lmap[string(r.Config.Address)]; !y { @@ -4148,8 +4148,8 @@ func (lhs *Bgp) Equal(rhs *Bgp) bool { } { lmap := make(map[string]*Mrt) - for _, l := range lhs.MrtDump { - lmap[string(l.FileName)] = &l + for i, l := range lhs.MrtDump { + lmap[string(l.FileName)] = &lhs.MrtDump[i] } for _, r := range rhs.MrtDump { if l, y := lmap[string(r.FileName)]; !y { @@ -4752,8 +4752,8 @@ func (lhs *PolicyDefinition) Equal(rhs *PolicyDefinition) bool { } { lmap := make(map[string]*Statement) - for _, l := range lhs.Statements { - lmap[string(l.Name)] = &l + for i, l := range lhs.Statements { + lmap[string(l.Name)] = &lhs.Statements[i] } for _, r := range rhs.Statements { if l, y := lmap[string(r.Name)]; !y { @@ -4863,8 +4863,8 @@ func (lhs *BgpDefinedSets) Equal(rhs *BgpDefinedSets) bool { } { lmap := make(map[string]*CommunitySet) - for _, l := range lhs.CommunitySets { - lmap[string(l.CommunitySetName)] = &l + for i, l := range lhs.CommunitySets { + lmap[string(l.CommunitySetName)] = &lhs.CommunitySets[i] } for _, r := range rhs.CommunitySets { if l, y := lmap[string(r.CommunitySetName)]; !y { @@ -4879,8 +4879,8 @@ func (lhs *BgpDefinedSets) Equal(rhs *BgpDefinedSets) bool { } { lmap := make(map[string]*ExtCommunitySet) - for _, l := range lhs.ExtCommunitySets { - lmap[string(l.ExtCommunitySetName)] = &l + for i, l := range lhs.ExtCommunitySets { + lmap[string(l.ExtCommunitySetName)] = &lhs.ExtCommunitySets[i] } for _, r := range rhs.ExtCommunitySets { if l, y := lmap[string(r.ExtCommunitySetName)]; !y { @@ -4895,8 +4895,8 @@ func (lhs *BgpDefinedSets) Equal(rhs *BgpDefinedSets) bool { } { lmap := make(map[string]*AsPathSet) - for _, l := range lhs.AsPathSets { - lmap[string(l.AsPathSetName)] = &l + for i, l := range lhs.AsPathSets { + lmap[string(l.AsPathSetName)] = &lhs.AsPathSets[i] } for _, r := range rhs.AsPathSets { if l, y := lmap[string(r.AsPathSetName)]; !y { @@ -4945,8 +4945,8 @@ func (lhs *TagSet) Equal(rhs *TagSet) bool { } { lmap := make(map[string]*Tag) - for _, l := range lhs.TagList { - lmap[string(l.Value)] = &l + for i, l := range lhs.TagList { + lmap[string(l.Value)] = &lhs.TagList[i] } for _, r := range rhs.TagList { if l, y := lmap[string(r.Value)]; !y { @@ -5028,8 +5028,8 @@ func (lhs *PrefixSet) Equal(rhs *PrefixSet) bool { } { lmap := make(map[string]*Prefix) - for _, l := range lhs.PrefixList { - lmap[string(l.IpPrefix+l.MasklengthRange)] = &l + for i, l := range lhs.PrefixList { + lmap[string(l.IpPrefix+l.MasklengthRange)] = &lhs.PrefixList[i] } for _, r := range rhs.PrefixList { if l, y := lmap[string(r.IpPrefix+r.MasklengthRange)]; !y { @@ -5063,8 +5063,8 @@ func (lhs *DefinedSets) Equal(rhs *DefinedSets) bool { } { lmap := make(map[string]*PrefixSet) - for _, l := range lhs.PrefixSets { - lmap[string(l.PrefixSetName)] = &l + for i, l := range lhs.PrefixSets { + lmap[string(l.PrefixSetName)] = &lhs.PrefixSets[i] } for _, r := range rhs.PrefixSets { if l, y := lmap[string(r.PrefixSetName)]; !y { @@ -5079,8 +5079,8 @@ func (lhs *DefinedSets) Equal(rhs *DefinedSets) bool { } { lmap := make(map[string]*NeighborSet) - for _, l := range lhs.NeighborSets { - lmap[string(l.NeighborSetName)] = &l + for i, l := range lhs.NeighborSets { + lmap[string(l.NeighborSetName)] = &lhs.NeighborSets[i] } for _, r := range rhs.NeighborSets { if l, y := lmap[string(r.NeighborSetName)]; !y { @@ -5095,8 +5095,8 @@ func (lhs *DefinedSets) Equal(rhs *DefinedSets) bool { } { lmap := make(map[string]*TagSet) - for _, l := range lhs.TagSets { - lmap[string(l.TagSetName)] = &l + for i, l := range lhs.TagSets { + lmap[string(l.TagSetName)] = &lhs.TagSets[i] } for _, r := range rhs.TagSets { if l, y := lmap[string(r.TagSetName)]; !y { @@ -5132,8 +5132,8 @@ func (lhs *RoutingPolicy) Equal(rhs *RoutingPolicy) bool { } { lmap := make(map[string]*PolicyDefinition) - for _, l := range lhs.PolicyDefinitions { - lmap[string(l.Name)] = &l + for i, l := range lhs.PolicyDefinitions { + lmap[string(l.Name)] = &lhs.PolicyDefinitions[i] } for _, r := range rhs.PolicyDefinitions { if l, y := lmap[string(r.Name)]; !y { diff --git a/tools/pyang_plugins/bgpyang2golang.py b/tools/pyang_plugins/bgpyang2golang.py index ebe1de8d..5c3819a7 100644 --- a/tools/pyang_plugins/bgpyang2golang.py +++ b/tools/pyang_plugins/bgpyang2golang.py @@ -309,8 +309,8 @@ def emit_class_def(ctx, yang_statement, struct_name, prefix): print >> o, '}' print >> o, '{' print >> o, 'lmap := make(map[string]*{0})'.format(type_name[2:]) - print >> o, 'for _, l := range lhs.{0} {{'.format(val_name) - print >> o, 'lmap[string({0})] = &l'.format(' + '.join('l.{0}'.format(convert_to_golang(v)) for v in elem.split(' '))) + print >> o, 'for i, l := range lhs.{0} {{'.format(val_name) + print >> o, 'lmap[string({0})] = &lhs.{1}[i]'.format(' + '.join('l.{0}'.format(convert_to_golang(v)) for v in elem.split(' ')), val_name) print >> o, '}' print >> o, 'for _, r := range rhs.{0} {{'.format(val_name) print >> o, 'if l, y := lmap[string({0})]; !y {{'.format('+'.join('r.{0}'.format(convert_to_golang(v)) for v in elem.split(' '))) |