mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Adding New Model onyx_qos for Configuring QoS on Onyx Switches (#55127)
* Adding New Model onyx_qos for Configuring QoS on Onyx Switches Signed-off-by: Anas Badaha <anasb@mellanox.com> * Fix Pep8 Failures in onyx_qos Signed-off-by: Anas Badaha <anasb@mellanox.com> * Fix Pep8 Failures phase 2 Signed-off-by: Anas Badaha <anasb@mellanox.com> * Fix Samer's Comments on onyx_qos Module Signed-off-by: Anas Badaha <anasb@mellanox.com> * Fix Shippable Comments Phase 3 Signed-off-by: Anas Badaha <anasb@mellanox.com> * Fix Current Version 2.9 Signed-off-by: Anas Badaha <anasb@mellanox.com>
This commit is contained in:
committed by
Ganesh Nalawade
parent
576593e175
commit
5a7bce1f8d
@@ -0,0 +1,134 @@
|
||||
[
|
||||
{
|
||||
"Eth1/1": [
|
||||
{
|
||||
"PCP,DEI rewrite": "enabled",
|
||||
"Default switch-priority": "0",
|
||||
"IP PCP;DEI rewrite": "enable",
|
||||
"Default DEI": "0",
|
||||
"Default PCP": "0",
|
||||
"Trust mode": "both",
|
||||
"DSCP rewrite": "disabled"
|
||||
},
|
||||
{
|
||||
"PCP(DEI); DSCP to switch-priority mapping": [
|
||||
{
|
||||
"2(0) 2(1)": [
|
||||
{
|
||||
"switch-priority": "2",
|
||||
"DSCP": "16 17 18 19 20 21 22 23"
|
||||
}
|
||||
],
|
||||
"3(0) 3(1)": [
|
||||
{
|
||||
"switch-priority": "3",
|
||||
"DSCP": "24 25 26 27 28 29 30 31"
|
||||
}
|
||||
],
|
||||
"5(0) 5(1)": [
|
||||
{
|
||||
"switch-priority": "5",
|
||||
"DSCP": "40 41 42 43 44 45 46 47"
|
||||
}
|
||||
],
|
||||
"0(0) 0(1)": [
|
||||
{
|
||||
"switch-priority": "0",
|
||||
"DSCP": "0 1 2 3 4 5 6 7"
|
||||
}
|
||||
],
|
||||
"7(0) 7(1)": [
|
||||
{
|
||||
"switch-priority": "7",
|
||||
"DSCP": "56 57 58 59 60 61 62 63"
|
||||
}
|
||||
],
|
||||
"4(0) 4(1)": [
|
||||
{
|
||||
"switch-priority": "4",
|
||||
"DSCP": "32 33 34 35 36 37 38 39"
|
||||
}
|
||||
],
|
||||
"6(0) 6(1)": [
|
||||
{
|
||||
"switch-priority": "6",
|
||||
"DSCP": "48 49 50 51 52 53 54 55"
|
||||
}
|
||||
],
|
||||
"1(0) 1(1)": [
|
||||
{
|
||||
"switch-priority": "1",
|
||||
"DSCP": "8 9 10 11 12 13 14 15"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"PCP(DEI); DSCP rewrite mapping (switch-priority to PCP(DEI); DSCP; traffic-class)": [
|
||||
{
|
||||
"Egress Interface": "Eth1/1"
|
||||
},
|
||||
{
|
||||
"1": [
|
||||
{
|
||||
"PCP(DEI)": "1(0)",
|
||||
"TC": "1",
|
||||
"DSCP": "8"
|
||||
}
|
||||
],
|
||||
"0": [
|
||||
{
|
||||
"PCP(DEI)": "0(0)",
|
||||
"TC": "0",
|
||||
"DSCP": "0"
|
||||
}
|
||||
],
|
||||
"3": [
|
||||
{
|
||||
"PCP(DEI)": "3(0)",
|
||||
"TC": "3",
|
||||
"DSCP": "24"
|
||||
}
|
||||
],
|
||||
"2": [
|
||||
{
|
||||
"PCP(DEI)": "2(0)",
|
||||
"TC": "2",
|
||||
"DSCP": "16"
|
||||
}
|
||||
],
|
||||
"5": [
|
||||
{
|
||||
"PCP(DEI)": "5(0)",
|
||||
"TC": "5",
|
||||
"DSCP": "40"
|
||||
}
|
||||
],
|
||||
"4": [
|
||||
{
|
||||
"PCP(DEI)": "4(0)",
|
||||
"TC": "4",
|
||||
"DSCP": "32"
|
||||
}
|
||||
],
|
||||
"7": [
|
||||
{
|
||||
"PCP(DEI)": "7(0)",
|
||||
"TC": "7",
|
||||
"DSCP": "56"
|
||||
}
|
||||
],
|
||||
"6": [
|
||||
{
|
||||
"PCP(DEI)": "6(0)",
|
||||
"TC": "6",
|
||||
"DSCP": "48"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
52
test/units/modules/network/onyx/test_onyx_qos.py
Normal file
52
test/units/modules/network/onyx/test_onyx_qos.py
Normal file
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# Copyright: Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from units.compat.mock import patch
|
||||
from ansible.modules.network.onyx import onyx_qos
|
||||
from units.modules.utils import set_module_args
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
|
||||
|
||||
class TestOnyxQosModule(TestOnyxModule):
|
||||
|
||||
module = onyx_qos
|
||||
|
||||
def setUp(self):
|
||||
super(TestOnyxQosModule, self).setUp()
|
||||
self.mock_get_if_qos_config = patch.object(
|
||||
onyx_qos.OnyxQosModule, "_show_interface_qos")
|
||||
self.get_if_qos_config = self.mock_get_if_qos_config.start()
|
||||
|
||||
self.mock_load_config = patch(
|
||||
'ansible.module_utils.network.onyx.onyx.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestOnyxQosModule, self).tearDown()
|
||||
self.mock_get_if_qos_config.stop()
|
||||
self.mock_load_config.stop()
|
||||
|
||||
def load_fixtures(self, commands=None, transport='cli'):
|
||||
qos_interface_ethernet_config_file = 'show_qos_interface_ethernet.cfg'
|
||||
qos_interface_ethernet_data = load_fixture(qos_interface_ethernet_config_file)
|
||||
self.get_if_qos_config.return_value = qos_interface_ethernet_data
|
||||
self.load_config.return_value = None
|
||||
|
||||
def test_qos_interface_ethernet_no_change(self):
|
||||
set_module_args(dict(interfaces=["Eth1/1"], trust="both", rewrite_pcp="enabled",
|
||||
rewrite_dscp="disabled"))
|
||||
self.execute_module(changed=False)
|
||||
|
||||
def test_qos_interface_ethernet_with_change(self):
|
||||
set_module_args(dict(interfaces=["Eth1/1"], trust="L2", rewrite_pcp="disabled",
|
||||
rewrite_dscp="enabled"))
|
||||
commands = ["interface ethernet 1/1 no qos rewrite pcp",
|
||||
"interface ethernet 1/1 qos trust L2",
|
||||
"interface ethernet 1/1 qos rewrite dscp"
|
||||
]
|
||||
self.execute_module(changed=True, commands=commands)
|
||||
Reference in New Issue
Block a user