Skip to content

Commit d364fad

Browse files
authored
Fix 0.6.3 Testing Issue (#494)
1 parent 92e66de commit d364fad

File tree

3 files changed

+138
-108
lines changed

3 files changed

+138
-108
lines changed

gen/definitions/profile_parcels/service_routing_bgp.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Manual resource - Modals updateBody and updateFromBody are manually configured to support 'restart', 'warning-only', and 'disable-peer' conditional attributes.
12
---
23
name: Service Routing BGP
34
rest_endpoint: /v1/feature-profile/sdwan/service/%v/routing/bgp

internal/provider/model_sdwan_service_routing_bgp_feature.go

Lines changed: 119 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,7 +1556,6 @@ func (data ServiceRoutingBGP) toBody(ctx context.Context) string {
15561556

15571557
// End of section. //template:end toBody
15581558

1559-
// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
15601559
func (data *ServiceRoutingBGP) fromBody(ctx context.Context, res gjson.Result) {
15611560
data.Name = types.StringValue(res.Get("payload.name").String())
15621561
if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
@@ -1881,80 +1880,94 @@ func (data *ServiceRoutingBGP) fromBody(ctx context.Context, res gjson.Result) {
18811880
}
18821881
cItem.RestartMaxNumberOfPrefixes = types.Int64Null()
18831882
cItem.RestartMaxNumberOfPrefixesVariable = types.StringNull()
1884-
if t := cv.Get("maxPrefixConfig.prefixNum.optionType"); t.Exists() {
1885-
va := cv.Get("maxPrefixConfig.prefixNum.value")
1886-
if t.String() == "variable" {
1887-
cItem.RestartMaxNumberOfPrefixesVariable = types.StringValue(va.String())
1888-
} else if t.String() == "global" {
1889-
cItem.RestartMaxNumberOfPrefixes = types.Int64Value(va.Int())
1883+
if true && cItem.PolicyType.ValueString() == "restart" {
1884+
if t := cv.Get("maxPrefixConfig.prefixNum.optionType"); t.Exists() {
1885+
va := cv.Get("maxPrefixConfig.prefixNum.value")
1886+
if t.String() == "variable" {
1887+
cItem.RestartMaxNumberOfPrefixesVariable = types.StringValue(va.String())
1888+
} else if t.String() == "global" {
1889+
cItem.RestartMaxNumberOfPrefixes = types.Int64Value(va.Int())
1890+
}
1891+
cItem.PolicyType = types.StringValue("restart")
18901892
}
1891-
cItem.PolicyType = types.StringValue("restart")
18921893
}
18931894
cItem.RestartThreshold = types.Int64Null()
18941895
cItem.RestartThresholdVariable = types.StringNull()
1895-
if t := cv.Get("maxPrefixConfig.threshold.optionType"); t.Exists() {
1896-
va := cv.Get("maxPrefixConfig.threshold.value")
1897-
if t.String() == "variable" {
1898-
cItem.RestartThresholdVariable = types.StringValue(va.String())
1899-
} else if t.String() == "global" {
1900-
cItem.RestartThreshold = types.Int64Value(va.Int())
1896+
if true && cItem.PolicyType.ValueString() == "restart" {
1897+
if t := cv.Get("maxPrefixConfig.threshold.optionType"); t.Exists() {
1898+
va := cv.Get("maxPrefixConfig.threshold.value")
1899+
if t.String() == "variable" {
1900+
cItem.RestartThresholdVariable = types.StringValue(va.String())
1901+
} else if t.String() == "global" {
1902+
cItem.RestartThreshold = types.Int64Value(va.Int())
1903+
}
1904+
cItem.PolicyType = types.StringValue("restart")
19011905
}
1902-
cItem.PolicyType = types.StringValue("restart")
19031906
}
19041907
cItem.RestartInterval = types.Int64Null()
19051908
cItem.RestartIntervalVariable = types.StringNull()
1906-
if t := cv.Get("maxPrefixConfig.restartInterval.optionType"); t.Exists() {
1907-
va := cv.Get("maxPrefixConfig.restartInterval.value")
1908-
if t.String() == "variable" {
1909-
cItem.RestartIntervalVariable = types.StringValue(va.String())
1910-
} else if t.String() == "global" {
1911-
cItem.RestartInterval = types.Int64Value(va.Int())
1909+
if true && cItem.PolicyType.ValueString() == "restart" {
1910+
if t := cv.Get("maxPrefixConfig.restartInterval.optionType"); t.Exists() {
1911+
va := cv.Get("maxPrefixConfig.restartInterval.value")
1912+
if t.String() == "variable" {
1913+
cItem.RestartIntervalVariable = types.StringValue(va.String())
1914+
} else if t.String() == "global" {
1915+
cItem.RestartInterval = types.Int64Value(va.Int())
1916+
}
1917+
cItem.PolicyType = types.StringValue("restart")
19121918
}
1913-
cItem.PolicyType = types.StringValue("restart")
19141919
}
19151920
cItem.WarningMessageMaxNumberOfPrefixes = types.Int64Null()
19161921
cItem.WarningMessageMaxNumberOfPrefixesVariable = types.StringNull()
1917-
if t := cv.Get("maxPrefixConfig.prefixNum.optionType"); t.Exists() {
1918-
va := cv.Get("maxPrefixConfig.prefixNum.value")
1919-
if t.String() == "variable" {
1920-
cItem.WarningMessageMaxNumberOfPrefixesVariable = types.StringValue(va.String())
1921-
} else if t.String() == "global" {
1922-
cItem.WarningMessageMaxNumberOfPrefixes = types.Int64Value(va.Int())
1922+
if true && cItem.PolicyType.ValueString() == "warning-only" {
1923+
if t := cv.Get("maxPrefixConfig.prefixNum.optionType"); t.Exists() {
1924+
va := cv.Get("maxPrefixConfig.prefixNum.value")
1925+
if t.String() == "variable" {
1926+
cItem.WarningMessageMaxNumberOfPrefixesVariable = types.StringValue(va.String())
1927+
} else if t.String() == "global" {
1928+
cItem.WarningMessageMaxNumberOfPrefixes = types.Int64Value(va.Int())
1929+
}
1930+
cItem.PolicyType = types.StringValue("warning-only")
19231931
}
1924-
cItem.PolicyType = types.StringValue("warning-only")
19251932
}
19261933
cItem.WarningMessageThreshold = types.Int64Null()
19271934
cItem.WarningMessageThresholdVariable = types.StringNull()
1928-
if t := cv.Get("maxPrefixConfig.threshold.optionType"); t.Exists() {
1929-
va := cv.Get("maxPrefixConfig.threshold.value")
1930-
if t.String() == "variable" {
1931-
cItem.WarningMessageThresholdVariable = types.StringValue(va.String())
1932-
} else if t.String() == "global" {
1933-
cItem.WarningMessageThreshold = types.Int64Value(va.Int())
1935+
if true && cItem.PolicyType.ValueString() == "warning-only" {
1936+
if t := cv.Get("maxPrefixConfig.threshold.optionType"); t.Exists() {
1937+
va := cv.Get("maxPrefixConfig.threshold.value")
1938+
if t.String() == "variable" {
1939+
cItem.WarningMessageThresholdVariable = types.StringValue(va.String())
1940+
} else if t.String() == "global" {
1941+
cItem.WarningMessageThreshold = types.Int64Value(va.Int())
1942+
}
1943+
cItem.PolicyType = types.StringValue("warning-only")
19341944
}
1935-
cItem.PolicyType = types.StringValue("warning-only")
19361945
}
19371946
cItem.DisablePeerMaxNumberOfPrefixes = types.Int64Null()
19381947
cItem.DisablePeerMaxNumberOfPrefixesVariable = types.StringNull()
1939-
if t := cv.Get("maxPrefixConfig.prefixNum.optionType"); t.Exists() {
1940-
va := cv.Get("maxPrefixConfig.prefixNum.value")
1941-
if t.String() == "variable" {
1942-
cItem.DisablePeerMaxNumberOfPrefixesVariable = types.StringValue(va.String())
1943-
} else if t.String() == "global" {
1944-
cItem.DisablePeerMaxNumberOfPrefixes = types.Int64Value(va.Int())
1948+
if true && cItem.PolicyType.ValueString() == "disable-peer" {
1949+
if t := cv.Get("maxPrefixConfig.prefixNum.optionType"); t.Exists() {
1950+
va := cv.Get("maxPrefixConfig.prefixNum.value")
1951+
if t.String() == "variable" {
1952+
cItem.DisablePeerMaxNumberOfPrefixesVariable = types.StringValue(va.String())
1953+
} else if t.String() == "global" {
1954+
cItem.DisablePeerMaxNumberOfPrefixes = types.Int64Value(va.Int())
1955+
}
1956+
cItem.PolicyType = types.StringValue("disable-peer")
19451957
}
1946-
cItem.PolicyType = types.StringValue("disable-peer")
19471958
}
19481959
cItem.DisablePeerThreshold = types.Int64Null()
19491960
cItem.DisablePeerThresholdVariable = types.StringNull()
1950-
if t := cv.Get("maxPrefixConfig.threshold.optionType"); t.Exists() {
1951-
va := cv.Get("maxPrefixConfig.threshold.value")
1952-
if t.String() == "variable" {
1953-
cItem.DisablePeerThresholdVariable = types.StringValue(va.String())
1954-
} else if t.String() == "global" {
1955-
cItem.DisablePeerThreshold = types.Int64Value(va.Int())
1961+
if true && cItem.PolicyType.ValueString() == "disable-peer" {
1962+
if t := cv.Get("maxPrefixConfig.threshold.optionType"); t.Exists() {
1963+
va := cv.Get("maxPrefixConfig.threshold.value")
1964+
if t.String() == "variable" {
1965+
cItem.DisablePeerThresholdVariable = types.StringValue(va.String())
1966+
} else if t.String() == "global" {
1967+
cItem.DisablePeerThreshold = types.Int64Value(va.Int())
1968+
}
1969+
cItem.PolicyType = types.StringValue("disable-peer")
19561970
}
1957-
cItem.PolicyType = types.StringValue("disable-peer")
19581971
}
19591972
cItem.InRoutePolicyId = types.StringNull()
19601973

@@ -2460,9 +2473,6 @@ func (data *ServiceRoutingBGP) fromBody(ctx context.Context, res gjson.Result) {
24602473
}
24612474
}
24622475

2463-
// End of section. //template:end fromBody
2464-
2465-
// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
24662476
func (data *ServiceRoutingBGP) updateFromBody(ctx context.Context, res gjson.Result) {
24672477
data.Name = types.StringValue(res.Get("payload.name").String())
24682478
if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
@@ -2841,72 +2851,86 @@ func (data *ServiceRoutingBGP) updateFromBody(ctx context.Context, res gjson.Res
28412851
}
28422852
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartMaxNumberOfPrefixes = types.Int64Null()
28432853
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartMaxNumberOfPrefixesVariable = types.StringNull()
2844-
if t := cr.Get("maxPrefixConfig.prefixNum.optionType"); t.Exists() {
2845-
va := cr.Get("maxPrefixConfig.prefixNum.value")
2846-
if t.String() == "variable" {
2847-
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartMaxNumberOfPrefixesVariable = types.StringValue(va.String())
2848-
} else if t.String() == "global" {
2849-
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartMaxNumberOfPrefixes = types.Int64Value(va.Int())
2854+
if true && data.Ipv4Neighbors[i].AddressFamilies[ci].PolicyType.ValueString() == "restart" {
2855+
if t := cr.Get("maxPrefixConfig.prefixNum.optionType"); t.Exists() {
2856+
va := cr.Get("maxPrefixConfig.prefixNum.value")
2857+
if t.String() == "variable" {
2858+
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartMaxNumberOfPrefixesVariable = types.StringValue(va.String())
2859+
} else if t.String() == "global" {
2860+
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartMaxNumberOfPrefixes = types.Int64Value(va.Int())
2861+
}
28502862
}
28512863
}
28522864
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartThreshold = types.Int64Null()
28532865
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartThresholdVariable = types.StringNull()
2854-
if t := cr.Get("maxPrefixConfig.threshold.optionType"); t.Exists() {
2855-
va := cr.Get("maxPrefixConfig.threshold.value")
2856-
if t.String() == "variable" {
2857-
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartThresholdVariable = types.StringValue(va.String())
2858-
} else if t.String() == "global" {
2859-
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartThreshold = types.Int64Value(va.Int())
2866+
if true && data.Ipv4Neighbors[i].AddressFamilies[ci].PolicyType.ValueString() == "restart" {
2867+
if t := cr.Get("maxPrefixConfig.threshold.optionType"); t.Exists() {
2868+
va := cr.Get("maxPrefixConfig.threshold.value")
2869+
if t.String() == "variable" {
2870+
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartThresholdVariable = types.StringValue(va.String())
2871+
} else if t.String() == "global" {
2872+
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartThreshold = types.Int64Value(va.Int())
2873+
}
28602874
}
28612875
}
28622876
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartInterval = types.Int64Null()
28632877
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartIntervalVariable = types.StringNull()
2864-
if t := cr.Get("maxPrefixConfig.restartInterval.optionType"); t.Exists() {
2865-
va := cr.Get("maxPrefixConfig.restartInterval.value")
2866-
if t.String() == "variable" {
2867-
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartIntervalVariable = types.StringValue(va.String())
2868-
} else if t.String() == "global" {
2869-
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartInterval = types.Int64Value(va.Int())
2878+
if true && data.Ipv4Neighbors[i].AddressFamilies[ci].PolicyType.ValueString() == "restart" {
2879+
if t := cr.Get("maxPrefixConfig.restartInterval.optionType"); t.Exists() {
2880+
va := cr.Get("maxPrefixConfig.restartInterval.value")
2881+
if t.String() == "variable" {
2882+
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartIntervalVariable = types.StringValue(va.String())
2883+
} else if t.String() == "global" {
2884+
data.Ipv4Neighbors[i].AddressFamilies[ci].RestartInterval = types.Int64Value(va.Int())
2885+
}
28702886
}
28712887
}
28722888
data.Ipv4Neighbors[i].AddressFamilies[ci].WarningMessageMaxNumberOfPrefixes = types.Int64Null()
28732889
data.Ipv4Neighbors[i].AddressFamilies[ci].WarningMessageMaxNumberOfPrefixesVariable = types.StringNull()
2874-
if t := cr.Get("maxPrefixConfig.prefixNum.optionType"); t.Exists() {
2875-
va := cr.Get("maxPrefixConfig.prefixNum.value")
2876-
if t.String() == "variable" {
2877-
data.Ipv4Neighbors[i].AddressFamilies[ci].WarningMessageMaxNumberOfPrefixesVariable = types.StringValue(va.String())
2878-
} else if t.String() == "global" {
2879-
data.Ipv4Neighbors[i].AddressFamilies[ci].WarningMessageMaxNumberOfPrefixes = types.Int64Value(va.Int())
2890+
if true && data.Ipv4Neighbors[i].AddressFamilies[ci].PolicyType.ValueString() == "warning-only" {
2891+
if t := cr.Get("maxPrefixConfig.prefixNum.optionType"); t.Exists() {
2892+
va := cr.Get("maxPrefixConfig.prefixNum.value")
2893+
if t.String() == "variable" {
2894+
data.Ipv4Neighbors[i].AddressFamilies[ci].WarningMessageMaxNumberOfPrefixesVariable = types.StringValue(va.String())
2895+
} else if t.String() == "global" {
2896+
data.Ipv4Neighbors[i].AddressFamilies[ci].WarningMessageMaxNumberOfPrefixes = types.Int64Value(va.Int())
2897+
}
28802898
}
28812899
}
28822900
data.Ipv4Neighbors[i].AddressFamilies[ci].WarningMessageThreshold = types.Int64Null()
28832901
data.Ipv4Neighbors[i].AddressFamilies[ci].WarningMessageThresholdVariable = types.StringNull()
2884-
if t := cr.Get("maxPrefixConfig.threshold.optionType"); t.Exists() {
2885-
va := cr.Get("maxPrefixConfig.threshold.value")
2886-
if t.String() == "variable" {
2887-
data.Ipv4Neighbors[i].AddressFamilies[ci].WarningMessageThresholdVariable = types.StringValue(va.String())
2888-
} else if t.String() == "global" {
2889-
data.Ipv4Neighbors[i].AddressFamilies[ci].WarningMessageThreshold = types.Int64Value(va.Int())
2902+
if true && data.Ipv4Neighbors[i].AddressFamilies[ci].PolicyType.ValueString() == "warning-only" {
2903+
if t := cr.Get("maxPrefixConfig.threshold.optionType"); t.Exists() {
2904+
va := cr.Get("maxPrefixConfig.threshold.value")
2905+
if t.String() == "variable" {
2906+
data.Ipv4Neighbors[i].AddressFamilies[ci].WarningMessageThresholdVariable = types.StringValue(va.String())
2907+
} else if t.String() == "global" {
2908+
data.Ipv4Neighbors[i].AddressFamilies[ci].WarningMessageThreshold = types.Int64Value(va.Int())
2909+
}
28902910
}
28912911
}
28922912
data.Ipv4Neighbors[i].AddressFamilies[ci].DisablePeerMaxNumberOfPrefixes = types.Int64Null()
28932913
data.Ipv4Neighbors[i].AddressFamilies[ci].DisablePeerMaxNumberOfPrefixesVariable = types.StringNull()
2894-
if t := cr.Get("maxPrefixConfig.prefixNum.optionType"); t.Exists() {
2895-
va := cr.Get("maxPrefixConfig.prefixNum.value")
2896-
if t.String() == "variable" {
2897-
data.Ipv4Neighbors[i].AddressFamilies[ci].DisablePeerMaxNumberOfPrefixesVariable = types.StringValue(va.String())
2898-
} else if t.String() == "global" {
2899-
data.Ipv4Neighbors[i].AddressFamilies[ci].DisablePeerMaxNumberOfPrefixes = types.Int64Value(va.Int())
2914+
if true && data.Ipv4Neighbors[i].AddressFamilies[ci].PolicyType.ValueString() == "disable-peer" {
2915+
if t := cr.Get("maxPrefixConfig.prefixNum.optionType"); t.Exists() {
2916+
va := cr.Get("maxPrefixConfig.prefixNum.value")
2917+
if t.String() == "variable" {
2918+
data.Ipv4Neighbors[i].AddressFamilies[ci].DisablePeerMaxNumberOfPrefixesVariable = types.StringValue(va.String())
2919+
} else if t.String() == "global" {
2920+
data.Ipv4Neighbors[i].AddressFamilies[ci].DisablePeerMaxNumberOfPrefixes = types.Int64Value(va.Int())
2921+
}
29002922
}
29012923
}
29022924
data.Ipv4Neighbors[i].AddressFamilies[ci].DisablePeerThreshold = types.Int64Null()
29032925
data.Ipv4Neighbors[i].AddressFamilies[ci].DisablePeerThresholdVariable = types.StringNull()
2904-
if t := cr.Get("maxPrefixConfig.threshold.optionType"); t.Exists() {
2905-
va := cr.Get("maxPrefixConfig.threshold.value")
2906-
if t.String() == "variable" {
2907-
data.Ipv4Neighbors[i].AddressFamilies[ci].DisablePeerThresholdVariable = types.StringValue(va.String())
2908-
} else if t.String() == "global" {
2909-
data.Ipv4Neighbors[i].AddressFamilies[ci].DisablePeerThreshold = types.Int64Value(va.Int())
2926+
if true && data.Ipv4Neighbors[i].AddressFamilies[ci].PolicyType.ValueString() == "disable-peer" {
2927+
if t := cr.Get("maxPrefixConfig.threshold.optionType"); t.Exists() {
2928+
va := cr.Get("maxPrefixConfig.threshold.value")
2929+
if t.String() == "variable" {
2930+
data.Ipv4Neighbors[i].AddressFamilies[ci].DisablePeerThresholdVariable = types.StringValue(va.String())
2931+
} else if t.String() == "global" {
2932+
data.Ipv4Neighbors[i].AddressFamilies[ci].DisablePeerThreshold = types.Int64Value(va.Int())
2933+
}
29102934
}
29112935
}
29122936
data.Ipv4Neighbors[i].AddressFamilies[ci].InRoutePolicyId = types.StringNull()
@@ -3598,5 +3622,3 @@ func (data *ServiceRoutingBGP) updateFromBody(ctx context.Context, res gjson.Res
35983622
}
35993623
}
36003624
}
3601-
3602-
// End of section. //template:end updateFromBody

0 commit comments

Comments
 (0)