Skip to content

Commit 8636adb

Browse files
committed
Update transport routing with recent model changes
1 parent cb41340 commit 8636adb

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

internal/provider/model_sdwan_transport_routing_bgp_feature.go

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,7 +1741,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
17411741
data.MultipathRelax = types.BoolValue(va.Bool())
17421742
}
17431743
}
1744-
if value := res.Get(path + "neighbor"); value.Exists() {
1744+
if value := res.Get(path + "neighbor"); value.Exists() && len(value.Array()) > 0 {
17451745
data.Ipv4Neighbors = make([]TransportRoutingBGPIpv4Neighbors, 0)
17461746
value.ForEach(func(k, v gjson.Result) bool {
17471747
item := TransportRoutingBGPIpv4Neighbors{}
@@ -1903,7 +1903,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
19031903
item.AllowasInNumber = types.Int64Value(va.Int())
19041904
}
19051905
}
1906-
if cValue := v.Get("addressFamily"); cValue.Exists() {
1906+
if cValue := v.Get("addressFamily"); cValue.Exists() && len(cValue.Array()) > 0 {
19071907
item.AddressFamilies = make([]TransportRoutingBGPIpv4NeighborsAddressFamilies, 0)
19081908
cValue.ForEach(func(ck, cv gjson.Result) bool {
19091909
cItem := TransportRoutingBGPIpv4NeighborsAddressFamilies{}
@@ -1934,6 +1934,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
19341934
cItem.RestartMaxNumberOfPrefixes = types.Int64Value(va.Int())
19351935
}
19361936
}
1937+
cItem.PolicyType = types.StringValue("restart")
19371938
}
19381939
cItem.RestartThreshold = types.Int64Null()
19391940
cItem.RestartThresholdVariable = types.StringNull()
@@ -1946,6 +1947,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
19461947
cItem.RestartThreshold = types.Int64Value(va.Int())
19471948
}
19481949
}
1950+
cItem.PolicyType = types.StringValue("restart")
19491951
}
19501952
cItem.RestartInterval = types.Int64Null()
19511953
cItem.RestartIntervalVariable = types.StringNull()
@@ -1958,6 +1960,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
19581960
cItem.RestartInterval = types.Int64Value(va.Int())
19591961
}
19601962
}
1963+
cItem.PolicyType = types.StringValue("restart")
19611964
}
19621965
cItem.WarningMessageMaxNumberOfPrefixes = types.Int64Null()
19631966
cItem.WarningMessageMaxNumberOfPrefixesVariable = types.StringNull()
@@ -1970,6 +1973,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
19701973
cItem.WarningMessageMaxNumberOfPrefixes = types.Int64Value(va.Int())
19711974
}
19721975
}
1976+
cItem.PolicyType = types.StringValue("warning-only")
19731977
}
19741978
cItem.WarningMessageThreshold = types.Int64Null()
19751979
cItem.WarningMessageThresholdVariable = types.StringNull()
@@ -1982,6 +1986,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
19821986
cItem.WarningMessageThreshold = types.Int64Value(va.Int())
19831987
}
19841988
}
1989+
cItem.PolicyType = types.StringValue("warning-only")
19851990
}
19861991
cItem.DisablePeerMaxNumberOfPrefixes = types.Int64Null()
19871992
cItem.DisablePeerMaxNumberOfPrefixesVariable = types.StringNull()
@@ -1994,6 +1999,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
19941999
cItem.DisablePeerMaxNumberOfPrefixes = types.Int64Value(va.Int())
19952000
}
19962001
}
2002+
cItem.PolicyType = types.StringValue("disable-peer")
19972003
}
19982004
cItem.DisablePeerThreshold = types.Int64Null()
19992005
cItem.DisablePeerThresholdVariable = types.StringNull()
@@ -2006,6 +2012,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
20062012
cItem.DisablePeerThreshold = types.Int64Value(va.Int())
20072013
}
20082014
}
2015+
cItem.PolicyType = types.StringValue("disable-peer")
20092016
}
20102017
cItem.InRoutePolicyId = types.StringNull()
20112018

@@ -2031,7 +2038,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
20312038
return true
20322039
})
20332040
}
2034-
if value := res.Get(path + "ipv6Neighbor"); value.Exists() {
2041+
if value := res.Get(path + "ipv6Neighbor"); value.Exists() && len(value.Array()) > 0 {
20352042
data.Ipv6Neighbors = make([]TransportRoutingBGPIpv6Neighbors, 0)
20362043
value.ForEach(func(k, v gjson.Result) bool {
20372044
item := TransportRoutingBGPIpv6Neighbors{}
@@ -2175,7 +2182,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
21752182
item.AllowasInNumber = types.Int64Value(va.Int())
21762183
}
21772184
}
2178-
if cValue := v.Get("addressFamily"); cValue.Exists() {
2185+
if cValue := v.Get("addressFamily"); cValue.Exists() && len(cValue.Array()) > 0 {
21792186
item.AddressFamilies = make([]TransportRoutingBGPIpv6NeighborsAddressFamilies, 0)
21802187
cValue.ForEach(func(ck, cv gjson.Result) bool {
21812188
cItem := TransportRoutingBGPIpv6NeighborsAddressFamilies{}
@@ -2249,7 +2256,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
22492256
return true
22502257
})
22512258
}
2252-
if value := res.Get(path + "addressFamily.aggregateAddress"); value.Exists() {
2259+
if value := res.Get(path + "addressFamily.aggregateAddress"); value.Exists() && len(value.Array()) > 0 {
22532260
data.Ipv4AggregateAddresses = make([]TransportRoutingBGPIpv4AggregateAddresses, 0)
22542261
value.ForEach(func(k, v gjson.Result) bool {
22552262
item := TransportRoutingBGPIpv4AggregateAddresses{}
@@ -2297,7 +2304,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
22972304
return true
22982305
})
22992306
}
2300-
if value := res.Get(path + "addressFamily.network"); value.Exists() {
2307+
if value := res.Get(path + "addressFamily.network"); value.Exists() && len(value.Array()) > 0 {
23012308
data.Ipv4Networks = make([]TransportRoutingBGPIpv4Networks, 0)
23022309
value.ForEach(func(k, v gjson.Result) bool {
23032310
item := TransportRoutingBGPIpv4Networks{}
@@ -2363,7 +2370,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
23632370
data.Ipv4TableMapFilter = types.BoolValue(va.Bool())
23642371
}
23652372
}
2366-
if value := res.Get(path + "addressFamily.redistribute"); value.Exists() {
2373+
if value := res.Get(path + "addressFamily.redistribute"); value.Exists() && len(value.Array()) > 0 {
23672374
data.Ipv4Redistributes = make([]TransportRoutingBGPIpv4Redistributes, 0)
23682375
value.ForEach(func(k, v gjson.Result) bool {
23692376
item := TransportRoutingBGPIpv4Redistributes{}
@@ -2389,7 +2396,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
23892396
return true
23902397
})
23912398
}
2392-
if value := res.Get(path + "ipv6AddressFamily.ipv6AggregateAddress"); value.Exists() {
2399+
if value := res.Get(path + "ipv6AddressFamily.ipv6AggregateAddress"); value.Exists() && len(value.Array()) > 0 {
23932400
data.Ipv6AggregateAddresses = make([]TransportRoutingBGPIpv6AggregateAddresses, 0)
23942401
value.ForEach(func(k, v gjson.Result) bool {
23952402
item := TransportRoutingBGPIpv6AggregateAddresses{}
@@ -2427,7 +2434,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
24272434
return true
24282435
})
24292436
}
2430-
if value := res.Get(path + "ipv6AddressFamily.ipv6Network"); value.Exists() {
2437+
if value := res.Get(path + "ipv6AddressFamily.ipv6Network"); value.Exists() && len(value.Array()) > 0 {
24312438
data.Ipv6Networks = make([]TransportRoutingBGPIpv6Networks, 0)
24322439
value.ForEach(func(k, v gjson.Result) bool {
24332440
item := TransportRoutingBGPIpv6Networks{}
@@ -2483,7 +2490,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
24832490
data.Ipv6TableMapFilter = types.BoolValue(va.Bool())
24842491
}
24852492
}
2486-
if value := res.Get(path + "ipv6AddressFamily.redistribute"); value.Exists() {
2493+
if value := res.Get(path + "ipv6AddressFamily.redistribute"); value.Exists() && len(value.Array()) > 0 {
24872494
data.Ipv6Redistributes = make([]TransportRoutingBGPIpv6Redistributes, 0)
24882495
value.ForEach(func(k, v gjson.Result) bool {
24892496
item := TransportRoutingBGPIpv6Redistributes{}
@@ -2509,7 +2516,7 @@ func (data *TransportRoutingBGP) fromBody(ctx context.Context, res gjson.Result)
25092516
return true
25102517
})
25112518
}
2512-
if value := res.Get(path + "mplsInterface"); value.Exists() {
2519+
if value := res.Get(path + "mplsInterface"); value.Exists() && len(value.Array()) > 0 {
25132520
data.MplsInterfaces = make([]TransportRoutingBGPMplsInterfaces, 0)
25142521
value.ForEach(func(k, v gjson.Result) bool {
25152522
item := TransportRoutingBGPMplsInterfaces{}

0 commit comments

Comments
 (0)