-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Azure:master' into config_validate
- Loading branch information
Showing
19 changed files
with
681 additions
and
9 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
"""Show techsupport command handler""" | ||
|
||
import host_service | ||
import subprocess | ||
import re | ||
|
||
MOD_NAME = 'showtech' | ||
|
||
class Showtech(host_service.HostModule): | ||
"""DBus endpoint that executes the "show techsupport" command | ||
""" | ||
@host_service.method(host_service.bus_name(MOD_NAME), in_signature='s', out_signature='is') | ||
def info(self, date): | ||
|
||
ERROR_TAR_FAILED = 5 | ||
ERROR_PROCFS_SAVE_FAILED = 6 | ||
ERROR_INVALID_ARGUMENT = 10 | ||
|
||
err_dict = {ERROR_INVALID_ARGUMENT: 'Invalid input: Incorrect DateTime format', | ||
ERROR_TAR_FAILED: 'Failure saving information into compressed output file', | ||
ERROR_PROCFS_SAVE_FAILED: 'Saving of process information failed'} | ||
|
||
cmd = ['/usr/local/bin/generate_dump'] | ||
if date: | ||
cmd.append("-s") | ||
cmd.append(date) | ||
|
||
try: | ||
result = subprocess.run(cmd, capture_output=True, text=True, | ||
check=True) | ||
|
||
except subprocess.CalledProcessError as err: | ||
errmsg = err_dict.get(err.returncode) | ||
|
||
if errmsg is None: | ||
output = 'Error: Failure code {:-5}'.format(err.returncode) | ||
else: | ||
output = errmsg | ||
|
||
print("%Error: Host side: Failed: " + str(err.returncode)) | ||
return err.returncode, output | ||
|
||
output_file_match = re.search('\/var\/.*dump.*\.gz', result.stdout) | ||
output_filename = output_file_match.group() | ||
return result.returncode, output_filename | ||
|
||
def register(): | ||
"""Return the class name""" | ||
return Showtech, MOD_NAME | ||
|
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
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
29 changes: 29 additions & 0 deletions
29
src/sonic-yang-models/tests/yang_model_tests/tests/vlan_sub_interface.json
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 @@ | ||
{ | ||
"VLAN_SUB_INTERFACE_MUST_CONDITION_TRUE_TEST": { | ||
"desc": "Configure valid vlan sub interface must condition true." | ||
}, | ||
"VLAN_SUB_INTERFACE_MUST_CONDITION_FALSE_TEST": { | ||
"desc": "Configure vlan sub interface must condition false.", | ||
"eStrKey": "Must" | ||
}, | ||
"VLAN_SUB_INTERFACE_IP_PREFIX_PORT_NON_EXISTING_LEAF_TEST": { | ||
"desc": "Configure ip prefix vlan sub interface with non-existing reference.", | ||
"eStrKey": "LeafRef" | ||
}, | ||
"VLAN_SUB_INTERFACE_INVALID_VLAN_ID_TEST": { | ||
"desc": "Configure vlan sub interface with invalid vlan id.", | ||
"eStrKey": "Pattern" | ||
}, | ||
"VLAN_SUB_INTERFACE_INVALID_VLAN_ID_WITH_LEADING_ZERO_TEST": { | ||
"desc": "Configure vlan sub interface with invalid vlan id with leading zeros.", | ||
"eStrKey": "Pattern" | ||
}, | ||
"VLAN_SUB_INTERFACE_IP_PREFIX_EMPTY_STRING_TEST": { | ||
"desc": "Configure ip prefix vlan sub interface with empty ip prefx.", | ||
"eStrKey": "InvalidValue" | ||
}, | ||
"VLAN_SUB_INTERFACE_INVALID_NAME_TEST": { | ||
"desc": "Configure invalid vlan sub interface name with no separator.", | ||
"eStrKey": "Pattern" | ||
} | ||
} |
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.