MCPcopy
hub / github.com/osrg/gobgp / Add

Method Add

internal/pkg/table/roa.go:116–140  ·  view source on GitHub ↗
(roa *ROA)

Source from the content-addressed store, hash-verified

114}
115
116func (rt *ROATable) Add(roa *ROA) {
117 b := rt.getBucket(roa)
118 for _, r := range b.entries {
119 if r.Equal(roa) {
120 // we already have the same one
121 return
122 }
123 }
124 b.entries = append(b.entries, roa)
125 sort.Slice(b.entries, func(i, j int) bool {
126 r1 := b.entries[i]
127 r2 := b.entries[j]
128
129 if r1.MaxLen < r2.MaxLen {
130 return true
131 } else if r1.MaxLen > r2.MaxLen {
132 return false
133 }
134
135 if r1.AS < r2.AS {
136 return true
137 }
138 return false
139 })
140}
141
142func (rt *ROATable) Delete(roa *ROA) {
143 tree := rt.roa2tree(roa)

Callers 15

TestValidate0Function · 0.95
TestValidate1Function · 0.95
TestValidate3Function · 0.95
TestValidate4Function · 0.95
TestValidate5Function · 0.95
TestValidate6Function · 0.95
TestValidate7Function · 0.95
TestValidate8Function · 0.95
TestValidate9Function · 0.95
TestValidate10Function · 0.95

Calls 2

getBucketMethod · 0.95
EqualMethod · 0.45

Tested by 15

TestValidate0Function · 0.76
TestValidate1Function · 0.76
TestValidate3Function · 0.76
TestValidate4Function · 0.76
TestValidate5Function · 0.76
TestValidate6Function · 0.76
TestValidate7Function · 0.76
TestValidate8Function · 0.76
TestValidate9Function · 0.76
TestValidate10Function · 0.76