-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SAI-PTF]Add platform helper for saiswitch test and refactor saiswitch (
#1445) * [SAI-PTF]Add platform helper for saiswitch test and refactor saiswitch Make the sai test on different platforms can use their own helpers for making some platform related settings. - Register the helper in the common_sai_helper - Override the helper in the platfrom helper as needed - Use the method from the helper for platform related settings - Platform choice the helper and its helper method from the corresponding platform - refactor the test from method to class Signed-off-by: richardyu-ms <[email protected]> * run switch tests and enable it in warmboot Signed-off-by: richardyu-ms <[email protected]> * remove duplicated cases Signed-off-by: richardyu-ms <[email protected]> * compatiable with v1, gSwichId and switch_id share the addredd Signed-off-by: richardyu-ms <[email protected]>
- Loading branch information
1 parent
c460675
commit 356e705
Showing
15 changed files
with
331 additions
and
87 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright (c) 2022 Microsoft Open Technologies, Inc. | ||
# | ||
# 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 | ||
# | ||
# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR | ||
# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT | ||
# LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS | ||
# FOR A PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT. | ||
# | ||
# See the Apache Version 2.0 License for specific language governing | ||
# permissions and limitations under the License. | ||
# | ||
# Microsoft would like to thank the following companies for their review and | ||
# assistance with these files: Intel Corporation, Mellanox Technologies Ltd, | ||
# Dell Products, L.P., Facebook, Inc., Marvell International Ltd. | ||
# | ||
# @file __init__.py | ||
# | ||
# @brief init | ||
# | ||
|
||
""" | ||
Init the platform helper module. | ||
platform_helper module contains classes to distiguish the different behivor on different platforms. | ||
""" |
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,40 @@ | ||
# Copyright (c) 2022 Microsoft Open Technologies, Inc. | ||
# | ||
# 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 | ||
# | ||
# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR | ||
# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT | ||
# LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS | ||
# FOR A PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT. | ||
# | ||
# See the Apache Version 2.0 License for specific language governing | ||
# permissions and limitations under the License. | ||
# | ||
# Microsoft would like to thank the following companies for their review and | ||
# assistance with these files: Intel Corporation, Mellanox Technologies Ltd, | ||
# Dell Products, L.P., Facebook, Inc., Marvell International Ltd. | ||
|
||
|
||
from platform_helper.common_helper.saiswitch_helper import * | ||
from sai_base_test import * # pylint: disable=wildcard-import; lgtm[py/polluting-import] | ||
|
||
""" | ||
Brcm sai switch helper for sai switch tests. | ||
""" | ||
|
||
class BrcmSaiSwitchHelper(SaiSwitchHelper): | ||
|
||
def create_route_entry_from_default_vrf(self, client): | ||
print("BrcmSaiSwitchHelper::create_route_entry_from_default_vrf.") | ||
route_entry = sai_thrift_route_entry_t( | ||
switch_id=client.switch_id, | ||
vr_id = client.default_vrf, | ||
destination=sai_ipprefix('0.0.0.0/0')) | ||
status = sai_thrift_create_route_entry( | ||
client.client, route_entry, next_hop_id=client.nhop) | ||
client.assertEqual(status, SAI_STATUS_SUCCESS) | ||
# Cause we add a route here, we need to increase the route_number | ||
if hasattr(client, 'route_number'): | ||
client.route_number += 1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright (c) 2022 Microsoft Open Technologies, Inc. | ||
# | ||
# 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 | ||
# | ||
# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR | ||
# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT | ||
# LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS | ||
# FOR A PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT. | ||
# | ||
# See the Apache Version 2.0 License for specific language governing | ||
# permissions and limitations under the License. | ||
# | ||
# Microsoft would like to thank the following companies for their review and | ||
# assistance with these files: Intel Corporation, Mellanox Technologies Ltd, | ||
# Dell Products, L.P., Facebook, Inc., Marvell International Ltd. | ||
# | ||
# @file __init__.py | ||
# | ||
# @brief init | ||
# | ||
|
||
""" | ||
Init the platform helper module. | ||
platform_helper module contains classes to distiguish the different behivor on different platforms. | ||
""" |
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,29 @@ | ||
# Copyright (c) 2022 Microsoft Open Technologies, Inc. | ||
# | ||
# 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 | ||
# | ||
# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR | ||
# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT | ||
# LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS | ||
# FOR A PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT. | ||
# | ||
# See the Apache Version 2.0 License for specific language governing | ||
# permissions and limitations under the License. | ||
# | ||
# Microsoft would like to thank the following companies for their review and | ||
# assistance with these files: Intel Corporation, Mellanox Technologies Ltd, | ||
# Dell Products, L.P., Facebook, Inc., Marvell International Ltd. | ||
|
||
""" | ||
Common sai switch helper for sai switch tests. | ||
""" | ||
|
||
class SaiSwitchHelper: | ||
""" | ||
Common sai switch helper for sai switch tests. | ||
""" | ||
|
||
def create_route_entry_from_default_vrf(self, client, nhop): | ||
print("SaiSwitchHelper::create_route_entry_from_default_vrf.") |
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
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.