This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
lijia-tsg-oam/py_module_test/py_common_module_dploy_test.py
lijia b5f320eb9c 调用不了logging的诡异问题;
杀不掉tfe进程是因为有其他类似进程也叫tfexxxx, 所以要用:ps -afx |grep tfe$, 以tfe结尾的.
2019-08-19 21:16:53 +08:00

42 lines
1.2 KiB
Python

#coding=utf-8
import os
import sys
import syslog
import subprocess
import time
import re
import logging
import logging.handlers
from sys import path
path.append(r'../py_common') #将存放module的路径添加进来
path.append(r'./py_common') #将存放module的路径添加进来
from common_system_cmd import *
from common_logger import *
from common_json import *
from common_modules_deploy import *
# coding: utf-8
#此文件定义四块计算板分别运行什么模块
#先根据tsg_chassis_ip.json, 根据当前设备的ip地址, 知道当前设备的sled名称
#然后根据设备类型名称, 找到当前运行的所有模块(应用)名称
#然后根据模块名称, 到common_modules_operator.json查找每个模块的操作方法
#{
# "modules_deploy": {
# "mcn0": ["kni", "a.out"],
# "mcn1": ["tfe", "a1.out"],
# "mcn2": ["tfe", "a2.out"],
# "mcn3": ["tfe", "a3.out"]
# }
#}
if __name__ == '__main__':
global logger
logger = logger_init(10)
sled_name = "mcnx"
module_list = tsg_get_local_sled_modules(sled_name)
if len(module_list) > 0:
print("sled %s run module %s" %(sled_name, module_list))
else:
print("can't get sled %s run module!")