-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added config commands for CBF #1799
Changes from 3 commits
350f92a
dee37e8
9e6c82b
14bf170
0dad73c
f5aefb3
c39c228
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{%- include 'cbf_config.j2' %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no variables here to use a template. In any case the file here should be the one that will be used when generating the config using "sonic_cfggen" command. How will these entries be created in production switch. Is there going to be a new template or are you going to use the existing qos templates. eg: There should be a PR for those changes if not already there. Copy the same template (that's used in prod switches) here for testing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes there is a separate PR for the default CBF template config. It's been updated as well with the new config now found in the UTs too. |
||
"DSCP_TO_FC_MAP": { | ||
"default": { | ||
"0": "0" | ||
} | ||
}, | ||
"EXP_TO_FC_MAP": { | ||
"default": { | ||
"0": "0" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"DSCP_TO_FC_MAP": { | ||
"default": { | ||
"0": "0" | ||
} | ||
}, | ||
"EXP_TO_FC_MAP": { | ||
"default": { | ||
"0": "0" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
build_version: 'master.487-a98cf221' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. may be we can reuse the exsiting one.. CBF, QoS are close related anyway. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reused the qos one |
||
debian_version: '10.6' | ||
kernel_version: '4.19.0-9-2-amd64' | ||
asic_type: broadcom | ||
commit_id: 'a98cf221' | ||
build_date: Thu Nov 12 12:21:45 UTC 2020 | ||
build_number: 487 | ||
built_by: johnar@jenkins-worker-8 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,6 +129,46 @@ def teardown_class(cls): | |
print("TEARDOWN") | ||
|
||
|
||
class TestConfigCbf(object): | ||
@classmethod | ||
def setup_class(cls): | ||
print("SETUP") | ||
os.environ['UTILITIES_UNIT_TESTING'] = "2" | ||
import config.main | ||
importlib.reload(config.main) | ||
|
||
def test_cbf_reload_single( | ||
self, get_cmd_module, setup_cbf_mock_apis, | ||
setup_single_broadcom_asic | ||
): | ||
(config, show) = get_cmd_module | ||
runner = CliRunner() | ||
output_file = os.path.join(os.sep, "tmp", "cbf_config_output.json") | ||
print("Saving output in {}".format(output_file)) | ||
try: | ||
os.remove(output_file) | ||
except OSError: | ||
pass | ||
result = runner.invoke( | ||
config.config.commands["cbf"], | ||
["reload", "--dry_run", output_file] | ||
) | ||
print(result.exit_code) | ||
print(result.output) | ||
assert result.exit_code == 0 | ||
|
||
cwd = os.path.dirname(os.path.realpath(__file__)) | ||
expected_result = os.path.join( | ||
cwd, "cbf_config_input", "config_cbf.json" | ||
) | ||
assert filecmp.cmp(output_file, expected_result, shallow=False) | ||
|
||
@classmethod | ||
def teardown_class(cls): | ||
print("TEARDOWN") | ||
os.environ['UTILITIES_UNIT_TESTING'] = "0" | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this feature will be used in WAN there's a high chance it will be multi ASIC platform. Please add test case for multi ASIC as well. You already added the code to generate, just need to add test cases. It can be the same pattern as QoS tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added the multi asic UT |
||
class TestConfigQos(object): | ||
@classmethod | ||
def setup_class(cls): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elsewhere it's DSCP_TO_TC_MAP. Please update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other updates were incorrect. CBF has to have its own DSCP mapping, I've reverted the names to DSCP_TO_FC_MAP in the other occurrences too.