forked from openconfig/featureprofiles
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RT-1.27: fixed failed tests (openconfig#3613)
* intial code * defined deviations * updated deviation usage * taken care of comments, also changed static route replace to update to preserve base routes * added default bgp instance name in metadata file * Update internal/cfgplugins/bgp_policy.go function description change Co-authored-by: Darren Loher <dloher@google.com> * Update internal/cfgplugins/bgp_policy.go function description change 2 Co-authored-by: Darren Loher <dloher@google.com> * added bug info to the deviations --------- Co-authored-by: Darren Loher <dloher@google.com> Co-authored-by: Ram <rmachat@google.com>
- Loading branch information
Showing
7 changed files
with
1,463 additions
and
1,132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
240 changes: 167 additions & 73 deletions
240
...on/otg_tests/static_route_bgp_redistribution_test/static_route_bgp_redistribution_test.go
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package cfgplugins | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/openconfig/featureprofiles/internal/helpers" | ||
"github.com/openconfig/ondatra" | ||
) | ||
|
||
// DeviationCiscoRoutingPolicyBGPActionSetCommunity is used as an alternative to | ||
// /routing-policy/policy-definitions/policy-definition/statements/statement/actions/bgp-actions/config/set-med. | ||
// This deviation implements CLI to perform the equivalent function. | ||
func DeviationCiscoRoutingPolicyBGPActionSetMed(t *testing.T, dut *ondatra.DUTDevice, policyName string, statement string, prefixSetName string, setMed int, origin string) { | ||
//route-policy route-policy-v4 | ||
// #statement-name statement-v4 | ||
// if destination in prefix-set-v4 then | ||
// set med 104 | ||
// set origin igp | ||
// endif | ||
// end-policy | ||
cliConfig := fmt.Sprintf("route-policy %s\n #statement-name %v\n if destination in %v then\n", policyName, statement, prefixSetName) | ||
|
||
if setMed != 0 { | ||
cliConfig += fmt.Sprintf(" set med %d\n", setMed) | ||
} | ||
if origin != "" { | ||
cliConfig += fmt.Sprintf(" set origin %v\n", origin) | ||
} | ||
cliConfig += " done\n endif\nend-policy\n" | ||
helpers.GnmiCLIConfig(t, dut, cliConfig) | ||
} | ||
|
||
// DeviationCiscoRoutingPolicyBGPActionSetCommunity is used as an alternative to | ||
// /routing-policy/policy-definitions/policy-definition/statements/statement/actions/bgp-actions/set-community | ||
// This deviation implements CLI to perform the equivalent function. | ||
func DeviationCiscoRoutingPolicyBGPActionSetCommunity(t *testing.T, dut *ondatra.DUTDevice, policyName string, statement string, community string) { | ||
// route-policy route-policy-v4 | ||
// #statement-name statement-v4 | ||
// set community community-set-v4 | ||
// done | ||
// end-policy | ||
cliConfig := fmt.Sprintf("route-policy %s\n #statement-name %v\n", policyName, statement) | ||
if community != "" { | ||
cliConfig += fmt.Sprintf(" set community %v\n", community) | ||
} | ||
cliConfig += " done\nend-policy\n" | ||
helpers.GnmiCLIConfig(t, dut, cliConfig) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package cfgplugins | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/openconfig/featureprofiles/internal/helpers" | ||
"github.com/openconfig/ondatra" | ||
) | ||
|
||
// DeviationCiscoTableConnectionsStatictoBGPMetricPropagation is used as an alternative to | ||
// /network-instances/network-instance/table-connections/table-connection/config/disable-metric-propagation. | ||
// In OC this path is set to 'false' by default, therefore enabling table-connections to propagate metrics | ||
// from one protocol to another. This deviation implements CLI to perform the equivalent function. | ||
func DeviationCiscoTableConnectionsStatictoBGPMetricPropagation(t *testing.T, dut *ondatra.DUTDevice, isV4 bool, metric int, routePolicyName string) { | ||
// router bgp 64512 | ||
// | ||
// address-family ipv4 unicast | ||
// redistribute static metric 104 | ||
// ! | ||
// address-family ipv6 unicast | ||
// redistribute static metric 106 | ||
var aftype string | ||
if isV4 { | ||
aftype = "ipv4" | ||
} else { | ||
aftype = "ipv6" | ||
} | ||
cliConfig := fmt.Sprintf("router bgp 64512\n address-family %v unicast\n redistribute static metric %d\n !\n!\n", aftype, metric) | ||
if routePolicyName != "" { | ||
cliConfig = fmt.Sprintf("router bgp 64512\n address-family %v unicast\n redistribute static metric %d route-policy %s\n !\n!\n", aftype, metric, routePolicyName) | ||
} | ||
helpers.GnmiCLIConfig(t, dut, cliConfig) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.