Specifies the script execution device number

Signed-off-by: wuliushuan <wuliushuan.30044128@huawei.com>
Change-Id: I5c5a39ffb1c4d0c4f8c27e1f2a303147ca96c000
This commit is contained in:
wuliushuan
2023-06-19 09:03:58 +00:00
parent 46e4187a88
commit 0ea8a46006
5 changed files with 74 additions and 8 deletions
@@ -1,3 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2023 Huawei Device Co., Ltd.
# 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.
import os
import sys
@@ -35,13 +48,13 @@ def whitelist_check(whitelist, acls):
raise
def main():
def main(sn):
set_log_content(LogLevel(2).name, log_tag,
'-------------------------- ACL check begin --------------------------')
try:
hdc_command(GENERATING_TOKEN_INFO_COMMAND)
hdc_command(DOWNLOAD_TOKEN_INFO_COMMAND)
hdc_command(CLEAR_TOKEN_INFO_FILE)
hdc_command(GENERATING_TOKEN_INFO_COMMAND.format(sn, TOKEN_INFO_URL))
hdc_command(DOWNLOAD_TOKEN_INFO_COMMAND.format(sn, TOKEN_INFO_URL, DOWNLOAD_TOKEN_INFO_URL))
hdc_command(CLEAR_TOKEN_INFO_FILE.format(sn, TOKEN_INFO_URL))
file = read_txt(DOWNLOAD_TOKEN_INFO_URL)
clear_token_info_txt(DOWNLOAD_TOKEN_INFO_URL)
acls_dict = check_and_get(file)
@@ -58,4 +71,5 @@ def main():
if __name__ == '__main__':
main()
sn = sys.argv[1]
main(sn)
@@ -1,3 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2023 Huawei Device Co., Ltd.
# 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.
import os
import platform
import time
@@ -15,10 +28,10 @@ TOKEN_INFO_NAME = 'token_info_{}.txt'.format(time.time_ns())
# 设备上生成文件存放位置
TOKEN_INFO_URL = '/data/{}'.format(TOKEN_INFO_NAME)
# 设备上文件生成命令
GENERATING_TOKEN_INFO_COMMAND = 'hdc shell atm dump -t > {}'.format(TOKEN_INFO_URL)
GENERATING_TOKEN_INFO_COMMAND = 'hdc -t {} shell atm dump -t > {}'
# 下载token info 文件存放路径
DOWNLOAD_TOKEN_INFO_URL = PATH + TOKEN_INFO_NAME
# 文件下载命令
DOWNLOAD_TOKEN_INFO_COMMAND = 'hdc file recv {} {}'.format(TOKEN_INFO_URL, DOWNLOAD_TOKEN_INFO_URL)
DOWNLOAD_TOKEN_INFO_COMMAND = 'hdc -t {} file recv {} {}'
# 删除设备上的文件命令
CLEAR_TOKEN_INFO_FILE = 'hdc shell rm -rf {}'.format(TOKEN_INFO_URL)
CLEAR_TOKEN_INFO_FILE = 'hdc -t {} shell rm -rf {}'
@@ -1,3 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2023 Huawei Device Co., Ltd.
# 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.
import os
import sys
@@ -1,3 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2023 Huawei Device Co., Ltd.
# 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.
import os
import sys
@@ -1,3 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2023 Huawei Device Co., Ltd.
# 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.
import enum
import logging
import os