openubmc-bingo 0.5.240__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of openubmc-bingo might be problematic. Click here for more details.
- bmcgo/__init__.py +12 -0
- bmcgo/bmcgo.py +22 -0
- bmcgo/bmcgo_config.py +176 -0
- bmcgo/cli/__init__.py +10 -0
- bmcgo/cli/cli.py +584 -0
- bmcgo/codegen/__init__.py +14 -0
- bmcgo/codegen/c/__init__.py +9 -0
- bmcgo/codegen/c/annotation.py +52 -0
- bmcgo/codegen/c/argument.py +42 -0
- bmcgo/codegen/c/codegen.py +153 -0
- bmcgo/codegen/c/comment.py +22 -0
- bmcgo/codegen/c/ctype_defination.py +353 -0
- bmcgo/codegen/c/helper.py +87 -0
- bmcgo/codegen/c/interface.py +63 -0
- bmcgo/codegen/c/method.py +82 -0
- bmcgo/codegen/c/property.py +180 -0
- bmcgo/codegen/c/renderer.py +21 -0
- bmcgo/codegen/c/signal.py +64 -0
- bmcgo/codegen/c/template/client.c.mako +145 -0
- bmcgo/codegen/c/template/client.h.mako +36 -0
- bmcgo/codegen/c/template/interface.c.mako +0 -0
- bmcgo/codegen/c/template/interface.introspect.xml.mako +99 -0
- bmcgo/codegen/c/template/micro_component.c.mako +32 -0
- bmcgo/codegen/c/template/public.c.mako +228 -0
- bmcgo/codegen/c/template/public.h.mako +128 -0
- bmcgo/codegen/c/template/server.c.mako +104 -0
- bmcgo/codegen/c/template/server.h.mako +36 -0
- bmcgo/codegen/lua/.lua-format +7 -0
- bmcgo/codegen/lua/Makefile +101 -0
- bmcgo/codegen/lua/__init__.py +9 -0
- bmcgo/codegen/lua/codegen.py +171 -0
- bmcgo/codegen/lua/proto/Makefile +87 -0
- bmcgo/codegen/lua/proto/ipmi_types.proto +17 -0
- bmcgo/codegen/lua/proto/types.proto +52 -0
- bmcgo/codegen/lua/script/check_intfs.py +161 -0
- bmcgo/codegen/lua/script/dto/__init__.py +11 -0
- bmcgo/codegen/lua/script/dto/exception.py +53 -0
- bmcgo/codegen/lua/script/dto/kepler_abstract.py +47 -0
- bmcgo/codegen/lua/script/dto/options.py +33 -0
- bmcgo/codegen/lua/script/dto/print_simple.py +19 -0
- bmcgo/codegen/lua/script/dto/redfish_api.py +241 -0
- bmcgo/codegen/lua/script/dto/url_route.py +195 -0
- bmcgo/codegen/lua/script/gen_db_json.py +444 -0
- bmcgo/codegen/lua/script/gen_depends.py +89 -0
- bmcgo/codegen/lua/script/gen_entry.py +263 -0
- bmcgo/codegen/lua/script/gen_feature_json.py +156 -0
- bmcgo/codegen/lua/script/gen_historical_local_db_json.py +88 -0
- bmcgo/codegen/lua/script/gen_intf_json.py +261 -0
- bmcgo/codegen/lua/script/gen_intf_rpc_json.py +575 -0
- bmcgo/codegen/lua/script/gen_ipmi_json.py +485 -0
- bmcgo/codegen/lua/script/gen_mdb_json.py +117 -0
- bmcgo/codegen/lua/script/gen_rpc_msg_json.py +487 -0
- bmcgo/codegen/lua/script/gen_schema.py +302 -0
- bmcgo/codegen/lua/script/ipmi_types_pb2.py +135 -0
- bmcgo/codegen/lua/script/loader/__init__.py +11 -0
- bmcgo/codegen/lua/script/loader/file_utils.py +33 -0
- bmcgo/codegen/lua/script/loader/kepler_abstract_collect.py +79 -0
- bmcgo/codegen/lua/script/loader/kepler_abstract_loader.py +47 -0
- bmcgo/codegen/lua/script/loader/redfish_loader.py +127 -0
- bmcgo/codegen/lua/script/lua_format.py +62 -0
- bmcgo/codegen/lua/script/mds_util.py +385 -0
- bmcgo/codegen/lua/script/merge_model.py +330 -0
- bmcgo/codegen/lua/script/merge_proto_algo.py +85 -0
- bmcgo/codegen/lua/script/proto_loader.py +47 -0
- bmcgo/codegen/lua/script/proto_plugin.py +140 -0
- bmcgo/codegen/lua/script/redfish_source_tree.py +118 -0
- bmcgo/codegen/lua/script/render_utils/__init__.py +38 -0
- bmcgo/codegen/lua/script/render_utils/base.py +25 -0
- bmcgo/codegen/lua/script/render_utils/client_lua.py +98 -0
- bmcgo/codegen/lua/script/render_utils/controller_lua.py +71 -0
- bmcgo/codegen/lua/script/render_utils/db_lua.py +224 -0
- bmcgo/codegen/lua/script/render_utils/error_lua.py +185 -0
- bmcgo/codegen/lua/script/render_utils/factory.py +52 -0
- bmcgo/codegen/lua/script/render_utils/ipmi_lua.py +159 -0
- bmcgo/codegen/lua/script/render_utils/ipmi_message_lua.py +24 -0
- bmcgo/codegen/lua/script/render_utils/mdb_lua.py +177 -0
- bmcgo/codegen/lua/script/render_utils/mdb_register.py +215 -0
- bmcgo/codegen/lua/script/render_utils/message_lua.py +26 -0
- bmcgo/codegen/lua/script/render_utils/messages_lua.py +156 -0
- bmcgo/codegen/lua/script/render_utils/model_lua.py +485 -0
- bmcgo/codegen/lua/script/render_utils/old_model_lua.py +429 -0
- bmcgo/codegen/lua/script/render_utils/plugin_lua.py +38 -0
- bmcgo/codegen/lua/script/render_utils/redfish_proto.py +86 -0
- bmcgo/codegen/lua/script/render_utils/request_lua.py +76 -0
- bmcgo/codegen/lua/script/render_utils/service_lua.py +130 -0
- bmcgo/codegen/lua/script/render_utils/utils_message_lua.py +125 -0
- bmcgo/codegen/lua/script/render_utils/validate_lua.py +221 -0
- bmcgo/codegen/lua/script/sep_ipmi_message_cmds.py +217 -0
- bmcgo/codegen/lua/script/template.py +166 -0
- bmcgo/codegen/lua/script/types_pb2.py +516 -0
- bmcgo/codegen/lua/script/utils.py +663 -0
- bmcgo/codegen/lua/script/validate.py +80 -0
- bmcgo/codegen/lua/script/yaml_to_json.py +73 -0
- bmcgo/codegen/lua/templates/Makefile +114 -0
- bmcgo/codegen/lua/templates/apps/Makefile +261 -0
- bmcgo/codegen/lua/templates/apps/Makefile.mdb.mk +64 -0
- bmcgo/codegen/lua/templates/apps/app.lua.mako +19 -0
- bmcgo/codegen/lua/templates/apps/class.lua.mako +35 -0
- bmcgo/codegen/lua/templates/apps/client.lua.mako +429 -0
- bmcgo/codegen/lua/templates/apps/controller.lua.mako +276 -0
- bmcgo/codegen/lua/templates/apps/datas.lua.mako +8 -0
- bmcgo/codegen/lua/templates/apps/db.lua.mako +89 -0
- bmcgo/codegen/lua/templates/apps/entry.lua.mako +128 -0
- bmcgo/codegen/lua/templates/apps/feature.lua.mako +37 -0
- bmcgo/codegen/lua/templates/apps/generate_route.mako +25 -0
- bmcgo/codegen/lua/templates/apps/impl_feature.lua.mako +72 -0
- bmcgo/codegen/lua/templates/apps/ipmi.lua.mako +97 -0
- bmcgo/codegen/lua/templates/apps/ipmi_cmd.lua.mako +18 -0
- bmcgo/codegen/lua/templates/apps/ipmi_message.lua.mako +36 -0
- bmcgo/codegen/lua/templates/apps/local_db.lua.mako +263 -0
- bmcgo/codegen/lua/templates/apps/main.lua.mako +25 -0
- bmcgo/codegen/lua/templates/apps/mc.lua.mako +77 -0
- bmcgo/codegen/lua/templates/apps/mdb.lua.mako +45 -0
- bmcgo/codegen/lua/templates/apps/mdb_interface.lua.mako +73 -0
- bmcgo/codegen/lua/templates/apps/message.lua.mako +38 -0
- bmcgo/codegen/lua/templates/apps/model.lua.mako +239 -0
- bmcgo/codegen/lua/templates/apps/orm_classes.lua.mako +16 -0
- bmcgo/codegen/lua/templates/apps/plugin.lua.mako +8 -0
- bmcgo/codegen/lua/templates/apps/redfish.proto.mako +47 -0
- bmcgo/codegen/lua/templates/apps/service.lua.mako +440 -0
- bmcgo/codegen/lua/templates/apps/signal_listen.lua.mako +19 -0
- bmcgo/codegen/lua/templates/apps/utils/default_intf.lua.mako +41 -0
- bmcgo/codegen/lua/templates/apps/utils/enum.mako +10 -0
- bmcgo/codegen/lua/templates/apps/utils/imports.mako +13 -0
- bmcgo/codegen/lua/templates/apps/utils/mdb_intf.lua.mako +25 -0
- bmcgo/codegen/lua/templates/apps/utils/mdb_obj.lua.mako +23 -0
- bmcgo/codegen/lua/templates/apps/utils/message.mako +160 -0
- bmcgo/codegen/lua/templates/apps/utils/request.lua.mako +59 -0
- bmcgo/codegen/lua/templates/apps/utils/validate.mako +83 -0
- bmcgo/codegen/lua/templates/errors.lua.mako +36 -0
- bmcgo/codegen/lua/templates/messages.lua.mako +32 -0
- bmcgo/codegen/lua/templates/new_app/.clang-format.mako +170 -0
- bmcgo/codegen/lua/templates/new_app/.gitignore.mako +26 -0
- bmcgo/codegen/lua/templates/new_app/CHANGELOG.md.mako +0 -0
- bmcgo/codegen/lua/templates/new_app/CMakeLists.txt.mako +29 -0
- bmcgo/codegen/lua/templates/new_app/Makefile.mako +25 -0
- bmcgo/codegen/lua/templates/new_app/README.md.mako +0 -0
- bmcgo/codegen/lua/templates/new_app/conanfile.py.mako +7 -0
- bmcgo/codegen/lua/templates/new_app/config.cfg.mako +6 -0
- bmcgo/codegen/lua/templates/new_app/mds/model.json.mako +3 -0
- bmcgo/codegen/lua/templates/new_app/mds/service.json.mako +21 -0
- bmcgo/codegen/lua/templates/new_app/permissions.ini.mako +16 -0
- bmcgo/codegen/lua/templates/new_app/src/lualib/${project_name}_app.lua.mako +16 -0
- bmcgo/codegen/lua/templates/new_app/src/service/main.lua.mako +25 -0
- bmcgo/codegen/lua/templates/new_app/test/integration/test_${project_name}.conf.mako +9 -0
- bmcgo/codegen/lua/templates/new_app/test/integration/test_${project_name}.lua.mako +47 -0
- bmcgo/codegen/lua/templates/new_app/test/unit/test.lua.mako +23 -0
- bmcgo/codegen/lua/templates/new_app/user_conf/rootfs/etc/systemd/system/${project_name}.service.mako +18 -0
- bmcgo/codegen/lua/templates/new_app/user_conf/rootfs/etc/systemd/system/multi-user.target.wants/${project_name}.service.link +1 -0
- bmcgo/component/__init__.py +10 -0
- bmcgo/component/analysis/analysis.py +183 -0
- bmcgo/component/analysis/build_deps.py +165 -0
- bmcgo/component/analysis/data_deps.py +333 -0
- bmcgo/component/analysis/dep-rules.json +912 -0
- bmcgo/component/analysis/dep_node.py +110 -0
- bmcgo/component/analysis/intf_deps.py +163 -0
- bmcgo/component/analysis/intf_validation.py +254 -0
- bmcgo/component/analysis/rule.py +211 -0
- bmcgo/component/analysis/smc_dfx_whitelist.json +11 -0
- bmcgo/component/analysis/sr_validation.py +391 -0
- bmcgo/component/build.py +222 -0
- bmcgo/component/component_dt_version_parse.py +348 -0
- bmcgo/component/component_helper.py +114 -0
- bmcgo/component/coverage/__init__.py +11 -0
- bmcgo/component/coverage/c_incremental_cov_report.template +53 -0
- bmcgo/component/coverage/incremental_cov.py +464 -0
- bmcgo/component/deploy.py +110 -0
- bmcgo/component/gen.py +169 -0
- bmcgo/component/package_info.py +236 -0
- bmcgo/component/template/conanbase.py.mako +278 -0
- bmcgo/component/template/conanfile.deploy.py.mako +40 -0
- bmcgo/component/test.py +947 -0
- bmcgo/errors.py +119 -0
- bmcgo/frame.py +217 -0
- bmcgo/functional/__init__.py +10 -0
- bmcgo/functional/analysis.py +96 -0
- bmcgo/functional/bmc_studio_action.py +98 -0
- bmcgo/functional/check.py +185 -0
- bmcgo/functional/conan_index_build.py +251 -0
- bmcgo/functional/config.py +332 -0
- bmcgo/functional/csr_build.py +724 -0
- bmcgo/functional/deploy.py +263 -0
- bmcgo/functional/diff.py +235 -0
- bmcgo/functional/fetch.py +235 -0
- bmcgo/functional/full_component.py +391 -0
- bmcgo/functional/maintain.py +381 -0
- bmcgo/functional/new.py +166 -0
- bmcgo/functional/schema_valid.py +111 -0
- bmcgo/functional/simple_sign.py +104 -0
- bmcgo/functional/upgrade.py +78 -0
- bmcgo/ipmigen/__init__.py +13 -0
- bmcgo/ipmigen/ctype_defination.py +82 -0
- bmcgo/ipmigen/ipmigen.py +309 -0
- bmcgo/ipmigen/template/cmd.c.mako +366 -0
- bmcgo/ipmigen/template/ipmi.c.mako +25 -0
- bmcgo/ipmigen/template/ipmi.h.mako +51 -0
- bmcgo/logger.py +176 -0
- bmcgo/misc.py +117 -0
- bmcgo/target/app.yml +17 -0
- bmcgo/target/install_sdk.yml +15 -0
- bmcgo/target/personal.yml +53 -0
- bmcgo/target/publish.yml +45 -0
- bmcgo/tasks/__init__.py +11 -0
- bmcgo/tasks/download_buildtools_hm.py +124 -0
- bmcgo/tasks/misc.py +15 -0
- bmcgo/tasks/task.py +354 -0
- bmcgo/tasks/task_build_conan.py +714 -0
- bmcgo/tasks/task_build_rootfs_img.py +595 -0
- bmcgo/tasks/task_buildgppbin.py +88 -0
- bmcgo/tasks/task_buildhpm_ext4.py +82 -0
- bmcgo/tasks/task_create_interface_config.py +122 -0
- bmcgo/tasks/task_download_buildtools.py +99 -0
- bmcgo/tasks/task_download_dependency.py +72 -0
- bmcgo/tasks/task_hpm_envir_prepare.py +112 -0
- bmcgo/tasks/task_packet_to_supporte.py +87 -0
- bmcgo/tasks/task_prepare.py +105 -0
- bmcgo/tasks/task_sign_and_pack_hpm.py +42 -0
- bmcgo/utils/__init__.py +10 -0
- bmcgo/utils/buffer.py +128 -0
- bmcgo/utils/combine_json_schemas.py +170 -0
- bmcgo/utils/component_post.py +54 -0
- bmcgo/utils/component_version_check.py +86 -0
- bmcgo/utils/config.py +1067 -0
- bmcgo/utils/fetch_component_code.py +232 -0
- bmcgo/utils/install_manager.py +61 -0
- bmcgo/utils/installations/__init__.py +10 -0
- bmcgo/utils/installations/base_installer.py +70 -0
- bmcgo/utils/installations/install_consts.py +30 -0
- bmcgo/utils/installations/install_plans/bingo.yml +11 -0
- bmcgo/utils/installations/install_workflow.py +50 -0
- bmcgo/utils/installations/installers/apt_installer.py +177 -0
- bmcgo/utils/installations/installers/pip_installer.py +46 -0
- bmcgo/utils/installations/version_util.py +100 -0
- bmcgo/utils/mapping_config_patch.py +443 -0
- bmcgo/utils/perf_analysis.py +114 -0
- bmcgo/utils/tools.py +704 -0
- bmcgo/worker.py +417 -0
- openubmc_bingo-0.5.240.dist-info/METADATA +30 -0
- openubmc_bingo-0.5.240.dist-info/RECORD +242 -0
- openubmc_bingo-0.5.240.dist-info/WHEEL +5 -0
- openubmc_bingo-0.5.240.dist-info/entry_points.txt +2 -0
- openubmc_bingo-0.5.240.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
--[[${make_header('lua')}]]--
|
|
2
|
+
<%namespace name="imports" file="utils/imports.mako"/>
|
|
3
|
+
<%
|
|
4
|
+
ClassName = root['package']
|
|
5
|
+
%>
|
|
6
|
+
% if render_utils.has_generate_client():
|
|
7
|
+
local bs = require 'mc.bitstring'
|
|
8
|
+
local enums = require 'ipmi.enums'
|
|
9
|
+
local ipmi = require 'ipmi'
|
|
10
|
+
% endif
|
|
11
|
+
% if render_utils.has_generate_service():
|
|
12
|
+
local types = require 'ipmi.types'
|
|
13
|
+
local privilege = require 'mc.privilege'
|
|
14
|
+
% endif
|
|
15
|
+
local msg = require "${project_name}.${root['filename'].replace('.proto', "").replace("/", ".")}_message"
|
|
16
|
+
|
|
17
|
+
% if render_utils.has_generate_client():
|
|
18
|
+
local CT = enums.ChannelType
|
|
19
|
+
% endif
|
|
20
|
+
|
|
21
|
+
local ${ClassName} = {}
|
|
22
|
+
|
|
23
|
+
% for ipmi in root['data']:
|
|
24
|
+
% if "nested_type" in ipmi and len(ipmi["nested_type"]) > 0:
|
|
25
|
+
% if render_utils.is_generate_service(ipmi):
|
|
26
|
+
|
|
27
|
+
${ClassName}.${ipmi['name']} = {
|
|
28
|
+
name = '${ipmi['name']}',
|
|
29
|
+
% if version >= 5:
|
|
30
|
+
prio = types.Priority.${render_utils.get_priority(ipmi)},
|
|
31
|
+
% else:
|
|
32
|
+
prio = types.Prio.${render_utils.get_priority(ipmi)},
|
|
33
|
+
% endif
|
|
34
|
+
netfn = ${render_utils.format_hex(render_utils.get_netfn(ipmi))},
|
|
35
|
+
cmd = ${render_utils.format_hex(ipmi['options']['cmd'])},
|
|
36
|
+
% if version >= 5:
|
|
37
|
+
role = types.Role.${ipmi['options']['role']},
|
|
38
|
+
% else:
|
|
39
|
+
role = types.Privilege.${ipmi['options']['role']},
|
|
40
|
+
% endif
|
|
41
|
+
privilege = ${render_utils.get_privilege(ipmi)},
|
|
42
|
+
sensitive = ${'true' if ipmi['options']['sensitive'] else 'false'},
|
|
43
|
+
restricted_channels = ${render_utils.get_restricted_channel(ipmi)},
|
|
44
|
+
filters = ${utils_py.format_value(render_utils.get_option(ipmi, 'filters'), '')},
|
|
45
|
+
decode = ${utils_py.format_value(render_utils.get_option(ipmi, 'decode'), '')},
|
|
46
|
+
encode = ${utils_py.format_value(render_utils.get_option(ipmi, 'encode'), '')},
|
|
47
|
+
req = msg.${ipmi['name']}Req,
|
|
48
|
+
rsp = msg.${ipmi['name']}Rsp,
|
|
49
|
+
% if version >= 6:
|
|
50
|
+
manufacturer = ${utils_py.format_value(render_utils.get_manufacturer(ipmi), '')},
|
|
51
|
+
% endif
|
|
52
|
+
sysLockedPolicy = '${render_utils.get_sys_locked_policy(ipmi)}'
|
|
53
|
+
}
|
|
54
|
+
% else:
|
|
55
|
+
|
|
56
|
+
% if render_utils.get_option(ipmi, 'decode') != '':
|
|
57
|
+
local ${utils_py.camel_to_snake(ipmi['name'])}_req = nil
|
|
58
|
+
% endif
|
|
59
|
+
% if render_utils.get_option(ipmi, 'encode') != '':
|
|
60
|
+
local ${utils_py.camel_to_snake(ipmi['name'])}_rsp = nil
|
|
61
|
+
% endif
|
|
62
|
+
% for p in render_utils.req_properties(ipmi):
|
|
63
|
+
---@param ${p['name']} ${utils_py.do_type_to_lua(p['type'], p['repeated'])}
|
|
64
|
+
% endfor
|
|
65
|
+
% for p in render_utils.rsp_properties(ipmi):
|
|
66
|
+
---@return ${p['name']} ${utils_py.do_type_to_lua(p['type'], p['repeated'])}
|
|
67
|
+
% endfor
|
|
68
|
+
% if render_utils.req_params(ipmi) != '':
|
|
69
|
+
function ${ClassName}.${ipmi['name']}(bus, ${render_utils.req_params(ipmi)})
|
|
70
|
+
% else:
|
|
71
|
+
function ${ClassName}.${ipmi['name']}(bus)
|
|
72
|
+
% endif
|
|
73
|
+
% if render_utils.get_option(ipmi, 'decode') != '':
|
|
74
|
+
${utils_py.camel_to_snake(ipmi['name'])}_req = ${utils_py.camel_to_snake(ipmi['name'])}_req or bs.new('${render_utils.get_option(ipmi, 'decode')}')
|
|
75
|
+
% endif
|
|
76
|
+
% if render_utils.get_option(ipmi, 'encode') != '':
|
|
77
|
+
${utils_py.camel_to_snake(ipmi['name'])}_rsp = ${utils_py.camel_to_snake(ipmi['name'])}_rsp or bs.new('${render_utils.get_option(ipmi, 'encode')}')
|
|
78
|
+
% endif
|
|
79
|
+
% if render_utils.get_option(ipmi, 'decode') != '':
|
|
80
|
+
local data = ${utils_py.camel_to_snake(ipmi['name'])}_req:pack(${render_utils.req_json(ipmi)})
|
|
81
|
+
% else:
|
|
82
|
+
local data = ''
|
|
83
|
+
% endif
|
|
84
|
+
local cc, payload = ipmi.request(bus, CT.${render_utils.get_channel(ipmi)}:value(), {DestNetFn = ${render_utils.format_hex(ipmi['options']['net_fn'])}, Cmd = ${render_utils.format_hex(ipmi['options']['cmd'])}, Payload = data})
|
|
85
|
+
|
|
86
|
+
% if render_utils.get_option(ipmi, 'encode') != '':
|
|
87
|
+
msg.${ipmi['name']}Rsp.new(${utils_py.camel_to_snake(ipmi['name'])}_rsp:unpack(payload)):validate()
|
|
88
|
+
return cc, ${utils_py.camel_to_snake(ipmi['name'])}_rsp:unpack(payload)
|
|
89
|
+
% else:
|
|
90
|
+
return cc, payload
|
|
91
|
+
% endif
|
|
92
|
+
end
|
|
93
|
+
% endif
|
|
94
|
+
% endif
|
|
95
|
+
% endfor
|
|
96
|
+
|
|
97
|
+
return ${ClassName}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
${make_header('lua')}
|
|
2
|
+
|
|
3
|
+
local factory = require '${project_name}.factory'
|
|
4
|
+
local class = require 'mc.class'
|
|
5
|
+
local log = require 'mc.logging'
|
|
6
|
+
local ipmi_msg = require '${project_name}.ipmi.ipmi'
|
|
7
|
+
local ipmi = require 'ipmi'
|
|
8
|
+
|
|
9
|
+
local ipmi_cmd = class()
|
|
10
|
+
|
|
11
|
+
% for ipmi_method in ipmi.get('cmds', []):
|
|
12
|
+
function ipmi_cmd:${ipmi_method}(req, ctx)
|
|
13
|
+
|
|
14
|
+
return
|
|
15
|
+
end
|
|
16
|
+
% endfor
|
|
17
|
+
|
|
18
|
+
factory.register_to_factory('ipmi_cmd', ipmi_cmd)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
--[[${make_header('lua')}]]--
|
|
2
|
+
<%
|
|
3
|
+
messages = []
|
|
4
|
+
for msg in root['data']:
|
|
5
|
+
if 'nested_type' in msg:
|
|
6
|
+
for nest_msg in msg['nested_type']:
|
|
7
|
+
if msg['type'] != 'Enum':
|
|
8
|
+
nest_msg['name'] = msg['name'] + nest_msg['name']
|
|
9
|
+
messages.append(nest_msg)
|
|
10
|
+
enums = [msg for msg in root['data'] if msg['type'] == 'Enum']
|
|
11
|
+
%>
|
|
12
|
+
local validate = require 'mc.validate'
|
|
13
|
+
local utils = require 'mc.utils'
|
|
14
|
+
% if len(enums) > 0:
|
|
15
|
+
local create_enum_type = require 'mc.enum'
|
|
16
|
+
% endif
|
|
17
|
+
<%namespace name="message" file="utils/message.mako"/>
|
|
18
|
+
<%namespace name="imports" file="utils/imports.mako"/>
|
|
19
|
+
<%namespace name="enum" file="utils/enum.mako"/>
|
|
20
|
+
${imports.render(root)}
|
|
21
|
+
|
|
22
|
+
local ${root['package']}Msg = {}
|
|
23
|
+
|
|
24
|
+
% for msg in enums:
|
|
25
|
+
${enum.render(msg, 'create_enum_type')}
|
|
26
|
+
${root['package']}Msg.${msg['name']} = E${msg['name']}
|
|
27
|
+
|
|
28
|
+
% endfor
|
|
29
|
+
|
|
30
|
+
% for msg in messages:
|
|
31
|
+
${message.render(msg)}
|
|
32
|
+
|
|
33
|
+
${root['package']}Msg.${msg['name']} = T${msg['name']}
|
|
34
|
+
% endfor
|
|
35
|
+
|
|
36
|
+
return ${root['package']}Msg
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
${make_header('lua')}
|
|
2
|
+
local Databases = require 'database'
|
|
3
|
+
local Col = require 'database.column'
|
|
4
|
+
<%namespace name="imports" file="utils/imports.mako"/>
|
|
5
|
+
${imports.render(root)}
|
|
6
|
+
<%
|
|
7
|
+
has_poweroff, has_reset, has_temporary = render_utils.check_local_per_type(root)
|
|
8
|
+
%>
|
|
9
|
+
|
|
10
|
+
local db_selector = {}
|
|
11
|
+
|
|
12
|
+
% if has_poweroff:
|
|
13
|
+
<% ClassName = root['package'] + 'DatabasePoweroff' %>
|
|
14
|
+
% for msg in root['data']:
|
|
15
|
+
% if render_utils.table_name(msg) and render_utils.check_local_per_poweroff(msg):
|
|
16
|
+
---@class ${msg['name']}Table: Table
|
|
17
|
+
% for prop in msg['properties']:
|
|
18
|
+
---@field ${prop['name']} FieldBase
|
|
19
|
+
% endfor
|
|
20
|
+
% endif
|
|
21
|
+
|
|
22
|
+
% endfor
|
|
23
|
+
|
|
24
|
+
---@class ${ClassName}
|
|
25
|
+
---@field db DataBase
|
|
26
|
+
---@field select fun(db:DataBase, table: any, ...): SelectStatement
|
|
27
|
+
---@field update fun(db:DataBase, table: any, ...): UpdateStatement
|
|
28
|
+
---@field insert fun(db:DataBase, table: any, ...): InsertStatement
|
|
29
|
+
% for msg in root['data']:
|
|
30
|
+
% if render_utils.table_name(msg) and render_utils.check_local_per_poweroff(msg):
|
|
31
|
+
---@field ${msg['name']} ${msg['name']}Table
|
|
32
|
+
% endif
|
|
33
|
+
% endfor
|
|
34
|
+
|
|
35
|
+
local ${ClassName} = {}
|
|
36
|
+
${ClassName}.__index = ${ClassName}
|
|
37
|
+
|
|
38
|
+
function ${ClassName}.new(path, datas)
|
|
39
|
+
local db = Databases(path)
|
|
40
|
+
local obj = {db = db}
|
|
41
|
+
|
|
42
|
+
% for msg in root['data']:
|
|
43
|
+
% if render_utils.table_name(msg) and render_utils.check_local_per_poweroff(msg):
|
|
44
|
+
obj.${msg['name']} = db:Table('${render_utils.table_name(msg)}', {
|
|
45
|
+
% for prop in msg['properties']:
|
|
46
|
+
${prop['name']} = Col.${render_utils.column_type(prop)}${render_utils.extend_field(prop)}:cid(${prop['id']})${render_utils.primary_key(prop)}${render_utils.unique(prop)}${render_utils.allow_null(prop)}${render_utils.max_len(prop)}${render_utils.default(msg['name'], prop)}${render_utils.deprecated(prop)},
|
|
47
|
+
% endfor
|
|
48
|
+
}):create_if_not_exist(datas and datas['${render_utils.table_name(msg)}'])
|
|
49
|
+
% if render_utils.table_max_rows(msg) and render_utils.get_lua_codegen_version() >= 11:
|
|
50
|
+
obj.${msg['name']}.table_max_rows = ${msg['options']['table_max_rows']}
|
|
51
|
+
%endif
|
|
52
|
+
% endif
|
|
53
|
+
% endfor
|
|
54
|
+
|
|
55
|
+
obj.tables = db.tables
|
|
56
|
+
return setmetatable(obj, ${ClassName})
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
function ${ClassName}:select(table, ...)
|
|
60
|
+
return self.db:select(table, ...)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
function ${ClassName}:update(table, ...)
|
|
64
|
+
return self.db:update(table, ...)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
function ${ClassName}:insert(table, ...)
|
|
68
|
+
return self.db:insert(table, ...)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
function ${ClassName}:delete(table, ...)
|
|
72
|
+
return self.db:delete(table, ...)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
function ${ClassName}:exec(...)
|
|
76
|
+
return self.db:exec(...)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
% for msg in root['data']:
|
|
80
|
+
% if render_utils.table_name(msg) and render_utils.check_local_per_poweroff(msg):
|
|
81
|
+
% if render_utils.table_max_rows(msg) and render_utils.get_lua_codegen_version() >= 11:
|
|
82
|
+
|
|
83
|
+
function ${ClassName}:Register${msg['name']}TableMaxRowsCallback(cb)
|
|
84
|
+
self.${msg['name']}.table_max_rows_cb = cb
|
|
85
|
+
end
|
|
86
|
+
% endif
|
|
87
|
+
% endif
|
|
88
|
+
% endfor
|
|
89
|
+
|
|
90
|
+
db_selector["poweroff"] = ${ClassName}.new
|
|
91
|
+
% endif
|
|
92
|
+
|
|
93
|
+
% if has_reset:
|
|
94
|
+
<% ClassName = root['package'] + 'DatabaseReset' %>
|
|
95
|
+
% for msg in root['data']:
|
|
96
|
+
% if render_utils.table_name(msg) and render_utils.check_local_per_reset(msg):
|
|
97
|
+
---@class ${msg['name']}Table: Table
|
|
98
|
+
% for prop in msg['properties']:
|
|
99
|
+
---@field ${prop['name']} FieldBase
|
|
100
|
+
% endfor
|
|
101
|
+
% endif
|
|
102
|
+
|
|
103
|
+
% endfor
|
|
104
|
+
|
|
105
|
+
---@class ${ClassName}
|
|
106
|
+
---@field db DataBase
|
|
107
|
+
---@field select fun(db:DataBase, table: any, ...): SelectStatement
|
|
108
|
+
---@field update fun(db:DataBase, table: any, ...): UpdateStatement
|
|
109
|
+
---@field insert fun(db:DataBase, table: any, ...): InsertStatement
|
|
110
|
+
% for msg in root['data']:
|
|
111
|
+
% if render_utils.table_name(msg) and render_utils.check_local_per_reset(msg):
|
|
112
|
+
---@field ${msg['name']} ${msg['name']}Table
|
|
113
|
+
% endif
|
|
114
|
+
% endfor
|
|
115
|
+
|
|
116
|
+
local ${ClassName} = {}
|
|
117
|
+
${ClassName}.__index = ${ClassName}
|
|
118
|
+
|
|
119
|
+
function ${ClassName}.new(path, datas)
|
|
120
|
+
local db = Databases(path)
|
|
121
|
+
local obj = {db = db}
|
|
122
|
+
|
|
123
|
+
% for msg in root['data']:
|
|
124
|
+
% if render_utils.table_name(msg) and render_utils.check_local_per_reset(msg):
|
|
125
|
+
obj.${msg['name']} = db:Table('${render_utils.table_name(msg)}', {
|
|
126
|
+
% for prop in msg['properties']:
|
|
127
|
+
${prop['name']} = Col.${render_utils.column_type(prop)}${render_utils.extend_field(prop)}:cid(${prop['id']})${render_utils.primary_key(prop)}${render_utils.unique(prop)}${render_utils.allow_null(prop)}${render_utils.max_len(prop)}${render_utils.default(msg['name'], prop)}${render_utils.deprecated(prop)},
|
|
128
|
+
% endfor
|
|
129
|
+
}):create_if_not_exist(datas and datas['${render_utils.table_name(msg)}'])
|
|
130
|
+
% if render_utils.table_max_rows(msg) and render_utils.get_lua_codegen_version() >= 11:
|
|
131
|
+
obj.${msg['name']}.table_max_rows = ${msg['options']['table_max_rows']}
|
|
132
|
+
%endif
|
|
133
|
+
% endif
|
|
134
|
+
% endfor
|
|
135
|
+
|
|
136
|
+
obj.tables = db.tables
|
|
137
|
+
return setmetatable(obj, ${ClassName})
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
function ${ClassName}:select(table, ...)
|
|
141
|
+
return self.db:select(table, ...)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
function ${ClassName}:update(table, ...)
|
|
145
|
+
return self.db:update(table, ...)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
function ${ClassName}:insert(table, ...)
|
|
149
|
+
return self.db:insert(table, ...)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
function ${ClassName}:delete(table, ...)
|
|
153
|
+
return self.db:delete(table, ...)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
function ${ClassName}:exec(...)
|
|
157
|
+
return self.db:exec(...)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
% for msg in root['data']:
|
|
161
|
+
% if render_utils.table_name(msg) and render_utils.check_local_per_reset(msg):
|
|
162
|
+
% if render_utils.table_max_rows(msg) and render_utils.get_lua_codegen_version() >= 11:
|
|
163
|
+
|
|
164
|
+
function ${ClassName}:Register${msg['name']}TableMaxRowsCallback(cb)
|
|
165
|
+
self.${msg['name']}.table_max_rows_cb = cb
|
|
166
|
+
end
|
|
167
|
+
% endif
|
|
168
|
+
% endif
|
|
169
|
+
% endfor
|
|
170
|
+
|
|
171
|
+
db_selector["reset"] = ${ClassName}.new
|
|
172
|
+
% endif
|
|
173
|
+
|
|
174
|
+
% if has_temporary:
|
|
175
|
+
<% ClassName = root['package'] + 'DatabaseTemporary' %>
|
|
176
|
+
% for msg in root['data']:
|
|
177
|
+
% if render_utils.table_name(msg) and render_utils.check_local_per_temporary(msg):
|
|
178
|
+
---@class ${msg['name']}Table: Table
|
|
179
|
+
% for prop in msg['properties']:
|
|
180
|
+
---@field ${prop['name']} FieldBase
|
|
181
|
+
% endfor
|
|
182
|
+
% endif
|
|
183
|
+
|
|
184
|
+
% endfor
|
|
185
|
+
|
|
186
|
+
---@class ${ClassName}
|
|
187
|
+
---@field db DataBase
|
|
188
|
+
---@field select fun(db:DataBase, table: any, ...): SelectStatement
|
|
189
|
+
---@field update fun(db:DataBase, table: any, ...): UpdateStatement
|
|
190
|
+
---@field insert fun(db:DataBase, table: any, ...): InsertStatement
|
|
191
|
+
% for msg in root['data']:
|
|
192
|
+
% if render_utils.table_name(msg) and render_utils.check_local_per_temporary(msg):
|
|
193
|
+
---@field ${msg['name']} ${msg['name']}Table
|
|
194
|
+
% endif
|
|
195
|
+
% endfor
|
|
196
|
+
|
|
197
|
+
local ${ClassName} = {}
|
|
198
|
+
${ClassName}.__index = ${ClassName}
|
|
199
|
+
|
|
200
|
+
function ${ClassName}.new(path, datas)
|
|
201
|
+
local db = Databases(path)
|
|
202
|
+
local obj = {db = db}
|
|
203
|
+
|
|
204
|
+
% for msg in root['data']:
|
|
205
|
+
% if render_utils.table_name(msg) and render_utils.check_local_per_temporary(msg):
|
|
206
|
+
obj.${msg['name']} = db:Table('${render_utils.table_name(msg)}', {
|
|
207
|
+
% for prop in msg['properties']:
|
|
208
|
+
${prop['name']} = Col.${render_utils.column_type(prop)}${render_utils.extend_field(prop)}:cid(${prop['id']})${render_utils.primary_key(prop)}${render_utils.unique(prop)}${render_utils.allow_null(prop)}${render_utils.max_len(prop)}${render_utils.default(msg['name'], prop)}${render_utils.deprecated(prop)},
|
|
209
|
+
% endfor
|
|
210
|
+
}):create_if_not_exist(datas and datas['${render_utils.table_name(msg)}'])
|
|
211
|
+
% if render_utils.table_max_rows(msg) and render_utils.get_lua_codegen_version() >= 11:
|
|
212
|
+
obj.${msg['name']}.table_max_rows = ${msg['options']['table_max_rows']}
|
|
213
|
+
%endif
|
|
214
|
+
% endif
|
|
215
|
+
% endfor
|
|
216
|
+
|
|
217
|
+
obj.tables = db.tables
|
|
218
|
+
return setmetatable(obj, ${ClassName})
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
function ${ClassName}:select(table, ...)
|
|
222
|
+
return self.db:select(table, ...)
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
function ${ClassName}:update(table, ...)
|
|
226
|
+
return self.db:update(table, ...)
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
function ${ClassName}:insert(table, ...)
|
|
230
|
+
return self.db:insert(table, ...)
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
function ${ClassName}:delete(table, ...)
|
|
234
|
+
return self.db:delete(table, ...)
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
function ${ClassName}:exec(...)
|
|
238
|
+
return self.db:exec(...)
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
% for msg in root['data']:
|
|
242
|
+
% if render_utils.table_name(msg) and render_utils.check_local_per_temporary(msg):
|
|
243
|
+
% if render_utils.table_max_rows(msg) and render_utils.get_lua_codegen_version() >= 11:
|
|
244
|
+
|
|
245
|
+
function ${ClassName}:Register${msg['name']}TableMaxRowsCallback(cb)
|
|
246
|
+
self.${msg['name']}.table_max_rows_cb = cb
|
|
247
|
+
end
|
|
248
|
+
% endif
|
|
249
|
+
% endif
|
|
250
|
+
% endfor
|
|
251
|
+
|
|
252
|
+
db_selector["temporary"] = ${ClassName}.new
|
|
253
|
+
% endif
|
|
254
|
+
|
|
255
|
+
<% ClassName = root['package'] + 'Database' %>
|
|
256
|
+
local ${ClassName} = {}
|
|
257
|
+
${ClassName}.__index = ${ClassName}
|
|
258
|
+
|
|
259
|
+
function ${ClassName}.new(path, datas, type)
|
|
260
|
+
return db_selector[type] and db_selector[type](path, datas) or nil
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
return ${ClassName}.new
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
${make_header('lua')}
|
|
2
|
+
|
|
3
|
+
local skynet = require 'skynet'
|
|
4
|
+
require 'skynet.manager'
|
|
5
|
+
local log = require 'mc.logging'
|
|
6
|
+
local app_entry = require '${project_name}.entry'
|
|
7
|
+
|
|
8
|
+
local CMD = {}
|
|
9
|
+
|
|
10
|
+
function CMD.exit()
|
|
11
|
+
skynet.timeout(0, function()
|
|
12
|
+
log:info('${project_name} service exit')
|
|
13
|
+
skynet.exit()
|
|
14
|
+
end)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
skynet.start(function()
|
|
18
|
+
skynet.uniqueservice('sd_bus')
|
|
19
|
+
skynet.register('${project_name}')
|
|
20
|
+
app_entry.new()
|
|
21
|
+
skynet.dispatch('lua', function(_, _, cmd, ...)
|
|
22
|
+
local f = assert(CMD[cmd])
|
|
23
|
+
skynet.ret(skynet.pack(f(...)))
|
|
24
|
+
end)
|
|
25
|
+
end)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
${make_header('lua')}
|
|
2
|
+
|
|
3
|
+
local class = require 'mc.class'
|
|
4
|
+
local factory = require '${project_name}.factory'
|
|
5
|
+
local mc_callback = class()
|
|
6
|
+
|
|
7
|
+
function mc_callback:on_add_object(class_name, object, position)
|
|
8
|
+
|
|
9
|
+
return
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
function mc_callback:on_del_object(class_name, object, position)
|
|
13
|
+
|
|
14
|
+
return
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
function mc_callback:on_add_object_complete(position)
|
|
18
|
+
|
|
19
|
+
return
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
function mc_callback:on_delete_object_complete(position)
|
|
23
|
+
|
|
24
|
+
return
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
function mc_callback:on_config_import(config_path)
|
|
28
|
+
|
|
29
|
+
return
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
function mc_callback:on_config_export(config_path)
|
|
33
|
+
|
|
34
|
+
return
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
function mc_callback:on_system_recovery()
|
|
38
|
+
|
|
39
|
+
return
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
function mc_callback:on_system_backup()
|
|
43
|
+
|
|
44
|
+
return
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
function mc_callback:on_reboot_prepare()
|
|
48
|
+
|
|
49
|
+
return 0
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
function mc_callback:on_reboot_cancel()
|
|
53
|
+
|
|
54
|
+
return
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
function mc_callback:on_reboot_action()
|
|
58
|
+
|
|
59
|
+
return 0
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
function mc_callback:on_debug_setlevel(level)
|
|
63
|
+
|
|
64
|
+
return
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
function mc_callback:on_debug_settype(type)
|
|
68
|
+
|
|
69
|
+
return
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
function mc_callback:on_debug_dump(dump_path)
|
|
73
|
+
|
|
74
|
+
return
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
factory.register_to_factory('mc_callback', mc_callback)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
${make_header('lua')}
|
|
2
|
+
<%
|
|
3
|
+
interface_package = {}
|
|
4
|
+
def fill_interface_package(value):
|
|
5
|
+
interface_package[value] = true
|
|
6
|
+
return ''
|
|
7
|
+
%>
|
|
8
|
+
% for msg in root['data']:
|
|
9
|
+
% if render_utils.has_path(msg):
|
|
10
|
+
% for p in msg['properties']:
|
|
11
|
+
% if p['type'] not in interface_package:
|
|
12
|
+
local ${p['type']}Interface = require 'mdb.${p['options']['interface']}Interface'
|
|
13
|
+
% endif
|
|
14
|
+
% endfor
|
|
15
|
+
% endif
|
|
16
|
+
% endfor
|
|
17
|
+
|
|
18
|
+
local childs = {}
|
|
19
|
+
% for (pkg, path) in render_utils.dependency(root):
|
|
20
|
+
% if not path.endswith('/types/message'):
|
|
21
|
+
childs.${pkg} = require '${path.replace("/", ".")}'
|
|
22
|
+
% endif
|
|
23
|
+
% endfor
|
|
24
|
+
local ${root['package']} = {childs = childs}
|
|
25
|
+
|
|
26
|
+
% if render_utils.has_msg(root):
|
|
27
|
+
local mdb = require 'mc.mdb'
|
|
28
|
+
|
|
29
|
+
% for msg in root['data']:
|
|
30
|
+
% if render_utils.has_path(msg):
|
|
31
|
+
local T${msg['name']} = mdb.register_object('${msg['options']['path']}', {
|
|
32
|
+
% for p in msg['properties']:
|
|
33
|
+
{name = '${p['name']}', interface = ${p['type']}Interface.${p['type']}},
|
|
34
|
+
% endfor
|
|
35
|
+
})
|
|
36
|
+
${root['package']}.${msg['name']}= T${msg['name']}
|
|
37
|
+
|
|
38
|
+
function T${msg['name']}:ctor(${", ".join(render_utils.get_path_params(msg['options']['path']))})
|
|
39
|
+
self.path = ${render_utils.make_path(msg)}
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
% endif
|
|
43
|
+
% endfor
|
|
44
|
+
% endif
|
|
45
|
+
return ${root['package']}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
${make_header('lua')}
|
|
2
|
+
<%
|
|
3
|
+
messages = [msg for msg in root['data'] if (msg['type'] != 'Enum' and 'interface' not in msg['options']) ]
|
|
4
|
+
enums = [msg for msg in root['data'] if msg['type'] == 'Enum']
|
|
5
|
+
%>
|
|
6
|
+
% if len(messages) > 0 or len(enums) > 0:
|
|
7
|
+
local validate = require 'mc.validate'
|
|
8
|
+
local utils = require 'mc.utils'
|
|
9
|
+
% endif
|
|
10
|
+
% if len(enums) > 0:
|
|
11
|
+
local create_enum_type = require 'mc.enum'
|
|
12
|
+
% endif
|
|
13
|
+
<%namespace name="message" file="utils/message.mako"/>
|
|
14
|
+
<%namespace name="imports" file="utils/imports.mako"/>
|
|
15
|
+
<%namespace name="enum" file="utils/enum.mako"/>
|
|
16
|
+
${imports.render(root)}
|
|
17
|
+
|
|
18
|
+
% if len(messages) > 0 or len(enums) > 0:
|
|
19
|
+
local msg = {}
|
|
20
|
+
local defs = {}
|
|
21
|
+
% endif
|
|
22
|
+
|
|
23
|
+
% for msg in enums:
|
|
24
|
+
${enum.render(msg, 'create_enum_type')}
|
|
25
|
+
${'defs' if msg['package'] == 'defs' else 'msg'}.${msg['name']} = E${msg['name']}
|
|
26
|
+
|
|
27
|
+
% endfor
|
|
28
|
+
|
|
29
|
+
% for msg in messages:
|
|
30
|
+
${message.render(msg)}
|
|
31
|
+
|
|
32
|
+
${'defs' if msg['package'] == 'defs' else 'msg'}.${msg['name']} = T${msg['name']}
|
|
33
|
+
% endfor
|
|
34
|
+
|
|
35
|
+
local ${root['package']} = {}
|
|
36
|
+
|
|
37
|
+
local mdb = require 'mc.mdb'
|
|
38
|
+
|
|
39
|
+
% for msg in root['data']:
|
|
40
|
+
% if render_utils.has_interface(msg):
|
|
41
|
+
|
|
42
|
+
---@class ${msg['name']}: Table
|
|
43
|
+
% for p in msg['properties']:
|
|
44
|
+
---@field ${p['name']} ${utils_py.do_type_to_lua(p['type'], p['repeated'])}
|
|
45
|
+
% endfor
|
|
46
|
+
${root['package']}.${msg['name']} = mdb.register_interface('${msg['options']['interface']}', {
|
|
47
|
+
% for p in msg['properties']:
|
|
48
|
+
${p['name']} = {'${utils_py.do_type_to_dbus(p['type'], p['repeated'])}', ${render_utils.get_flags(p)}, ${render_utils.readonly_flag(p)}, ${render_utils.default(p)}},
|
|
49
|
+
% endfor
|
|
50
|
+
% if len(render_utils.make_methods(root, msg['options']['interface'])) == 0 and not render_utils.has_signals(msg):
|
|
51
|
+
}, {}, {})
|
|
52
|
+
% elif len(render_utils.make_methods(root, msg['options']['interface'])) > 0 :
|
|
53
|
+
}, {
|
|
54
|
+
% for p in render_utils.make_methods(root, msg['options']['interface']):
|
|
55
|
+
${p['name']} = {'a{ss}${utils_py.do_service_types_to_dbus(root, p['req'][1:])}', '${utils_py.do_service_types_to_dbus(root, p['rsp'][1:])}', ${render_utils.get_json_req(p)}, ${render_utils.get_json_rsp(p)}},
|
|
56
|
+
% endfor
|
|
57
|
+
% if render_utils.has_signals(msg):
|
|
58
|
+
}, {
|
|
59
|
+
% for p in msg['nested_type']:
|
|
60
|
+
${p['name']} = '${utils_py.do_types_to_dbus(p)}',
|
|
61
|
+
% endfor
|
|
62
|
+
})
|
|
63
|
+
% else :
|
|
64
|
+
}, {})
|
|
65
|
+
% endif
|
|
66
|
+
% else :
|
|
67
|
+
}, {}, {
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
% endif
|
|
71
|
+
% endif
|
|
72
|
+
% endfor
|
|
73
|
+
return ${root['package']}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
${make_header('lua')}
|
|
2
|
+
<%
|
|
3
|
+
messages = [msg for msg in root['data'] if msg['type'] != 'Enum']
|
|
4
|
+
enums = [msg for msg in root['data'] if msg['type'] == 'Enum']
|
|
5
|
+
%>
|
|
6
|
+
local validate = require 'mc.validate'
|
|
7
|
+
local utils = require 'mc.utils'
|
|
8
|
+
% if 'intf' in root:
|
|
9
|
+
local mdb = require 'mc.mdb'
|
|
10
|
+
% endif
|
|
11
|
+
% if len(enums) > 0:
|
|
12
|
+
local create_enum_type = require 'mc.enum'
|
|
13
|
+
% endif
|
|
14
|
+
<%namespace name="message" file="utils/message.mako"/>
|
|
15
|
+
<%namespace name="imports" file="utils/imports.mako"/>
|
|
16
|
+
<%namespace name="enum" file="utils/enum.mako"/>
|
|
17
|
+
<%namespace name="mdb_intf" file= "utils/mdb_intf.lua.mako"/>
|
|
18
|
+
${imports.render(root)}
|
|
19
|
+
|
|
20
|
+
local ${root['package']} = {}
|
|
21
|
+
|
|
22
|
+
% for msg in enums:
|
|
23
|
+
${enum.render(msg, 'create_enum_type')}
|
|
24
|
+
${root['package']}.${msg['name']} = E${msg['name']}
|
|
25
|
+
|
|
26
|
+
% endfor
|
|
27
|
+
|
|
28
|
+
% for msg in messages:
|
|
29
|
+
${message.render(msg, root.get('intf', {}).get('name', ''))}
|
|
30
|
+
|
|
31
|
+
${root['package']}.${msg['name']} = T${msg['name']}
|
|
32
|
+
% endfor
|
|
33
|
+
|
|
34
|
+
% if 'intf' in root:
|
|
35
|
+
${root['package']}.interface = ${mdb_intf.render(root['intf'])}
|
|
36
|
+
|
|
37
|
+
% endif
|
|
38
|
+
return ${root['package']}
|