diff --git a/amp-sql/Dockerfile b/amp-sql/Dockerfile index 54dbb6d..87cec37 100644 --- a/amp-sql/Dockerfile +++ b/amp-sql/Dockerfile @@ -24,29 +24,15 @@ FROM postgres:14 -COPY postgres/Database_Scripts/Tables/amp_core_create_database.sql /docker-entrypoint-initdb.d/00-amp_core_create_database.sql -COPY postgres/Database_Scripts/Tables/transcoder.sql /docker-entrypoint-initdb.d/00-transcoder.sql -COPY postgres/Database_Scripts/Tables/adm_data.sql /docker-entrypoint-initdb.d/01-adm_data.sql +# COPY postgres/Database_Scripts/Tables/*.sql /docker-entrypoint-initdb.d/ -COPY postgres/Database_Scripts/Views/obj_view.sql /docker-entrypoint-initdb.d/01-obj_view.sql -COPY postgres/Database_Scripts/Views/ari_view.sql /docker-entrypoint-initdb.d/14-ari_view.sql -COPY postgres/Database_Scripts/Views/ctrl_view.sql /docker-entrypoint-initdb.d/04-ctrl_view.sql -COPY postgres/Database_Scripts/Views/edd_view.sql /docker-entrypoint-initdb.d/05-edd_view.sql -COPY postgres/Database_Scripts/Views/mac_view.sql /docker-entrypoint-initdb.d/06-mac_view.sql -COPY postgres/Database_Scripts/Views/oper_view.sql /docker-entrypoint-initdb.d/07-oper_view.sql -COPY postgres/Database_Scripts/Views/message_view.sql /docker-entrypoint-initdb.d/08-message_view.sql -COPY postgres/Database_Scripts/Views/rpt_view.sql /docker-entrypoint-initdb.d/13-rpt_view.sql -COPY postgres/Database_Scripts/Views/sbr_view.sql /docker-entrypoint-initdb.d/09-sbr_view.sql -COPY postgres/Database_Scripts/Views/tbr_view.sql /docker-entrypoint-initdb.d/10-tbr_view.sql -COPY postgres/Database_Scripts/Views/tblt_view.sql /docker-entrypoint-initdb.d/11-tblt_view.sql -COPY postgres/Database_Scripts/Views/tnvc_view.sql /docker-entrypoint-initdb.d/12-tnvc_view.sql -COPY postgres/Database_Scripts/Views/parm_view.sql /docker-entrypoint-initdb.d/13-parm_view.sql -COPY postgres/Database_Scripts/Views/var_view.sql /docker-entrypoint-initdb.d/13-var_view.sql -COPY postgres/Database_Scripts/Views/namespace_view.sql /docker-entrypoint-initdb.d/13-namespace_view.sql +# COPY postgres/Database_Scripts/Views/*.sql /docker-entrypoint-initdb.d/ +# +# COPY postgres/Database_Scripts/Routines/*.sql /docker-entrypoint-initdb.d/ + +COPY postgres/Database_Scripts/*/*.sql /docker-entrypoint-initdb.d/ +COPY postgres/Database_Scripts/*.sql /docker-entrypoint-initdb.d/ -COPY postgres/Database_Scripts/Routines/all_routines.sql /docker-entrypoint-initdb.d/16-all_routines.sql -COPY postgres/Database_Scripts/Tables/healthcheck_roles.sql /docker-entrypoint-initdb.d/17-healthcheck_roles.sql -COPY postgres/Database_Scripts/amp_core_functions.sql /docker-entrypoint-initdb.d/17-amp_core_functions.sql # This is used for testing, it is easier to delete the amp_agent after inserting it using adm_amp_agent.sql instead of removing the script since other scripts are also relying on amp_agent # COPY postgres/Database_Scripts/Routines/amp_agent_delete.sql /docker-entrypoint-initdb.d/31-amp_agent_delete.sql diff --git a/amp-sql/mysql/docker-compose.yml b/amp-sql/mysql/docker-compose.yml deleted file mode 100644 index b6d80a1..0000000 --- a/amp-sql/mysql/docker-compose.yml +++ /dev/null @@ -1,77 +0,0 @@ -## -## Copyright (c) 2023 The Johns Hopkins University Applied Physics -## Laboratory LLC. -## -## This file is part of the Asynchronous Network Management System (ANMS). -## -## 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. -## -## This work was performed for the Jet Propulsion Laboratory, California -## Institute of Technology, sponsored by the United States Government under -## the prime contract 80NM0018D0004 between the Caltech and NASA under -## subcontract 1658085. -## -version: '3.9' - -services: - db: - image: mysql - volumes: - - ${PWD}:/shared - - ${PWD}/Database_Scripts/Tables/amp_core_create_database.sql:/docker-entrypoint-initdb.d/00-amp_core_create_database.sql - - ${PWD}/Database_Scripts/Tables/transcoder.sql:/docker-entrypoint-initdb.d/00-transcoder.sql - - ${PWD}/Database_Scripts/Views/obj_view.sql:/docker-entrypoint-initdb.d/01-obj_view.sql - - ${PWD}/Database_Scripts/Views/ari_view.sql:/docker-entrypoint-initdb.d/14-ari_view.sql - - ${PWD}/Database_Scripts/Views/ctrl_view.sql:/docker-entrypoint-initdb.d/04-ctrl_view.sql - - ${PWD}/Database_Scripts/Views/edd_view.sql:/docker-entrypoint-initdb.d/05-edd_view.sql - - ${PWD}/Database_Scripts/Views/mac_view.sql:/docker-entrypoint-initdb.d/06-mac_view.sql - - ${PWD}/Database_Scripts/Views/oper_view.sql:/docker-entrypoint-initdb.d/07-oper_view.sql - - ${PWD}/Database_Scripts/Views/message_view.sql:/docker-entrypoint-initdb.d/08-message_view.sql - - ${PWD}/Database_Scripts/Views/rpt_view.sql:/docker-entrypoint-initdb.d/13-rpt_view.sql - - ${PWD}/Database_Scripts/Views/sbr_view.sql:/docker-entrypoint-initdb.d/09-sbr_view.sql - - ${PWD}/Database_Scripts/Views/tbr_view.sql:/docker-entrypoint-initdb.d/10-tbr_view.sql - - ${PWD}/Database_Scripts/Views/tblt_view.sql:/docker-entrypoint-initdb.d/11-tblt_view.sql - - ${PWD}/Database_Scripts/Views/tnvc_view.sql:/docker-entrypoint-initdb.d/12-tnvc_view.sql - - ${PWD}/Database_Scripts/Views/parm_view.sql:/docker-entrypoint-initdb.d/13-parm_view.sql - - ${PWD}/Database_Scripts/Views/var_view.sql:/docker-entrypoint-initdb.d/13-var_view.sql - - ${PWD}/Database_Scripts/Routines/all_routines.sql:/docker-entrypoint-initdb.d/16-all_routines.sql - - ${PWD}/Agent_Scripts/adm_amp_agent.sql:/docker-entrypoint-initdb.d/30-adm_amp_agent.sql - - ${PWD}/Agent_Scripts/adm_bp_agent.sql:/docker-entrypoint-initdb.d/30-adm_bp_agent.sql - - ${PWD}/Agent_Scripts/adm_ltp_agent.sql:/docker-entrypoint-initdb.d/30-adm_ltp_agent.sql - - ${PWD}/Agent_Scripts/adm_ionsec_admin.sql:/docker-entrypoint-initdb.d/30-adm_ionsec_admin.sql - - ${PWD}/Agent_Scripts/adm_ion_ltp_admin.sql:/docker-entrypoint-initdb.d/30-adm_ion_ltp_admin.sql - - ${PWD}/Agent_Scripts/adm_ion_ipn_admin.sql:/docker-entrypoint-initdb.d/30-adm_ion_ipn_admin.sql - - ${PWD}/Agent_Scripts/adm_ion_bp_admin.sql:/docker-entrypoint-initdb.d/30-adm_ion_bp_admin.sql - - ${PWD}/Agent_Scripts/adm_ion_admin.sql:/docker-entrypoint-initdb.d/30-adm_ion_admin.sql - - ${PWD}/Agent_Scripts/adm_sbsp.sql:/docker-entrypoint-initdb.d/30-adm_sbsp.sql - - ${PWD}/Database_Scripts/Tables/healthcheck_roles.sql:/docker-entrypoint-initdb.d/17-healthcheck_roles.sql - - ${PWD}/Database_Scripts/amp_core_functions.sql:/docker-entrypoint-initdb.d/17-amp_core_functions.sql - - # Optional: Specify a folder for reliably persistent storage, omit and use force-recreate to guarantee fresh starts, or - # manually delete prior to start - - ${PWD}/tmp/mysql:/var/lib/mysql - restart: always - # MySQL8 Authentication fix (https://github.com/docker-library/mysql/issues/454) -- quicker than figuring out how to install plugin - command: --lower_case_table_names=1 --default-authentication-plugin=mysql_native_password - hostname: amp_db - environment: - MYSQL_ROOT_PASSWORD: mysql - MYSQL_DATABASE: amp_core - MYSQL_USER: amp - MYSQL_PASSWORD: amp - ports: - - 3306:3306 - - adminer: - image: adminer - restart: always - ports: - - 8080:8080 \ No newline at end of file diff --git a/amp-sql/postgres/Agent_Scripts/adm_amp_agent.sql b/amp-sql/postgres/Agent_Scripts/adm_amp_agent.sql deleted file mode 100644 index de41080..0000000 --- a/amp-sql/postgres/Agent_Scripts/adm_amp_agent.sql +++ /dev/null @@ -1,826 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- -DO -$do$ -DECLARE tnvc_id INT; -DECLARE adm_enum integer := 1; -DECLARE amp_namespace_id integer := 7; - -DECLARE agent_meta_version integer; -DECLARE agent_meta_version_did integer; -DECLARE agent_meta_organization integer; -DECLARE agent_meta_organization_did integer; -DECLARE agent_edd_num_rpt_tpls integer; -DECLARE agent_edd_num_rpt_tpls_did integer; -DECLARE agent_edd_num_rpt_tpls_aid integer; -DECLARE agent_edd_num_tbl_tpls integer; -DECLARE agent_edd_num_tbl_tpls_did integer; -DECLARE agent_edd_num_tbl_tpls_aid integer; -DECLARE agent_edd_sent_reports integer; -DECLARE agent_edd_sent_reports_did integer; -DECLARE agent_edd_sent_reports_aid integer; -DECLARE agent_edd_num_tbr integer; -DECLARE agent_edd_num_tbr_did integer; -DECLARE agent_edd_num_tbr_aid integer; -DECLARE agent_edd_run_tbr integer; -DECLARE agent_edd_run_tbr_did integer; -DECLARE agent_edd_run_tbr_aid integer; -DECLARE agent_edd_num_sbr integer; -DECLARE agent_edd_num_sbr_did integer; -DECLARE agent_edd_num_sbr_aid integer; -DECLARE agent_edd_run_sbr integer; -DECLARE agent_edd_run_sbr_did integer; -DECLARE agent_edd_run_sbr_aid integer; -DECLARE agent_edd_num_const integer; -DECLARE agent_edd_num_const_did integer; -DECLARE agent_edd_num_const_aid integer; -DECLARE agent_edd_num_var integer; -DECLARE agent_edd_num_var_did integer; -DECLARE agent_edd_num_var_aid integer; -DECLARE agent_edd_num_macros integer; -DECLARE agent_edd_num_macros_did integer; -DECLARE agent_edd_num_macros_aid integer; -DECLARE agent_edd_run_macros integer; -DECLARE agent_edd_run_macros_did integer; -DECLARE agent_edd_run_macros_aid integer; -DECLARE agent_edd_num_controls integer; -DECLARE agent_edd_num_controls_did integer; -DECLARE agent_edd_num_controls_aid integer; -DECLARE agent_edd_run_controls integer; -DECLARE agent_edd_run_controls_did integer; -DECLARE agent_edd_run_controls_aid integer; -DECLARE agent_edd_cur_time integer; -DECLARE agent_edd_cur_time_did integer; -DECLARE agent_edd_cur_time_aid integer; -DECLARE agent_op_plusint integer; -DECLARE op_tnvc_id integer; -DECLARE tnvc_entry1 integer; -DECLARE tnvc_entry2 integer; -DECLARE agent_op_plusint_did integer; -DECLARE agent_op_plusuint integer; -DECLARE agent_op_plusuint_did integer; -DECLARE agent_op_plusvast integer; -DECLARE agent_op_plusvast_did integer; -DECLARE agent_op_plusuvast integer; -DECLARE agent_op_plusuvast_did integer; -DECLARE agent_op_plusreal32 integer; -DECLARE agent_op_plusreal32_did integer; -DECLARE agent_op_plusreal64 integer; -DECLARE agent_op_plusreal64_did integer; -DECLARE agent_op_minusint integer; -DECLARE agent_op_minusint_did integer; -DECLARE agent_op_minusuint integer; -DECLARE agent_op_minusuint_did integer; -DECLARE agent_op_minusvast integer; -DECLARE agent_op_minusvast_did integer; -DECLARE agent_op_minusuvast integer; -DECLARE agent_op_minusuvast_did integer; -DECLARE agent_op_minusreal32 integer; -DECLARE agent_op_minusreal32_did integer; -DECLARE agent_op_minusreal64 integer; -DECLARE agent_op_minusreal64_did integer; -DECLARE agent_op_multint integer; -DECLARE agent_op_multint_did integer; -DECLARE agent_op_multuint integer; -DECLARE agent_op_multuint_did integer; -DECLARE agent_op_multvast integer; -DECLARE agent_op_multvast_did integer; -DECLARE agent_op_multuvast integer; -DECLARE agent_op_multuvast_did integer; -DECLARE agent_op_multreal32 integer; -DECLARE agent_op_multreal32_did integer; -DECLARE agent_op_multreal64 integer; -DECLARE agent_op_multreal64_did integer; -DECLARE agent_op_divint integer; -DECLARE agent_op_divint_did integer; -DECLARE agent_op_divuint integer; -DECLARE agent_op_divuint_did integer; -DECLARE agent_op_divvast integer; -DECLARE agent_op_divvast_did integer; -DECLARE agent_op_divuvast integer; -DECLARE agent_op_divuvast_did integer; -DECLARE agent_op_divreal32 integer; -DECLARE agent_op_divreal32_did integer; -DECLARE agent_op_divreal64 integer; -DECLARE agent_op_divreal64_did integer; -DECLARE agent_op_modint integer; -DECLARE agent_op_modint_did integer; -DECLARE agent_op_moduint integer; -DECLARE agent_op_moduint_did integer; -DECLARE agent_op_modvast integer; -DECLARE agent_op_modvast_did integer; -DECLARE agent_op_moduvast integer; -DECLARE agent_op_moduvast_did integer; -DECLARE agent_op_modreal32 integer; -DECLARE agent_op_modreal32_did integer; -DECLARE agent_op_modreal64 integer; -DECLARE agent_op_modreal64_did integer; -DECLARE agent_op_expint integer; -DECLARE agent_op_expint_did integer; -DECLARE agent_op_expuint integer; -DECLARE agent_op_expuint_did integer; -DECLARE agent_op_expvast integer; -DECLARE agent_op_expvast_did integer; -DECLARE agent_op_expuvast integer; -DECLARE agent_op_expuvast_did integer; -DECLARE agent_op_expreal32 integer; -DECLARE agent_op_expreal32_did integer; -DECLARE agent_op_expreal64 integer; -DECLARE agent_op_expreal64_did integer; -DECLARE agent_op_bitand integer; -DECLARE agent_op_bitand_did integer; -DECLARE agent_op_bitor integer; -DECLARE agent_op_bitor_did integer; -DECLARE agent_op_bitxor integer; -DECLARE agent_op_bitxor_did integer; -DECLARE agent_op_bitnot integer; -DECLARE agent_op_bitnot_did integer; -DECLARE agent_op_logand integer; -DECLARE agent_op_logand_did integer; -DECLARE agent_op_logor integer; -DECLARE agent_op_logor_did integer; -DECLARE agent_op_lognot integer; -DECLARE agent_op_lognot_did integer; -DECLARE agent_op_abs integer; -DECLARE agent_op_abs_did integer; -DECLARE agent_op_lessthan integer; -DECLARE agent_op_lessthan_did integer; -DECLARE agent_op_greaterthan integer; -DECLARE agent_op_greaterthan_did integer; -DECLARE agent_op_lessequal integer; -DECLARE agent_op_lessequal_did integer; -DECLARE agent_op_greaterequal integer; -DECLARE agent_op_greaterequal_did integer; -DECLARE agent_op_notequal integer; -DECLARE agent_op_notequal_did integer; -DECLARE agent_op_equal integer; -DECLARE agent_op_equal_did integer; -DECLARE agent_op_bitshiftleft integer; -DECLARE agent_op_bitshiftleft_did integer; -DECLARE agent_op_bitshiftright integer; -DECLARE agent_op_bitshiftright_did integer; -DECLARE agent_op_stor integer; -DECLARE agent_op_stor_did integer; -DECLARE agent_var_num_rules integer; -DECLARE var_ac_id integer; -DECLARE r_ac_entry_id_1 integer; -DECLARE r_ac_entry_id_2 integer; -DECLARE r_ac_entry_id_3 integer; -DECLARE agent_var_num_rules_did integer; -DECLARE agent_tblt_adms integer; -DECLARE tbl_tnvc_id integer; -DECLARE tnvc_entry integer; -DECLARE agent_tblt_adms_did integer; -DECLARE agent_tblt_variables integer; -DECLARE agent_tblt_variables_did integer; -DECLARE agent_tblt_rptts integer; -DECLARE agent_tblt_rptts_did integer; -DECLARE agent_tblt_macros integer; -DECLARE agent_tblt_macros_did integer; -DECLARE agent_tblt_rules integer; -DECLARE agent_tblt_rules_did integer; -DECLARE agent_tblt_tblts integer; -DECLARE agent_tblt_tblts_did integer; -DECLARE agent_rpttpl_full_report integer; -DECLARE rptt_ac_id integer; -DECLARE r_ac_rpt_entry_1 integer; -DECLARE r_ac_rpt_entry_2 integer; -DECLARE r_ac_rpt_entry_3 integer; -DECLARE r_ac_rpt_entry_4 integer; -DECLARE r_ac_rpt_entry_5 integer; -DECLARE r_ac_rpt_entry_6 integer; -DECLARE r_ac_rpt_entry_7 integer; -DECLARE r_ac_rpt_entry_8 integer; -DECLARE r_ac_rpt_entry_9 integer; -DECLARE r_ac_rpt_entry_10 integer; -DECLARE r_ac_rpt_entry_11 integer; -DECLARE r_ac_rpt_entry_12 integer; -DECLARE r_ac_rpt_entry_13 integer; -DECLARE r_ac_rpt_entry_14 integer; -DECLARE r_ac_rpt_entry_15 integer; -DECLARE r_ac_rpt_entry_16 integer; -DECLARE agent_rpttpl_full_report_did integer; -DECLARE agent_rpttpl_full_report_aid integer; -DECLARE agent_ctrl_add_var integer; -DECLARE fp_spec_id integer; -DECLARE r_fp_ent integer; -DECLARE agent_ctrl_add_var_did integer; -DECLARE agent_ctrl_del_var integer; -DECLARE agent_ctrl_del_var_did integer; -DECLARE agent_ctrl_add_rptt integer; -DECLARE agent_ctrl_add_rptt_did integer; -DECLARE agent_ctrl_del_rptt integer; -DECLARE agent_ctrl_del_rptt_did integer; -DECLARE agent_ctrl_desc_rptt integer; -DECLARE agent_ctrl_desc_rptt_did integer; -DECLARE agent_ctrl_gen_rpts integer; -DECLARE agent_ctrl_gen_rpts_did integer; -DECLARE agent_ctrl_gen_tbls integer; -DECLARE agent_ctrl_gen_tbls_did integer; -DECLARE agent_ctrl_add_macro integer; -DECLARE agent_ctrl_add_macro_did integer; -DECLARE agent_ctrl_del_macro integer; -DECLARE agent_ctrl_del_macro_did integer; -DECLARE agent_ctrl_desc_macro integer; -DECLARE agent_ctrl_desc_macro_did integer; -DECLARE agent_ctrl_add_tbr integer; -DECLARE agent_ctrl_add_tbr_did integer; -DECLARE agent_ctrl_add_sbr integer; -DECLARE agent_ctrl_add_sbr_did integer; -DECLARE agent_ctrl_del_rule integer; -DECLARE agent_ctrl_del_rule_did integer; -DECLARE agent_ctrl_desc_rule integer; -DECLARE agent_ctrl_desc_rule_did integer; -DECLARE agent_ctrl_store_var integer; -DECLARE agent_ctrl_store_var_did integer; -DECLARE agent_ctrl_reset_counts integer; -DECLARE agent_ctrl_reset_counts_did integer; -DECLARE agent_cnst_amp_epoch integer; -DECLARE agent_cnst_amp_epoch_did integer; --- #META -DECLARE agent_meta_name integer; -DECLARE agent_meta_name_did integer; -DECLARE agent_meta_namespace_did integer; -DECLARE agent_meta_namespace integer; -BEGIN -CALL SP__insert_adm_defined_namespace('JHUAPL', 'Amp/Agent', 'v3.1', 'amp_agent', adm_enum, NULL, 'The namespace of the ADM.', amp_namespace_id); -CALL SP__insert_obj_metadata(0, 'name', amp_namespace_id, agent_meta_name); -CALL SP__insert_const_actual_definition(agent_meta_name, 'The human-readable name of the ADM.', 'STR', 'amp_agent', agent_meta_name_did); - - -CALL SP__insert_obj_metadata(0, 'namespace', amp_namespace_id, agent_meta_namespace); -CALL SP__insert_const_actual_definition(agent_meta_namespace, 'The namespace of the ADM.', 'STR', 'Amp/Agent', agent_meta_namespace_did); - -CALL SP__insert_obj_metadata(0, 'version', amp_namespace_id, agent_meta_version); -CALL SP__insert_const_actual_definition(agent_meta_version, 'The version of the ADM.', 'STR', 'v3.1', agent_meta_version_did); - -CALL SP__insert_obj_metadata(0, 'organization', amp_namespace_id, agent_meta_organization); -CALL SP__insert_const_actual_definition(agent_meta_organization, 'The name of the issuing organization of the ADM.', 'STR', 'JHUAPL', agent_meta_organization_did); - --- #EDD -CALL SP__insert_obj_metadata(2, 'num_rpt_tpls', amp_namespace_id, agent_edd_num_rpt_tpls); -CALL SP__insert_edd_formal_definition(agent_edd_num_rpt_tpls, 'This is the number of report templates known to the Agent.', NULL, 'UINT', agent_edd_num_rpt_tpls_did); -CALL SP__insert_edd_actual_definition(agent_edd_num_rpt_tpls, 'The singleton value for num_rpt_tpls', NULL, agent_edd_num_rpt_tpls_aid); - -CALL SP__insert_obj_metadata(2, 'num_tbl_tpls', amp_namespace_id, agent_edd_num_tbl_tpls); -CALL SP__insert_edd_formal_definition(agent_edd_num_tbl_tpls, 'This is the number of table templates known to the Agent.', NULL, 'UINT', agent_edd_num_tbl_tpls_did); -CALL SP__insert_edd_actual_definition(agent_edd_num_tbl_tpls, 'The singleton value for num_tbl_tpls', NULL, agent_edd_num_tbl_tpls_aid); - -CALL SP__insert_obj_metadata(2, 'sent_reports', amp_namespace_id, agent_edd_sent_reports); -CALL SP__insert_edd_formal_definition(agent_edd_sent_reports, 'This is the number of reports sent by the agent.', NULL, 'UINT', agent_edd_sent_reports_did); -CALL SP__insert_edd_actual_definition(agent_edd_sent_reports, 'The singleton value for sent_reports', NULL, agent_edd_sent_reports_aid); - -CALL SP__insert_obj_metadata(2, 'num_tbr', amp_namespace_id, agent_edd_num_tbr); -CALL SP__insert_edd_formal_definition(agent_edd_num_tbr, 'This is the number of time-based rules running on the agent.', NULL, 'UINT', agent_edd_num_tbr_did); -CALL SP__insert_edd_actual_definition(agent_edd_num_tbr, 'The singleton value for num_tbr', NULL, agent_edd_num_tbr_aid); - -CALL SP__insert_obj_metadata(2, 'run_tbr', amp_namespace_id, agent_edd_run_tbr); -CALL SP__insert_edd_formal_definition(agent_edd_run_tbr, 'This is the number of time-based rules run by the agent since the last reset.', NULL, 'UINT', agent_edd_run_tbr_did); -CALL SP__insert_edd_actual_definition(agent_edd_run_tbr, 'The singleton value for run_tbr', NULL, agent_edd_run_tbr_aid); - -CALL SP__insert_obj_metadata(2, 'num_sbr', amp_namespace_id, agent_edd_num_sbr); -CALL SP__insert_edd_formal_definition(agent_edd_num_sbr, 'This is the number of state-based rules running on the agent.', NULL, 'UINT', agent_edd_num_sbr_did); -CALL SP__insert_edd_actual_definition(agent_edd_num_sbr, 'The singleton value for num_sbr', NULL, agent_edd_num_sbr_aid); - -CALL SP__insert_obj_metadata(2, 'run_sbr', amp_namespace_id, agent_edd_run_sbr); -CALL SP__insert_edd_formal_definition(agent_edd_run_sbr, 'This is the number of state-based rules run by the agent since the last reset.', NULL, 'UINT', agent_edd_run_sbr_did); -CALL SP__insert_edd_actual_definition(agent_edd_run_sbr, 'The singleton value for run_sbr', NULL, agent_edd_run_sbr_aid); - -CALL SP__insert_obj_metadata(2, 'num_const', amp_namespace_id, agent_edd_num_const); -CALL SP__insert_edd_formal_definition(agent_edd_num_const, 'This is the number of constants known by the agent.', NULL, 'UINT', agent_edd_num_const_did); -CALL SP__insert_edd_actual_definition(agent_edd_num_const, 'The singleton value for num_const', NULL, agent_edd_num_const_aid); - -CALL SP__insert_obj_metadata(2, 'num_var', amp_namespace_id, agent_edd_num_var); -CALL SP__insert_edd_formal_definition(agent_edd_num_var, 'This is the number of variables known by the agent.', NULL, 'UINT', agent_edd_num_var_did); -CALL SP__insert_edd_actual_definition(agent_edd_num_var, 'The singleton value for num_var', NULL, agent_edd_num_var_aid); - -CALL SP__insert_obj_metadata(2, 'num_macros', amp_namespace_id, agent_edd_num_macros); -CALL SP__insert_edd_formal_definition(agent_edd_num_macros, 'This is the number of macros known by the agent.', NULL, 'UINT', agent_edd_num_macros_did); -CALL SP__insert_edd_actual_definition(agent_edd_num_macros, 'The singleton value for num_macros', NULL, agent_edd_num_macros_aid); - -CALL SP__insert_obj_metadata(2, 'run_macros', amp_namespace_id, agent_edd_run_macros); -CALL SP__insert_edd_formal_definition(agent_edd_run_macros, 'This is the number of macros run by the agent since the last reset.', NULL, 'UINT', agent_edd_run_macros_did); -CALL SP__insert_edd_actual_definition(agent_edd_run_macros, 'The singleton value for run_macros', NULL, agent_edd_run_macros_aid); - -CALL SP__insert_obj_metadata(2, 'num_controls', amp_namespace_id, agent_edd_num_controls); -CALL SP__insert_edd_formal_definition(agent_edd_num_controls, 'This is the number of controls known by the agent.', NULL, 'UINT', agent_edd_num_controls_did); -CALL SP__insert_edd_actual_definition(agent_edd_num_controls, 'The singleton value for num_controls', NULL, agent_edd_num_controls_aid); - -CALL SP__insert_obj_metadata(2, 'run_controls', amp_namespace_id, agent_edd_run_controls); -CALL SP__insert_edd_formal_definition(agent_edd_run_controls, 'This is the number of controls run by the agent since the last reset.', NULL, 'UINT', agent_edd_run_controls_did); -CALL SP__insert_edd_actual_definition(agent_edd_run_controls, 'The singleton value for run_controls', NULL, agent_edd_run_controls_aid); - -CALL SP__insert_obj_metadata(2, 'cur_time', amp_namespace_id, agent_edd_cur_time); -CALL SP__insert_edd_formal_definition(agent_edd_cur_time, 'This is the current system time.', NULL, 'TV', agent_edd_cur_time_did); -CALL SP__insert_edd_actual_definition(agent_edd_cur_time, 'The singleton value for cur_time', NULL, agent_edd_cur_time_aid); - --- #OPER -CALL SP__insert_obj_metadata(5, 'plusINT', amp_namespace_id, agent_op_plusint); -CALL SP__insert_tnvc_collection('operands for plusINT', op_tnvc_id); -CALL SP__insert_tnvc_int_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_int_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_plusint, 'Int32 addition', 'INT', 2, op_tnvc_id, agent_op_plusint_did); - -CALL SP__insert_obj_metadata(5, 'plusUINT', amp_namespace_id, agent_op_plusuint); -CALL SP__insert_tnvc_collection('operands for plusUINT', op_tnvc_id); -CALL SP__insert_tnvc_uint_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_uint_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_plusuint, 'Unsigned Int32 addition', 'UINT', 2, op_tnvc_id, agent_op_plusuint_did); - -CALL SP__insert_obj_metadata(5, 'plusVAST', amp_namespace_id, agent_op_plusvast); -CALL SP__insert_tnvc_collection('operands for plusVAST', op_tnvc_id); -CALL SP__insert_tnvc_vast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_vast_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_plusvast, 'Int64 addition', 'VAST', 2, op_tnvc_id, agent_op_plusvast_did); - -CALL SP__insert_obj_metadata(5, 'plusUVAST', amp_namespace_id, agent_op_plusuvast); -CALL SP__insert_tnvc_collection('operands for plusUVAST', op_tnvc_id); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_plusuvast, 'Unsigned Int64 addition', 'UVAST', 2, op_tnvc_id, agent_op_plusuvast_did); - -CALL SP__insert_obj_metadata(5, 'plusREAL32', amp_namespace_id, agent_op_plusreal32); -CALL SP__insert_tnvc_collection('operands for plusREAL32', op_tnvc_id); -CALL SP__insert_tnvc_real32_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_real32_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_plusreal32, 'Real32 addition', 'REAL32', 2, op_tnvc_id, agent_op_plusreal32_did); - -CALL SP__insert_obj_metadata(5, 'plusREAL64', amp_namespace_id, agent_op_plusreal64); -CALL SP__insert_tnvc_collection('operands for plusREAL64', op_tnvc_id); -CALL SP__insert_tnvc_real64_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_real64_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_plusreal64, 'Real64 addition', 'REAL64', 2, op_tnvc_id, agent_op_plusreal64_did); - -CALL SP__insert_obj_metadata(5, 'minusINT', amp_namespace_id, agent_op_minusint); -CALL SP__insert_tnvc_collection('operands for minusINT', op_tnvc_id); -CALL SP__insert_tnvc_int_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_int_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_minusint, 'Int32 subtraction', 'INT', 2, op_tnvc_id, agent_op_minusint_did); - -CALL SP__insert_obj_metadata(5, 'minusUINT', amp_namespace_id, agent_op_minusuint); -CALL SP__insert_tnvc_collection('operands for minusUINT', op_tnvc_id); -CALL SP__insert_tnvc_uint_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_uint_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_minusuint, 'Unsigned Int32 subtraction', 'UINT', 2, op_tnvc_id, agent_op_minusuint_did); - -CALL SP__insert_obj_metadata(5, 'minusVAST', amp_namespace_id, agent_op_minusvast); -CALL SP__insert_tnvc_collection('operands for minusVAST', op_tnvc_id); -CALL SP__insert_tnvc_vast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_vast_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_minusvast, 'Int64 subtraction', 'VAST', 2, op_tnvc_id, agent_op_minusvast_did); - -CALL SP__insert_obj_metadata(5, 'minusUVAST', amp_namespace_id, agent_op_minusuvast); -CALL SP__insert_tnvc_collection('operands for minusUVAST', op_tnvc_id); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_minusuvast, 'Unsigned Int64 subtraction', 'UVAST', 2, op_tnvc_id, agent_op_minusuvast_did); - -CALL SP__insert_obj_metadata(5, 'minusREAL32', amp_namespace_id, agent_op_minusreal32); -CALL SP__insert_tnvc_collection('operands for minusREAL32', op_tnvc_id); -CALL SP__insert_tnvc_real32_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_real32_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_minusreal32, 'Real32 subtraction', 'REAL32', 2, op_tnvc_id, agent_op_minusreal32_did); - -CALL SP__insert_obj_metadata(5, 'minusREAL64', amp_namespace_id, agent_op_minusreal64); -CALL SP__insert_tnvc_collection('operands for minusREAL64', op_tnvc_id); -CALL SP__insert_tnvc_real64_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_real64_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_minusreal64, 'Real64 subtraction', 'REAL64', 2, op_tnvc_id, agent_op_minusreal64_did); - -CALL SP__insert_obj_metadata(5, 'multINT', amp_namespace_id, agent_op_multint); -CALL SP__insert_tnvc_collection('operands for multINT', op_tnvc_id); -CALL SP__insert_tnvc_int_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_int_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_multint, 'Int32 multiplication', 'INT', 2, op_tnvc_id, agent_op_multint_did); - -CALL SP__insert_obj_metadata(5, 'multUINT', amp_namespace_id, agent_op_multuint); -CALL SP__insert_tnvc_collection('operands for multUINT', op_tnvc_id); -CALL SP__insert_tnvc_uint_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_uint_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_multuint, 'Unsigned Int32 multiplication', 'UINT', 2, op_tnvc_id, agent_op_multuint_did); - -CALL SP__insert_obj_metadata(5, 'multVAST', amp_namespace_id, agent_op_multvast); -CALL SP__insert_tnvc_collection('operands for multVAST', op_tnvc_id); -CALL SP__insert_tnvc_vast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_vast_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_multvast, 'Int64 multiplication', 'VAST', 2, op_tnvc_id, agent_op_multvast_did); - -CALL SP__insert_obj_metadata(5, 'multUVAST', amp_namespace_id, agent_op_multuvast); -CALL SP__insert_tnvc_collection('operands for multUVAST', op_tnvc_id); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_multuvast, 'Unsigned Int64 multiplication', 'UVAST', 2, op_tnvc_id, agent_op_multuvast_did); - -CALL SP__insert_obj_metadata(5, 'multREAL32', amp_namespace_id, agent_op_multreal32); -CALL SP__insert_tnvc_collection('operands for multREAL32', op_tnvc_id); -CALL SP__insert_tnvc_real32_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_real32_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_multreal32, 'Real32 multiplication', 'REAL32', 2, op_tnvc_id, agent_op_multreal32_did); - -CALL SP__insert_obj_metadata(5, 'multREAL64', amp_namespace_id, agent_op_multreal64); -CALL SP__insert_tnvc_collection('operands for multREAL64', op_tnvc_id); -CALL SP__insert_tnvc_real64_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_real64_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_multreal64, 'Real64 multiplication', 'REAL64', 2, op_tnvc_id, agent_op_multreal64_did); - -CALL SP__insert_obj_metadata(5, 'divINT', amp_namespace_id, agent_op_divint); -CALL SP__insert_tnvc_collection('operands for divINT', op_tnvc_id); -CALL SP__insert_tnvc_int_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_int_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_divint, 'Int32 division', 'INT', 2, op_tnvc_id, agent_op_divint_did); - -CALL SP__insert_obj_metadata(5, 'divUINT', amp_namespace_id, agent_op_divuint); -CALL SP__insert_tnvc_collection('operands for divUINT', op_tnvc_id); -CALL SP__insert_tnvc_uint_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_uint_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_divuint, 'Unsigned Int32 division', 'UINT', 2, op_tnvc_id, agent_op_divuint_did); - -CALL SP__insert_obj_metadata(5, 'divVAST', amp_namespace_id, agent_op_divvast); -CALL SP__insert_tnvc_collection('operands for divVAST', op_tnvc_id); -CALL SP__insert_tnvc_vast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_vast_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_divvast, 'Int64 division', 'VAST', 2, op_tnvc_id, agent_op_divvast_did); - -CALL SP__insert_obj_metadata(5, 'divUVAST', amp_namespace_id, agent_op_divuvast); -CALL SP__insert_tnvc_collection('operands for divUVAST', op_tnvc_id); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_divuvast, 'Unsigned Int64 division', 'UVAST', 2, op_tnvc_id, agent_op_divuvast_did); - -CALL SP__insert_obj_metadata(5, 'divREAL32', amp_namespace_id, agent_op_divreal32); -CALL SP__insert_tnvc_collection('operands for divREAL32', op_tnvc_id); -CALL SP__insert_tnvc_real32_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_real32_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_divreal32, 'Real32 division', 'REAL32', 2, op_tnvc_id, agent_op_divreal32_did); - -CALL SP__insert_obj_metadata(5, 'divREAL64', amp_namespace_id, agent_op_divreal64); -CALL SP__insert_tnvc_collection('operands for divREAL64', op_tnvc_id); -CALL SP__insert_tnvc_real64_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_real64_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_divreal64, 'Real64 division', 'REAL64', 2, op_tnvc_id, agent_op_divreal64_did); - -CALL SP__insert_obj_metadata(5, 'modINT', amp_namespace_id, agent_op_modint); -CALL SP__insert_tnvc_collection('operands for modINT', op_tnvc_id); -CALL SP__insert_tnvc_int_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_int_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_modint, 'Int32 modulus division', 'INT', 2, op_tnvc_id, agent_op_modint_did); - -CALL SP__insert_obj_metadata(5, 'modUINT', amp_namespace_id, agent_op_moduint); -CALL SP__insert_tnvc_collection('operands for modUINT', op_tnvc_id); -CALL SP__insert_tnvc_uint_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_uint_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_moduint, 'Unsigned Int32 modulus division', 'UINT', 2, op_tnvc_id, agent_op_moduint_did); - -CALL SP__insert_obj_metadata(5, 'modVAST', amp_namespace_id, agent_op_modvast); -CALL SP__insert_tnvc_collection('operands for modVAST', op_tnvc_id); -CALL SP__insert_tnvc_vast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_vast_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_modvast, 'Int64 modulus division', 'VAST', 2, op_tnvc_id, agent_op_modvast_did); - -CALL SP__insert_obj_metadata(5, 'modUVAST', amp_namespace_id, agent_op_moduvast); -CALL SP__insert_tnvc_collection('operands for modUVAST', op_tnvc_id); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_moduvast, 'Unsigned Int64 modulus division', 'UVAST', 2, op_tnvc_id, agent_op_moduvast_did); - -CALL SP__insert_obj_metadata(5, 'modREAL32', amp_namespace_id, agent_op_modreal32); -CALL SP__insert_tnvc_collection('operands for modREAL32', op_tnvc_id); -CALL SP__insert_tnvc_real32_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_real32_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_modreal32, 'Real32 modulus division', 'REAL32', 2, op_tnvc_id, agent_op_modreal32_did); - -CALL SP__insert_obj_metadata(5, 'modREAL64', amp_namespace_id, agent_op_modreal64); -CALL SP__insert_tnvc_collection('operands for modREAL64', op_tnvc_id); -CALL SP__insert_tnvc_real64_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_real64_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_modreal64, 'Real64 modulus division', 'REAL64', 2, op_tnvc_id, agent_op_modreal64_did); - -CALL SP__insert_obj_metadata(5, 'expINT', amp_namespace_id, agent_op_expint); -CALL SP__insert_tnvc_collection('operands for expINT', op_tnvc_id); -CALL SP__insert_tnvc_int_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_int_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_expint, 'Int32 exponentiation', 'INT', 2, op_tnvc_id, agent_op_expint_did); - -CALL SP__insert_obj_metadata(5, 'expUINT', amp_namespace_id, agent_op_expuint); -CALL SP__insert_tnvc_collection('operands for expUINT', op_tnvc_id); -CALL SP__insert_tnvc_uint_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_uint_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_expuint, 'Unsigned int32 exponentiation', 'UINT', 2, op_tnvc_id, agent_op_expuint_did); - -CALL SP__insert_obj_metadata(5, 'expVAST', amp_namespace_id, agent_op_expvast); -CALL SP__insert_tnvc_collection('operands for expVAST', op_tnvc_id); -CALL SP__insert_tnvc_vast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_vast_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_expvast, 'Int64 exponentiation', 'VAST', 2, op_tnvc_id, agent_op_expvast_did); - -CALL SP__insert_obj_metadata(5, 'expUVAST', amp_namespace_id, agent_op_expuvast); -CALL SP__insert_tnvc_collection('operands for expUVAST', op_tnvc_id); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_expuvast, 'Unsigned Int64 exponentiation', 'UVAST', 2, op_tnvc_id, agent_op_expuvast_did); - -CALL SP__insert_obj_metadata(5, 'expREAL32', amp_namespace_id, agent_op_expreal32); -CALL SP__insert_tnvc_collection('operands for expREAL32', op_tnvc_id); -CALL SP__insert_tnvc_real32_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_real32_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_expreal32, 'Real32 exponentiation', 'REAL32', 2, op_tnvc_id, agent_op_expreal32_did); - -CALL SP__insert_obj_metadata(5, 'expREAL64', amp_namespace_id, agent_op_expreal64); -CALL SP__insert_tnvc_collection('operands for expREAL64', op_tnvc_id); -CALL SP__insert_tnvc_real64_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_real64_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_expreal64, 'Real64 exponentiation', 'REAL64', 2, op_tnvc_id, agent_op_expreal64_did); - -CALL SP__insert_obj_metadata(5, 'bitAND', amp_namespace_id, agent_op_bitand); -CALL SP__insert_tnvc_collection('operands for bitAND', op_tnvc_id); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_bitand, 'Bitwise and', 'UVAST', 2, op_tnvc_id, agent_op_bitand_did); - -CALL SP__insert_obj_metadata(5, 'bitOR', amp_namespace_id, agent_op_bitor); -CALL SP__insert_tnvc_collection('operands for bitOR', op_tnvc_id); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_bitor, 'Bitwise or', 'UVAST', 2, op_tnvc_id, agent_op_bitor_did); - -CALL SP__insert_obj_metadata(5, 'bitXOR', amp_namespace_id, agent_op_bitxor); -CALL SP__insert_tnvc_collection('operands for bitXOR', op_tnvc_id); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_bitxor, 'Bitwise xor', 'UVAST', 2, op_tnvc_id, agent_op_bitxor_did); - -CALL SP__insert_obj_metadata(5, 'bitNOT', amp_namespace_id, agent_op_bitnot); -CALL SP__insert_tnvc_collection('operands for bitNOT', op_tnvc_id); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_operator_actual_definition(agent_op_bitnot, 'Bitwise not', 'UVAST', 1, op_tnvc_id, agent_op_bitnot_did); - -CALL SP__insert_obj_metadata(5, 'logAND', amp_namespace_id, agent_op_logand); -CALL SP__insert_tnvc_collection('operands for logAND', op_tnvc_id); -CALL SP__insert_tnvc_bool_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_bool_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_logand, 'Logical and', 'BOOL', 2, op_tnvc_id, agent_op_logand_did); - -CALL SP__insert_obj_metadata(5, 'logOR', amp_namespace_id, agent_op_logor); -CALL SP__insert_tnvc_collection('operands for logOR', op_tnvc_id); -CALL SP__insert_tnvc_bool_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_bool_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_logor, 'Logical or', 'BOOL', 2, op_tnvc_id, agent_op_logor_did); - -CALL SP__insert_obj_metadata(5, 'logNOT', amp_namespace_id, agent_op_lognot); -CALL SP__insert_tnvc_collection('operands for logNOT', op_tnvc_id); -CALL SP__insert_tnvc_bool_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_operator_actual_definition(agent_op_lognot, 'Logical not', 'BOOL', 1, op_tnvc_id, agent_op_lognot_did); - -CALL SP__insert_obj_metadata(5, 'abs', amp_namespace_id, agent_op_abs); -CALL SP__insert_tnvc_collection('operands for abs', op_tnvc_id); -CALL SP__insert_tnvc_vast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_operator_actual_definition(agent_op_abs, 'absolute value', 'UVAST', 1, op_tnvc_id, agent_op_abs_did); - -CALL SP__insert_obj_metadata(5, 'lessThan', amp_namespace_id, agent_op_lessthan); -CALL SP__insert_tnvc_collection('operands for lessThan', op_tnvc_id); -CALL SP__insert_tnvc_unk_entry(op_tnvc_id, 1, null, tnvc_entry1); -CALL SP__insert_tnvc_unk_entry(op_tnvc_id, 2, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_lessthan, '<', 'BOOL', 2, op_tnvc_id, agent_op_lessthan_did); - -CALL SP__insert_obj_metadata(5, 'greaterThan', amp_namespace_id, agent_op_greaterthan); -CALL SP__insert_tnvc_collection('operands for greaterThan', op_tnvc_id); -CALL SP__insert_tnvc_unk_entry(op_tnvc_id, 1, null, tnvc_entry1); -CALL SP__insert_tnvc_unk_entry(op_tnvc_id, 2, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_greaterthan, '>', 'BOOL', 2, op_tnvc_id, agent_op_greaterthan_did); - -CALL SP__insert_obj_metadata(5, 'lessEqual', amp_namespace_id, agent_op_lessequal); -CALL SP__insert_tnvc_collection('operands for lessEqual', op_tnvc_id); -CALL SP__insert_tnvc_unk_entry(op_tnvc_id, 1, null, tnvc_entry1); -CALL SP__insert_tnvc_unk_entry(op_tnvc_id, 2, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_lessequal, '<=', 'BOOL', 2, op_tnvc_id, agent_op_lessequal_did); - -CALL SP__insert_obj_metadata(5, 'greaterEqual', amp_namespace_id, agent_op_greaterequal); -CALL SP__insert_tnvc_collection('operands for greaterEqual', op_tnvc_id); -CALL SP__insert_tnvc_unk_entry(op_tnvc_id, 1, null, tnvc_entry1); -CALL SP__insert_tnvc_unk_entry(op_tnvc_id, 2, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_greaterequal, '>=', 'BOOL', 2, op_tnvc_id, agent_op_greaterequal_did); - -CALL SP__insert_obj_metadata(5, 'notEqual', amp_namespace_id, agent_op_notequal); -CALL SP__insert_tnvc_collection('operands for notEqual', op_tnvc_id); -CALL SP__insert_tnvc_unk_entry(op_tnvc_id, 1, null, tnvc_entry1); -CALL SP__insert_tnvc_unk_entry(op_tnvc_id, 2, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_notequal, '!=', 'BOOL', 2, op_tnvc_id, agent_op_notequal_did); - -CALL SP__insert_obj_metadata(5, 'Equal', amp_namespace_id, agent_op_equal); -CALL SP__insert_tnvc_collection('operands for Equal', op_tnvc_id); -CALL SP__insert_tnvc_unk_entry(op_tnvc_id, 1, null, tnvc_entry1); -CALL SP__insert_tnvc_unk_entry(op_tnvc_id, 2, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_equal, '==', 'BOOL', 2, op_tnvc_id, agent_op_equal_did); - -CALL SP__insert_obj_metadata(5, 'bitShiftLeft', amp_namespace_id, agent_op_bitshiftleft); -CALL SP__insert_tnvc_collection('operands for bitShiftLeft', op_tnvc_id); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_bitshiftleft, '<<', 'UVAST', 2, op_tnvc_id, agent_op_bitshiftleft_did); - -CALL SP__insert_obj_metadata(5, 'bitShiftRight', amp_namespace_id, agent_op_bitshiftright); -CALL SP__insert_tnvc_collection('operands for bitShiftRight', op_tnvc_id); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 1, null, null, tnvc_entry1); -CALL SP__insert_tnvc_uvast_entry(op_tnvc_id, 2, null, null, tnvc_entry2); -CALL SP__insert_operator_actual_definition(agent_op_bitshiftright, '>>', 'UVAST', 2, op_tnvc_id, agent_op_bitshiftright_did); - -CALL SP__insert_obj_metadata(5, 'STOR', amp_namespace_id, agent_op_stor); -CALL SP__insert_tnvc_collection('operands for STOR', op_tnvc_id); -CALL SP__insert_tnvc_unk_entry(op_tnvc_id, 1, null, tnvc_entry1); -CALL SP__insert_tnvc_unk_entry(op_tnvc_id, 2, null, tnvc_entry2); --- CALL SP__insert_operator_actual_definition(agent_op_stor, 'Store value of parm 2 in parm 1', 'UNK', 2, op_tnvc_id, agent_op_stor_did); - - --- #VAR -raise notice 'Value: %',agent_edd_num_tbr_did; --- create ac for expression -CALL SP__insert_ac_id(3, 'ac for the expression used by agent_var_num_rules', var_ac_id); -CALL SP__insert_ac_actual_entry(var_ac_id, agent_edd_num_tbr_aid, 1, r_ac_entry_id_1 ); -CALL SP__insert_ac_actual_entry(var_ac_id, agent_edd_num_sbr_aid, 2, r_ac_entry_id_2 ); -CALL SP__insert_ac_actual_entry(var_ac_id, agent_op_plusuint_did, 3, r_ac_entry_id_3 ); -CALL SP__insert_obj_metadata(12, 'num_rules', amp_namespace_id, agent_var_num_rules); -CALL SP__insert_variable_definition(agent_var_num_rules, 'This is the number of rules known to the Agent (#TBR + #SBR).', 20, var_ac_id, agent_var_num_rules_did); - --- #TBLT -CALL SP__insert_obj_metadata(10, 'adms', amp_namespace_id, agent_tblt_adms); -CALL SP__insert_tnvc_collection('columns for the adms table', tbl_tnvc_id); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 1, 'adm_name', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(agent_tblt_adms, 'This table lists all the adms that are supported by the agent.', tbl_tnvc_id, agent_tblt_adms_did); - -CALL SP__insert_obj_metadata(10, 'variables', amp_namespace_id, agent_tblt_variables); -CALL SP__insert_tnvc_collection('columns for the variables table', tbl_tnvc_id); -CALL SP__insert_tnvc_ari_entry(tbl_tnvc_id, 1, 'ids', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(agent_tblt_variables, 'This table lists the ARI for every variable that is known to the agent.', tbl_tnvc_id, agent_tblt_variables_did); - -CALL SP__insert_obj_metadata(10, 'rptts', amp_namespace_id, agent_tblt_rptts); -CALL SP__insert_tnvc_collection('columns for the rptts table', tbl_tnvc_id); -CALL SP__insert_tnvc_ari_entry(tbl_tnvc_id, 1, 'ids', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(agent_tblt_rptts, 'This table lists the ARI for every report template that is known to the agent.', tbl_tnvc_id, agent_tblt_rptts_did); - -CALL SP__insert_obj_metadata(10, 'macros', amp_namespace_id, agent_tblt_macros); -CALL SP__insert_tnvc_collection('columns for the macros table', tbl_tnvc_id); -CALL SP__insert_tnvc_ari_entry(tbl_tnvc_id, 1, 'ids', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(agent_tblt_macros, 'This table lists the ARI for every macro that is known to the agent.', tbl_tnvc_id, agent_tblt_macros_did); - -CALL SP__insert_obj_metadata(10, 'rules', amp_namespace_id, agent_tblt_rules); -CALL SP__insert_tnvc_collection('columns for the rules table', tbl_tnvc_id); -CALL SP__insert_tnvc_ari_entry(tbl_tnvc_id, 1, 'ids', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(agent_tblt_rules, 'This table lists the ARI for every rule that is known to the agent.', tbl_tnvc_id, agent_tblt_rules_did); - -CALL SP__insert_obj_metadata(10, 'tblts', amp_namespace_id, agent_tblt_tblts); -CALL SP__insert_tnvc_collection('columns for the tblts table', tbl_tnvc_id); -CALL SP__insert_tnvc_ari_entry(tbl_tnvc_id, 1, 'ids', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(agent_tblt_tblts, 'This table lists the ARI for every table template that is known to the agent.', tbl_tnvc_id, agent_tblt_tblts_did); - - --- #RPTT - -CALL SP__insert_obj_metadata(7, 'full_report', amp_namespace_id, agent_rpttpl_full_report); - -CALL SP__insert_ac_id(16, 'ac for report template full_report', rptt_ac_id); -CALL SP__insert_ac_actual_entry(rptt_ac_id, agent_meta_name_did, 1, r_ac_rpt_entry_1); -CALL SP__insert_ac_actual_entry(rptt_ac_id, agent_meta_version_did, 2, r_ac_rpt_entry_2); -CALL SP__insert_ac_actual_entry(rptt_ac_id, agent_edd_num_rpt_tpls_aid, 3, r_ac_rpt_entry_3); -CALL SP__insert_ac_actual_entry(rptt_ac_id, agent_edd_num_tbl_tpls_aid, 4, r_ac_rpt_entry_4); -CALL SP__insert_ac_actual_entry(rptt_ac_id, agent_edd_sent_reports_aid, 5, r_ac_rpt_entry_5); -CALL SP__insert_ac_actual_entry(rptt_ac_id, agent_edd_num_tbr_aid, 6, r_ac_rpt_entry_6); -CALL SP__insert_ac_actual_entry(rptt_ac_id, agent_edd_run_tbr_aid, 7, r_ac_rpt_entry_7); -CALL SP__insert_ac_actual_entry(rptt_ac_id, agent_edd_num_sbr_aid, 8, r_ac_rpt_entry_8); -CALL SP__insert_ac_actual_entry(rptt_ac_id, agent_edd_run_sbr_aid, 9, r_ac_rpt_entry_9); -CALL SP__insert_ac_actual_entry(rptt_ac_id, agent_edd_num_const_aid, 10, r_ac_rpt_entry_10); -CALL SP__insert_ac_actual_entry(rptt_ac_id, agent_edd_num_var_aid, 11, r_ac_rpt_entry_11); -CALL SP__insert_ac_actual_entry(rptt_ac_id, agent_edd_num_macros_aid, 12, r_ac_rpt_entry_12); -CALL SP__insert_ac_actual_entry(rptt_ac_id, agent_edd_run_macros_aid, 13, r_ac_rpt_entry_13); -CALL SP__insert_ac_actual_entry(rptt_ac_id, agent_edd_num_controls_aid, 14, r_ac_rpt_entry_14); -CALL SP__insert_ac_actual_entry(rptt_ac_id, agent_edd_run_controls_aid, 15, r_ac_rpt_entry_15); -CALL SP__insert_ac_actual_entry(rptt_ac_id, agent_var_num_rules_did, 16, r_ac_rpt_entry_16); - -CALL SP__insert_report_template_formal_definition(agent_rpttpl_full_report, 'This is all known meta-data, EDD, and VAR values known by the agent.', null, rptt_ac_id, agent_rpttpl_full_report_did); -CALL SP__insert_report_actual_definition(agent_rpttpl_full_report, null, null, 'Singleton value for full_report', agent_rpttpl_full_report_aid); - --- #CTRL -CALL SP__insert_obj_metadata(1, 'add_var', amp_namespace_id, agent_ctrl_add_var); -CALL SP__insert_formal_parmspec(3, 'parms for the add_var control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'id', 'ARI', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'def', 'EXPR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'type', 'BYTE', null, r_fp_ent); -CALL SP__insert_control_formal_definition(agent_ctrl_add_var , 'This control configures a new variable definition on the Agent.', fp_spec_id, agent_ctrl_add_var_did); - -CALL SP__insert_obj_metadata(1, 'del_var', amp_namespace_id, agent_ctrl_del_var); -CALL SP__insert_formal_parmspec(1, 'parms for the del_var control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'ids', 'AC', null, r_fp_ent); -CALL SP__insert_control_formal_definition(agent_ctrl_del_var , 'This control removes one or more variable definitions from the Agent.', fp_spec_id, agent_ctrl_del_var_did); - -CALL SP__insert_obj_metadata(1, 'add_rptt', amp_namespace_id, agent_ctrl_add_rptt); -CALL SP__insert_formal_parmspec(2, 'parms for the add_rptt control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'id', 'ARI', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'template', 'AC', null, r_fp_ent); -CALL SP__insert_control_formal_definition(agent_ctrl_add_rptt , 'This control configures a new report template definition on the Agent.', fp_spec_id, agent_ctrl_add_rptt_did); - -CALL SP__insert_obj_metadata(1, 'del_rptt', amp_namespace_id, agent_ctrl_del_rptt); -CALL SP__insert_formal_parmspec(1, 'parms for the del_rptt control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'ids', 'AC', null, r_fp_ent); -CALL SP__insert_control_formal_definition(agent_ctrl_del_rptt , 'This control removes one or more report template definitions from the Agent.', fp_spec_id, agent_ctrl_del_rptt_did); - -CALL SP__insert_obj_metadata(1, 'desc_rptt', amp_namespace_id, agent_ctrl_desc_rptt); -CALL SP__insert_formal_parmspec(1, 'parms for the desc_rptt control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'ids', 'AC', null, r_fp_ent); -CALL SP__insert_control_formal_definition(agent_ctrl_desc_rptt , 'This control produces a detailed description of one or more report template identifier(ARI) known to the Agent.', fp_spec_id, agent_ctrl_desc_rptt_did); - -CALL SP__insert_obj_metadata(1, 'gen_rpts', amp_namespace_id, agent_ctrl_gen_rpts); -CALL SP__insert_formal_parmspec(2, 'parms for the gen_rpts control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'ids', 'AC', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'rxmgrs', 'TNVC', null, r_fp_ent); -CALL SP__insert_control_formal_definition(agent_ctrl_gen_rpts , 'This control causes the Agent to produce a report entry for each identified report templates and send them to one or more identified managers(ARIs).', fp_spec_id, agent_ctrl_gen_rpts_did); - -CALL SP__insert_obj_metadata(1, 'gen_tbls', amp_namespace_id, agent_ctrl_gen_tbls); -CALL SP__insert_formal_parmspec(2, 'parms for the gen_tbls control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'ids', 'AC', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'rxmgrs', 'TNVC', null, r_fp_ent); -CALL SP__insert_control_formal_definition(agent_ctrl_gen_tbls , 'This control causes the Agent to produce a table for each identified table templates and send them to one or more identified managers(ARIs).', fp_spec_id, agent_ctrl_gen_tbls_did); - -CALL SP__insert_obj_metadata(1, 'add_macro', amp_namespace_id, agent_ctrl_add_macro); -CALL SP__insert_formal_parmspec(3, 'parms for the add_macro control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'id', 'ARI', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'def', 'AC', null, r_fp_ent); -CALL SP__insert_control_formal_definition(agent_ctrl_add_macro , 'This control configures a new macro definition on the Agent.', fp_spec_id, agent_ctrl_add_macro_did); - -CALL SP__insert_obj_metadata(1, 'del_macro', amp_namespace_id, agent_ctrl_del_macro); -CALL SP__insert_formal_parmspec(1, 'parms for the del_macro control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'ids', 'AC', null, r_fp_ent); -CALL SP__insert_control_formal_definition(agent_ctrl_del_macro , 'This control removes one or more macro definitions from the Agent.', fp_spec_id, agent_ctrl_del_macro_did); - -CALL SP__insert_obj_metadata(1, 'desc_macro', amp_namespace_id, agent_ctrl_desc_macro); -CALL SP__insert_formal_parmspec(1, 'parms for the desc_macro control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'ids', 'AC', null, r_fp_ent); -CALL SP__insert_control_formal_definition(agent_ctrl_desc_macro , 'This control produces a detailed description of one or more macro identifier(ARI) known to the Agent.', fp_spec_id, agent_ctrl_desc_macro_did); - -CALL SP__insert_obj_metadata(1, 'add_tbr', amp_namespace_id, agent_ctrl_add_tbr); -CALL SP__insert_formal_parmspec(6, 'parms for the add_tbr control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'id', 'ARI', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'start', 'TV', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'period', 'TV', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 4, 'count', 'UVAST', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 5, 'action', 'AC', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 6, 'description', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(agent_ctrl_add_tbr , 'This control configures a new time-based rule(TBR) definition on the Agent.', fp_spec_id, agent_ctrl_add_tbr_did); - -CALL SP__insert_obj_metadata(1, 'add_sbr', amp_namespace_id, agent_ctrl_add_sbr); -CALL SP__insert_formal_parmspec(7, 'parms for the add_sbr control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'id', 'ARI', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'start', 'TV', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'state', 'EXPR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 4, 'max_eval', 'UVAST', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 5, 'count', 'UVAST', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 6, 'action', 'AC', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 7, 'description', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(agent_ctrl_add_sbr , 'This control configures a new state-based rule(SBR) definition on the Agent.', fp_spec_id, agent_ctrl_add_sbr_did); - -CALL SP__insert_obj_metadata(1, 'del_rule', amp_namespace_id, agent_ctrl_del_rule); -CALL SP__insert_formal_parmspec(1, 'parms for the del_rule control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'ids', 'AC', null, r_fp_ent); -CALL SP__insert_control_formal_definition(agent_ctrl_del_rule , 'This control removes one or more rule definitions from the Agent.', fp_spec_id, agent_ctrl_del_rule_did); - -CALL SP__insert_obj_metadata(1, 'desc_rule', amp_namespace_id, agent_ctrl_desc_rule); -CALL SP__insert_formal_parmspec(1, 'parms for the desc_rule control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'ids', 'AC', null, r_fp_ent); -CALL SP__insert_control_formal_definition(agent_ctrl_desc_rule , 'This control produces a detailed description of one or more rules known to the Agent.', fp_spec_id, agent_ctrl_desc_rule_did); - -CALL SP__insert_obj_metadata(1, 'store_var', amp_namespace_id, agent_ctrl_store_var); -CALL SP__insert_formal_parmspec(2, 'parms for the store_var control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'id', 'ARI', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'value', 'EXPR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(agent_ctrl_store_var , 'This control stores variables.', fp_spec_id, agent_ctrl_store_var_did); - -CALL SP__insert_obj_metadata(1, 'reset_counts', amp_namespace_id, agent_ctrl_reset_counts); -CALL SP__insert_control_formal_definition(agent_ctrl_reset_counts , 'This control resets all Agent ADM statistics reported in the Agent ADM report.', null, agent_ctrl_reset_counts_did); - - --- #CONST -CALL SP__insert_obj_metadata(0, 'amp_epoch', amp_namespace_id, agent_cnst_amp_epoch); -CALL SP__insert_const_actual_definition(agent_cnst_amp_epoch, 'This constant is the time epoch for the Agent.', 'TS', '1504915200', agent_cnst_amp_epoch_did); - - --- #MAC -END -$do$ \ No newline at end of file diff --git a/amp-sql/postgres/Agent_Scripts/adm_bp_agent.sql b/amp-sql/postgres/Agent_Scripts/adm_bp_agent.sql deleted file mode 100644 index 3ee4025..0000000 --- a/amp-sql/postgres/Agent_Scripts/adm_bp_agent.sql +++ /dev/null @@ -1,585 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - -DO -$do$ -DECLARE -adm_enum int; -dtn_namespace_id int; -bp_agent_meta_name int; -bp_agent_meta_name_did int; -bp_agent_meta_namespace int; -bp_agent_meta_namespace_did int; -bp_agent_meta_version int; -bp_agent_meta_version_did int; -bp_agent_meta_organization int; -bp_agent_meta_organization_did int; -bp_agent_edd_bp_node_id int; -bp_agent_edd_bp_node_id_did int; -bp_agent_edd_bp_node_id_aid int; -bp_agent_edd_bp_node_version int; -bp_agent_edd_bp_node_version_did int; -bp_agent_edd_bp_node_version_aid int; -bp_agent_edd_available_storage int; -bp_agent_edd_available_storage_did int; -bp_agent_edd_available_storage_aid int; -bp_agent_edd_last_reset_time int; -bp_agent_edd_last_reset_time_did int; -bp_agent_edd_last_reset_time_aid int; -bp_agent_edd_num_registrations int; -bp_agent_edd_num_registrations_did int; -bp_agent_edd_num_registrations_aid int; -bp_agent_edd_num_pend_fwd int; -bp_agent_edd_num_pend_fwd_did int; -bp_agent_edd_num_pend_fwd_aid int; -bp_agent_edd_num_pend_dis int; -bp_agent_edd_num_pend_dis_did int; -bp_agent_edd_num_pend_dis_aid int; -bp_agent_edd_num_in_cust int; -bp_agent_edd_num_in_cust_did int; -bp_agent_edd_num_in_cust_aid int; -bp_agent_edd_num_pend_reassembly int; -bp_agent_edd_num_pend_reassembly_did int; -bp_agent_edd_num_pend_reassembly_aid int; -bp_agent_edd_bundles_by_priority int; -bp_agent_edd_bundles_by_priority_fp int; -r_fp_ent int; -bp_agent_edd_bundles_by_priority_did int; -bp_agent_edd_bytes_by_priority int; -bp_agent_edd_bytes_by_priority_fp int; -bp_agent_edd_bytes_by_priority_did int; -bp_agent_edd_src_bundles_by_priority int; -bp_agent_edd_src_bundles_by_priority_fp int; -bp_agent_edd_src_bundles_by_priority_did int; -bp_agent_edd_src_bytes_by_priority int; -bp_agent_edd_src_bytes_by_priority_fp int; -bp_agent_edd_src_bytes_by_priority_did int; -bp_agent_edd_num_fragmented_bundles int; -bp_agent_edd_num_fragmented_bundles_did int; -bp_agent_edd_num_fragmented_bundles_aid int; -bp_agent_edd_num_fragments_produced int; -bp_agent_edd_num_fragments_produced_did int; -bp_agent_edd_num_fragments_produced_aid int; -bp_agent_edd_num_failed_by_reason int; -bp_agent_edd_num_failed_by_reason_fp int; -bp_agent_edd_num_failed_by_reason_did int; -bp_agent_edd_num_bundles_deleted int; -bp_agent_edd_num_bundles_deleted_did int; -bp_agent_edd_num_bundles_deleted_aid int; -bp_agent_edd_failed_custody_bundles int; -bp_agent_edd_failed_custody_bundles_did int; -bp_agent_edd_failed_custody_bundles_aid int; -bp_agent_edd_failed_custody_bytes int; -bp_agent_edd_failed_custody_bytes_did int; -bp_agent_edd_failed_custody_bytes_aid int; -bp_agent_edd_failed_forward_bundles int; -bp_agent_edd_failed_forward_bundles_did int; -bp_agent_edd_failed_forward_bundles_aid int; -bp_agent_edd_failed_forward_bytes int; -bp_agent_edd_failed_forward_bytes_did int; -bp_agent_edd_failed_forward_bytes_aid int; -bp_agent_edd_abandoned_bundles int; -bp_agent_edd_abandoned_bundles_did int; -bp_agent_edd_abandoned_bundles_aid int; -bp_agent_edd_abandoned_bytes int; -bp_agent_edd_abandoned_bytes_did int; -bp_agent_edd_abandoned_bytes_aid int; -bp_agent_edd_discarded_bundles int; -bp_agent_edd_discarded_bundles_did int; -bp_agent_edd_discarded_bundles_aid int; -bp_agent_edd_discarded_bytes int; -bp_agent_edd_discarded_bytes_did int; -bp_agent_edd_discarded_bytes_aid int; -bp_agent_edd_endpoint_names int; -bp_agent_edd_endpoint_names_did int; -bp_agent_edd_endpoint_names_aid int; -bp_agent_edd_endpoint_active int; -bp_agent_edd_endpoint_active_fp int; -bp_agent_edd_endpoint_active_did int; -bp_agent_edd_endpoint_singleton int; -bp_agent_edd_endpoint_singleton_fp int; -bp_agent_edd_endpoint_singleton_did int; -bp_agent_edd_endpoint_policy int; -bp_agent_edd_endpoint_policy_fp int; -bp_agent_edd_endpoint_policy_did int; -bp_agent_rpttpl_full_report int; -ap_spec_id int; -p_lit_meta_1_id int; -r_lit_1_id int; -bp_agent_edd_bundles_by_priority_aid_1_1 int; -p_lit_meta_2_id int; -r_lit_2_id int; -bp_agent_edd_bundles_by_priority_aid_1_2 int; -p_lit_meta_4_id int; -r_lit_4_id int; -bp_agent_edd_bundles_by_priority_aid_1_4 int; -bp_agent_edd_bytes_by_priority_aid_1_1 int; -bp_agent_edd_bytes_by_priority_aid_1_2 int; -bp_agent_edd_bytes_by_priority_aid_1_4 int; -bp_agent_edd_src_bundles_by_priority_aid_1_1 int; -bp_agent_edd_src_bundles_by_priority_aid_1_2 int; -bp_agent_edd_src_bundles_by_priority_aid_1_4 int; -bp_agent_edd_src_bytes_by_priority_aid_1_1 int; -bp_agent_edd_src_bytes_by_priority_aid_1_2 int; -bp_agent_edd_src_bytes_by_priority_aid_1_4 int; -bp_agent_edd_num_failed_by_reason_aid_1_1 int; -bp_agent_edd_num_failed_by_reason_aid_1_2 int; -bp_agent_edd_num_failed_by_reason_aid_1_4 int; -p_lit_meta_8_id int; -r_lit_8_id int; -bp_agent_edd_num_failed_by_reason_aid_1_8 int; -p_lit_meta_16_id int; -r_lit_16_id int; -bp_agent_edd_num_failed_by_reason_aid_1_16 int; -p_lit_meta_32_id int; -r_lit_32_id int; -bp_agent_edd_num_failed_by_reason_aid_1_32 int; -p_lit_meta_64_id int; -r_lit_64_id int; -bp_agent_edd_num_failed_by_reason_aid_1_64 int; -p_lit_meta_128_id int; -r_lit_128_id int; -bp_agent_edd_num_failed_by_reason_aid_1_128 int; -p_lit_meta_256_id int; -r_lit_256_id int; -bp_agent_edd_num_failed_by_reason_aid_1_256 int; -rptt_ac_id int; -r_ac_rpt_entry_1 int; -r_ac_rpt_entry_2 int; -r_ac_rpt_entry_3 int; -r_ac_rpt_entry_4 int; -r_ac_rpt_entry_5 int; -r_ac_rpt_entry_6 int; -r_ac_rpt_entry_7 int; -r_ac_rpt_entry_8 int; -r_ac_rpt_entry_9 int; -r_ac_rpt_entry_10 int; -r_ac_rpt_entry_11 int; -r_ac_rpt_entry_12 int; -r_ac_rpt_entry_13 int; -r_ac_rpt_entry_14 int; -r_ac_rpt_entry_15 int; -r_ac_rpt_entry_16 int; -r_ac_rpt_entry_17 int; -r_ac_rpt_entry_18 int; -r_ac_rpt_entry_19 int; -r_ac_rpt_entry_20 int; -r_ac_rpt_entry_21 int; -r_ac_rpt_entry_22 int; -r_ac_rpt_entry_23 int; -r_ac_rpt_entry_24 int; -r_ac_rpt_entry_25 int; -r_ac_rpt_entry_26 int; -r_ac_rpt_entry_27 int; -r_ac_rpt_entry_28 int; -r_ac_rpt_entry_29 int; -r_ac_rpt_entry_30 int; -r_ac_rpt_entry_31 int; -r_ac_rpt_entry_32 int; -r_ac_rpt_entry_33 int; -r_ac_rpt_entry_34 int; -r_ac_rpt_entry_35 int; -r_ac_rpt_entry_36 int; -r_ac_rpt_entry_37 int; -r_ac_rpt_entry_38 int; -r_ac_rpt_entry_39 int; -r_ac_rpt_entry_40 int; -r_ac_rpt_entry_41 int; -r_ac_rpt_entry_42 int; -r_ac_rpt_entry_43 int; -bp_agent_rpttpl_full_report_did int; -bp_agent_rpttpl_full_report_aid int; -bp_agent_rpttpl_endpoint_report int; -fp_spec_id int; -bp_agent_edd_endpoint_active_aid_endpoint_id_1 int; -bp_agent_edd_endpoint_singleton_aid_endpoint_id_1 int; -bp_agent_edd_endpoint_policy_aid_endpoint_id_1 int; -bp_agent_rpttpl_endpoint_report_did int; -bp_agent_rpttpl_endpoint_report_aid int; -bp_agent_ctrl_reset_all_counts int; -bp_agent_ctrl_reset_all_counts_did int; -BEGIN -adm_enum := 2; -CALL SP__insert_adm_defined_namespace('JHUAPL', 'DTN/bp_agent', 'v0.1', 'bp_agent', adm_enum, NULL, 'The namespace of the ADM.', dtn_namespace_id); - - --- #META -CALL SP__insert_obj_metadata(0, 'name', dtn_namespace_id, bp_agent_meta_name); -CALL SP__insert_const_actual_definition(bp_agent_meta_name, 'The human-readable name of the ADM.', 'STR', 'bp_agent', bp_agent_meta_name_did); - -CALL SP__insert_obj_metadata(0, 'namespace', dtn_namespace_id, bp_agent_meta_namespace); -CALL SP__insert_const_actual_definition(bp_agent_meta_namespace, 'The namespace of the ADM.', 'STR', 'DTN/bp_agent', bp_agent_meta_namespace_did); - -CALL SP__insert_obj_metadata(0, 'version', dtn_namespace_id, bp_agent_meta_version); -CALL SP__insert_const_actual_definition(bp_agent_meta_version, 'The version of the ADM', 'STR', 'v0.1', bp_agent_meta_version_did); - -CALL SP__insert_obj_metadata(0, 'organization', dtn_namespace_id, bp_agent_meta_organization); -CALL SP__insert_const_actual_definition(bp_agent_meta_organization, 'The name of the issuing organization of the ADM.', 'STR', 'JHUAPL', bp_agent_meta_organization_did); - --- #EDD -CALL SP__insert_obj_metadata(2, 'bp_node_id', dtn_namespace_id, bp_agent_edd_bp_node_id); -CALL SP__insert_edd_formal_definition(bp_agent_edd_bp_node_id, 'The node administration endpoint', NULL, 'STR', bp_agent_edd_bp_node_id_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_bp_node_id, 'The singleton value for bp_node_id', NULL, bp_agent_edd_bp_node_id_aid); - -CALL SP__insert_obj_metadata(2, 'bp_node_version', dtn_namespace_id, bp_agent_edd_bp_node_version); -CALL SP__insert_edd_formal_definition(bp_agent_edd_bp_node_version, 'The latest version of the BP supported by this node', NULL, 'STR', bp_agent_edd_bp_node_version_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_bp_node_version, 'The singleton value for bp_node_version', NULL, bp_agent_edd_bp_node_version_aid); - -CALL SP__insert_obj_metadata(2, 'available_storage', dtn_namespace_id, bp_agent_edd_available_storage); -CALL SP__insert_edd_formal_definition(bp_agent_edd_available_storage, 'Bytes available for bundle storage', NULL, 'UVAST', bp_agent_edd_available_storage_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_available_storage, 'The singleton value for available_storage', NULL, bp_agent_edd_available_storage_aid); - -CALL SP__insert_obj_metadata(2, 'last_reset_time', dtn_namespace_id, bp_agent_edd_last_reset_time); -CALL SP__insert_edd_formal_definition(bp_agent_edd_last_reset_time, 'The last time that BP counters were reset, either due to execution of a reset control or a restart of the node itself', NULL, 'UVAST', bp_agent_edd_last_reset_time_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_last_reset_time, 'The singleton value for last_reset_time', NULL, bp_agent_edd_last_reset_time_aid); - -CALL SP__insert_obj_metadata(2, 'num_registrations', dtn_namespace_id, bp_agent_edd_num_registrations); -CALL SP__insert_edd_formal_definition(bp_agent_edd_num_registrations, 'number of registrations', NULL, 'UINT', bp_agent_edd_num_registrations_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_num_registrations, 'The singleton value for num_registrations', NULL, bp_agent_edd_num_registrations_aid); - -CALL SP__insert_obj_metadata(2, 'num_pend_fwd', dtn_namespace_id, bp_agent_edd_num_pend_fwd); -CALL SP__insert_edd_formal_definition(bp_agent_edd_num_pend_fwd, 'number of bundles pending forwarding', NULL, 'UINT', bp_agent_edd_num_pend_fwd_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_num_pend_fwd, 'The singleton value for num_pend_fwd', NULL, bp_agent_edd_num_pend_fwd_aid); - -CALL SP__insert_obj_metadata(2, 'num_pend_dis', dtn_namespace_id, bp_agent_edd_num_pend_dis); -CALL SP__insert_edd_formal_definition(bp_agent_edd_num_pend_dis, 'number of bundles awaiting dispatch', NULL, 'UINT', bp_agent_edd_num_pend_dis_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_num_pend_dis, 'The singleton value for num_pend_dis', NULL, bp_agent_edd_num_pend_dis_aid); - -CALL SP__insert_obj_metadata(2, 'num_in_cust', dtn_namespace_id, bp_agent_edd_num_in_cust); -CALL SP__insert_edd_formal_definition(bp_agent_edd_num_in_cust, 'number of bundles', NULL, 'UINT', bp_agent_edd_num_in_cust_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_num_in_cust, 'The singleton value for num_in_cust', NULL, bp_agent_edd_num_in_cust_aid); - -CALL SP__insert_obj_metadata(2, 'num_pend_reassembly', dtn_namespace_id, bp_agent_edd_num_pend_reassembly); -CALL SP__insert_edd_formal_definition(bp_agent_edd_num_pend_reassembly, 'number of bundles pending reassembly', NULL, 'UINT', bp_agent_edd_num_pend_reassembly_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_num_pend_reassembly, 'The singleton value for num_pend_reassembly', NULL, bp_agent_edd_num_pend_reassembly_aid); - -CALL SP__insert_obj_metadata(2, 'bundles_by_priority', dtn_namespace_id, bp_agent_edd_bundles_by_priority); -CALL SP__insert_formal_parmspec(1, 'parms for bundles_by_priority', bp_agent_edd_bundles_by_priority_fp); -CALL SP__insert_formal_parmspec_entry(bp_agent_edd_bundles_by_priority_fp, 1, 'mask', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(bp_agent_edd_bundles_by_priority, 'number of bundles for the given priority. Priority is given as a priority mask where Bulk=0x1, normal=0x2, express=0x4. Any bundles matching any of the masked priorities will be included in the returned count', bp_agent_edd_bundles_by_priority_fp, 'UINT', bp_agent_edd_bundles_by_priority_did); - -CALL SP__insert_obj_metadata(2, 'bytes_by_priority', dtn_namespace_id, bp_agent_edd_bytes_by_priority); -CALL SP__insert_formal_parmspec(1, 'parms for bytes_by_priority', bp_agent_edd_bytes_by_priority_fp); -CALL SP__insert_formal_parmspec_entry(bp_agent_edd_bytes_by_priority_fp, 1, 'mask', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(bp_agent_edd_bytes_by_priority, 'number of bytes of the given priority. Priority is given as a priority mask where bulk=0x1, normal=0x2, express=0x4. Any bundles matching any of the masked priorities will be included in the returned count.', bp_agent_edd_bytes_by_priority_fp, 'UINT', bp_agent_edd_bytes_by_priority_did); - -CALL SP__insert_obj_metadata(2, 'src_bundles_by_priority', dtn_namespace_id, bp_agent_edd_src_bundles_by_priority); -CALL SP__insert_formal_parmspec(1, 'parms for src_bundles_by_priority', bp_agent_edd_src_bundles_by_priority_fp); -CALL SP__insert_formal_parmspec_entry(bp_agent_edd_src_bundles_by_priority_fp, 1, 'mask', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(bp_agent_edd_src_bundles_by_priority, 'number of bundles sourced by this node of the given priority. Priority is given as a priority mask where bulk=0x1, normal=0x2, express=0x4. Any bundles sourced by this node and matching any of the masked priorities will be included in the returned count.', bp_agent_edd_src_bundles_by_priority_fp, 'UINT', bp_agent_edd_src_bundles_by_priority_did); - -CALL SP__insert_obj_metadata(2, 'src_bytes_by_priority', dtn_namespace_id, bp_agent_edd_src_bytes_by_priority); -CALL SP__insert_formal_parmspec(1, 'parms for src_bytes_by_priority', bp_agent_edd_src_bytes_by_priority_fp); -CALL SP__insert_formal_parmspec_entry(bp_agent_edd_src_bytes_by_priority_fp, 1, 'mask', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(bp_agent_edd_src_bytes_by_priority, 'number of bytes sourced by this node of the given priority. Priority is given as a priority mask where bulk=0x1, normal=0x2, express=0x4. Any bundles sourced by this node and matching any of the masked priorities will be included in the returned count', bp_agent_edd_src_bytes_by_priority_fp, 'UINT', bp_agent_edd_src_bytes_by_priority_did); - -CALL SP__insert_obj_metadata(2, 'num_fragmented_bundles', dtn_namespace_id, bp_agent_edd_num_fragmented_bundles); -CALL SP__insert_edd_formal_definition(bp_agent_edd_num_fragmented_bundles, 'number of fragmented bundles', NULL, 'UINT', bp_agent_edd_num_fragmented_bundles_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_num_fragmented_bundles, 'The singleton value for num_fragmented_bundles', NULL, bp_agent_edd_num_fragmented_bundles_aid); - -CALL SP__insert_obj_metadata(2, 'num_fragments_produced', dtn_namespace_id, bp_agent_edd_num_fragments_produced); -CALL SP__insert_edd_formal_definition(bp_agent_edd_num_fragments_produced, 'number of bundles with fragmentary payloads produced by this node', NULL, 'UINT', bp_agent_edd_num_fragments_produced_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_num_fragments_produced, 'The singleton value for num_fragments_produced', NULL, bp_agent_edd_num_fragments_produced_aid); - -CALL SP__insert_obj_metadata(2, 'num_failed_by_reason', dtn_namespace_id, bp_agent_edd_num_failed_by_reason); -CALL SP__insert_formal_parmspec(1, 'parms for num_failed_by_reason', bp_agent_edd_num_failed_by_reason_fp); -CALL SP__insert_formal_parmspec_entry(bp_agent_edd_num_failed_by_reason_fp, 1, 'mask', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(bp_agent_edd_num_failed_by_reason, 'number of bundles failed for any of the given reasons. (noInfo=0x1, Expired=0x2, UniFwd=0x4, Cancelled=0x8, NoStorage=0x10, BadEID=0x20, NoRoute=0x40, NoContact=0x80, BadBlock=0x100)', bp_agent_edd_num_failed_by_reason_fp, 'UINT', bp_agent_edd_num_failed_by_reason_did); - -CALL SP__insert_obj_metadata(2, 'num_bundles_deleted', dtn_namespace_id, bp_agent_edd_num_bundles_deleted); -CALL SP__insert_edd_formal_definition(bp_agent_edd_num_bundles_deleted, 'number of bundles deleted by this node', NULL, 'UINT', bp_agent_edd_num_bundles_deleted_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_num_bundles_deleted, 'The singleton value for num_bundles_deleted', NULL, bp_agent_edd_num_bundles_deleted_aid); - -CALL SP__insert_obj_metadata(2, 'failed_custody_bundles', dtn_namespace_id, bp_agent_edd_failed_custody_bundles); -CALL SP__insert_edd_formal_definition(bp_agent_edd_failed_custody_bundles, 'number of bundle fails at this node', NULL, 'UINT', bp_agent_edd_failed_custody_bundles_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_failed_custody_bundles, 'The singleton value for failed_custody_bundles', NULL, bp_agent_edd_failed_custody_bundles_aid); - -CALL SP__insert_obj_metadata(2, 'failed_custody_bytes', dtn_namespace_id, bp_agent_edd_failed_custody_bytes); -CALL SP__insert_edd_formal_definition(bp_agent_edd_failed_custody_bytes, 'number bytes of fails at this node', NULL, 'UINT', bp_agent_edd_failed_custody_bytes_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_failed_custody_bytes, 'The singleton value for failed_custody_bytes', NULL, bp_agent_edd_failed_custody_bytes_aid); - -CALL SP__insert_obj_metadata(2, 'failed_forward_bundles', dtn_namespace_id, bp_agent_edd_failed_forward_bundles); -CALL SP__insert_edd_formal_definition(bp_agent_edd_failed_forward_bundles, 'number bundles not forwarded by this node', NULL, 'UINT', bp_agent_edd_failed_forward_bundles_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_failed_forward_bundles, 'The singleton value for failed_forward_bundles', NULL, bp_agent_edd_failed_forward_bundles_aid); - -CALL SP__insert_obj_metadata(2, 'failed_forward_bytes', dtn_namespace_id, bp_agent_edd_failed_forward_bytes); -CALL SP__insert_edd_formal_definition(bp_agent_edd_failed_forward_bytes, 'number of bytes not forwaded by this node', NULL, 'UINT', bp_agent_edd_failed_forward_bytes_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_failed_forward_bytes, 'The singleton value for failed_forward_bytes', NULL, bp_agent_edd_failed_forward_bytes_aid); - -CALL SP__insert_obj_metadata(2, 'abandoned_bundles', dtn_namespace_id, bp_agent_edd_abandoned_bundles); -CALL SP__insert_edd_formal_definition(bp_agent_edd_abandoned_bundles, 'number of bundles abandoned by this node', NULL, 'UINT', bp_agent_edd_abandoned_bundles_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_abandoned_bundles, 'The singleton value for abandoned_bundles', NULL, bp_agent_edd_abandoned_bundles_aid); - -CALL SP__insert_obj_metadata(2, 'abandoned_bytes', dtn_namespace_id, bp_agent_edd_abandoned_bytes); -CALL SP__insert_edd_formal_definition(bp_agent_edd_abandoned_bytes, 'number of bytes abandoned by this node', NULL, 'UINT', bp_agent_edd_abandoned_bytes_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_abandoned_bytes, 'The singleton value for abandoned_bytes', NULL, bp_agent_edd_abandoned_bytes_aid); - -CALL SP__insert_obj_metadata(2, 'discarded_bundles', dtn_namespace_id, bp_agent_edd_discarded_bundles); -CALL SP__insert_edd_formal_definition(bp_agent_edd_discarded_bundles, 'number of bundles discarded by this node', NULL, 'UINT', bp_agent_edd_discarded_bundles_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_discarded_bundles, 'The singleton value for discarded_bundles', NULL, bp_agent_edd_discarded_bundles_aid); - -CALL SP__insert_obj_metadata(2, 'discarded_bytes', dtn_namespace_id, bp_agent_edd_discarded_bytes); -CALL SP__insert_edd_formal_definition(bp_agent_edd_discarded_bytes, 'number of bytes discarded by this node', NULL, 'UINT', bp_agent_edd_discarded_bytes_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_discarded_bytes, 'The singleton value for discarded_bytes', NULL, bp_agent_edd_discarded_bytes_aid); - -CALL SP__insert_obj_metadata(2, 'endpoint_names', dtn_namespace_id, bp_agent_edd_endpoint_names); -CALL SP__insert_edd_formal_definition(bp_agent_edd_endpoint_names, 'CSV list of endpoint names for this node', NULL, 'STR', bp_agent_edd_endpoint_names_did); -CALL SP__insert_edd_actual_definition(bp_agent_edd_endpoint_names, 'The singleton value for endpoint_names', NULL, bp_agent_edd_endpoint_names_aid); - -CALL SP__insert_obj_metadata(2, 'endpoint_active', dtn_namespace_id, bp_agent_edd_endpoint_active); -CALL SP__insert_formal_parmspec(1, 'parms for endpoint_active', bp_agent_edd_endpoint_active_fp); -CALL SP__insert_formal_parmspec_entry(bp_agent_edd_endpoint_active_fp, 1, 'endpoint_name', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(bp_agent_edd_endpoint_active, 'is the given endpoint active? (0=no)', bp_agent_edd_endpoint_active_fp, 'UINT', bp_agent_edd_endpoint_active_did); - -CALL SP__insert_obj_metadata(2, 'endpoint_singleton', dtn_namespace_id, bp_agent_edd_endpoint_singleton); -CALL SP__insert_formal_parmspec(1, 'parms for endpoint_singleton', bp_agent_edd_endpoint_singleton_fp); -CALL SP__insert_formal_parmspec_entry(bp_agent_edd_endpoint_singleton_fp, 1, 'endpoint_name', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(bp_agent_edd_endpoint_singleton, 'is the given endpoint singleton? (0=no)', bp_agent_edd_endpoint_singleton_fp, 'UINT', bp_agent_edd_endpoint_singleton_did); - -CALL SP__insert_obj_metadata(2, 'endpoint_policy', dtn_namespace_id, bp_agent_edd_endpoint_policy); -CALL SP__insert_formal_parmspec(1, 'parms for endpoint_policy', bp_agent_edd_endpoint_policy_fp); -CALL SP__insert_formal_parmspec_entry(bp_agent_edd_endpoint_policy_fp, 1, 'endpoint_name', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(bp_agent_edd_endpoint_policy, 'Does the endpoint abandon on fail (0=no)', bp_agent_edd_endpoint_policy_fp, 'UINT', bp_agent_edd_endpoint_policy_did); - --- #OPER - --- #VAR - --- #TBLT - --- #RPTT - -CALL SP__insert_obj_metadata(7, 'full_report', dtn_namespace_id, bp_agent_rpttpl_full_report); - -CALL SP__insert_actual_parmspec(bp_agent_edd_bundles_by_priority_fp, 1, 'actual parms for bundles_by_priority passed 1', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 1', dtn_namespace_id, p_lit_meta_1_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_1_id, 'literal value 1', 'UINT', '1', r_lit_1_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_1_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_bundles_by_priority, NULL, ap_spec_id, bp_agent_edd_bundles_by_priority_aid_1_1); - -CALL SP__insert_actual_parmspec(bp_agent_edd_bundles_by_priority_fp, 1, 'actual parms for bundles_by_priority passed 2', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 2', dtn_namespace_id, p_lit_meta_2_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_2_id, 'literal value 2', 'UINT', '2', r_lit_2_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_2_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_bundles_by_priority, NULL, ap_spec_id, bp_agent_edd_bundles_by_priority_aid_1_2); - -CALL SP__insert_actual_parmspec(bp_agent_edd_bundles_by_priority_fp, 1, 'actual parms for bundles_by_priority passed 4', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 4', dtn_namespace_id, p_lit_meta_4_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_4_id, 'literal value 4', 'UINT', '4', r_lit_4_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_4_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_bundles_by_priority, NULL, ap_spec_id, bp_agent_edd_bundles_by_priority_aid_1_4); - -CALL SP__insert_actual_parmspec(bp_agent_edd_bytes_by_priority_fp, 1, 'actual parms for bytes_by_priority passed 1', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 1', dtn_namespace_id, p_lit_meta_1_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_1_id, 'literal value 1', 'UINT', '1', r_lit_1_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_1_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_bytes_by_priority, NULL, ap_spec_id, bp_agent_edd_bytes_by_priority_aid_1_1); - -CALL SP__insert_actual_parmspec(bp_agent_edd_bytes_by_priority_fp, 1, 'actual parms for bytes_by_priority passed 2', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 2', dtn_namespace_id, p_lit_meta_2_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_2_id, 'literal value 2', 'UINT', '2', r_lit_2_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_2_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_bytes_by_priority, NULL, ap_spec_id, bp_agent_edd_bytes_by_priority_aid_1_2); - -CALL SP__insert_actual_parmspec(bp_agent_edd_bytes_by_priority_fp, 1, 'actual parms for bytes_by_priority passed 4', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 4', dtn_namespace_id, p_lit_meta_4_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_4_id, 'literal value 4', 'UINT', '4', r_lit_4_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_4_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_bytes_by_priority, NULL, ap_spec_id, bp_agent_edd_bytes_by_priority_aid_1_4); - -CALL SP__insert_actual_parmspec(bp_agent_edd_src_bundles_by_priority_fp, 1, 'actual parms for src_bundles_by_priority passed 1', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 1', dtn_namespace_id, p_lit_meta_1_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_1_id, 'literal value 1', 'UINT', '1', r_lit_1_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_1_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_src_bundles_by_priority, NULL, ap_spec_id, bp_agent_edd_src_bundles_by_priority_aid_1_1); - -CALL SP__insert_actual_parmspec(bp_agent_edd_src_bundles_by_priority_fp, 1, 'actual parms for src_bundles_by_priority passed 2', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 2', dtn_namespace_id, p_lit_meta_2_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_2_id, 'literal value 2', 'UINT', '2', r_lit_2_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_2_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_src_bundles_by_priority, NULL, ap_spec_id, bp_agent_edd_src_bundles_by_priority_aid_1_2); - -CALL SP__insert_actual_parmspec(bp_agent_edd_src_bundles_by_priority_fp, 1, 'actual parms for src_bundles_by_priority passed 4', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 4', dtn_namespace_id, p_lit_meta_4_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_4_id, 'literal value 4', 'UINT', '4', r_lit_4_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_4_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_src_bundles_by_priority, NULL, ap_spec_id, bp_agent_edd_src_bundles_by_priority_aid_1_4); - -CALL SP__insert_actual_parmspec(bp_agent_edd_src_bytes_by_priority_fp, 1, 'actual parms for src_bytes_by_priority passed 1', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 1', dtn_namespace_id, p_lit_meta_1_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_1_id, 'literal value 1', 'UINT', '1', r_lit_1_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_1_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_src_bytes_by_priority, NULL, ap_spec_id, bp_agent_edd_src_bytes_by_priority_aid_1_1); - -CALL SP__insert_actual_parmspec(bp_agent_edd_src_bytes_by_priority_fp, 1, 'actual parms for src_bytes_by_priority passed 2', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 2', dtn_namespace_id, p_lit_meta_2_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_2_id, 'literal value 2', 'UINT', '2', r_lit_2_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_2_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_src_bytes_by_priority, NULL, ap_spec_id, bp_agent_edd_src_bytes_by_priority_aid_1_2); - -CALL SP__insert_actual_parmspec(bp_agent_edd_src_bytes_by_priority_fp, 1, 'actual parms for src_bytes_by_priority passed 4', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 4', dtn_namespace_id, p_lit_meta_4_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_4_id, 'literal value 4', 'UINT', '4', r_lit_4_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_4_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_src_bytes_by_priority, NULL, ap_spec_id, bp_agent_edd_src_bytes_by_priority_aid_1_4); - -CALL SP__insert_actual_parmspec(bp_agent_edd_num_failed_by_reason_fp, 1, 'actual parms for num_failed_by_reason passed 1', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 1', dtn_namespace_id, p_lit_meta_1_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_1_id, 'literal value 1', 'UINT', '1', r_lit_1_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_1_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_num_failed_by_reason, NULL, ap_spec_id, bp_agent_edd_num_failed_by_reason_aid_1_1); - -CALL SP__insert_actual_parmspec(bp_agent_edd_num_failed_by_reason_fp, 1, 'actual parms for num_failed_by_reason passed 2', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 2', dtn_namespace_id, p_lit_meta_2_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_2_id, 'literal value 2', 'UINT', '2', r_lit_2_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_2_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_num_failed_by_reason, NULL, ap_spec_id, bp_agent_edd_num_failed_by_reason_aid_1_2); - -CALL SP__insert_actual_parmspec(bp_agent_edd_num_failed_by_reason_fp, 1, 'actual parms for num_failed_by_reason passed 4', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 4', dtn_namespace_id, p_lit_meta_4_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_4_id, 'literal value 4', 'UINT', '4', r_lit_4_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_4_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_num_failed_by_reason, NULL, ap_spec_id, bp_agent_edd_num_failed_by_reason_aid_1_4); - -CALL SP__insert_actual_parmspec(bp_agent_edd_num_failed_by_reason_fp, 1, 'actual parms for num_failed_by_reason passed 8', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 8', dtn_namespace_id, p_lit_meta_8_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_8_id, 'literal value 8', 'UINT', '8', r_lit_8_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_8_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_num_failed_by_reason, NULL, ap_spec_id, bp_agent_edd_num_failed_by_reason_aid_1_8); - -CALL SP__insert_actual_parmspec(bp_agent_edd_num_failed_by_reason_fp, 1, 'actual parms for num_failed_by_reason passed 16', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 16', dtn_namespace_id, p_lit_meta_16_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_16_id, 'literal value 16', 'UINT', '16', r_lit_16_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_16_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_num_failed_by_reason, NULL, ap_spec_id, bp_agent_edd_num_failed_by_reason_aid_1_16); - -CALL SP__insert_actual_parmspec(bp_agent_edd_num_failed_by_reason_fp, 1, 'actual parms for num_failed_by_reason passed 32', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 32', dtn_namespace_id, p_lit_meta_32_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_32_id, 'literal value 32', 'UINT', '32', r_lit_32_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_32_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_num_failed_by_reason, NULL, ap_spec_id, bp_agent_edd_num_failed_by_reason_aid_1_32); - -CALL SP__insert_actual_parmspec(bp_agent_edd_num_failed_by_reason_fp, 1, 'actual parms for num_failed_by_reason passed 64', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 64', dtn_namespace_id, p_lit_meta_64_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_64_id, 'literal value 64', 'UINT', '64', r_lit_64_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_64_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_num_failed_by_reason, NULL, ap_spec_id, bp_agent_edd_num_failed_by_reason_aid_1_64); - -CALL SP__insert_actual_parmspec(bp_agent_edd_num_failed_by_reason_fp, 1, 'actual parms for num_failed_by_reason passed 128', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 128', dtn_namespace_id, p_lit_meta_128_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_128_id, 'literal value 128', 'UINT', '128', r_lit_128_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_128_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_num_failed_by_reason, NULL, ap_spec_id, bp_agent_edd_num_failed_by_reason_aid_1_128); - -CALL SP__insert_actual_parmspec(bp_agent_edd_num_failed_by_reason_fp, 1, 'actual parms for num_failed_by_reason passed 256', ap_spec_id); -CALL SP__insert_obj_metadata(3, 'Literal value 256', dtn_namespace_id, p_lit_meta_256_id); -CALL SP__insert_literal_actual_definition(p_lit_meta_256_id, 'literal value 256', 'UINT', '256', r_lit_256_id); -CALL SP__insert_actual_parms_object(ap_spec_id, 1, 'UINT', r_lit_256_id); -CALL SP__insert_edd_actual_definition(bp_agent_edd_num_failed_by_reason, NULL, ap_spec_id, bp_agent_edd_num_failed_by_reason_aid_1_256); - -CALL SP__insert_ac_id(43, 'ac for report template full_report', rptt_ac_id); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_meta_name_did, 1, r_ac_rpt_entry_1); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_meta_version_did, 2, r_ac_rpt_entry_2); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_bp_node_id_aid, 3, r_ac_rpt_entry_3); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_bp_node_version_aid, 4, r_ac_rpt_entry_4); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_available_storage_aid, 5, r_ac_rpt_entry_5); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_last_reset_time_aid, 6, r_ac_rpt_entry_6); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_num_registrations_aid, 7, r_ac_rpt_entry_7); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_num_pend_fwd_aid, 8, r_ac_rpt_entry_8); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_num_pend_dis_aid, 9, r_ac_rpt_entry_9); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_num_in_cust_aid, 10, r_ac_rpt_entry_10); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_num_pend_reassembly_aid, 11, r_ac_rpt_entry_11); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_bundles_by_priority_aid_1_1, 12, r_ac_rpt_entry_12); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_bundles_by_priority_aid_1_2, 13, r_ac_rpt_entry_13); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_bundles_by_priority_aid_1_4, 14, r_ac_rpt_entry_14); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_bytes_by_priority_aid_1_1, 15, r_ac_rpt_entry_15); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_bytes_by_priority_aid_1_2, 16, r_ac_rpt_entry_16); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_bytes_by_priority_aid_1_4, 17, r_ac_rpt_entry_17); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_src_bundles_by_priority_aid_1_1, 18, r_ac_rpt_entry_18); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_src_bundles_by_priority_aid_1_2, 19, r_ac_rpt_entry_19); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_src_bundles_by_priority_aid_1_4, 20, r_ac_rpt_entry_20); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_src_bytes_by_priority_aid_1_1, 21, r_ac_rpt_entry_21); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_src_bytes_by_priority_aid_1_2, 22, r_ac_rpt_entry_22); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_src_bytes_by_priority_aid_1_4, 23, r_ac_rpt_entry_23); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_num_fragmented_bundles_aid, 24, r_ac_rpt_entry_24); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_num_fragments_produced_aid, 25, r_ac_rpt_entry_25); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_num_failed_by_reason_aid_1_1, 26, r_ac_rpt_entry_26); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_num_failed_by_reason_aid_1_2, 27, r_ac_rpt_entry_27); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_num_failed_by_reason_aid_1_4, 28, r_ac_rpt_entry_28); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_num_failed_by_reason_aid_1_8, 29, r_ac_rpt_entry_29); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_num_failed_by_reason_aid_1_16, 30, r_ac_rpt_entry_30); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_num_failed_by_reason_aid_1_32, 31, r_ac_rpt_entry_31); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_num_failed_by_reason_aid_1_64, 32, r_ac_rpt_entry_32); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_num_failed_by_reason_aid_1_128, 33, r_ac_rpt_entry_33); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_num_failed_by_reason_aid_1_256, 34, r_ac_rpt_entry_34); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_num_bundles_deleted_aid, 35, r_ac_rpt_entry_35); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_failed_custody_bundles_aid, 36, r_ac_rpt_entry_36); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_failed_custody_bytes_aid, 37, r_ac_rpt_entry_37); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_failed_forward_bundles_aid, 38, r_ac_rpt_entry_38); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_failed_forward_bytes_aid, 39, r_ac_rpt_entry_39); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_abandoned_bundles_aid, 40, r_ac_rpt_entry_40); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_discarded_bundles_aid, 41, r_ac_rpt_entry_41); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_discarded_bytes_aid, 42, r_ac_rpt_entry_42); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_endpoint_names_aid, 43, r_ac_rpt_entry_43); - -CALL SP__insert_report_template_formal_definition(bp_agent_rpttpl_full_report, 'This is all known meta-data, EDD, and VAR values known by the agent.', null, rptt_ac_id, bp_agent_rpttpl_full_report_did); -CALL SP__insert_report_actual_definition(bp_agent_rpttpl_full_report, null, null, 'Singleton value for full_report', bp_agent_rpttpl_full_report_aid); - -CALL SP__insert_obj_metadata(7, 'endpoint_report', dtn_namespace_id, bp_agent_rpttpl_endpoint_report); -CALL SP__insert_formal_parmspec(1, 'parms for endpoint_active', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'endpoint_active', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(bp_agent_edd_endpoint_active_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(bp_agent_edd_endpoint_active_did, NULL, ap_spec_id, bp_agent_edd_endpoint_active_aid_endpoint_id_1); -CALL SP__insert_formal_parmspec(1, 'parms for endpoint_singleton', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'endpoint_singleton', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(bp_agent_edd_endpoint_singleton_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(bp_agent_edd_endpoint_singleton_did, NULL, ap_spec_id, bp_agent_edd_endpoint_singleton_aid_endpoint_id_1); -CALL SP__insert_formal_parmspec(1, 'parms for endpoint_policy', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'endpoint_policy', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(bp_agent_edd_endpoint_policy_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(bp_agent_edd_endpoint_policy_did, NULL, ap_spec_id, bp_agent_edd_endpoint_policy_aid_endpoint_id_1); - -CALL SP__insert_ac_id(3, 'ac for report template endpoint_report', rptt_ac_id); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_endpoint_active_did, 1, r_ac_rpt_entry_1); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_endpoint_singleton_did, 2, r_ac_rpt_entry_2); -CALL SP__insert_ac_actual_entry(rptt_ac_id, bp_agent_edd_endpoint_policy_did, 3, r_ac_rpt_entry_3); - -CALL SP__insert_report_template_formal_definition(bp_agent_rpttpl_endpoint_report, 'This is all known endpoint information', fp_spec_id, rptt_ac_id, bp_agent_rpttpl_endpoint_report_did); -CALL SP__insert_report_actual_definition(bp_agent_rpttpl_endpoint_report, null, null, 'Singleton value for endpoint_report', bp_agent_rpttpl_endpoint_report_aid); - --- #CTRL -CALL SP__insert_obj_metadata(1, 'reset_all_counts', dtn_namespace_id, bp_agent_ctrl_reset_all_counts); -CALL SP__insert_control_formal_definition(bp_agent_ctrl_reset_all_counts , 'This control causes the Agent to reset all counts associated with bundle or byte statistics and to set the last reset time of the BP primitive data to the time when the control was run', null, bp_agent_ctrl_reset_all_counts_did); - - --- #CONST - --- #MAC - -END -$do$ diff --git a/amp-sql/postgres/Agent_Scripts/adm_ion_admin.sql b/amp-sql/postgres/Agent_Scripts/adm_ion_admin.sql deleted file mode 100644 index fafeec1..0000000 --- a/amp-sql/postgres/Agent_Scripts/adm_ion_admin.sql +++ /dev/null @@ -1,317 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - -DO -$do$ -DECLARE -adm_enum integer; -dtn_namespace_id integer; -ion_ionadmin_meta_name integer; -ion_ionadmin_meta_name_did integer; -ion_ionadmin_meta_namespace integer; -ion_ionadmin_meta_namespace_did integer; -ion_ionadmin_meta_version integer; -ion_ionadmin_meta_version_did integer; -ion_ionadmin_meta_organization integer; -ion_ionadmin_meta_organization_did integer; -ion_ionadmin_edd_clock_error integer; -ion_ionadmin_edd_clock_error_did integer; -ion_ionadmin_edd_clock_error_aid integer; -ion_ionadmin_edd_clock_sync integer; -ion_ionadmin_edd_clock_sync_did integer; -ion_ionadmin_edd_clock_sync_aid integer; -ion_ionadmin_edd_congestion_alarm_control integer; -ion_ionadmin_edd_congestion_alarm_control_did integer; -ion_ionadmin_edd_congestion_alarm_control_aid integer; -ion_ionadmin_edd_congestion_end_time_forecasts integer; -ion_ionadmin_edd_congestion_end_time_forecasts_did integer; -ion_ionadmin_edd_congestion_end_time_forecasts_aid integer; -ion_ionadmin_edd_consumption_rate integer; -ion_ionadmin_edd_consumption_rate_did integer; -ion_ionadmin_edd_consumption_rate_aid integer; -ion_ionadmin_edd_inbound_file_system_occupancy_limit integer; -ion_ionadmin_edd_inbound_file_system_occupancy_limit_did integer; -ion_ionadmin_edd_inbound_file_system_occupancy_limit_aid integer; -ion_ionadmin_edd_inbound_heap_occupancy_limit integer; -ion_ionadmin_edd_inbound_heap_occupancy_limit_did integer; -ion_ionadmin_edd_inbound_heap_occupancy_limit_aid integer; -ion_ionadmin_edd_number integer; -ion_ionadmin_edd_number_did integer; -ion_ionadmin_edd_number_aid integer; -ion_ionadmin_edd_outbound_file_system_occupancy_limit integer; -ion_ionadmin_edd_outbound_file_system_occupancy_limit_did integer; -ion_ionadmin_edd_outbound_file_system_occupancy_limit_aid integer; -ion_ionadmin_edd_outbound_heap_occupancy_limit integer; -ion_ionadmin_edd_outbound_heap_occupancy_limit_did integer; -ion_ionadmin_edd_outbound_heap_occupancy_limit_aid integer; -ion_ionadmin_edd_production_rate integer; -ion_ionadmin_edd_production_rate_did integer; -ion_ionadmin_edd_production_rate_aid integer; -ion_ionadmin_edd_ref_time integer; -ion_ionadmin_edd_ref_time_did integer; -ion_ionadmin_edd_ref_time_aid integer; -ion_ionadmin_edd_time_delta integer; -ion_ionadmin_edd_time_delta_did integer; -ion_ionadmin_edd_time_delta_aid integer; -ion_ionadmin_edd_version integer; -ion_ionadmin_edd_version_did integer; -ion_ionadmin_edd_version_aid integer; -ion_ionadmin_tblt_contacts integer; -tbl_tnvc_id integer; -tnvc_entry integer; -ion_ionadmin_tblt_contacts_did integer; -ion_ionadmin_tblt_ranges integer; -ion_ionadmin_tblt_ranges_did integer; -ion_ionadmin_ctrl_node_init integer; -fp_spec_id integer; -r_fp_ent integer; -ion_ionadmin_ctrl_node_init_did integer; -ion_ionadmin_ctrl_node_clock_error_set integer; -ion_ionadmin_ctrl_node_clock_error_set_did integer; -ion_ionadmin_ctrl_node_clock_sync_set integer; -ion_ionadmin_ctrl_node_clock_sync_set_did integer; -ion_ionadmin_ctrl_node_congestion_alarm_control_set integer; -ion_ionadmin_ctrl_node_congestion_alarm_control_set_did integer; -ion_ionadmin_ctrl_node_congestion_end_time_forecasts_set integer; -ion_ionadmin_ctrl_node_congestion_end_time_forecasts_set_did integer; -ion_ionadmin_ctrl_node_consumption_rate_set integer; -ion_ionadmin_ctrl_node_consumption_rate_set_did integer; -ion_ionadmin_ctrl_node_contact_add integer; -ion_ionadmin_ctrl_node_contact_add_did integer; -ion_ionadmin_ctrl_node_contact_del integer; -ion_ionadmin_ctrl_node_contact_del_did integer; -ion_ionadmin_ctrl_node_inbound_heap_occupancy_limit_set integer; -ion_ionadmin_ctrl_node_inbound_heap_occupancy_limit_set_did integer; -ion_ionadmin_ctrl_node_outbound_heap_occupancy_limit_set integer; -ion_ionadmin_ctrl_node_outbound_heap_occupancy_limit_set_did integer; -ion_ionadmin_ctrl_node_production_rate_set integer; -ion_ionadmin_ctrl_node_production_rate_set_did integer; -ion_ionadmin_ctrl_node_range_add integer; -ion_ionadmin_ctrl_node_range_add_did integer; -ion_ionadmin_ctrl_node_range_del integer; -ion_ionadmin_ctrl_node_range_del_did integer; -ion_ionadmin_ctrl_node_ref_time_set integer; -ion_ionadmin_ctrl_node_ref_time_set_did integer; -ion_ionadmin_ctrl_node_time_delta_set integer; -ion_ionadmin_ctrl_node_time_delta_set_did integer; - -BEGIN - adm_enum = 7; -CALL SP__insert_adm_defined_namespace('JHUAPL', 'DTN/ION/ionadmin', 'v0.0', 'ion_admin', adm_enum, NULL, 'The namespace of the ADM.', dtn_namespace_id); - - --- #META -CALL SP__insert_obj_metadata(0, 'name', dtn_namespace_id, ion_ionadmin_meta_name); -CALL SP__insert_const_actual_definition(ion_ionadmin_meta_name, 'The human-readable name of the ADM.', 'STR', 'ion_admin', ion_ionadmin_meta_name_did); - -CALL SP__insert_obj_metadata(0, 'namespace', dtn_namespace_id, ion_ionadmin_meta_namespace); -CALL SP__insert_const_actual_definition(ion_ionadmin_meta_namespace, 'The namespace of the ADM.', 'STR', 'DTN/ION/ionadmin', ion_ionadmin_meta_namespace_did); - -CALL SP__insert_obj_metadata(0, 'version', dtn_namespace_id, ion_ionadmin_meta_version); -CALL SP__insert_const_actual_definition(ion_ionadmin_meta_version, 'The version of the ADM.', 'STR', 'v0.0', ion_ionadmin_meta_version_did); - -CALL SP__insert_obj_metadata(0, 'organization', dtn_namespace_id, ion_ionadmin_meta_organization); -CALL SP__insert_const_actual_definition(ion_ionadmin_meta_organization, 'The name of the issuing organization of the ADM.', 'STR', 'JHUAPL', ion_ionadmin_meta_organization_did); - --- #EDD -CALL SP__insert_obj_metadata(2, 'clock_error', dtn_namespace_id, ion_ionadmin_edd_clock_error); -CALL SP__insert_edd_formal_definition(ion_ionadmin_edd_clock_error, 'This is how accurate the ION Agent''s clock is described as number of seconds, an absolute value.', NULL, 'UINT', ion_ionadmin_edd_clock_error_did); -CALL SP__insert_edd_actual_definition(ion_ionadmin_edd_clock_error, 'The singleton value for clock_error', NULL, ion_ionadmin_edd_clock_error_aid); - -CALL SP__insert_obj_metadata(2, 'clock_sync', dtn_namespace_id, ion_ionadmin_edd_clock_sync); -CALL SP__insert_edd_formal_definition(ion_ionadmin_edd_clock_sync, 'This is whether or not the the computer on which the local ION node is running has a synchronized clock.', NULL, 'UINT', ion_ionadmin_edd_clock_sync_did); -CALL SP__insert_edd_actual_definition(ion_ionadmin_edd_clock_sync, 'The singleton value for clock_sync', NULL, ion_ionadmin_edd_clock_sync_aid); - -CALL SP__insert_obj_metadata(2, 'congestion_alarm_control', dtn_namespace_id, ion_ionadmin_edd_congestion_alarm_control); -CALL SP__insert_edd_formal_definition(ion_ionadmin_edd_congestion_alarm_control, 'This is whether or not the node has a control that will set off alarm if it will become congested at some future time.', NULL, 'UINT', ion_ionadmin_edd_congestion_alarm_control_did); -CALL SP__insert_edd_actual_definition(ion_ionadmin_edd_congestion_alarm_control, 'The singleton value for congestion_alarm_control', NULL, ion_ionadmin_edd_congestion_alarm_control_aid); - -CALL SP__insert_obj_metadata(2, 'congestion_end_time_forecasts', dtn_namespace_id, ion_ionadmin_edd_congestion_end_time_forecasts); -CALL SP__insert_edd_formal_definition(ion_ionadmin_edd_congestion_end_time_forecasts, 'This is the time horizon beyond which we don''t attempt to forecast congestion', NULL, 'UINT', ion_ionadmin_edd_congestion_end_time_forecasts_did); -CALL SP__insert_edd_actual_definition(ion_ionadmin_edd_congestion_end_time_forecasts, 'The singleton value for congestion_end_time_forecasts', NULL, ion_ionadmin_edd_congestion_end_time_forecasts_aid); - -CALL SP__insert_obj_metadata(2, 'consumption_rate', dtn_namespace_id, ion_ionadmin_edd_consumption_rate); -CALL SP__insert_edd_formal_definition(ion_ionadmin_edd_consumption_rate, 'This is the mean rate of continuous data delivery to local BP applications.', NULL, 'UINT', ion_ionadmin_edd_consumption_rate_did); -CALL SP__insert_edd_actual_definition(ion_ionadmin_edd_consumption_rate, 'The singleton value for consumption_rate', NULL, ion_ionadmin_edd_consumption_rate_aid); - -CALL SP__insert_obj_metadata(2, 'inbound_file_system_occupancy_limit', dtn_namespace_id, ion_ionadmin_edd_inbound_file_system_occupancy_limit); -CALL SP__insert_edd_formal_definition(ion_ionadmin_edd_inbound_file_system_occupancy_limit, 'This is the maximum number of megabytes of storage space in ION''s local file system that can be used for the storage of inbound zero-copy objects. The default heap limit is 1 Terabyte.', NULL, 'UINT', ion_ionadmin_edd_inbound_file_system_occupancy_limit_did); -CALL SP__insert_edd_actual_definition(ion_ionadmin_edd_inbound_file_system_occupancy_limit, 'The singleton value for inbound_file_system_occupancy_limit', NULL, ion_ionadmin_edd_inbound_file_system_occupancy_limit_aid); - -CALL SP__insert_obj_metadata(2, 'inbound_heap_occupancy_limit', dtn_namespace_id, ion_ionadmin_edd_inbound_heap_occupancy_limit); -CALL SP__insert_edd_formal_definition(ion_ionadmin_edd_inbound_heap_occupancy_limit, 'This is the maximum number of megabytes of storage space in ION''s SDR non-volatile heap that can be used for the storage of inbound zero-copy objects. The default heap limit is 20% of the SDR data space''s total heap size.', NULL, 'UINT', ion_ionadmin_edd_inbound_heap_occupancy_limit_did); -CALL SP__insert_edd_actual_definition(ion_ionadmin_edd_inbound_heap_occupancy_limit, 'The singleton value for inbound_heap_occupancy_limit', NULL, ion_ionadmin_edd_inbound_heap_occupancy_limit_aid); - -CALL SP__insert_obj_metadata(2, 'number', dtn_namespace_id, ion_ionadmin_edd_number); -CALL SP__insert_edd_formal_definition(ion_ionadmin_edd_number, 'This is a CBHE node number which uniquely identifies the node in the delay-tolerant network.', NULL, 'UINT', ion_ionadmin_edd_number_did); -CALL SP__insert_edd_actual_definition(ion_ionadmin_edd_number, 'The singleton value for number', NULL, ion_ionadmin_edd_number_aid); - -CALL SP__insert_obj_metadata(2, 'outbound_file_system_occupancy_limit', dtn_namespace_id, ion_ionadmin_edd_outbound_file_system_occupancy_limit); -CALL SP__insert_edd_formal_definition(ion_ionadmin_edd_outbound_file_system_occupancy_limit, 'This is the maximum number of megabytes of storage space in ION''s local file system that can be used for the storage of outbound zero-copy objects. The default heap limit is 1 Terabyte.', NULL, 'UINT', ion_ionadmin_edd_outbound_file_system_occupancy_limit_did); -CALL SP__insert_edd_actual_definition(ion_ionadmin_edd_outbound_file_system_occupancy_limit, 'The singleton value for outbound_file_system_occupancy_limit', NULL, ion_ionadmin_edd_outbound_file_system_occupancy_limit_aid); - -CALL SP__insert_obj_metadata(2, 'outbound_heap_occupancy_limit', dtn_namespace_id, ion_ionadmin_edd_outbound_heap_occupancy_limit); -CALL SP__insert_edd_formal_definition(ion_ionadmin_edd_outbound_heap_occupancy_limit, 'This is the maximum number of megabytes of storage space in ION''s SDR non-volatile heap that can be used for the storage of outbound zero-copy objects. The default heap limit is 20% of the SDR data space''s total heap size.', NULL, 'UINT', ion_ionadmin_edd_outbound_heap_occupancy_limit_did); -CALL SP__insert_edd_actual_definition(ion_ionadmin_edd_outbound_heap_occupancy_limit, 'The singleton value for outbound_heap_occupancy_limit', NULL, ion_ionadmin_edd_outbound_heap_occupancy_limit_aid); - -CALL SP__insert_obj_metadata(2, 'production_rate', dtn_namespace_id, ion_ionadmin_edd_production_rate); -CALL SP__insert_edd_formal_definition(ion_ionadmin_edd_production_rate, 'This is the rate of local data production.', NULL, 'UINT', ion_ionadmin_edd_production_rate_did); -CALL SP__insert_edd_actual_definition(ion_ionadmin_edd_production_rate, 'The singleton value for production_rate', NULL, ion_ionadmin_edd_production_rate_aid); - -CALL SP__insert_obj_metadata(2, 'ref_time', dtn_namespace_id, ion_ionadmin_edd_ref_time); -CALL SP__insert_edd_formal_definition(ion_ionadmin_edd_ref_time, 'This is the reference time that will be used for interpreting relative time values from now until the next revision of reference time.', NULL, 'TV', ion_ionadmin_edd_ref_time_did); -CALL SP__insert_edd_actual_definition(ion_ionadmin_edd_ref_time, 'The singleton value for ref_time', NULL, ion_ionadmin_edd_ref_time_aid); - -CALL SP__insert_obj_metadata(2, 'time_delta', dtn_namespace_id, ion_ionadmin_edd_time_delta); -CALL SP__insert_edd_formal_definition(ion_ionadmin_edd_time_delta, 'The time delta is used to compensate for error (drift) in clocks, particularly spacecraft clocks. The hardware clock on a spacecraft might gain or lose a few seconds every month, to the point at which its understanding of the current time - as reported out by the operating system - might differ significantly from the actual value of Unix Epoch time as reported by authoritative clocks on Earth. To compensate for this difference without correcting the clock itself (which can be difficult and dangerous), ION simply adds the time delta to the Epoch time reported by the operating system.', NULL, 'UINT', ion_ionadmin_edd_time_delta_did); -CALL SP__insert_edd_actual_definition(ion_ionadmin_edd_time_delta, 'The singleton value for time_delta', NULL, ion_ionadmin_edd_time_delta_aid); - -CALL SP__insert_obj_metadata(2, 'version', dtn_namespace_id, ion_ionadmin_edd_version); -CALL SP__insert_edd_formal_definition(ion_ionadmin_edd_version, 'This is the version of ION that is currently installed.', NULL, 'STR', ion_ionadmin_edd_version_did); -CALL SP__insert_edd_actual_definition(ion_ionadmin_edd_version, 'The singleton value for version', NULL, ion_ionadmin_edd_version_aid); - --- #OPER - --- #VAR - --- #TBLT -CALL SP__insert_obj_metadata(10, 'contacts', dtn_namespace_id, ion_ionadmin_tblt_contacts); -CALL SP__insert_tnvc_collection('columns for the contacts table', tbl_tnvc_id); -CALL SP__insert_tnvc_tv_entry(tbl_tnvc_id, 1, 'start_time', null, tnvc_entry); -CALL SP__insert_tnvc_tv_entry(tbl_tnvc_id, 2, 'stop_time', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 3, 'source_node', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 4, 'dest_node', null, tnvc_entry); -CALL SP__insert_tnvc_uvast_entry(tbl_tnvc_id, 5, 'xmit_data', null, tnvc_entry); -CALL SP__insert_tnvc_uvast_entry(tbl_tnvc_id, 6, 'confidence', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(ion_ionadmin_tblt_contacts, 'This table shows all scheduled periods of data transmission.', tbl_tnvc_id, ion_ionadmin_tblt_contacts_did); - -CALL SP__insert_obj_metadata(10, 'ranges', dtn_namespace_id, ion_ionadmin_tblt_ranges); -CALL SP__insert_tnvc_collection('columns for the ranges table', tbl_tnvc_id); -CALL SP__insert_tnvc_tv_entry(tbl_tnvc_id, 1, 'start', null, tnvc_entry); -CALL SP__insert_tnvc_tv_entry(tbl_tnvc_id, 2, 'stop', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 3, 'node', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 4, 'other_node', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 5, 'distance', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(ion_ionadmin_tblt_ranges, 'This table shows all predicted periods of constant distance between nodes.', tbl_tnvc_id, ion_ionadmin_tblt_ranges_did); - - --- #RPTT - --- #CTRL -CALL SP__insert_obj_metadata(1, 'node_init', dtn_namespace_id, ion_ionadmin_ctrl_node_init); -CALL SP__insert_formal_parmspec(2, 'parms for the node_init control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'node_nbr', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'config_file', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionadmin_ctrl_node_init , 'Until this control is executed, the local ION node does not exist and most ionadmin controls will fail. The control configures the local node to be identified by node_number, a CBHE node number which uniquely identifies the node in the delay-tolerant network. It also configures ION''s data space (SDR) and shared working-memory region. For this purpose it uses a set of default settings if no argument follows node_number or if the argument following node_number is ''''; otherwise it uses the configuration settings found in a configuration file. If configuration file name is provided, then the configuration file''s name is implicitly ''hostname.ionconfig''; otherwise, ion_config_filename is taken to be the explicit configuration file name.', fp_spec_id, ion_ionadmin_ctrl_node_init_did); - -CALL SP__insert_obj_metadata(1, 'node_clock_error_set', dtn_namespace_id, ion_ionadmin_ctrl_node_clock_error_set); -CALL SP__insert_formal_parmspec(1, 'parms for the node_clock_error_set control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'known_maximum_clock_error', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionadmin_ctrl_node_clock_error_set , 'This management control sets ION''s understanding of the accuracy of the scheduled start and stop times of planned contacts, in seconds. The default value is 1.', fp_spec_id, ion_ionadmin_ctrl_node_clock_error_set_did); - -CALL SP__insert_obj_metadata(1, 'node_clock_sync_set', dtn_namespace_id, ion_ionadmin_ctrl_node_clock_sync_set); -CALL SP__insert_formal_parmspec(1, 'parms for the node_clock_sync_set control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'new_state', 'BOOL', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionadmin_ctrl_node_clock_sync_set , 'This management control reports whether or not the computer on which the local ION node is running has a synchronized clock.', fp_spec_id, ion_ionadmin_ctrl_node_clock_sync_set_did); - -CALL SP__insert_obj_metadata(1, 'node_congestion_alarm_control_set', dtn_namespace_id, ion_ionadmin_ctrl_node_congestion_alarm_control_set); -CALL SP__insert_formal_parmspec(1, 'parms for the node_congestion_alarm_control_set control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'congestion_alarm_control', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionadmin_ctrl_node_congestion_alarm_control_set , 'This management control establishes a control which will automatically be executed whenever ionadmin predicts that the node will become congested at some future time.', fp_spec_id, ion_ionadmin_ctrl_node_congestion_alarm_control_set_did); - -CALL SP__insert_obj_metadata(1, 'node_congestion_end_time_forecasts_set', dtn_namespace_id, ion_ionadmin_ctrl_node_congestion_end_time_forecasts_set); -CALL SP__insert_formal_parmspec(1, 'parms for the node_congestion_end_time_forecasts_set control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'end_time_for_congestion_forcasts', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionadmin_ctrl_node_congestion_end_time_forecasts_set , 'This management control sets the end time for computed congestion forecasts. Setting congestion forecast horizon to zero sets the congestion forecast end time to infinite time in the future: if there is any predicted net growth in bundle storage space occupancy at all, following the end of the last scheduled contact, then eventual congestion will be predicted. The default value is zero, i.e., no end time.', fp_spec_id, ion_ionadmin_ctrl_node_congestion_end_time_forecasts_set_did); - -CALL SP__insert_obj_metadata(1, 'node_consumption_rate_set', dtn_namespace_id, ion_ionadmin_ctrl_node_consumption_rate_set); -CALL SP__insert_formal_parmspec(1, 'parms for the node_consumption_rate_set control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'planned_data_consumption_rate', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionadmin_ctrl_node_consumption_rate_set , 'This management control sets ION''s expectation of the mean rate of continuous data delivery to local BP applications throughout the period of time over which congestion forecasts are computed. For nodes that function only as routers this variable will normally be zero. A value of -1, which is the default, indicates that the rate of local data consumption is unknown; in that case local data consumption is not considered in the computation of congestion forecasts.', fp_spec_id, ion_ionadmin_ctrl_node_consumption_rate_set_did); - -CALL SP__insert_obj_metadata(1, 'node_contact_add', dtn_namespace_id, ion_ionadmin_ctrl_node_contact_add); -CALL SP__insert_formal_parmspec(6, 'parms for the node_contact_add control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'start', 'TV', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'stop', 'TV', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'from_node_id', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 4, 'to_node_id', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 5, 'data_rate', 'UVAST', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 6, 'prob', 'UVAST', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionadmin_ctrl_node_contact_add , 'This control schedules a period of data transmission from source_node to dest_node. The period of transmission will begin at start_time and end at stop_time, and the rate of data transmission will be xmit_data_rate bytes/second. Our confidence in the contact defaults to 1.0, indicating that the contact is scheduled - not that non-occurrence of the contact is impossible, just that occurrence of the contact is planned and scheduled rather than merely imputed from past node behavior. In the latter case, confidence indicates our estimation of the likelihood of this potential contact.', fp_spec_id, ion_ionadmin_ctrl_node_contact_add_did); - -CALL SP__insert_obj_metadata(1, 'node_contact_del', dtn_namespace_id, ion_ionadmin_ctrl_node_contact_del); -CALL SP__insert_formal_parmspec(3, 'parms for the node_contact_del control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'start', 'TV', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'node_id', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'dest', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionadmin_ctrl_node_contact_del , 'This control deletes the scheduled period of data transmission from source_node to dest_node starting at start_time. To delete all contacts between some pair of nodes, use ''*'' as start_time.', fp_spec_id, ion_ionadmin_ctrl_node_contact_del_did); - -CALL SP__insert_obj_metadata(1, 'node_inbound_heap_occupancy_limit_set', dtn_namespace_id, ion_ionadmin_ctrl_node_inbound_heap_occupancy_limit_set); -CALL SP__insert_formal_parmspec(2, 'parms for the node_inbound_heap_occupancy_limit_set control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'heap_occupancy_limit', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'file_system_occupancy_limit', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionadmin_ctrl_node_inbound_heap_occupancy_limit_set , 'This management control sets the maximum number of megabytes of storage space in ION''s SDR non-volatile heap that can be used for the storage of inbound zero-copy objects. A value of -1 for either limit signifies ''leave unchanged''. The default heap limit is 30% of the SDR data space''s total heap size.', fp_spec_id, ion_ionadmin_ctrl_node_inbound_heap_occupancy_limit_set_did); - -CALL SP__insert_obj_metadata(1, 'node_outbound_heap_occupancy_limit_set', dtn_namespace_id, ion_ionadmin_ctrl_node_outbound_heap_occupancy_limit_set); -CALL SP__insert_formal_parmspec(2, 'parms for the node_outbound_heap_occupancy_limit_set control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'heap_occupancy_limit', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'file_system_occupancy_limit', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionadmin_ctrl_node_outbound_heap_occupancy_limit_set , 'This management control sets the maximum number of megabytes of storage space in ION''s SDR non-volatile heap that can be used for the storage of outbound zero-copy objects. A value of -1 for either limit signifies ''leave unchanged''. The default heap limit is 30% of the SDR data space''s total heap size.', fp_spec_id, ion_ionadmin_ctrl_node_outbound_heap_occupancy_limit_set_did); - -CALL SP__insert_obj_metadata(1, 'node_production_rate_set', dtn_namespace_id, ion_ionadmin_ctrl_node_production_rate_set); -CALL SP__insert_formal_parmspec(1, 'parms for the node_production_rate_set control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'planned_data_production_rate', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionadmin_ctrl_node_production_rate_set , 'This management control sets ION''s expectation of the mean rate of continuous data origination by local BP applications throughout the period of time over which congestion forecasts are computed. For nodes that function only as routers this variable will normally be zero. A value of -1, which is the default, indicates that the rate of local data production is unknown; in that case local data production is not considered in the computation of congestion forecasts.', fp_spec_id, ion_ionadmin_ctrl_node_production_rate_set_did); - -CALL SP__insert_obj_metadata(1, 'node_range_add', dtn_namespace_id, ion_ionadmin_ctrl_node_range_add); -CALL SP__insert_formal_parmspec(5, 'parms for the node_range_add control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'start', 'TV', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'stop', 'TV', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'node', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 4, 'other_node', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 5, 'distance', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionadmin_ctrl_node_range_add , 'This control predicts a period of time during which the distance from node to other_node will be constant to within one light second. The period will begin at start_time and end at stop_time, and the distance between the nodes during that time will be distance light seconds.', fp_spec_id, ion_ionadmin_ctrl_node_range_add_did); - -CALL SP__insert_obj_metadata(1, 'node_range_del', dtn_namespace_id, ion_ionadmin_ctrl_node_range_del); -CALL SP__insert_formal_parmspec(3, 'parms for the node_range_del control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'start', 'TV', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'node', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'other_node', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionadmin_ctrl_node_range_del , 'This control deletes the predicted period of constant distance between node and other_node starting at start_time. To delete all ranges between some pair of nodes, use ''*'' as start_time.', fp_spec_id, ion_ionadmin_ctrl_node_range_del_did); - -CALL SP__insert_obj_metadata(1, 'node_ref_time_set', dtn_namespace_id, ion_ionadmin_ctrl_node_ref_time_set); -CALL SP__insert_formal_parmspec(1, 'parms for the node_ref_time_set control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'time', 'TV', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionadmin_ctrl_node_ref_time_set , 'This is used to set the reference time that will be used for interpreting relative time values from now until the next revision of reference time. Note that the new reference time can be a relative time, i.e., an offset beyond the current reference time.', fp_spec_id, ion_ionadmin_ctrl_node_ref_time_set_did); - -CALL SP__insert_obj_metadata(1, 'node_time_delta_set', dtn_namespace_id, ion_ionadmin_ctrl_node_time_delta_set); -CALL SP__insert_formal_parmspec(1, 'parms for the node_time_delta_set control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'local_time_sec_after_epoch', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionadmin_ctrl_node_time_delta_set , 'This management control sets ION''s understanding of the current difference between correct time and the Unix Epoch time values reported by the clock for the local ION node''s computer. This delta is automatically applied to locally obtained time values whenever ION needs to know the current time.', fp_spec_id, ion_ionadmin_ctrl_node_time_delta_set_did); - - --- #CONST - --- #MAC - -END -$do$ \ No newline at end of file diff --git a/amp-sql/postgres/Agent_Scripts/adm_ion_bp_admin.sql b/amp-sql/postgres/Agent_Scripts/adm_ion_bp_admin.sql deleted file mode 100644 index 98d8bc6..0000000 --- a/amp-sql/postgres/Agent_Scripts/adm_ion_bp_admin.sql +++ /dev/null @@ -1,351 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- -DO -$do$ -DECLARE -adm_enum integer; -dtn_namespace_id integer; -ion_bpadmin_meta_name integer; -ion_bpadmin_meta_name_did integer; -ion_bpadmin_meta_namespace integer; -ion_bpadmin_meta_namespace_did integer; -ion_bpadmin_meta_version integer; -ion_bpadmin_meta_version_did integer; -ion_bpadmin_meta_organization integer; -ion_bpadmin_meta_organization_did integer; -ion_bpadmin_edd_bp_version integer; -ion_bpadmin_edd_bp_version_did integer; -ion_bpadmin_edd_bp_version_aid integer; -ion_bpadmin_tblt_endpoints integer; -tbl_tnvc_id integer; -tnvc_entry integer; -ion_bpadmin_tblt_endpoints_did integer; -ion_bpadmin_tblt_inducts integer; -ion_bpadmin_tblt_inducts_did integer; -ion_bpadmin_tblt_outducts integer; -ion_bpadmin_tblt_outducts_did integer; -ion_bpadmin_tblt_protocols integer; -ion_bpadmin_tblt_protocols_did integer; -ion_bpadmin_tblt_schemes integer; -ion_bpadmin_tblt_schemes_did integer; -ion_bpadmin_tblt_egress_plans integer; -ion_bpadmin_tblt_egress_plans_did integer; -ion_bpadmin_ctrl_endpoint_add integer; -fp_spec_id integer; -r_fp_ent integer; -ion_bpadmin_ctrl_endpoint_add_did integer; -ion_bpadmin_ctrl_endpoint_change integer; -ion_bpadmin_ctrl_endpoint_change_did integer; -ion_bpadmin_ctrl_endpoint_del integer; -ion_bpadmin_ctrl_endpoint_del_did integer; -ion_bpadmin_ctrl_induct_add integer; -ion_bpadmin_ctrl_induct_add_did integer; -ion_bpadmin_ctrl_induct_change integer; -ion_bpadmin_ctrl_induct_change_did integer; -ion_bpadmin_ctrl_induct_del integer; -ion_bpadmin_ctrl_induct_del_did integer; -ion_bpadmin_ctrl_induct_start integer; -ion_bpadmin_ctrl_induct_start_did integer; -ion_bpadmin_ctrl_induct_stop integer; -ion_bpadmin_ctrl_induct_stop_did integer; -ion_bpadmin_ctrl_manage_heap_max integer; -ion_bpadmin_ctrl_manage_heap_max_did integer; -ion_bpadmin_ctrl_outduct_add integer; -ion_bpadmin_ctrl_outduct_add_did integer; -ion_bpadmin_ctrl_outduct_change integer; -ion_bpadmin_ctrl_outduct_change_did integer; -ion_bpadmin_ctrl_outduct_del integer; -ion_bpadmin_ctrl_outduct_del_did integer; -ion_bpadmin_ctrl_outduct_start integer; -ion_bpadmin_ctrl_outduct_start_did integer; -ion_bpadmin_ctrl_egress_plan_block integer; -ion_bpadmin_ctrl_egress_plan_block_did integer; -ion_bpadmin_ctrl_egress_plan_unblock integer; -ion_bpadmin_ctrl_egress_plan_unblock_did integer; -ion_bpadmin_ctrl_outduct_stop integer; -ion_bpadmin_ctrl_outduct_stop_did integer; -ion_bpadmin_ctrl_protocol_add integer; -ion_bpadmin_ctrl_protocol_add_did integer; -ion_bpadmin_ctrl_protocol_del integer; -ion_bpadmin_ctrl_protocol_del_did integer; -ion_bpadmin_ctrl_protocol_start integer; -ion_bpadmin_ctrl_protocol_start_did integer; -ion_bpadmin_ctrl_protocol_stop integer; -ion_bpadmin_ctrl_protocol_stop_did integer; -ion_bpadmin_ctrl_scheme_add integer; -ion_bpadmin_ctrl_scheme_add_did integer; -ion_bpadmin_ctrl_scheme_change integer; -ion_bpadmin_ctrl_scheme_change_did integer; -ion_bpadmin_ctrl_scheme_del integer; -ion_bpadmin_ctrl_scheme_del_did integer; -ion_bpadmin_ctrl_scheme_start integer; -ion_bpadmin_ctrl_scheme_start_did integer; -ion_bpadmin_ctrl_scheme_stop integer; -ion_bpadmin_ctrl_scheme_stop_did integer; -ion_bpadmin_ctrl_watch integer; -ion_bpadmin_ctrl_watch_did integer; -BEGIN - adm_enum = 5; -CALL SP__insert_adm_defined_namespace('JHUAPL', 'DTN/ION/bpadmin', 'v0.0', 'ion_bp_admin', adm_enum, NULL, 'The namespace of the ADM', dtn_namespace_id); - - --- #META -CALL SP__insert_obj_metadata(0, 'name', dtn_namespace_id, ion_bpadmin_meta_name); -CALL SP__insert_const_actual_definition(ion_bpadmin_meta_name, 'The human-readable name of the ADM.', 'STR', 'ion_bp_admin', ion_bpadmin_meta_name_did); - -CALL SP__insert_obj_metadata(0, 'namespace', dtn_namespace_id, ion_bpadmin_meta_namespace); -CALL SP__insert_const_actual_definition(ion_bpadmin_meta_namespace, 'The namespace of the ADM', 'STR', 'DTN/ION/bpadmin', ion_bpadmin_meta_namespace_did); - -CALL SP__insert_obj_metadata(0, 'version', dtn_namespace_id, ion_bpadmin_meta_version); -CALL SP__insert_const_actual_definition(ion_bpadmin_meta_version, 'The version of the ADM', 'STR', 'v0.0', ion_bpadmin_meta_version_did); - -CALL SP__insert_obj_metadata(0, 'organization', dtn_namespace_id, ion_bpadmin_meta_organization); -CALL SP__insert_const_actual_definition(ion_bpadmin_meta_organization, 'The name of the issuing organization of the ADM', 'STR', 'JHUAPL', ion_bpadmin_meta_organization_did); - --- #EDD -CALL SP__insert_obj_metadata(2, 'bp_version', dtn_namespace_id, ion_bpadmin_edd_bp_version); -CALL SP__insert_edd_formal_definition(ion_bpadmin_edd_bp_version, 'Version of installed ION BP Admin utility.', NULL, 'STR', ion_bpadmin_edd_bp_version_did); -CALL SP__insert_edd_actual_definition(ion_bpadmin_edd_bp_version, 'The singleton value for bp_version', NULL, ion_bpadmin_edd_bp_version_aid); - --- #OPER - --- #VAR - --- #TBLT -CALL SP__insert_obj_metadata(10, 'endpoints', dtn_namespace_id, ion_bpadmin_tblt_endpoints); -CALL SP__insert_tnvc_collection('columns for the endpoints table', tbl_tnvc_id); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 1, 'scheme_name', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 2, 'endpoint_nss', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 3, 'app_pid', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 4, 'recv_rule', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 5, 'rcv_script', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(ion_bpadmin_tblt_endpoints, 'Local endpoints, regardless of scheme name.', tbl_tnvc_id, ion_bpadmin_tblt_endpoints_did); - -CALL SP__insert_obj_metadata(10, 'inducts', dtn_namespace_id, ion_bpadmin_tblt_inducts); -CALL SP__insert_tnvc_collection('columns for the inducts table', tbl_tnvc_id); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 1, 'protocol_name', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 2, 'duct_name', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 3, 'cli_control', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(ion_bpadmin_tblt_inducts, 'Inducts established locally for the indicated CL protocol.', tbl_tnvc_id, ion_bpadmin_tblt_inducts_did); - -CALL SP__insert_obj_metadata(10, 'outducts', dtn_namespace_id, ion_bpadmin_tblt_outducts); -CALL SP__insert_tnvc_collection('columns for the outducts table', tbl_tnvc_id); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 1, 'protocol_name', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 2, 'duct_name', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 3, 'clo_pid', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 4, 'clo_control', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 5, 'max_payload_length', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(ion_bpadmin_tblt_outducts, 'If protocolName is specified, this table lists all outducts established locally for the indicated CL protocol. Otherwise, it lists all locally established outducts, regardless of their protocol.', tbl_tnvc_id, ion_bpadmin_tblt_outducts_did); - -CALL SP__insert_obj_metadata(10, 'protocols', dtn_namespace_id, ion_bpadmin_tblt_protocols); -CALL SP__insert_tnvc_collection('columns for the protocols table', tbl_tnvc_id); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 1, 'name', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 2, 'payload_bpf', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 3, 'overhead_bpf', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 4, 'protocol class', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(ion_bpadmin_tblt_protocols, 'Convergence layer protocols that can currently be utilized at the local node.', tbl_tnvc_id, ion_bpadmin_tblt_protocols_did); - -CALL SP__insert_obj_metadata(10, 'schemes', dtn_namespace_id, ion_bpadmin_tblt_schemes); -CALL SP__insert_tnvc_collection('columns for the schemes table', tbl_tnvc_id); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 1, 'scheme_name', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 2, 'fwd_pid', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 3, 'fwd_cmd', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 4, 'admin_app_pid', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 5, 'admin_app_cmd', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(ion_bpadmin_tblt_schemes, 'Declared endpoint naming schemes.', tbl_tnvc_id, ion_bpadmin_tblt_schemes_did); - -CALL SP__insert_obj_metadata(10, 'egress_plans', dtn_namespace_id, ion_bpadmin_tblt_egress_plans); -CALL SP__insert_tnvc_collection('columns for the egress_plans table', tbl_tnvc_id); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 1, 'neighbor_eid', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 2, 'clm_pid', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 3, 'nominal_rate', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(ion_bpadmin_tblt_egress_plans, 'Egress plans.', tbl_tnvc_id, ion_bpadmin_tblt_egress_plans_did); - - --- #RPTT - --- #CTRL -CALL SP__insert_obj_metadata(1, 'endpoint_add', dtn_namespace_id, ion_bpadmin_ctrl_endpoint_add); -CALL SP__insert_formal_parmspec(3, 'parms for the endpoint_add control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'endpoint_id', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'type', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'rcv_script', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_endpoint_add , 'Establish DTN endpoint named endpointId on the local node. The remaining parameters indicate what is to be done when bundles destined for this endpoint arrive at a time when no application has the endpoint open for bundle reception. If type is ''x'', then such bundles are to be discarded silently and immediately. If type is ''q'', then such bundles are to be enqueued for later delivery and, if recvScript is provided, recvScript is to be executed.', fp_spec_id, ion_bpadmin_ctrl_endpoint_add_did); - -CALL SP__insert_obj_metadata(1, 'endpoint_change', dtn_namespace_id, ion_bpadmin_ctrl_endpoint_change); -CALL SP__insert_formal_parmspec(3, 'parms for the endpoint_change control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'endpoint_id', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'type', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'rcv_script', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_endpoint_change , 'Change the action taken when bundles destined for this endpoint arrive at a time when no application has the endpoint open for bundle reception.', fp_spec_id, ion_bpadmin_ctrl_endpoint_change_did); - -CALL SP__insert_obj_metadata(1, 'endpoint_del', dtn_namespace_id, ion_bpadmin_ctrl_endpoint_del); -CALL SP__insert_formal_parmspec(1, 'parms for the endpoint_del control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'endpoint_id', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_endpoint_del , 'Delete the endpoint identified by endpointId. The control will fail if any bundles are currently pending delivery to this endpoint.', fp_spec_id, ion_bpadmin_ctrl_endpoint_del_did); - -CALL SP__insert_obj_metadata(1, 'induct_add', dtn_namespace_id, ion_bpadmin_ctrl_induct_add); -CALL SP__insert_formal_parmspec(3, 'parms for the induct_add control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'protocol_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'duct_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'cli_control', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_induct_add , 'Establish a duct for reception of bundles via the indicated CL protocol. The duct''s data acquisition structure is used and populated by the induct task whose operation is initiated by cliControl at the time the duct is started.', fp_spec_id, ion_bpadmin_ctrl_induct_add_did); - -CALL SP__insert_obj_metadata(1, 'induct_change', dtn_namespace_id, ion_bpadmin_ctrl_induct_change); -CALL SP__insert_formal_parmspec(3, 'parms for the induct_change control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'protocol_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'duct_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'cli_control', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_induct_change , 'Change the control used to initiate operation of the induct task for the indicated duct.', fp_spec_id, ion_bpadmin_ctrl_induct_change_did); - -CALL SP__insert_obj_metadata(1, 'induct_del', dtn_namespace_id, ion_bpadmin_ctrl_induct_del); -CALL SP__insert_formal_parmspec(2, 'parms for the induct_del control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'protocol_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'duct_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_induct_del , 'Delete the induct identified by protocolName and ductName. The control will fail if any bundles are currently pending acquisition via this induct.', fp_spec_id, ion_bpadmin_ctrl_induct_del_did); - -CALL SP__insert_obj_metadata(1, 'induct_start', dtn_namespace_id, ion_bpadmin_ctrl_induct_start); -CALL SP__insert_formal_parmspec(2, 'parms for the induct_start control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'protocol_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'duct_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_induct_start , 'Start the indicated induct task as defined for the indicated CL protocol on the local node.', fp_spec_id, ion_bpadmin_ctrl_induct_start_did); - -CALL SP__insert_obj_metadata(1, 'induct_stop', dtn_namespace_id, ion_bpadmin_ctrl_induct_stop); -CALL SP__insert_formal_parmspec(2, 'parms for the induct_stop control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'protocol_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'duct_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_induct_stop , 'Stop the indicated induct task as defined for the indicated CL protocol on the local node.', fp_spec_id, ion_bpadmin_ctrl_induct_stop_did); - -CALL SP__insert_obj_metadata(1, 'manage_heap_max', dtn_namespace_id, ion_bpadmin_ctrl_manage_heap_max); -CALL SP__insert_formal_parmspec(1, 'parms for the manage_heap_max control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'max_database_heap_per_acquisition', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_manage_heap_max , 'Declare the maximum number of bytes of SDR heap space that will be occupied by any single bundle acquisition activity (nominally the acquisition of a single bundle, but this is at the discretion of the convergence-layer input task). All data acquired in excess of this limit will be written to a temporary file pending extraction and dispatching of the acquired bundle or bundles. The default is the minimum allowed value (560 bytes), which is the approximate size of a ZCO file reference object; this is the minimum SDR heap space occupancy in the event that all acquisition is into a file.', fp_spec_id, ion_bpadmin_ctrl_manage_heap_max_did); - -CALL SP__insert_obj_metadata(1, 'outduct_add', dtn_namespace_id, ion_bpadmin_ctrl_outduct_add); -CALL SP__insert_formal_parmspec(4, 'parms for the outduct_add control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'protocol_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'duct_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'clo_command', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 4, 'max_payload_length', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_outduct_add , 'Establish a duct for transmission of bundles via the indicated CL protocol. the duct''s data transmission structure is serviced by the outduct task whose operation is initiated by CLOcommand at the time the duct is started. A value of zero for maxPayloadLength indicates that bundles of any size can be accomodated; this is the default.', fp_spec_id, ion_bpadmin_ctrl_outduct_add_did); - -CALL SP__insert_obj_metadata(1, 'outduct_change', dtn_namespace_id, ion_bpadmin_ctrl_outduct_change); -CALL SP__insert_formal_parmspec(4, 'parms for the outduct_change control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'protocol_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'duct_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'clo_control', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 4, 'max_payload_length', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_outduct_change , 'Set new values for the indicated duct''s payload size limit and the control that is used to initiate operation of the outduct task for this duct.', fp_spec_id, ion_bpadmin_ctrl_outduct_change_did); - -CALL SP__insert_obj_metadata(1, 'outduct_del', dtn_namespace_id, ion_bpadmin_ctrl_outduct_del); -CALL SP__insert_formal_parmspec(2, 'parms for the outduct_del control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'protocol_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'duct_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_outduct_del , 'Delete the outduct identified by protocolName and ductName. The control will fail if any bundles are currently pending transmission via this outduct.', fp_spec_id, ion_bpadmin_ctrl_outduct_del_did); - -CALL SP__insert_obj_metadata(1, 'outduct_start', dtn_namespace_id, ion_bpadmin_ctrl_outduct_start); -CALL SP__insert_formal_parmspec(2, 'parms for the outduct_start control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'protocol_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'duct_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_outduct_start , 'Start the indicated outduct task as defined for the indicated CL protocol on the local node.', fp_spec_id, ion_bpadmin_ctrl_outduct_start_did); - -CALL SP__insert_obj_metadata(1, 'egress_plan_block', dtn_namespace_id, ion_bpadmin_ctrl_egress_plan_block); -CALL SP__insert_formal_parmspec(1, 'parms for the egress_plan_block control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'plan_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_egress_plan_block , 'Disable transmission of bundles queued for transmission to the indicated node and reforwards all non-critical bundles currently queued for transmission to this node. This may result in some or all of these bundles being enqueued for transmission to the psuedo-node limbo.', fp_spec_id, ion_bpadmin_ctrl_egress_plan_block_did); - -CALL SP__insert_obj_metadata(1, 'egress_plan_unblock', dtn_namespace_id, ion_bpadmin_ctrl_egress_plan_unblock); -CALL SP__insert_formal_parmspec(1, 'parms for the egress_plan_unblock control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'plan_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_egress_plan_unblock , 'Re-enable transmission of bundles to the indicated node and reforwards all bundles in limbo in the hope that the unblocking of this egress plan will enable some of them to be transmitted.', fp_spec_id, ion_bpadmin_ctrl_egress_plan_unblock_did); - -CALL SP__insert_obj_metadata(1, 'outduct_stop', dtn_namespace_id, ion_bpadmin_ctrl_outduct_stop); -CALL SP__insert_formal_parmspec(2, 'parms for the outduct_stop control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'protocol_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'duct_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_outduct_stop , 'Stop the indicated outduct task as defined for the indicated CL protocol on the local node.', fp_spec_id, ion_bpadmin_ctrl_outduct_stop_did); - -CALL SP__insert_obj_metadata(1, 'protocol_add', dtn_namespace_id, ion_bpadmin_ctrl_protocol_add); -CALL SP__insert_formal_parmspec(4, 'parms for the protocol_add control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'protocol_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'payload_bytes_per_frame', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'overhead_bytes_per_frame', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 4, 'nominal_data_rate', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_protocol_add , 'Establish access to the named convergence layer protocol at the local node. The payloadBytesPerFrame and overheadBytesPerFrame arguments are used in calculating the estimated transmission capacity consumption of each bundle, to aid in route computation and congesting forecasting. The optional nominalDataRate argument overrides the hard coded default continuous data rate for the indicated protocol for purposes of rate control. For all promiscuous prototocols-that is, protocols whose outducts are not specifically dedicated to transmission to a single identified convergence-layer protocol endpoint- the protocol''s applicable nominal continuous data rate is the data rate that is always used for rate control over links served by that protocol; data rates are not extracted from contact graph information. This is because only the induct and outduct throttles for non-promiscuous protocols (LTP, TCP) can be dynamically adjusted in response to changes in data rate between the local node and its neighbors, as enacted per the contact plan. Even for an outduct of a non-promiscuous protocol the nominal data rate may be the authority for rate control, in the event that the contact plan lacks identified contacts with the node to which the outduct is mapped.', fp_spec_id, ion_bpadmin_ctrl_protocol_add_did); - -CALL SP__insert_obj_metadata(1, 'protocol_del', dtn_namespace_id, ion_bpadmin_ctrl_protocol_del); -CALL SP__insert_formal_parmspec(1, 'parms for the protocol_del control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'protocol_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_protocol_del , 'Delete the convergence layer protocol identified by protocolName. The control will fail if any ducts are still locally declared for this protocol.', fp_spec_id, ion_bpadmin_ctrl_protocol_del_did); - -CALL SP__insert_obj_metadata(1, 'protocol_start', dtn_namespace_id, ion_bpadmin_ctrl_protocol_start); -CALL SP__insert_formal_parmspec(1, 'parms for the protocol_start control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'protocol_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_protocol_start , 'Start all induct and outduct tasks for inducts and outducts that have been defined for the indicated CL protocol on the local node.', fp_spec_id, ion_bpadmin_ctrl_protocol_start_did); - -CALL SP__insert_obj_metadata(1, 'protocol_stop', dtn_namespace_id, ion_bpadmin_ctrl_protocol_stop); -CALL SP__insert_formal_parmspec(1, 'parms for the protocol_stop control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'protocol_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_protocol_stop , 'Stop all induct and outduct tasks for inducts and outducts that have been defined for the indicated CL protocol on the local node.', fp_spec_id, ion_bpadmin_ctrl_protocol_stop_did); - -CALL SP__insert_obj_metadata(1, 'scheme_add', dtn_namespace_id, ion_bpadmin_ctrl_scheme_add); -CALL SP__insert_formal_parmspec(3, 'parms for the scheme_add control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'scheme_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'forwarder_control', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'admin_app_control', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_scheme_add , 'Declares an endpoint naming scheme for use in endpoint IDs, which are structured as URIs: schemeName:schemeSpecificPart. forwarderControl will be executed when the scheme is started on this node, to initiate operation of a forwarding daemon for this scheme. adminAppControl will also be executed when the scheme is started on this node, to initiate operation of a daemon that opens a custodian endpoint identified within this scheme so that it can recieve and process custody signals and bundle status reports.', fp_spec_id, ion_bpadmin_ctrl_scheme_add_did); - -CALL SP__insert_obj_metadata(1, 'scheme_change', dtn_namespace_id, ion_bpadmin_ctrl_scheme_change); -CALL SP__insert_formal_parmspec(3, 'parms for the scheme_change control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'scheme_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'forwarder_control', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'admin_app_control', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_scheme_change , 'Set the indicated scheme''s forwarderControl and adminAppControl to the strings provided as arguments.', fp_spec_id, ion_bpadmin_ctrl_scheme_change_did); - -CALL SP__insert_obj_metadata(1, 'scheme_del', dtn_namespace_id, ion_bpadmin_ctrl_scheme_del); -CALL SP__insert_formal_parmspec(1, 'parms for the scheme_del control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'scheme_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_scheme_del , 'Delete the scheme identified by schemeName. The control will fail if any bundles identified in this scheme are pending forwarding, transmission, or delivery.', fp_spec_id, ion_bpadmin_ctrl_scheme_del_did); - -CALL SP__insert_obj_metadata(1, 'scheme_start', dtn_namespace_id, ion_bpadmin_ctrl_scheme_start); -CALL SP__insert_formal_parmspec(1, 'parms for the scheme_start control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'scheme_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_scheme_start , 'Start the forwarder and administrative endpoint tasks for the indicated scheme task on the local node.', fp_spec_id, ion_bpadmin_ctrl_scheme_start_did); - -CALL SP__insert_obj_metadata(1, 'scheme_stop', dtn_namespace_id, ion_bpadmin_ctrl_scheme_stop); -CALL SP__insert_formal_parmspec(1, 'parms for the scheme_stop control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'scheme_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_scheme_stop , 'Stop the forwarder and administrative endpoint tasks for the indicated scheme task on the local node.', fp_spec_id, ion_bpadmin_ctrl_scheme_stop_did); - -CALL SP__insert_obj_metadata(1, 'watch', dtn_namespace_id, ion_bpadmin_ctrl_watch); -CALL SP__insert_formal_parmspec(2, 'parms for the watch control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'status', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'activity_spec', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_bpadmin_ctrl_watch , 'Enable/Disable production of a continuous stream of user selected Bundle Protocol activity indication characters. A watch parameter of 1 selects all BP activity indication characters, 0 deselects allBP activity indication characters; any other activitySpec such as acz~ selects all activity indication characters in the string, deselecting all others. BP will print each selected activity indication character to stdout every time a processing event of the associated type occurs: a new bundle is queued for forwarding, b bundle is queued for transmission, c bundle is popped from its transmission queue, m custody acceptance signal is recieved, w custody of bundle is accepted, x custody of bundle is refused, y bundle is accepted upon arrival, z bundle is queued for delivery to an application, ~ bundle is abandoned (discarded) on attempt to forward it, ! bundle is destroyed due to TTL expiration, & custody refusal signal is recieved, # bundle is queued for re-forwarding due to CL protocol failures, j bundle is placed in ''limbo'' for possible future reforwarding, k bundle is removed from ''limbo'' and queued for reforwarding, $ bundle''s custodial retransmission timeout interval expired.', fp_spec_id, ion_bpadmin_ctrl_watch_did); - - --- #CONST - --- #MAC - -END -$do$ \ No newline at end of file diff --git a/amp-sql/postgres/Agent_Scripts/adm_ion_ipn_admin.sql b/amp-sql/postgres/Agent_Scripts/adm_ion_ipn_admin.sql deleted file mode 100644 index 8bbeddf..0000000 --- a/amp-sql/postgres/Agent_Scripts/adm_ion_ipn_admin.sql +++ /dev/null @@ -1,147 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - -DO -$do$ -DECLARE -adm_enum integer; -dtn_namespace_id integer; -ion_ipnadmin_meta_name integer; -ion_ipnadmin_meta_name_did integer; -ion_ipnadmin_meta_namespace integer; -ion_ipnadmin_meta_namespace_did integer; -ion_ipnadmin_meta_version integer; -ion_ipnadmin_meta_version_did integer; -ion_ipnadmin_meta_organization integer; -ion_ipnadmin_meta_organization_did integer; -ion_ipnadmin_edd_ion_version integer; -ion_ipnadmin_edd_ion_version_did integer; -ion_ipnadmin_edd_ion_version_aid integer; -ion_ipnadmin_tblt_exits integer; -tbl_tnvc_id integer; -tnvc_entry integer; -ion_ipnadmin_tblt_exits_did integer; -ion_ipnadmin_tblt_plans integer; -ion_ipnadmin_tblt_plans_did integer; -ion_ipnadmin_ctrl_exit_add integer; -fp_spec_id integer; -r_fp_ent integer; -ion_ipnadmin_ctrl_exit_add_did integer; -ion_ipnadmin_ctrl_exit_change integer; -ion_ipnadmin_ctrl_exit_change_did integer; -ion_ipnadmin_ctrl_exit_del integer; -ion_ipnadmin_ctrl_exit_del_did integer; -ion_ipnadmin_ctrl_plan_add integer; -ion_ipnadmin_ctrl_plan_add_did integer; -ion_ipnadmin_ctrl_plan_change integer; -ion_ipnadmin_ctrl_plan_change_did integer; -ion_ipnadmin_ctrl_plan_del integer; -ion_ipnadmin_ctrl_plan_del_did integer; -BEGIN -adm_enum = 6; -CALL SP__insert_adm_defined_namespace('JHUAPL', 'DTN/ION/ipnadmin', 'v0.0', 'ion_ipn_admin', adm_enum, NULL, 'The namespace of the ADM', dtn_namespace_id); - - --- #META -CALL SP__insert_obj_metadata(0, 'name', dtn_namespace_id, ion_ipnadmin_meta_name); -CALL SP__insert_const_actual_definition(ion_ipnadmin_meta_name, 'The human-readable name of the ADM.', 'STR', 'ion_ipn_admin', ion_ipnadmin_meta_name_did); - -CALL SP__insert_obj_metadata(0, 'namespace', dtn_namespace_id, ion_ipnadmin_meta_namespace); -CALL SP__insert_const_actual_definition(ion_ipnadmin_meta_namespace, 'The namespace of the ADM', 'STR', 'DTN/ION/ipnadmin', ion_ipnadmin_meta_namespace_did); - -CALL SP__insert_obj_metadata(0, 'version', dtn_namespace_id, ion_ipnadmin_meta_version); -CALL SP__insert_const_actual_definition(ion_ipnadmin_meta_version, 'The version of the ADM', 'STR', 'v0.0', ion_ipnadmin_meta_version_did); - -CALL SP__insert_obj_metadata(0, 'organization', dtn_namespace_id, ion_ipnadmin_meta_organization); -CALL SP__insert_const_actual_definition(ion_ipnadmin_meta_organization, 'The name of the issuing organization of the ADM', 'STR', 'JHUAPL', ion_ipnadmin_meta_organization_did); - --- #EDD -CALL SP__insert_obj_metadata(2, 'ion_version', dtn_namespace_id, ion_ipnadmin_edd_ion_version); -CALL SP__insert_edd_formal_definition(ion_ipnadmin_edd_ion_version, 'This is the version of ion is that currently installed.', NULL, 'STR', ion_ipnadmin_edd_ion_version_did); -CALL SP__insert_edd_actual_definition(ion_ipnadmin_edd_ion_version, 'The singleton value for ion_version', NULL, ion_ipnadmin_edd_ion_version_aid); - --- #OPER - --- #VAR - --- #TBLT -CALL SP__insert_obj_metadata(10, 'exits', dtn_namespace_id, ion_ipnadmin_tblt_exits); -CALL SP__insert_tnvc_collection('columns for the exits table', tbl_tnvc_id); -CALL SP__insert_tnvc_uvast_entry(tbl_tnvc_id, 1, 'first_node_nbr', null, tnvc_entry); -CALL SP__insert_tnvc_uvast_entry(tbl_tnvc_id, 2, 'last_node_nbr', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 3, 'gateway_endpoint_id', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(ion_ipnadmin_tblt_exits, 'This table lists all of the exits that are defined in the IPN database for the local node.', tbl_tnvc_id, ion_ipnadmin_tblt_exits_did); - -CALL SP__insert_obj_metadata(10, 'plans', dtn_namespace_id, ion_ipnadmin_tblt_plans); -CALL SP__insert_tnvc_collection('columns for the plans table', tbl_tnvc_id); -CALL SP__insert_tnvc_uvast_entry(tbl_tnvc_id, 1, 'node_nbr', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 2, 'action', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 3, 'spec', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(ion_ipnadmin_tblt_plans, 'This table lists all of the egress plans that are established in the IPN database for the local node.', tbl_tnvc_id, ion_ipnadmin_tblt_plans_did); - - --- #RPTT - --- #CTRL -CALL SP__insert_obj_metadata(1, 'exit_add', dtn_namespace_id, ion_ipnadmin_ctrl_exit_add); -CALL SP__insert_formal_parmspec(3, 'parms for the exit_add control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'first_node_nbr', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'last_node_nbr', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'gateway_endpoint_id', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ipnadmin_ctrl_exit_add , 'This control establishes an exit for static default routing.', fp_spec_id, ion_ipnadmin_ctrl_exit_add_did); - -CALL SP__insert_obj_metadata(1, 'exit_change', dtn_namespace_id, ion_ipnadmin_ctrl_exit_change); -CALL SP__insert_formal_parmspec(3, 'parms for the exit_change control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'first_node_nbr', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'last_node_nbr', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'gatewayEndpointId', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ipnadmin_ctrl_exit_change , 'This control changes the gateway node number for the exit identified by firstNodeNbr and lastNodeNbr.', fp_spec_id, ion_ipnadmin_ctrl_exit_change_did); - -CALL SP__insert_obj_metadata(1, 'exit_del', dtn_namespace_id, ion_ipnadmin_ctrl_exit_del); -CALL SP__insert_formal_parmspec(2, 'parms for the exit_del control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'first_node_nbr', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'last_node_nbr', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ipnadmin_ctrl_exit_del , 'This control deletes the exit identified by firstNodeNbr and lastNodeNbr.', fp_spec_id, ion_ipnadmin_ctrl_exit_del_did); - -CALL SP__insert_obj_metadata(1, 'plan_add', dtn_namespace_id, ion_ipnadmin_ctrl_plan_add); -CALL SP__insert_formal_parmspec(2, 'parms for the plan_add control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'node_nbr', 'UVAST', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'xmit_rate', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ipnadmin_ctrl_plan_add , 'This control establishes an egress plan for the bundles that must be transmitted to the neighboring node that is identified by it''s nodeNbr.', fp_spec_id, ion_ipnadmin_ctrl_plan_add_did); - -CALL SP__insert_obj_metadata(1, 'plan_change', dtn_namespace_id, ion_ipnadmin_ctrl_plan_change); -CALL SP__insert_formal_parmspec(2, 'parms for the plan_change control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'node_nbr', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'default_duct_expression', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ipnadmin_ctrl_plan_change , 'This control changes the duct expression for the indicated plan.', fp_spec_id, ion_ipnadmin_ctrl_plan_change_did); - -CALL SP__insert_obj_metadata(1, 'plan_del', dtn_namespace_id, ion_ipnadmin_ctrl_plan_del); -CALL SP__insert_formal_parmspec(1, 'parms for the plan_del control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'node_nbr', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ipnadmin_ctrl_plan_del , 'This control deletes the egress plan for the node that is identified by it''s nodeNbr.', fp_spec_id, ion_ipnadmin_ctrl_plan_del_did); - - --- #CONST - --- #MAC -END -$do$ \ No newline at end of file diff --git a/amp-sql/postgres/Agent_Scripts/adm_ion_ltp_admin.sql b/amp-sql/postgres/Agent_Scripts/adm_ion_ltp_admin.sql deleted file mode 100644 index 48f9caa..0000000 --- a/amp-sql/postgres/Agent_Scripts/adm_ion_ltp_admin.sql +++ /dev/null @@ -1,172 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - -DO -$do$ -DECLARE -adm_enum INTEGER; -dtn_namespace_id INTEGER; -ion_ltpadmin_meta_name INTEGER; -ion_ltpadmin_meta_name_did INTEGER; -ion_ltpadmin_meta_namespace INTEGER; -ion_ltpadmin_meta_namespace_did INTEGER; -ion_ltpadmin_meta_version INTEGER; -ion_ltpadmin_meta_version_did INTEGER; -ion_ltpadmin_meta_organization INTEGER; -ion_ltpadmin_meta_organization_did INTEGER; -ion_ltpadmin_edd_ion_version INTEGER; -ion_ltpadmin_edd_ion_version_did INTEGER; -ion_ltpadmin_edd_ion_version_aid INTEGER; -ion_ltpadmin_tblt_spans INTEGER; -tbl_tnvc_id INTEGER; -tnvc_entry INTEGER; -ion_ltpadmin_tblt_spans_did INTEGER; -ion_ltpadmin_ctrl_manage_heap INTEGER; -fp_spec_id INTEGER; -r_fp_ent INTEGER; -ion_ltpadmin_ctrl_manage_heap_did INTEGER; -ion_ltpadmin_ctrl_manage_max_ber INTEGER; -ion_ltpadmin_ctrl_manage_max_ber_did INTEGER; -ion_ltpadmin_ctrl_manage_own_queue_time INTEGER; -ion_ltpadmin_ctrl_manage_own_queue_time_did INTEGER; -ion_ltpadmin_ctrl_manage_screening INTEGER; -ion_ltpadmin_ctrl_manage_screening_did INTEGER; -ion_ltpadmin_ctrl_span_add INTEGER; -ion_ltpadmin_ctrl_span_add_did INTEGER; -ion_ltpadmin_ctrl_span_change INTEGER; -ion_ltpadmin_ctrl_span_change_did INTEGER; -ion_ltpadmin_ctrl_span_del INTEGER; -ion_ltpadmin_ctrl_span_del_did INTEGER; -ion_ltpadmin_ctrl_stop INTEGER; -ion_ltpadmin_ctrl_stop_did INTEGER; -ion_ltpadmin_ctrl_watch_set INTEGER; - negative INTEGER; -ion_ltpadmin_ctrl_watch_set_did INTEGER; - - -BEGIN -adm_enum = 9; -CALL SP__insert_adm_defined_namespace('JHUAPL', 'DTN/ION/ltpadmin', 'v0.0', 'ion_ltp_admin', adm_enum, NULL, 'The namespace of the ADM.', dtn_namespace_id); - - --- #META -CALL SP__insert_obj_metadata(0, 'name', dtn_namespace_id, ion_ltpadmin_meta_name); -CALL SP__insert_const_actual_definition(ion_ltpadmin_meta_name, 'The human-readable name of the ADM.', 'STR', 'ion_ltp_admin', ion_ltpadmin_meta_name_did); - -CALL SP__insert_obj_metadata(0, 'namespace', dtn_namespace_id, ion_ltpadmin_meta_namespace); -CALL SP__insert_const_actual_definition(ion_ltpadmin_meta_namespace, 'The namespace of the ADM.', 'STR', 'DTN/ION/ltpadmin', ion_ltpadmin_meta_namespace_did); - -CALL SP__insert_obj_metadata(0, 'version', dtn_namespace_id, ion_ltpadmin_meta_version); -CALL SP__insert_const_actual_definition(ion_ltpadmin_meta_version, 'The version of the ADM.', 'STR', 'v0.0', ion_ltpadmin_meta_version_did); - -CALL SP__insert_obj_metadata(0, 'organization', dtn_namespace_id, ion_ltpadmin_meta_organization); -CALL SP__insert_const_actual_definition(ion_ltpadmin_meta_organization, 'The name of the issuing organization of the ADM.', 'STR', 'JHUAPL', ion_ltpadmin_meta_organization_did); - --- #EDD -CALL SP__insert_obj_metadata(2, 'ion_version', dtn_namespace_id, ion_ltpadmin_edd_ion_version); -CALL SP__insert_edd_formal_definition(ion_ltpadmin_edd_ion_version, 'This is the version of ION that is currently installed.', NULL, 'STR', ion_ltpadmin_edd_ion_version_did); -CALL SP__insert_edd_actual_definition(ion_ltpadmin_edd_ion_version, 'The singleton value for ion_version', NULL, ion_ltpadmin_edd_ion_version_aid); - --- #OPER - --- #VAR - --- #TBLT -CALL SP__insert_obj_metadata(10, 'spans', dtn_namespace_id, ion_ltpadmin_tblt_spans); -CALL SP__insert_tnvc_collection('columns for the spans table', tbl_tnvc_id); -CALL SP__insert_tnvc_uvast_entry(tbl_tnvc_id, 1, 'peer_engine_nbr', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 2, 'max_export_sessions', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 3, 'max_import_sessions', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 4, 'max_segment_size', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 5, 'aggregation_size_limit', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 6, 'aggregation_time_limit', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 7, 'lso_control', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 8, 'queueing_latency', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(ion_ltpadmin_tblt_spans, 'This table lists all spans of potential LTP data interchange that exists between the local LTP engine and the indicated (neighboring) LTP engine.', tbl_tnvc_id, ion_ltpadmin_tblt_spans_did); - - --- #RPTT - --- #CTRL -CALL SP__insert_obj_metadata(1, 'manage_heap', dtn_namespace_id, ion_ltpadmin_ctrl_manage_heap); -CALL SP__insert_formal_parmspec(1, 'parms for the manage_heap control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'max_database_heap_per_block', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ltpadmin_ctrl_manage_heap , 'This control declares the maximum number of bytes of SDR heap space that will be occupied by the acquisition of any single LTP block. All data acquired in excess of this limit will be written to a temporary file pending extraction and dispatching of the acquired block. Default is the minimum allowed value (560 bytes), which is the approximate size of a ZCO file reference object; this is the minimum SDR heap space occupancy in the event that all acquisition is into a file.', fp_spec_id, ion_ltpadmin_ctrl_manage_heap_did); - -CALL SP__insert_obj_metadata(1, 'manage_max_ber', dtn_namespace_id, ion_ltpadmin_ctrl_manage_max_ber); -CALL SP__insert_formal_parmspec(1, 'parms for the manage_max_ber control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'max_expected_bit_error_rate', 'REAL32', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ltpadmin_ctrl_manage_max_ber , 'This control sets the expected maximum bit error rate(BER) that LTP should provide for in computing the maximum number of transmission efforts to initiate in the transmission of a given block.(Note that this computation is also sensitive to data segment size and to the size of the block that is to be transmitted.) The default value is .0001 (10^-4).', fp_spec_id, ion_ltpadmin_ctrl_manage_max_ber_did); - -CALL SP__insert_obj_metadata(1, 'manage_own_queue_time', dtn_namespace_id, ion_ltpadmin_ctrl_manage_own_queue_time); -CALL SP__insert_formal_parmspec(1, 'parms for the manage_own_queue_time control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'own_queing_latency', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ltpadmin_ctrl_manage_own_queue_time , 'This control sets the number of seconds of predicted additional latency attributable to processing delay within the local engine itself that should be included whenever LTP computes the nominal round-trip time for an exchange of data with any remote engine.The default value is 1.', fp_spec_id, ion_ltpadmin_ctrl_manage_own_queue_time_did); - -CALL SP__insert_obj_metadata(1, 'manage_screening', dtn_namespace_id, ion_ltpadmin_ctrl_manage_screening); -CALL SP__insert_formal_parmspec(1, 'parms for the manage_screening control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'new_state', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ltpadmin_ctrl_manage_screening , 'This control enables or disables the screening of received LTP segments per the periods of scheduled reception in the node''s contact graph. By default, screening is disabled. When screening is enabled, such segments are silently discarded. Note that when screening is enabled the ranges declared in the contact graph must be accurate and clocks must be synchronized; otherwise, segments will be arriving at times other than the scheduled contact intervals and will be discarded.', fp_spec_id, ion_ltpadmin_ctrl_manage_screening_did); - -CALL SP__insert_obj_metadata(1, 'span_add', dtn_namespace_id, ion_ltpadmin_ctrl_span_add); -CALL SP__insert_formal_parmspec(8, 'parms for the span_add control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'peer_engine_number', 'UVAST', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'max_export_sessions', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'max_import_sessions', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 4, 'max_segment_size', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 5, 'aggregtion_size_limit', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 6, 'aggregation_time_limit', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 7, 'lso_control', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 8, 'queuing_latency', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ltpadmin_ctrl_span_add , 'This control declares that a span of potential LTP data interchange exists between the local LTP engine and the indicated (neighboring) LTP engine.', fp_spec_id, ion_ltpadmin_ctrl_span_add_did); - -CALL SP__insert_obj_metadata(1, 'span_change', dtn_namespace_id, ion_ltpadmin_ctrl_span_change); -CALL SP__insert_formal_parmspec(8, 'parms for the span_change control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'peer_engine_number', 'UVAST', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'max_export_sessions', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'max_import_sessions', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 4, 'max_segment_size', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 5, 'aggregtion_size_limit', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 6, 'aggregation_time_limit', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 7, 'lso_control', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 8, 'queuing_latency', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ltpadmin_ctrl_span_change , 'This control sets the indicated span''s configuration parameters to the values provided as arguments', fp_spec_id, ion_ltpadmin_ctrl_span_change_did); - -CALL SP__insert_obj_metadata(1, 'span_del', dtn_namespace_id, ion_ltpadmin_ctrl_span_del); -CALL SP__insert_formal_parmspec(1, 'parms for the span_del control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'peer_engine_number', 'UVAST', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ltpadmin_ctrl_span_del , 'This control deletes the span identified by peerEngineNumber. The control will fail if any outbound segments for this span are pending transmission or any inbound blocks from the peer engine are incomplete.', fp_spec_id, ion_ltpadmin_ctrl_span_del_did); - -CALL SP__insert_obj_metadata(1, 'stop', dtn_namespace_id, ion_ltpadmin_ctrl_stop); -CALL SP__insert_control_formal_definition(ion_ltpadmin_ctrl_stop , 'This control stops all link service input and output tasks for the local LTP engine.', null, ion_ltpadmin_ctrl_stop_did); - -CALL SP__insert_obj_metadata(1, 'watch_set', dtn_namespace_id, ion_ltpadmin_ctrl_watch_set); -CALL SP__insert_formal_parmspec(1, 'parms for the watch_set control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'activity', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ltpadmin_ctrl_watch_set , 'This control enables and disables production of a continuous stream of user- selected LTP activity indication characters. Activity parameter of 1 selects all LTP activity indication characters; 0 de-selects all LTP activity indication characters; any other activitySpec such as df{] selects all activity indication characters in the string, de-selecting all others. LTP will print each selected activity indication character to stdout every time a processing event of the associated type occurs: d bundle appended to block for next session, e segment of block is queued for transmission, f block has been fully segmented for transmission, g segment popped from transmission queue, h positive ACK received for block and session ended, s segment received, t block has been fully received, negative ACK received for block and segments retransmitted, = unacknowledged checkpoint was retransmitted, + unacknowledged report segment was retransmitted, { export session canceled locally (by sender), } import session canceled by remote sender, [ import session canceled locally (by receiver), ] export session canceled by remote receiver', fp_spec_id, ion_ltpadmin_ctrl_watch_set_did); - - --- #CONST - --- #MAC -END -$do$ \ No newline at end of file diff --git a/amp-sql/postgres/Agent_Scripts/adm_ionsec_admin.sql b/amp-sql/postgres/Agent_Scripts/adm_ionsec_admin.sql deleted file mode 100644 index 4c1d139..0000000 --- a/amp-sql/postgres/Agent_Scripts/adm_ionsec_admin.sql +++ /dev/null @@ -1,178 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- -DO -$do$ -DECLARE -adm_enum integer; -dtn_namespace_id integer; -ion_ionsecadmin_meta_name integer; -ion_ionsecadmin_meta_name_did integer; -ion_ionsecadmin_meta_namespace integer; -ion_ionsecadmin_meta_namespace_did integer; -ion_ionsecadmin_meta_version integer; -ion_ionsecadmin_meta_version_did integer; -ion_ionsecadmin_meta_organization integer; -ion_ionsecadmin_meta_organization_did integer; -ion_ionsecadmin_tblt_ltp_rx_rules integer; -tbl_tnvc_id integer; -tnvc_entry integer; -ion_ionsecadmin_tblt_ltp_rx_rules_did integer; -ion_ionsecadmin_tblt_ltp_tx_rules integer; -ion_ionsecadmin_tblt_ltp_tx_rules_did integer; -ion_ionsecadmin_ctrl_key_add integer; -fp_spec_id integer; -r_fp_ent integer; -ion_ionsecadmin_ctrl_key_add_did integer; -ion_ionsecadmin_ctrl_key_change integer; -ion_ionsecadmin_ctrl_key_change_did integer; -ion_ionsecadmin_ctrl_key_del integer; -ion_ionsecadmin_ctrl_key_del_did integer; -ion_ionsecadmin_ctrl_ltp_rx_rule_add integer; -ion_ionsecadmin_ctrl_ltp_rx_rule_add_did integer; -ion_ionsecadmin_ctrl_ltp_rx_rule_change integer; -ion_ionsecadmin_ctrl_ltp_rx_rule_change_did integer; -ion_ionsecadmin_ctrl_ltp_rx_rule_del integer; -ion_ionsecadmin_ctrl_ltp_rx_rule_del_did integer; -ion_ionsecadmin_ctrl_ltp_tx_rule_add integer; -ion_ionsecadmin_ctrl_ltp_tx_rule_add_did integer; -ion_ionsecadmin_ctrl_ltp_tx_rule_change integer; -ion_ionsecadmin_ctrl_ltp_tx_rule_change_did integer; -ion_ionsecadmin_ctrl_ltp_tx_rule_del integer; -ion_ionsecadmin_ctrl_ltp_tx_rule_del_did integer; -ion_ionsecadmin_ctrl_list_keys integer; -ion_ionsecadmin_ctrl_list_keys_did integer; -ion_ionsecadmin_ctrl_list_ltp_rx_rules integer; -ion_ionsecadmin_ctrl_list_ltp_rx_rules_did integer; -ion_ionsecadmin_ctrl_list_ltp_tx_rules integer; -ion_ionsecadmin_ctrl_list_ltp_tx_rules_did integer; -begin - -adm_enum = 8; -CALL SP__insert_adm_defined_namespace('JHUAPL', 'DTN/ION/ionsecadmin', 'v0.0', 'ionsec_admin', adm_enum, NULL, 'The namespace of the ADM.', dtn_namespace_id); - - --- #META -CALL SP__insert_obj_metadata(0, 'name', dtn_namespace_id, ion_ionsecadmin_meta_name); -CALL SP__insert_const_actual_definition(ion_ionsecadmin_meta_name, 'The human-readable name of the ADM.', 'STR', 'ionsec_admin', ion_ionsecadmin_meta_name_did); - -CALL SP__insert_obj_metadata(0, 'namespace', dtn_namespace_id, ion_ionsecadmin_meta_namespace); -CALL SP__insert_const_actual_definition(ion_ionsecadmin_meta_namespace, 'The namespace of the ADM.', 'STR', 'DTN/ION/ionsecadmin', ion_ionsecadmin_meta_namespace_did); - -CALL SP__insert_obj_metadata(0, 'version', dtn_namespace_id, ion_ionsecadmin_meta_version); -CALL SP__insert_const_actual_definition(ion_ionsecadmin_meta_version, 'The version of the ADM.', 'STR', 'v0.0', ion_ionsecadmin_meta_version_did); - -CALL SP__insert_obj_metadata(0, 'organization', dtn_namespace_id, ion_ionsecadmin_meta_organization); -CALL SP__insert_const_actual_definition(ion_ionsecadmin_meta_organization, 'The name of the issuing organization of the ADM.', 'STR', 'JHUAPL', ion_ionsecadmin_meta_organization_did); - --- #EDD --- #OPER - --- #VAR - --- #TBLT -CALL SP__insert_obj_metadata(10, 'ltp_rx_rules', dtn_namespace_id, ion_ionsecadmin_tblt_ltp_rx_rules); -CALL SP__insert_tnvc_collection('columns for the ltp_rx_rules table', tbl_tnvc_id); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 1, 'ltp_engine_id', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 2, 'ciphersuite_nbr', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 3, 'key_name', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(ion_ionsecadmin_tblt_ltp_rx_rules, 'This table lists all LTP segment authentication rulesin the security policy database.', tbl_tnvc_id, ion_ionsecadmin_tblt_ltp_rx_rules_did); - -CALL SP__insert_obj_metadata(10, 'ltp_tx_rules', dtn_namespace_id, ion_ionsecadmin_tblt_ltp_tx_rules); -CALL SP__insert_tnvc_collection('columns for the ltp_tx_rules table', tbl_tnvc_id); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 1, 'ltp_engine_id', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 2, 'ciphersuite_nbr', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 3, 'key_name', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(ion_ionsecadmin_tblt_ltp_tx_rules, 'This table lists all LTP segment signing rules in the security policy database.', tbl_tnvc_id, ion_ionsecadmin_tblt_ltp_tx_rules_did); - - --- #RPTT - --- #CTRL -CALL SP__insert_obj_metadata(1, 'key_add', dtn_namespace_id, ion_ionsecadmin_ctrl_key_add); -CALL SP__insert_formal_parmspec(2, 'parms for the key_add control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'key_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'key_value', 'BYTESTR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionsecadmin_ctrl_key_add , 'This control adds a named key value to the security policy database. The content of file_name is taken as the value of the key.Named keys can be referenced by other elements of thesecurity policy database.', fp_spec_id, ion_ionsecadmin_ctrl_key_add_did); - -CALL SP__insert_obj_metadata(1, 'key_change', dtn_namespace_id, ion_ionsecadmin_ctrl_key_change); -CALL SP__insert_formal_parmspec(2, 'parms for the key_change control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'key_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'key_value', 'BYTESTR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionsecadmin_ctrl_key_change , 'This control changes the value of the named key, obtaining the new key value from the content of file_name.', fp_spec_id, ion_ionsecadmin_ctrl_key_change_did); - -CALL SP__insert_obj_metadata(1, 'key_del', dtn_namespace_id, ion_ionsecadmin_ctrl_key_del); -CALL SP__insert_formal_parmspec(1, 'parms for the key_del control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'key_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionsecadmin_ctrl_key_del , 'This control deletes the key identified by name.', fp_spec_id, ion_ionsecadmin_ctrl_key_del_did); - -CALL SP__insert_obj_metadata(1, 'ltp_rx_rule_add', dtn_namespace_id, ion_ionsecadmin_ctrl_ltp_rx_rule_add); -CALL SP__insert_formal_parmspec(3, 'parms for the ltp_rx_rule_add control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'ltp_engine_id', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'ciphersuite_nbr', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'key_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionsecadmin_ctrl_ltp_rx_rule_add , 'This control adds a rule specifying the manner in which LTP segment authentication will be applied to LTP segmentsrecieved from the indicated LTP engine. A segment from the indicated LTP engine will only be deemed authentic if it contains an authentication extension computed via the ciphersuite identified by ciphersuite_nbr using the applicable key value. If ciphersuite_nbr is 255 then the applicable key value is a hard-coded constant and key_name must be omitted; otherwise key_nameis required and the applicable key value is the current value of the key named key_name in the local security policy database. Valid values of ciphersuite_nbr are: 0: HMAC-SHA1-80 1: RSA-SHA256 255: NULL', fp_spec_id, ion_ionsecadmin_ctrl_ltp_rx_rule_add_did); - -CALL SP__insert_obj_metadata(1, 'ltp_rx_rule_change', dtn_namespace_id, ion_ionsecadmin_ctrl_ltp_rx_rule_change); -CALL SP__insert_formal_parmspec(3, 'parms for the ltp_rx_rule_change control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'ltp_engine_id', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'ciphersuite_nbr', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'key_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionsecadmin_ctrl_ltp_rx_rule_change , 'This control changes the parameters of the LTP segment authentication rule for the indicated LTP engine.', fp_spec_id, ion_ionsecadmin_ctrl_ltp_rx_rule_change_did); - -CALL SP__insert_obj_metadata(1, 'ltp_rx_rule_del', dtn_namespace_id, ion_ionsecadmin_ctrl_ltp_rx_rule_del); -CALL SP__insert_formal_parmspec(1, 'parms for the ltp_rx_rule_del control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'ltp_engine_id', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionsecadmin_ctrl_ltp_rx_rule_del , 'This control deletes the LTP segment authentication rule for the indicated LTP engine.', fp_spec_id, ion_ionsecadmin_ctrl_ltp_rx_rule_del_did); - -CALL SP__insert_obj_metadata(1, 'ltp_tx_rule_add', dtn_namespace_id, ion_ionsecadmin_ctrl_ltp_tx_rule_add); -CALL SP__insert_formal_parmspec(3, 'parms for the ltp_tx_rule_add control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'ltp_engine_id', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'ciphersuite_nbr', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'key_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionsecadmin_ctrl_ltp_tx_rule_add , 'This control adds a rule specifying the manner in which LTP segments transmitted to the indicated LTP engine mustbe signed. Signing a segment destined for the indicated LTP engineentails computing an authentication extension via the ciphersuite identified by ciphersuite_nbr using the applicable key value. If ciphersuite_nbr is 255 then the applicable key value is a hard-coded constant and key_name must be omitted; otherwise key_nameis required and the applicable key value is the current value of the key named key_name in the local security policy database.Valid values of ciphersuite_nbr are: 0:HMAC_SHA1-80 1: RSA_SHA256 255: NULL', fp_spec_id, ion_ionsecadmin_ctrl_ltp_tx_rule_add_did); - -CALL SP__insert_obj_metadata(1, 'ltp_tx_rule_change', dtn_namespace_id, ion_ionsecadmin_ctrl_ltp_tx_rule_change); -CALL SP__insert_formal_parmspec(3, 'parms for the ltp_tx_rule_change control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'ltp_engine_id', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'ciphersuite_nbr', 'UINT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'key_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionsecadmin_ctrl_ltp_tx_rule_change , 'This control changes the parameters of the LTP segment signing rule for the indicated LTP engine.', fp_spec_id, ion_ionsecadmin_ctrl_ltp_tx_rule_change_did); - -CALL SP__insert_obj_metadata(1, 'ltp_tx_rule_del', dtn_namespace_id, ion_ionsecadmin_ctrl_ltp_tx_rule_del); -CALL SP__insert_formal_parmspec(1, 'parms for the ltp_tx_rule_del control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'ltp_engine_id', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ion_ionsecadmin_ctrl_ltp_tx_rule_del , 'This control deletes the LTP segment signing rule forthe indicated LTP engine.', fp_spec_id, ion_ionsecadmin_ctrl_ltp_tx_rule_del_did); - -CALL SP__insert_obj_metadata(1, 'list_keys', dtn_namespace_id, ion_ionsecadmin_ctrl_list_keys); -CALL SP__insert_control_formal_definition(ion_ionsecadmin_ctrl_list_keys , 'This control lists the names of keys available in the key policy database.', null, ion_ionsecadmin_ctrl_list_keys_did); - -CALL SP__insert_obj_metadata(1, 'list_ltp_rx_rules', dtn_namespace_id, ion_ionsecadmin_ctrl_list_ltp_rx_rules); -CALL SP__insert_control_formal_definition(ion_ionsecadmin_ctrl_list_ltp_rx_rules , 'This control lists all LTP segment authentication rules in the security policy database.', null, ion_ionsecadmin_ctrl_list_ltp_rx_rules_did); - -CALL SP__insert_obj_metadata(1, 'list_ltp_tx_rules', dtn_namespace_id, ion_ionsecadmin_ctrl_list_ltp_tx_rules); -CALL SP__insert_control_formal_definition(ion_ionsecadmin_ctrl_list_ltp_tx_rules , 'This control lists all LTP segment signing rules in the security policy database.', null, ion_ionsecadmin_ctrl_list_ltp_tx_rules_did); - - --- #CONST - --- #MAC -END$do$ \ No newline at end of file diff --git a/amp-sql/postgres/Agent_Scripts/adm_ltp_agent.sql b/amp-sql/postgres/Agent_Scripts/adm_ltp_agent.sql deleted file mode 100644 index 90dd111..0000000 --- a/amp-sql/postgres/Agent_Scripts/adm_ltp_agent.sql +++ /dev/null @@ -1,816 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - -DO -$do$ -DECLARE -adm_enum integer; -dtn_namespace_id integer; -ltp_agent_meta_name integer; -ltp_agent_meta_name_did integer; -ltp_agent_meta_namespace integer; -ltp_agent_meta_namespace_did integer; -ltp_agent_meta_version integer; -ltp_agent_meta_version_did integer; -ltp_agent_meta_organization integer; -ltp_agent_meta_organization_did integer; -ltp_agent_edd_span_remote_engine_nbr integer; -ltp_agent_edd_span_remote_engine_nbr_fp integer; -r_fp_ent integer; -ltp_agent_edd_span_remote_engine_nbr_did integer; -ltp_agent_edd_span_cur_expt_sess integer; -ltp_agent_edd_span_cur_expt_sess_fp integer; -ltp_agent_edd_span_cur_expt_sess_did integer; -ltp_agent_edd_span_cur_out_seg integer; -ltp_agent_edd_span_cur_out_seg_fp integer; -ltp_agent_edd_span_cur_out_seg_did integer; -ltp_agent_edd_span_cur_imp_sess integer; -ltp_agent_edd_span_cur_imp_sess_fp integer; -ltp_agent_edd_span_cur_imp_sess_did integer; -ltp_agent_edd_span_cur_in_seg integer; -ltp_agent_edd_span_cur_in_seg_fp integer; -ltp_agent_edd_span_cur_in_seg_did integer; -ltp_agent_edd_span_reset_time integer; -ltp_agent_edd_span_reset_time_fp integer; -ltp_agent_edd_span_reset_time_did integer; -ltp_agent_edd_span_out_seg_q_cnt integer; -ltp_agent_edd_span_out_seg_q_cnt_fp integer; -ltp_agent_edd_span_out_seg_q_cnt_did integer; -ltp_agent_edd_span_out_seg_q_bytes integer; -ltp_agent_edd_span_out_seg_q_bytes_fp integer; -ltp_agent_edd_span_out_seg_q_bytes_did integer; -ltp_agent_edd_span_out_seg_pop_cnt integer; -ltp_agent_edd_span_out_seg_pop_cnt_fp integer; -ltp_agent_edd_span_out_seg_pop_cnt_did integer; -ltp_agent_edd_span_out_seg_pop_bytes integer; -ltp_agent_edd_span_out_seg_pop_bytes_fp integer; -ltp_agent_edd_span_out_seg_pop_bytes_did integer; -ltp_agent_edd_span_out_ckpt_xmit_cnt integer; -ltp_agent_edd_span_out_ckpt_xmit_cnt_fp integer; -ltp_agent_edd_span_out_ckpt_xmit_cnt_did integer; -ltp_agent_edd_span_out_pos_ack_rx_cnt integer; -ltp_agent_edd_span_out_pos_ack_rx_cnt_fp integer; -ltp_agent_edd_span_out_pos_ack_rx_cnt_did integer; -ltp_agent_edd_span_out_neg_ack_rx_cnt integer; -ltp_agent_edd_span_out_neg_ack_rx_cnt_fp integer; -ltp_agent_edd_span_out_neg_ack_rx_cnt_did integer; -ltp_agent_edd_span_out_cancel_rx_cnt integer; -ltp_agent_edd_span_out_cancel_rx_cnt_fp integer; -ltp_agent_edd_span_out_cancel_rx_cnt_did integer; -ltp_agent_edd_span_out_ckpt_rexmit_cnt integer; -ltp_agent_edd_span_out_ckpt_rexmit_cnt_fp integer; -ltp_agent_edd_span_out_ckpt_rexmit_cnt_did integer; -ltp_agent_edd_span_out_cancel_xmit_cnt integer; -ltp_agent_edd_span_out_cancel_xmit_cnt_fp integer; -ltp_agent_edd_span_out_cancel_xmit_cnt_did integer; -ltp_agent_edd_span_out_complete_cnt integer; -ltp_agent_edd_span_out_complete_cnt_fp integer; -ltp_agent_edd_span_out_complete_cnt_did integer; -ltp_agent_edd_span_in_seg_rx_red_cnt integer; -ltp_agent_edd_span_in_seg_rx_red_cnt_fp integer; -ltp_agent_edd_span_in_seg_rx_red_cnt_did integer; -ltp_agent_edd_span_in_seg_rx_red_bytes integer; -ltp_agent_edd_span_in_seg_rx_red_bytes_fp integer; -ltp_agent_edd_span_in_seg_rx_red_bytes_did integer; -ltp_agent_edd_span_in_seg_rx_green_cnt integer; -ltp_agent_edd_span_in_seg_rx_green_cnt_fp integer; -ltp_agent_edd_span_in_seg_rx_green_cnt_did integer; -ltp_agent_edd_span_in_seg_rx_green_bytes integer; -ltp_agent_edd_span_in_seg_rx_green_bytes_fp integer; -ltp_agent_edd_span_in_seg_rx_green_bytes_did integer; -ltp_agent_edd_span_in_seg_rx_redundant_cnt integer; -ltp_agent_edd_span_in_seg_rx_redundant_cnt_fp integer; -ltp_agent_edd_span_in_seg_rx_redundant_cnt_did integer; -ltp_agent_edd_span_in_seg_rx_redundant_bytes integer; -ltp_agent_edd_span_in_seg_rx_redundant_bytes_fp integer; -ltp_agent_edd_span_in_seg_rx_redundant_bytes_did integer; -ltp_agent_edd_span_in_seg_rx_mal_cnt integer; -ltp_agent_edd_span_in_seg_rx_mal_cnt_fp integer; -ltp_agent_edd_span_in_seg_rx_mal_cnt_did integer; -ltp_agent_edd_span_in_seg_rx_mal_bytes integer; -ltp_agent_edd_span_in_seg_rx_mal_bytes_fp integer; -ltp_agent_edd_span_in_seg_rx_mal_bytes_did integer; -ltp_agent_edd_span_in_seg_rx_unk_sender_cnt integer; -ltp_agent_edd_span_in_seg_rx_unk_sender_cnt_fp integer; -ltp_agent_edd_span_in_seg_rx_unk_sender_cnt_did integer; -ltp_agent_edd_span_in_seg_rx_unk_sender_bytes integer; -ltp_agent_edd_span_in_seg_rx_unk_sender_bytes_fp integer; -ltp_agent_edd_span_in_seg_rx_unk_sender_bytes_did integer; -ltp_agent_edd_span_in_seg_rx_unk_client_cnt integer; -ltp_agent_edd_span_in_seg_rx_unk_client_cnt_fp integer; -ltp_agent_edd_span_in_seg_rx_unk_client_cnt_did integer; -ltp_agent_edd_span_in_seg_rx_unk_client_bytes integer; -ltp_agent_edd_span_in_seg_rx_unk_client_bytes_fp integer; -ltp_agent_edd_span_in_seg_rx_unk_client_bytes_did integer; -ltp_agent_edd_span_in_seg_stray_cnt integer; -ltp_agent_edd_span_in_seg_stray_cnt_fp integer; -ltp_agent_edd_span_in_seg_stray_cnt_did integer; -ltp_agent_edd_span_in_seg_stray_bytes integer; -ltp_agent_edd_span_in_seg_stray_bytes_fp integer; -ltp_agent_edd_span_in_seg_stray_bytes_did integer; -ltp_agent_edd_span_in_seg_miscolor_cnt integer; -ltp_agent_edd_span_in_seg_miscolor_cnt_fp integer; -ltp_agent_edd_span_in_seg_miscolor_cnt_did integer; -ltp_agent_edd_span_in_seg_miscolor_bytes integer; -ltp_agent_edd_span_in_seg_miscolor_bytes_fp integer; -ltp_agent_edd_span_in_seg_miscolor_bytes_did integer; -ltp_agent_edd_span_in_seg_closed_cnt integer; -ltp_agent_edd_span_in_seg_closed_cnt_fp integer; -ltp_agent_edd_span_in_seg_closed_cnt_did integer; -ltp_agent_edd_span_in_seg_closed_bytes integer; -ltp_agent_edd_span_in_seg_closed_bytes_fp integer; -ltp_agent_edd_span_in_seg_closed_bytes_did integer; -ltp_agent_edd_span_in_ckpt_rx_cnt integer; -ltp_agent_edd_span_in_ckpt_rx_cnt_fp integer; -ltp_agent_edd_span_in_ckpt_rx_cnt_did integer; -ltp_agent_edd_span_in_pos_ack_tx_cnt integer; -ltp_agent_edd_span_in_pos_ack_tx_cnt_fp integer; -ltp_agent_edd_span_in_pos_ack_tx_cnt_did integer; -ltp_agent_edd_span_in_neg_ack_tx_cnt integer; -ltp_agent_edd_span_in_neg_ack_tx_cnt_fp integer; -ltp_agent_edd_span_in_neg_ack_tx_cnt_did integer; -ltp_agent_edd_span_in_cancel_tx_cnt integer; -ltp_agent_edd_span_in_cancel_tx_cnt_fp integer; -ltp_agent_edd_span_in_cancel_tx_cnt_did integer; -ltp_agent_edd_span_in_ack_retx_cnt integer; -ltp_agent_edd_span_in_ack_retx_cnt_fp integer; -ltp_agent_edd_span_in_ack_retx_cnt_did integer; -ltp_agent_edd_span_in_cancel_rx_cnt integer; -ltp_agent_edd_span_in_cancel_rx_cnt_fp integer; -ltp_agent_edd_span_in_cancel_rx_cnt_did integer; -ltp_agent_edd_span_in_complete_cnt integer; -ltp_agent_edd_span_in_complete_cnt_fp integer; -ltp_agent_edd_span_in_complete_cnt_did integer; -ltp_agent_tblt_engines integer; -tbl_tnvc_id integer; -tnvc_entry integer; -ltp_agent_tblt_engines_did integer; -ltp_agent_rpttpl_endpointreport integer; -fp_spec_id integer; -ap_spec_id integer; -ltp_agent_edd_span_remote_engine_nbr_aid_ltp_span_1 integer; -ltp_agent_edd_span_cur_expt_sess_aid_ltp_span_1 integer; -ltp_agent_edd_span_cur_out_seg_aid_ltp_span_1 integer; -ltp_agent_edd_span_cur_imp_sess_aid_ltp_span_1 integer; -ltp_agent_edd_span_cur_in_seg_aid_ltp_span_1 integer; -ltp_agent_edd_span_reset_time_aid_ltp_span_1 integer; -ltp_agent_edd_span_out_seg_q_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_out_seg_q_bytes_aid_ltp_span_1 integer; -ltp_agent_edd_span_out_seg_pop_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_out_seg_pop_bytes_aid_ltp_span_1 integer; -ltp_agent_edd_span_out_ckpt_xmit_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_out_pos_ack_rx_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_out_neg_ack_rx_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_out_cancel_rx_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_out_ckpt_rexmit_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_out_cancel_xmit_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_out_complete_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_rx_red_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_rx_red_bytes_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_rx_green_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_rx_green_bytes_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_rx_redundant_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_rx_redundant_bytes_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_rx_mal_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_rx_mal_bytes_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_rx_unk_sender_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_rx_unk_sender_bytes_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_rx_unk_client_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_rx_unk_client_bytes_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_stray_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_stray_bytes_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_miscolor_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_miscolor_bytes_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_closed_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_seg_closed_bytes_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_ckpt_rx_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_pos_ack_tx_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_neg_ack_tx_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_cancel_tx_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_ack_retx_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_cancel_rx_cnt_aid_ltp_span_1 integer; -ltp_agent_edd_span_in_complete_cnt_aid_ltp_span_1 integer; -rptt_ac_id integer; -r_ac_rpt_entry_1 integer; -r_ac_rpt_entry_2 integer; -r_ac_rpt_entry_3 integer; -r_ac_rpt_entry_4 integer; -r_ac_rpt_entry_5 integer; -r_ac_rpt_entry_6 integer; -r_ac_rpt_entry_7 integer; -r_ac_rpt_entry_8 integer; -r_ac_rpt_entry_9 integer; -r_ac_rpt_entry_10 integer; -r_ac_rpt_entry_11 integer; -r_ac_rpt_entry_12 integer; -r_ac_rpt_entry_13 integer; -r_ac_rpt_entry_14 integer; -r_ac_rpt_entry_15 integer; -r_ac_rpt_entry_16 integer; -r_ac_rpt_entry_17 integer; -r_ac_rpt_entry_18 integer; -r_ac_rpt_entry_19 integer; -r_ac_rpt_entry_20 integer; -r_ac_rpt_entry_21 integer; -r_ac_rpt_entry_22 integer; -r_ac_rpt_entry_23 integer; -r_ac_rpt_entry_24 integer; -r_ac_rpt_entry_25 integer; -r_ac_rpt_entry_26 integer; -r_ac_rpt_entry_27 integer; -r_ac_rpt_entry_28 integer; -r_ac_rpt_entry_29 integer; -r_ac_rpt_entry_30 integer; -r_ac_rpt_entry_31 integer; -r_ac_rpt_entry_32 integer; -r_ac_rpt_entry_33 integer; -r_ac_rpt_entry_34 integer; -r_ac_rpt_entry_35 integer; -r_ac_rpt_entry_36 integer; -r_ac_rpt_entry_37 integer; -r_ac_rpt_entry_38 integer; -r_ac_rpt_entry_39 integer; -r_ac_rpt_entry_40 integer; -r_ac_rpt_entry_41 integer; -r_ac_rpt_entry_42 integer; -ltp_agent_rpttpl_endpointreport_did integer; -ltp_agent_rpttpl_endpointreport_aid integer; -ltp_agent_ctrl_reset integer; -ltp_agent_ctrl_reset_did integer; -BEGIN - - -adm_enum = 3; -CALL SP__insert_adm_defined_namespace('JHUAPL', 'DTN/ltp_agent', 'v0.0', 'ltp_agent', adm_enum, NULL, 'The namespace of the ADM.', dtn_namespace_id); - - --- #META -CALL SP__insert_obj_metadata(0, 'name', dtn_namespace_id, ltp_agent_meta_name); -CALL SP__insert_const_actual_definition(ltp_agent_meta_name, 'The human-readable name of the ADM.', 'STR', 'ltp_agent', ltp_agent_meta_name_did); - -CALL SP__insert_obj_metadata(0, 'namespace', dtn_namespace_id, ltp_agent_meta_namespace); -CALL SP__insert_const_actual_definition(ltp_agent_meta_namespace, 'The namespace of the ADM.', 'STR', 'DTN/ltp_agent', ltp_agent_meta_namespace_did); - -CALL SP__insert_obj_metadata(0, 'version', dtn_namespace_id, ltp_agent_meta_version); -CALL SP__insert_const_actual_definition(ltp_agent_meta_version, 'The version of the ADM.', 'STR', 'v0.0', ltp_agent_meta_version_did); - -CALL SP__insert_obj_metadata(0, 'organization', dtn_namespace_id, ltp_agent_meta_organization); -CALL SP__insert_const_actual_definition(ltp_agent_meta_organization, 'The name of the issuing organization of the ADM.', 'STR', 'JHUAPL', ltp_agent_meta_organization_did); - --- #EDD -CALL SP__insert_obj_metadata(2, 'span_remote_engine_nbr', dtn_namespace_id, ltp_agent_edd_span_remote_engine_nbr); -CALL SP__insert_formal_parmspec(1, 'parms for span_remote_engine_nbr', ltp_agent_edd_span_remote_engine_nbr_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_remote_engine_nbr_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_remote_engine_nbr, 'The remote engine number of this span.', ltp_agent_edd_span_remote_engine_nbr_fp, 'UINT', ltp_agent_edd_span_remote_engine_nbr_did); - -CALL SP__insert_obj_metadata(2, 'span_cur_expt_sess', dtn_namespace_id, ltp_agent_edd_span_cur_expt_sess); -CALL SP__insert_formal_parmspec(1, 'parms for span_cur_expt_sess', ltp_agent_edd_span_cur_expt_sess_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_cur_expt_sess_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_cur_expt_sess, 'Expected sessions on this span.', ltp_agent_edd_span_cur_expt_sess_fp, 'UINT', ltp_agent_edd_span_cur_expt_sess_did); - -CALL SP__insert_obj_metadata(2, 'span_cur_out_seg', dtn_namespace_id, ltp_agent_edd_span_cur_out_seg); -CALL SP__insert_formal_parmspec(1, 'parms for span_cur_out_seg', ltp_agent_edd_span_cur_out_seg_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_cur_out_seg_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_cur_out_seg, 'The current number of outbound segments for this span.', ltp_agent_edd_span_cur_out_seg_fp, 'UINT', ltp_agent_edd_span_cur_out_seg_did); - -CALL SP__insert_obj_metadata(2, 'span_cur_imp_sess', dtn_namespace_id, ltp_agent_edd_span_cur_imp_sess); -CALL SP__insert_formal_parmspec(1, 'parms for span_cur_imp_sess', ltp_agent_edd_span_cur_imp_sess_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_cur_imp_sess_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_cur_imp_sess, 'The current number of import segments for this span.', ltp_agent_edd_span_cur_imp_sess_fp, 'UINT', ltp_agent_edd_span_cur_imp_sess_did); - -CALL SP__insert_obj_metadata(2, 'span_cur_in_seg', dtn_namespace_id, ltp_agent_edd_span_cur_in_seg); -CALL SP__insert_formal_parmspec(1, 'parms for span_cur_in_seg', ltp_agent_edd_span_cur_in_seg_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_cur_in_seg_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_cur_in_seg, 'The current number of inbound segments for this span.', ltp_agent_edd_span_cur_in_seg_fp, 'UINT', ltp_agent_edd_span_cur_in_seg_did); - -CALL SP__insert_obj_metadata(2, 'span_reset_time', dtn_namespace_id, ltp_agent_edd_span_reset_time); -CALL SP__insert_formal_parmspec(1, 'parms for span_reset_time', ltp_agent_edd_span_reset_time_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_reset_time_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_reset_time, 'The last time the span counters were reset.', ltp_agent_edd_span_reset_time_fp, 'UVAST', ltp_agent_edd_span_reset_time_did); - -CALL SP__insert_obj_metadata(2, 'span_out_seg_q_cnt', dtn_namespace_id, ltp_agent_edd_span_out_seg_q_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_seg_q_cnt', ltp_agent_edd_span_out_seg_q_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_out_seg_q_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_out_seg_q_cnt, 'The output segment queued count for the span.', ltp_agent_edd_span_out_seg_q_cnt_fp, 'UINT', ltp_agent_edd_span_out_seg_q_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_out_seg_q_bytes', dtn_namespace_id, ltp_agent_edd_span_out_seg_q_bytes); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_seg_q_bytes', ltp_agent_edd_span_out_seg_q_bytes_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_out_seg_q_bytes_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_out_seg_q_bytes, 'The output segment queued bytes for the span.', ltp_agent_edd_span_out_seg_q_bytes_fp, 'UINT', ltp_agent_edd_span_out_seg_q_bytes_did); - -CALL SP__insert_obj_metadata(2, 'span_out_seg_pop_cnt', dtn_namespace_id, ltp_agent_edd_span_out_seg_pop_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_seg_pop_cnt', ltp_agent_edd_span_out_seg_pop_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_out_seg_pop_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_out_seg_pop_cnt, 'The output segment popped count for the span.', ltp_agent_edd_span_out_seg_pop_cnt_fp, 'UINT', ltp_agent_edd_span_out_seg_pop_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_out_seg_pop_bytes', dtn_namespace_id, ltp_agent_edd_span_out_seg_pop_bytes); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_seg_pop_bytes', ltp_agent_edd_span_out_seg_pop_bytes_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_out_seg_pop_bytes_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_out_seg_pop_bytes, 'The output segment popped bytes for the span.', ltp_agent_edd_span_out_seg_pop_bytes_fp, 'UINT', ltp_agent_edd_span_out_seg_pop_bytes_did); - -CALL SP__insert_obj_metadata(2, 'span_out_ckpt_xmit_cnt', dtn_namespace_id, ltp_agent_edd_span_out_ckpt_xmit_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_ckpt_xmit_cnt', ltp_agent_edd_span_out_ckpt_xmit_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_out_ckpt_xmit_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_out_ckpt_xmit_cnt, 'The output checkpoint transmit count for the span.', ltp_agent_edd_span_out_ckpt_xmit_cnt_fp, 'UINT', ltp_agent_edd_span_out_ckpt_xmit_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_out_pos_ack_rx_cnt', dtn_namespace_id, ltp_agent_edd_span_out_pos_ack_rx_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_pos_ack_rx_cnt', ltp_agent_edd_span_out_pos_ack_rx_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_out_pos_ack_rx_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_out_pos_ack_rx_cnt, 'The output positive acknowledgement received count for the span.', ltp_agent_edd_span_out_pos_ack_rx_cnt_fp, 'UINT', ltp_agent_edd_span_out_pos_ack_rx_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_out_neg_ack_rx_cnt', dtn_namespace_id, ltp_agent_edd_span_out_neg_ack_rx_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_neg_ack_rx_cnt', ltp_agent_edd_span_out_neg_ack_rx_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_out_neg_ack_rx_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_out_neg_ack_rx_cnt, 'The output negative acknowledgement received count for the span.', ltp_agent_edd_span_out_neg_ack_rx_cnt_fp, 'UINT', ltp_agent_edd_span_out_neg_ack_rx_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_out_cancel_rx_cnt', dtn_namespace_id, ltp_agent_edd_span_out_cancel_rx_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_cancel_rx_cnt', ltp_agent_edd_span_out_cancel_rx_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_out_cancel_rx_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_out_cancel_rx_cnt, 'The output cancelled received count for the span.', ltp_agent_edd_span_out_cancel_rx_cnt_fp, 'UINT', ltp_agent_edd_span_out_cancel_rx_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_out_ckpt_rexmit_cnt', dtn_namespace_id, ltp_agent_edd_span_out_ckpt_rexmit_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_ckpt_rexmit_cnt', ltp_agent_edd_span_out_ckpt_rexmit_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_out_ckpt_rexmit_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_out_ckpt_rexmit_cnt, 'The output checkpoint retransmit count for the span.', ltp_agent_edd_span_out_ckpt_rexmit_cnt_fp, 'UINT', ltp_agent_edd_span_out_ckpt_rexmit_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_out_cancel_xmit_cnt', dtn_namespace_id, ltp_agent_edd_span_out_cancel_xmit_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_cancel_xmit_cnt', ltp_agent_edd_span_out_cancel_xmit_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_out_cancel_xmit_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_out_cancel_xmit_cnt, 'The output cancel retransmit count for the span.', ltp_agent_edd_span_out_cancel_xmit_cnt_fp, 'UINT', ltp_agent_edd_span_out_cancel_xmit_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_out_complete_cnt', dtn_namespace_id, ltp_agent_edd_span_out_complete_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_complete_cnt', ltp_agent_edd_span_out_complete_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_out_complete_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_out_complete_cnt, 'The output completed count for the span.', ltp_agent_edd_span_out_complete_cnt_fp, 'UINT', ltp_agent_edd_span_out_complete_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_rx_red_cnt', dtn_namespace_id, ltp_agent_edd_span_in_seg_rx_red_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_red_cnt', ltp_agent_edd_span_in_seg_rx_red_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_rx_red_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_rx_red_cnt, 'The input segment received red count for the span.', ltp_agent_edd_span_in_seg_rx_red_cnt_fp, 'UINT', ltp_agent_edd_span_in_seg_rx_red_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_rx_red_bytes', dtn_namespace_id, ltp_agent_edd_span_in_seg_rx_red_bytes); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_red_bytes', ltp_agent_edd_span_in_seg_rx_red_bytes_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_rx_red_bytes_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_rx_red_bytes, 'The input segment received red bytes for the span.', ltp_agent_edd_span_in_seg_rx_red_bytes_fp, 'UINT', ltp_agent_edd_span_in_seg_rx_red_bytes_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_rx_green_cnt', dtn_namespace_id, ltp_agent_edd_span_in_seg_rx_green_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_green_cnt', ltp_agent_edd_span_in_seg_rx_green_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_rx_green_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_rx_green_cnt, 'The input segment received green count for the span.', ltp_agent_edd_span_in_seg_rx_green_cnt_fp, 'UINT', ltp_agent_edd_span_in_seg_rx_green_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_rx_green_bytes', dtn_namespace_id, ltp_agent_edd_span_in_seg_rx_green_bytes); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_green_bytes', ltp_agent_edd_span_in_seg_rx_green_bytes_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_rx_green_bytes_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_rx_green_bytes, 'The input segment received green bytes for the span.', ltp_agent_edd_span_in_seg_rx_green_bytes_fp, 'UINT', ltp_agent_edd_span_in_seg_rx_green_bytes_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_rx_redundant_cnt', dtn_namespace_id, ltp_agent_edd_span_in_seg_rx_redundant_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_redundant_cnt', ltp_agent_edd_span_in_seg_rx_redundant_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_rx_redundant_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_rx_redundant_cnt, 'The input segment received redundant count for the span.', ltp_agent_edd_span_in_seg_rx_redundant_cnt_fp, 'UINT', ltp_agent_edd_span_in_seg_rx_redundant_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_rx_redundant_bytes', dtn_namespace_id, ltp_agent_edd_span_in_seg_rx_redundant_bytes); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_redundant_bytes', ltp_agent_edd_span_in_seg_rx_redundant_bytes_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_rx_redundant_bytes_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_rx_redundant_bytes, 'The input segment received redundant bytes for the span.', ltp_agent_edd_span_in_seg_rx_redundant_bytes_fp, 'UINT', ltp_agent_edd_span_in_seg_rx_redundant_bytes_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_rx_mal_cnt', dtn_namespace_id, ltp_agent_edd_span_in_seg_rx_mal_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_mal_cnt', ltp_agent_edd_span_in_seg_rx_mal_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_rx_mal_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_rx_mal_cnt, 'The input segment malformed count for the span.', ltp_agent_edd_span_in_seg_rx_mal_cnt_fp, 'UINT', ltp_agent_edd_span_in_seg_rx_mal_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_rx_mal_bytes', dtn_namespace_id, ltp_agent_edd_span_in_seg_rx_mal_bytes); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_mal_bytes', ltp_agent_edd_span_in_seg_rx_mal_bytes_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_rx_mal_bytes_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_rx_mal_bytes, 'The input segment malformed bytes for the span.', ltp_agent_edd_span_in_seg_rx_mal_bytes_fp, 'UINT', ltp_agent_edd_span_in_seg_rx_mal_bytes_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_rx_unk_sender_cnt', dtn_namespace_id, ltp_agent_edd_span_in_seg_rx_unk_sender_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_unk_sender_cnt', ltp_agent_edd_span_in_seg_rx_unk_sender_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_rx_unk_sender_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_rx_unk_sender_cnt, 'The input segment unknown sender count for the span.', ltp_agent_edd_span_in_seg_rx_unk_sender_cnt_fp, 'UINT', ltp_agent_edd_span_in_seg_rx_unk_sender_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_rx_unk_sender_bytes', dtn_namespace_id, ltp_agent_edd_span_in_seg_rx_unk_sender_bytes); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_unk_sender_bytes', ltp_agent_edd_span_in_seg_rx_unk_sender_bytes_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_rx_unk_sender_bytes_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_rx_unk_sender_bytes, 'The input segment unknown sender bytes for the span.', ltp_agent_edd_span_in_seg_rx_unk_sender_bytes_fp, 'UINT', ltp_agent_edd_span_in_seg_rx_unk_sender_bytes_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_rx_unk_client_cnt', dtn_namespace_id, ltp_agent_edd_span_in_seg_rx_unk_client_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_unk_client_cnt', ltp_agent_edd_span_in_seg_rx_unk_client_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_rx_unk_client_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_rx_unk_client_cnt, 'The input segment unknown client count for the span.', ltp_agent_edd_span_in_seg_rx_unk_client_cnt_fp, 'UINT', ltp_agent_edd_span_in_seg_rx_unk_client_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_rx_unk_client_bytes', dtn_namespace_id, ltp_agent_edd_span_in_seg_rx_unk_client_bytes); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_unk_client_bytes', ltp_agent_edd_span_in_seg_rx_unk_client_bytes_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_rx_unk_client_bytes_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_rx_unk_client_bytes, 'The input segment unknown client bytes for the span.', ltp_agent_edd_span_in_seg_rx_unk_client_bytes_fp, 'UINT', ltp_agent_edd_span_in_seg_rx_unk_client_bytes_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_stray_cnt', dtn_namespace_id, ltp_agent_edd_span_in_seg_stray_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_stray_cnt', ltp_agent_edd_span_in_seg_stray_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_stray_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_stray_cnt, 'The input segment stray count for the span.', ltp_agent_edd_span_in_seg_stray_cnt_fp, 'UINT', ltp_agent_edd_span_in_seg_stray_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_stray_bytes', dtn_namespace_id, ltp_agent_edd_span_in_seg_stray_bytes); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_stray_bytes', ltp_agent_edd_span_in_seg_stray_bytes_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_stray_bytes_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_stray_bytes, 'The input segment stray bytes for the span.', ltp_agent_edd_span_in_seg_stray_bytes_fp, 'UINT', ltp_agent_edd_span_in_seg_stray_bytes_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_miscolor_cnt', dtn_namespace_id, ltp_agent_edd_span_in_seg_miscolor_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_miscolor_cnt', ltp_agent_edd_span_in_seg_miscolor_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_miscolor_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_miscolor_cnt, 'The input segment miscolored count for the span.', ltp_agent_edd_span_in_seg_miscolor_cnt_fp, 'UINT', ltp_agent_edd_span_in_seg_miscolor_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_miscolor_bytes', dtn_namespace_id, ltp_agent_edd_span_in_seg_miscolor_bytes); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_miscolor_bytes', ltp_agent_edd_span_in_seg_miscolor_bytes_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_miscolor_bytes_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_miscolor_bytes, 'The input segment miscolored bytes for the span.', ltp_agent_edd_span_in_seg_miscolor_bytes_fp, 'UINT', ltp_agent_edd_span_in_seg_miscolor_bytes_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_closed_cnt', dtn_namespace_id, ltp_agent_edd_span_in_seg_closed_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_closed_cnt', ltp_agent_edd_span_in_seg_closed_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_closed_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_closed_cnt, 'The input segment closed count for the span.', ltp_agent_edd_span_in_seg_closed_cnt_fp, 'UINT', ltp_agent_edd_span_in_seg_closed_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_in_seg_closed_bytes', dtn_namespace_id, ltp_agent_edd_span_in_seg_closed_bytes); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_closed_bytes', ltp_agent_edd_span_in_seg_closed_bytes_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_seg_closed_bytes_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_seg_closed_bytes, 'The input segment closed bytes for the span.', ltp_agent_edd_span_in_seg_closed_bytes_fp, 'UINT', ltp_agent_edd_span_in_seg_closed_bytes_did); - -CALL SP__insert_obj_metadata(2, 'span_in_ckpt_rx_cnt', dtn_namespace_id, ltp_agent_edd_span_in_ckpt_rx_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_ckpt_rx_cnt', ltp_agent_edd_span_in_ckpt_rx_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_ckpt_rx_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_ckpt_rx_cnt, 'The input checkpoint receive count for the span.', ltp_agent_edd_span_in_ckpt_rx_cnt_fp, 'UINT', ltp_agent_edd_span_in_ckpt_rx_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_in_pos_ack_tx_cnt', dtn_namespace_id, ltp_agent_edd_span_in_pos_ack_tx_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_pos_ack_tx_cnt', ltp_agent_edd_span_in_pos_ack_tx_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_pos_ack_tx_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_pos_ack_tx_cnt, 'The input positive acknolwedgement transmitted count for the span.', ltp_agent_edd_span_in_pos_ack_tx_cnt_fp, 'UINT', ltp_agent_edd_span_in_pos_ack_tx_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_in_neg_ack_tx_cnt', dtn_namespace_id, ltp_agent_edd_span_in_neg_ack_tx_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_neg_ack_tx_cnt', ltp_agent_edd_span_in_neg_ack_tx_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_neg_ack_tx_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_neg_ack_tx_cnt, 'The input negative acknolwedgement transmitted count for the span.', ltp_agent_edd_span_in_neg_ack_tx_cnt_fp, 'UINT', ltp_agent_edd_span_in_neg_ack_tx_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_in_cancel_tx_cnt', dtn_namespace_id, ltp_agent_edd_span_in_cancel_tx_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_cancel_tx_cnt', ltp_agent_edd_span_in_cancel_tx_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_cancel_tx_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_cancel_tx_cnt, 'The input cancel transmitted count for the span.', ltp_agent_edd_span_in_cancel_tx_cnt_fp, 'UINT', ltp_agent_edd_span_in_cancel_tx_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_in_ack_retx_cnt', dtn_namespace_id, ltp_agent_edd_span_in_ack_retx_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_ack_retx_cnt', ltp_agent_edd_span_in_ack_retx_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_ack_retx_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_ack_retx_cnt, 'The input acknolwedgement retransmit count for the span.', ltp_agent_edd_span_in_ack_retx_cnt_fp, 'UINT', ltp_agent_edd_span_in_ack_retx_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_in_cancel_rx_cnt', dtn_namespace_id, ltp_agent_edd_span_in_cancel_rx_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_cancel_rx_cnt', ltp_agent_edd_span_in_cancel_rx_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_cancel_rx_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_cancel_rx_cnt, 'The input cancel receive count for the span.', ltp_agent_edd_span_in_cancel_rx_cnt_fp, 'UINT', ltp_agent_edd_span_in_cancel_rx_cnt_did); - -CALL SP__insert_obj_metadata(2, 'span_in_complete_cnt', dtn_namespace_id, ltp_agent_edd_span_in_complete_cnt); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_complete_cnt', ltp_agent_edd_span_in_complete_cnt_fp); -CALL SP__insert_formal_parmspec_entry(ltp_agent_edd_span_in_complete_cnt_fp, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(ltp_agent_edd_span_in_complete_cnt, 'The input completed count for the span.', ltp_agent_edd_span_in_complete_cnt_fp, 'UINT', ltp_agent_edd_span_in_complete_cnt_did); - --- #OPER - --- #VAR - --- #TBLT -CALL SP__insert_obj_metadata(10, 'engines', dtn_namespace_id, ltp_agent_tblt_engines); -CALL SP__insert_tnvc_collection('columns for the engines table', tbl_tnvc_id); -CALL SP__insert_tnvc_uvast_entry(tbl_tnvc_id, 1, 'peer_engine_nbr', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(ltp_agent_tblt_engines, 'This table lists all known remote engine ids.', tbl_tnvc_id, ltp_agent_tblt_engines_did); - - --- #RPTT - -CALL SP__insert_obj_metadata(7, 'endpointReport', dtn_namespace_id, ltp_agent_rpttpl_endpointreport); -CALL SP__insert_formal_parmspec(1, 'parms for span_remote_engine_nbr', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_remote_engine_nbr', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_remote_engine_nbr_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_remote_engine_nbr_did, NULL, ap_spec_id, ltp_agent_edd_span_remote_engine_nbr_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_cur_expt_sess', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_cur_expt_sess', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_cur_expt_sess_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_cur_expt_sess_did, NULL, ap_spec_id, ltp_agent_edd_span_cur_expt_sess_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_cur_out_seg', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_cur_out_seg', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_cur_out_seg_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_cur_out_seg_did, NULL, ap_spec_id, ltp_agent_edd_span_cur_out_seg_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_cur_imp_sess', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_cur_imp_sess', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_cur_imp_sess_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_cur_imp_sess_did, NULL, ap_spec_id, ltp_agent_edd_span_cur_imp_sess_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_cur_in_seg', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_cur_in_seg', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_cur_in_seg_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_cur_in_seg_did, NULL, ap_spec_id, ltp_agent_edd_span_cur_in_seg_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_reset_time', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_reset_time', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_reset_time_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_reset_time_did, NULL, ap_spec_id, ltp_agent_edd_span_reset_time_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_seg_q_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_out_seg_q_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_out_seg_q_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_out_seg_q_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_out_seg_q_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_seg_q_bytes', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_out_seg_q_bytes', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_out_seg_q_bytes_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_out_seg_q_bytes_did, NULL, ap_spec_id, ltp_agent_edd_span_out_seg_q_bytes_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_seg_pop_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_out_seg_pop_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_out_seg_pop_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_out_seg_pop_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_out_seg_pop_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_seg_pop_bytes', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_out_seg_pop_bytes', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_out_seg_pop_bytes_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_out_seg_pop_bytes_did, NULL, ap_spec_id, ltp_agent_edd_span_out_seg_pop_bytes_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_ckpt_xmit_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_out_ckpt_xmit_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_out_ckpt_xmit_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_out_ckpt_xmit_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_out_ckpt_xmit_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_pos_ack_rx_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_out_pos_ack_rx_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_out_pos_ack_rx_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_out_pos_ack_rx_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_out_pos_ack_rx_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_neg_ack_rx_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_out_neg_ack_rx_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_out_neg_ack_rx_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_out_neg_ack_rx_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_out_neg_ack_rx_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_cancel_rx_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_out_cancel_rx_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_out_cancel_rx_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_out_cancel_rx_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_out_cancel_rx_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_ckpt_rexmit_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_out_ckpt_rexmit_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_out_ckpt_rexmit_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_out_ckpt_rexmit_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_out_ckpt_rexmit_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_cancel_xmit_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_out_cancel_xmit_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_out_cancel_xmit_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_out_cancel_xmit_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_out_cancel_xmit_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_out_complete_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_out_complete_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_out_complete_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_out_complete_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_out_complete_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_red_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_rx_red_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_rx_red_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_rx_red_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_rx_red_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_red_bytes', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_rx_red_bytes', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_rx_red_bytes_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_rx_red_bytes_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_rx_red_bytes_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_green_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_rx_green_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_rx_green_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_rx_green_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_rx_green_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_green_bytes', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_rx_green_bytes', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_rx_green_bytes_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_rx_green_bytes_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_rx_green_bytes_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_redundant_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_rx_redundant_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_rx_redundant_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_rx_redundant_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_rx_redundant_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_redundant_bytes', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_rx_redundant_bytes', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_rx_redundant_bytes_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_rx_redundant_bytes_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_rx_redundant_bytes_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_mal_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_rx_mal_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_rx_mal_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_rx_mal_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_rx_mal_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_mal_bytes', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_rx_mal_bytes', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_rx_mal_bytes_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_rx_mal_bytes_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_rx_mal_bytes_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_unk_sender_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_rx_unk_sender_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_rx_unk_sender_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_rx_unk_sender_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_rx_unk_sender_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_unk_sender_bytes', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_rx_unk_sender_bytes', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_rx_unk_sender_bytes_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_rx_unk_sender_bytes_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_rx_unk_sender_bytes_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_unk_client_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_rx_unk_client_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_rx_unk_client_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_rx_unk_client_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_rx_unk_client_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_rx_unk_client_bytes', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_rx_unk_client_bytes', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_rx_unk_client_bytes_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_rx_unk_client_bytes_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_rx_unk_client_bytes_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_stray_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_stray_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_stray_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_stray_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_stray_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_stray_bytes', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_stray_bytes', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_stray_bytes_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_stray_bytes_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_stray_bytes_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_miscolor_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_miscolor_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_miscolor_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_miscolor_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_miscolor_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_miscolor_bytes', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_miscolor_bytes', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_miscolor_bytes_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_miscolor_bytes_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_miscolor_bytes_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_closed_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_closed_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_closed_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_closed_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_closed_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_seg_closed_bytes', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_seg_closed_bytes', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_seg_closed_bytes_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_seg_closed_bytes_did, NULL, ap_spec_id, ltp_agent_edd_span_in_seg_closed_bytes_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_ckpt_rx_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_ckpt_rx_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_ckpt_rx_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_ckpt_rx_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_in_ckpt_rx_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_pos_ack_tx_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_pos_ack_tx_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_pos_ack_tx_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_pos_ack_tx_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_in_pos_ack_tx_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_neg_ack_tx_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_neg_ack_tx_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_neg_ack_tx_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_neg_ack_tx_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_in_neg_ack_tx_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_cancel_tx_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_cancel_tx_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_cancel_tx_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_cancel_tx_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_in_cancel_tx_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_ack_retx_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_ack_retx_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_ack_retx_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_ack_retx_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_in_ack_retx_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_cancel_rx_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_cancel_rx_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_cancel_rx_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_cancel_rx_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_in_cancel_rx_cnt_aid_ltp_span_1); -CALL SP__insert_formal_parmspec(1, 'parms for span_in_complete_cnt', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'span_in_complete_cnt', 'UINT', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(ltp_agent_edd_span_in_complete_cnt_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'UINT', fp_spec_id); -CALL SP__insert_edd_actual_definition(ltp_agent_edd_span_in_complete_cnt_did, NULL, ap_spec_id, ltp_agent_edd_span_in_complete_cnt_aid_ltp_span_1); - -CALL SP__insert_ac_id(42, 'ac for report template endpointReport', rptt_ac_id); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_remote_engine_nbr_did, 1, r_ac_rpt_entry_1); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_cur_expt_sess_did, 2, r_ac_rpt_entry_2); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_cur_out_seg_did, 3, r_ac_rpt_entry_3); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_cur_imp_sess_did, 4, r_ac_rpt_entry_4); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_cur_in_seg_did, 5, r_ac_rpt_entry_5); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_reset_time_did, 6, r_ac_rpt_entry_6); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_out_seg_q_cnt_did, 7, r_ac_rpt_entry_7); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_out_seg_q_bytes_did, 8, r_ac_rpt_entry_8); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_out_seg_pop_cnt_did, 9, r_ac_rpt_entry_9); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_out_seg_pop_bytes_did, 10, r_ac_rpt_entry_10); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_out_ckpt_xmit_cnt_did, 11, r_ac_rpt_entry_11); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_out_pos_ack_rx_cnt_did, 12, r_ac_rpt_entry_12); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_out_neg_ack_rx_cnt_did, 13, r_ac_rpt_entry_13); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_out_cancel_rx_cnt_did, 14, r_ac_rpt_entry_14); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_out_ckpt_rexmit_cnt_did, 15, r_ac_rpt_entry_15); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_out_cancel_xmit_cnt_did, 16, r_ac_rpt_entry_16); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_out_complete_cnt_did, 17, r_ac_rpt_entry_17); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_rx_red_cnt_did, 18, r_ac_rpt_entry_18); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_rx_red_bytes_did, 19, r_ac_rpt_entry_19); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_rx_green_cnt_did, 20, r_ac_rpt_entry_20); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_rx_green_bytes_did, 21, r_ac_rpt_entry_21); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_rx_redundant_cnt_did, 22, r_ac_rpt_entry_22); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_rx_redundant_bytes_did, 23, r_ac_rpt_entry_23); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_rx_mal_cnt_did, 24, r_ac_rpt_entry_24); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_rx_mal_bytes_did, 25, r_ac_rpt_entry_25); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_rx_unk_sender_cnt_did, 26, r_ac_rpt_entry_26); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_rx_unk_sender_bytes_did, 27, r_ac_rpt_entry_27); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_rx_unk_client_cnt_did, 28, r_ac_rpt_entry_28); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_rx_unk_client_bytes_did, 29, r_ac_rpt_entry_29); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_stray_cnt_did, 30, r_ac_rpt_entry_30); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_stray_bytes_did, 31, r_ac_rpt_entry_31); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_miscolor_cnt_did, 32, r_ac_rpt_entry_32); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_miscolor_bytes_did, 33, r_ac_rpt_entry_33); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_closed_cnt_did, 34, r_ac_rpt_entry_34); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_seg_closed_bytes_did, 35, r_ac_rpt_entry_35); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_ckpt_rx_cnt_did, 36, r_ac_rpt_entry_36); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_pos_ack_tx_cnt_did, 37, r_ac_rpt_entry_37); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_neg_ack_tx_cnt_did, 38, r_ac_rpt_entry_38); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_cancel_tx_cnt_did, 39, r_ac_rpt_entry_39); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_ack_retx_cnt_did, 40, r_ac_rpt_entry_40); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_cancel_rx_cnt_did, 41, r_ac_rpt_entry_41); -CALL SP__insert_ac_actual_entry(rptt_ac_id, ltp_agent_edd_span_in_complete_cnt_did, 42, r_ac_rpt_entry_42); - -CALL SP__insert_report_template_formal_definition(ltp_agent_rpttpl_endpointreport, 'This is all known endpoint information', null, rptt_ac_id, ltp_agent_rpttpl_endpointreport_did); -CALL SP__insert_report_actual_definition(ltp_agent_rpttpl_endpointreport, null, null, 'Singleton value for endpointReport', ltp_agent_rpttpl_endpointreport_aid); - --- #CTRL -CALL SP__insert_obj_metadata(1, 'reset', dtn_namespace_id, ltp_agent_ctrl_reset); -CALL SP__insert_formal_parmspec(1, 'parms for the reset control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'ltp_span', 'UINT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(ltp_agent_ctrl_reset , 'Resets the counters associated with the engine and updates the last reset time for the span to be the time when this control was run.', fp_spec_id, ltp_agent_ctrl_reset_did); - - --- #CONST - --- #MAC - -END -$do$ \ No newline at end of file diff --git a/amp-sql/postgres/Agent_Scripts/adm_sbsp.sql b/amp-sql/postgres/Agent_Scripts/adm_sbsp.sql deleted file mode 100644 index 1ee769f..0000000 --- a/amp-sql/postgres/Agent_Scripts/adm_sbsp.sql +++ /dev/null @@ -1,887 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- -DO -$do$ -DECLARE -adm_enum INTEGER; -dtn_namespace_id INTEGER; -sbsp_meta_name INTEGER; -sbsp_meta_name_did INTEGER; -sbsp_meta_namespace INTEGER; -sbsp_meta_namespace_did INTEGER; -sbsp_meta_version INTEGER; -sbsp_meta_version_did INTEGER; -sbsp_meta_organization INTEGER; -sbsp_meta_organization_did INTEGER; -sbsp_edd_num_good_tx_bcb_blk INTEGER; -sbsp_edd_num_good_tx_bcb_blk_did INTEGER; -sbsp_edd_num_good_tx_bcb_blk_aid INTEGER; -sbsp_edd_num_bad_tx_bcb_blk INTEGER; -sbsp_edd_num_bad_tx_bcb_blk_did INTEGER; -sbsp_edd_num_bad_tx_bcb_blk_aid INTEGER; -sbsp_edd_num_good_rx_bcb_blk INTEGER; -sbsp_edd_num_good_rx_bcb_blk_did INTEGER; -sbsp_edd_num_good_rx_bcb_blk_aid INTEGER; -sbsp_edd_num_bad_rx_bcb_blk INTEGER; -sbsp_edd_num_bad_rx_bcb_blk_did INTEGER; -sbsp_edd_num_bad_rx_bcb_blk_aid INTEGER; -sbsp_edd_num_missing_rx_bcb_blks INTEGER; -sbsp_edd_num_missing_rx_bcb_blks_did INTEGER; -sbsp_edd_num_missing_rx_bcb_blks_aid INTEGER; -sbsp_edd_num_fwd_bcb_blks INTEGER; -sbsp_edd_num_fwd_bcb_blks_did INTEGER; -sbsp_edd_num_fwd_bcb_blks_aid INTEGER; -sbsp_edd_num_good_tx_bcb_bytes INTEGER; -sbsp_edd_num_good_tx_bcb_bytes_did INTEGER; -sbsp_edd_num_good_tx_bcb_bytes_aid INTEGER; -sbsp_edd_num_bad_tx_bcb_bytes INTEGER; -sbsp_edd_num_bad_tx_bcb_bytes_did INTEGER; -sbsp_edd_num_bad_tx_bcb_bytes_aid INTEGER; -sbsp_edd_num_bad_tx_bcb_blks INTEGER; -sbsp_edd_num_bad_tx_bcb_blks_aid INTEGER; -sbsp_edd_num_good_rx_bcb_bytes INTEGER; -sbsp_edd_num_good_rx_bcb_bytes_did INTEGER; -sbsp_edd_num_good_rx_bcb_bytes_aid INTEGER; -sbsp_edd_num_bad_rx_bcb_bytes INTEGER; -sbsp_edd_num_bad_rx_bcb_bytes_did INTEGER; -sbsp_edd_num_bad_rx_bcb_bytes_aid INTEGER; -sbsp_edd_num_missing_rx_bcb_bytes INTEGER; -sbsp_edd_num_missing_rx_bcb_bytes_did INTEGER; -sbsp_edd_num_missing_rx_bcb_bytes_aid INTEGER; -sbsp_edd_num_fwd_bcb_bytes INTEGER; -sbsp_edd_num_fwd_bcb_bytes_did INTEGER; -sbsp_edd_num_fwd_bcb_bytes_aid INTEGER; -sbsp_edd_num_good_tx_bib_blks INTEGER; -sbsp_edd_num_good_tx_bib_blks_did INTEGER; -sbsp_edd_num_good_tx_bib_blks_aid INTEGER; -sbsp_edd_num_bad_tx_bib_blks INTEGER; -sbsp_edd_num_bad_tx_bib_blks_did INTEGER; -sbsp_edd_num_bad_tx_bib_blks_aid INTEGER; -sbsp_edd_num_good_rx_bib_blks INTEGER; -sbsp_edd_num_good_rx_bib_blks_did INTEGER; -sbsp_edd_num_good_rx_bib_blks_aid INTEGER; -sbsp_edd_num_bad_rx_bib_blks INTEGER; -sbsp_edd_num_bad_rx_bib_blks_did INTEGER; -sbsp_edd_num_bad_rx_bib_blks_aid INTEGER; -sbsp_edd_num_miss_rx_bib_blks INTEGER; -sbsp_edd_num_miss_rx_bib_blks_did INTEGER; -sbsp_edd_num_miss_rx_bib_blks_aid INTEGER; -sbsp_edd_num_fwd_bib_blks INTEGER; -sbsp_edd_num_fwd_bib_blks_did INTEGER; -sbsp_edd_num_fwd_bib_blks_aid INTEGER; -sbsp_edd_num_good_tx_bib_bytes INTEGER; -sbsp_edd_num_good_tx_bib_bytes_did INTEGER; -sbsp_edd_num_good_tx_bib_bytes_aid INTEGER; -sbsp_edd_num_bad_tx_bib_bytes INTEGER; -sbsp_edd_num_bad_tx_bib_bytes_did INTEGER; -sbsp_edd_num_bad_tx_bib_bytes_aid INTEGER; -sbsp_edd_num_good_rx_bib_bytes INTEGER; -sbsp_edd_num_good_rx_bib_bytes_did INTEGER; -sbsp_edd_num_good_rx_bib_bytes_aid INTEGER; -sbsp_edd_num_bad_rx_bib_bytes INTEGER; -sbsp_edd_num_bad_rx_bib_bytes_did INTEGER; -sbsp_edd_num_bad_rx_bib_bytes_aid INTEGER; -sbsp_edd_num_miss_rx_bib_bytes INTEGER; -sbsp_edd_num_miss_rx_bib_bytes_did INTEGER; -sbsp_edd_num_miss_rx_bib_bytes_aid INTEGER; -sbsp_edd_num_fwd_bib_bytes INTEGER; -sbsp_edd_num_fwd_bib_bytes_did INTEGER; -sbsp_edd_num_fwd_bib_bytes_aid INTEGER; -sbsp_edd_last_update INTEGER; -sbsp_edd_last_update_did INTEGER; -sbsp_edd_last_update_aid INTEGER; -sbsp_edd_num_known_keys INTEGER; -sbsp_edd_num_known_keys_did INTEGER; -sbsp_edd_num_known_keys_aid INTEGER; -sbsp_edd_key_names INTEGER; -sbsp_edd_key_names_did INTEGER; -sbsp_edd_key_names_aid INTEGER; -sbsp_edd_ciphersuite_names INTEGER; -sbsp_edd_ciphersuite_names_did INTEGER; -sbsp_edd_ciphersuite_names_aid INTEGER; -sbsp_edd_rule_source INTEGER; -sbsp_edd_rule_source_did INTEGER; -sbsp_edd_rule_source_aid INTEGER; -sbsp_edd_num_good_tx_bcb_blks_src INTEGER; -sbsp_edd_num_good_tx_bcb_blks_src_fp INTEGER; -r_fp_ent INTEGER; -sbsp_edd_num_good_tx_bcb_blks_src_did INTEGER; -sbsp_edd_num_bad_tx_bcb_blks_src INTEGER; -sbsp_edd_num_bad_tx_bcb_blks_src_fp INTEGER; -sbsp_edd_num_bad_tx_bcb_blks_src_did INTEGER; -sbsp_edd_num_good_rx_bcb_blks_src INTEGER; -sbsp_edd_num_good_rx_bcb_blks_src_fp INTEGER; -sbsp_edd_num_good_rx_bcb_blks_src_did INTEGER; -sbsp_edd_num_bad_rx_bcb_blks_src INTEGER; -sbsp_edd_num_bad_rx_bcb_blks_src_fp INTEGER; -sbsp_edd_num_bad_rx_bcb_blks_src_did INTEGER; -sbsp_edd_num_missing_rx_bcb_blks_src INTEGER; -sbsp_edd_num_missing_rx_bcb_blks_src_fp INTEGER; -sbsp_edd_num_missing_rx_bcb_blks_src_did INTEGER; -sbsp_edd_num_fwd_bcb_blks_src INTEGER; -sbsp_edd_num_fwd_bcb_blks_src_fp INTEGER; -sbsp_edd_num_fwd_bcb_blks_src_did INTEGER; -sbsp_edd_num_good_tx_bcb_bytes_src INTEGER; -sbsp_edd_num_good_tx_bcb_bytes_src_fp INTEGER; -sbsp_edd_num_good_tx_bcb_bytes_src_did INTEGER; -sbsp_edd_num_bad_tx_bcb_bytes_src INTEGER; -sbsp_edd_num_bad_tx_bcb_bytes_src_fp INTEGER; -sbsp_edd_num_bad_tx_bcb_bytes_src_did INTEGER; -sbsp_edd_num_good_rx_bcb_bytes_src INTEGER; -sbsp_edd_num_good_rx_bcb_bytes_src_fp INTEGER; -sbsp_edd_num_good_rx_bcb_bytes_src_did INTEGER; -sbsp_edd_num_bad_rx_bcb_bytes_src INTEGER; -sbsp_edd_num_bad_rx_bcb_bytes_src_fp INTEGER; -sbsp_edd_num_bad_rx_bcb_bytes_src_did INTEGER; -sbsp_edd_num_missing_rx_bcb_bytes_src INTEGER; -sbsp_edd_num_missing_rx_bcb_bytes_src_fp INTEGER; -sbsp_edd_num_missing_rx_bcb_bytes_src_did INTEGER; -sbsp_edd_num_fwd_bcb_bytes_src INTEGER; -sbsp_edd_num_fwd_bcb_bytes_src_fp INTEGER; -sbsp_edd_num_fwd_bcb_bytes_src_did INTEGER; -sbsp_edd_num_good_tx_bib_blks_src INTEGER; -sbsp_edd_num_good_tx_bib_blks_src_fp INTEGER; -sbsp_edd_num_good_tx_bib_blks_src_did INTEGER; -sbsp_edd_num_bad_tx_bib_blks_src INTEGER; -sbsp_edd_num_bad_tx_bib_blks_src_fp INTEGER; -sbsp_edd_num_bad_tx_bib_blks_src_did INTEGER; -sbsp_edd_num_good_rx_bib_blks_src INTEGER; -sbsp_edd_num_good_rx_bib_blks_src_fp INTEGER; -sbsp_edd_num_good_rx_bib_blks_src_did INTEGER; -sbsp_edd_num_bad_rx_bib_blks_src INTEGER; -sbsp_edd_num_bad_rx_bib_blks_src_fp INTEGER; -sbsp_edd_num_bad_rx_bib_blks_src_did INTEGER; -sbsp_edd_num_miss_rx_bib_blks_src INTEGER; -sbsp_edd_num_miss_rx_bib_blks_src_fp INTEGER; -sbsp_edd_num_miss_rx_bib_blks_src_did INTEGER; -sbsp_edd_num_fwd_bib_blks_src INTEGER; -sbsp_edd_num_fwd_bib_blks_src_fp INTEGER; -sbsp_edd_num_fwd_bib_blks_src_did INTEGER; -sbsp_edd_num_good_tx_bib_bytes_src INTEGER; -sbsp_edd_num_good_tx_bib_bytes_src_fp INTEGER; -sbsp_edd_num_good_tx_bib_bytes_src_did INTEGER; -sbsp_edd_num_bad_tx_bib_bytes_src INTEGER; -sbsp_edd_num_bad_tx_bib_bytes_src_fp INTEGER; -sbsp_edd_num_bad_tx_bib_bytes_src_did INTEGER; -sbsp_edd_num_good_rx_bib_bytes_src INTEGER; -sbsp_edd_num_good_rx_bib_bytes_src_fp INTEGER; -sbsp_edd_num_good_rx_bib_bytes_src_did INTEGER; -sbsp_edd_num_bad_rx_bib_bytes_src INTEGER; -sbsp_edd_num_bad_rx_bib_bytes_src_fp INTEGER; -sbsp_edd_num_bad_rx_bib_bytes_src_did INTEGER; -sbsp_edd_num_missing_rx_bib_bytes_src INTEGER; -sbsp_edd_num_missing_rx_bib_bytes_src_fp INTEGER; -sbsp_edd_num_missing_rx_bib_bytes_src_did INTEGER; -sbsp_edd_num_fwd_bib_bytes_src INTEGER; -sbsp_edd_num_fwd_bib_bytes_src_fp INTEGER; -sbsp_edd_num_fwd_bib_bytes_src_did INTEGER; -sbsp_edd_last_update_src INTEGER; -sbsp_edd_last_update_src_fp INTEGER; -sbsp_edd_last_update_src_did INTEGER; -sbsp_edd_last_reset INTEGER; -sbsp_edd_last_reset_fp INTEGER; -sbsp_edd_last_reset_did INTEGER; -sbsp_var_total_bad_tx_blks INTEGER; -var_ac_id INTEGER; -r_ac_entry_id_1 INTEGER; -r_ac_entry_id_2 INTEGER; -agent_op_plusuint_did INTEGER; -r_ac_entry_id_3 INTEGER; -sbsp_var_total_bad_tx_blks_did INTEGER; -sbsp_tblt_bib_rules INTEGER; -tbl_tnvc_id INTEGER; -tnvc_entry INTEGER; -sbsp_tblt_bib_rules_did INTEGER; -sbsp_tblt_bcb_rules INTEGER; -sbsp_tblt_bcb_rules_did INTEGER; -sbsp_rpttpl_full_report INTEGER; -rptt_ac_id INTEGER; -r_ac_rpt_entry_1 INTEGER; -r_ac_rpt_entry_2 INTEGER; -r_ac_rpt_entry_3 INTEGER; -r_ac_rpt_entry_4 INTEGER; -r_ac_rpt_entry_5 INTEGER; -r_ac_rpt_entry_6 INTEGER; -r_ac_rpt_entry_7 INTEGER; -r_ac_rpt_entry_8 INTEGER; -r_ac_rpt_entry_9 INTEGER; -r_ac_rpt_entry_10 INTEGER; -r_ac_rpt_entry_11 INTEGER; -r_ac_rpt_entry_12 INTEGER; -r_ac_rpt_entry_13 INTEGER; -r_ac_rpt_entry_14 INTEGER; -r_ac_rpt_entry_15 INTEGER; -r_ac_rpt_entry_16 INTEGER; -r_ac_rpt_entry_17 INTEGER; -r_ac_rpt_entry_18 INTEGER; -r_ac_rpt_entry_19 INTEGER; -r_ac_rpt_entry_20 INTEGER; -r_ac_rpt_entry_21 INTEGER; -r_ac_rpt_entry_22 INTEGER; -r_ac_rpt_entry_23 INTEGER; -r_ac_rpt_entry_24 INTEGER; -r_ac_rpt_entry_25 INTEGER; -r_ac_rpt_entry_26 INTEGER; -r_ac_rpt_entry_27 INTEGER; -r_ac_rpt_entry_28 INTEGER; -r_ac_rpt_entry_29 INTEGER; -sbsp_rpttpl_full_report_did INTEGER; -sbsp_rpttpl_full_report_aid INTEGER; -sbsp_rpttpl_source_report INTEGER; -fp_spec_id INTEGER; -ap_spec_id INTEGER; -sbsp_edd_num_good_tx_bcb_blks_src_aid_source_1 INTEGER; -sbsp_edd_num_bad_tx_bcb_blks_src_aid_source_1 INTEGER; -sbsp_edd_num_good_rx_bcb_blks_src_aid_source_1 INTEGER; -sbsp_edd_num_bad_rx_bcb_blks_src_aid_source_1 INTEGER; -sbsp_edd_num_missing_rx_bcb_blks_src_aid_source_1 INTEGER; -sbsp_edd_num_fwd_bcb_blks_src_aid_source_1 INTEGER; -sbsp_edd_num_good_tx_bcb_bytes_src_aid_source_1 INTEGER; -sbsp_edd_num_bad_tx_bcb_bytes_src_aid_source_1 INTEGER; -sbsp_edd_num_good_rx_bcb_bytes_src_aid_source_1 INTEGER; -sbsp_edd_num_bad_rx_bcb_bytes_src_aid_source_1 INTEGER; -sbsp_edd_num_missing_rx_bcb_bytes_src_aid_source_1 INTEGER; -sbsp_edd_num_fwd_bcb_bytes_src_aid_source_1 INTEGER; -sbsp_edd_num_good_tx_bib_blks_src_aid_source_1 INTEGER; -sbsp_edd_num_bad_tx_bib_blks_src_aid_source_1 INTEGER; -sbsp_edd_num_good_rx_bib_blks_src_aid_source_1 INTEGER; -sbsp_edd_num_bad_rx_bib_blks_src_aid_source_1 INTEGER; -sbsp_edd_num_miss_rx_bib_blks_src_aid_source_1 INTEGER; -sbsp_edd_num_fwd_bib_blks_src_aid_source_1 INTEGER; -sbsp_edd_num_good_tx_bib_bytes_src_aid_source_1 INTEGER; -sbsp_edd_num_bad_tx_bib_bytes_src_aid_source_1 INTEGER; -sbsp_edd_num_good_rx_bib_bytes_src_aid_source_1 INTEGER; -sbsp_edd_num_bad_rx_bib_bytes_src_aid_source_1 INTEGER; -sbsp_edd_num_missing_rx_bib_bytes_src_aid_source_1 INTEGER; -sbsp_edd_num_fwd_bib_bytes_src_aid_source_1 INTEGER; -sbsp_edd_last_update_src_aid_source_1 INTEGER; -sbsp_edd_last_reset_aid_source_1 INTEGER; -sbsp_rpttpl_source_report_did INTEGER; -sbsp_rpttpl_source_report_aid INTEGER; -sbsp_ctrl_rst_all_cnts INTEGER; -sbsp_ctrl_rst_all_cnts_did INTEGER; -sbsp_ctrl_rst_src_cnts INTEGER; -sbsp_ctrl_rst_src_cnts_did INTEGER; -sbsp_ctrl_delete_key INTEGER; -sbsp_ctrl_delete_key_did INTEGER; -sbsp_ctrl_add_key INTEGER; -sbsp_ctrl_add_key_did INTEGER; -sbsp_ctrl_add_bib_rule INTEGER; -sbsp_ctrl_add_bib_rule_did INTEGER; -sbsp_ctrl_del_bib_rule INTEGER; -sbsp_ctrl_del_bib_rule_did INTEGER; -sbsp_ctrl_add_bcb_rule INTEGER; -sbsp_ctrl_add_bcb_rule_did INTEGER; -sbsp_ctrl_del_bcb_rule INTEGER; -sbsp_ctrl_del_bcb_rule_did INTEGER; -BEGIN - - adm_enum = 10; -CALL SP__insert_adm_defined_namespace('JHUAPL', 'DTN/sbsp', 'v1.0', 'sbsp', adm_enum, NULL, 'The namespace of the ADM.', dtn_namespace_id); - - --- #META -CALL SP__insert_obj_metadata(0, 'name', dtn_namespace_id, sbsp_meta_name); -CALL SP__insert_const_actual_definition(sbsp_meta_name, 'The human-readable name of the ADM.', 'STR', 'sbsp', sbsp_meta_name_did); - -CALL SP__insert_obj_metadata(0, 'namespace', dtn_namespace_id, sbsp_meta_namespace); -CALL SP__insert_const_actual_definition(sbsp_meta_namespace, 'The namespace of the ADM.', 'STR', 'DTN/sbsp', sbsp_meta_namespace_did); - -CALL SP__insert_obj_metadata(0, 'version', dtn_namespace_id, sbsp_meta_version); -CALL SP__insert_const_actual_definition(sbsp_meta_version, 'The version of the ADM.', 'STR', 'v1.0', sbsp_meta_version_did); - -CALL SP__insert_obj_metadata(0, 'organization', dtn_namespace_id, sbsp_meta_organization); -CALL SP__insert_const_actual_definition(sbsp_meta_organization, 'The name of the issuing organization of the ADM.', 'STR', 'JHUAPL', sbsp_meta_organization_did); - --- #EDD -CALL SP__insert_obj_metadata(2, 'num_good_tx_bcb_blk', dtn_namespace_id, sbsp_edd_num_good_tx_bcb_blk); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_good_tx_bcb_blk, 'Total successfully Tx Bundle Confidentiality blocks', NULL, 'UINT', sbsp_edd_num_good_tx_bcb_blk_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_good_tx_bcb_blk, 'The singleton value for num_good_tx_bcb_blk', NULL, sbsp_edd_num_good_tx_bcb_blk_aid); - -CALL SP__insert_obj_metadata(2, 'num_bad_tx_bcb_blk', dtn_namespace_id, sbsp_edd_num_bad_tx_bcb_blk); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_bad_tx_bcb_blk, 'Total unsuccessfully Tx Block Confidentiality Block (BCB) blocks', NULL, 'UINT', sbsp_edd_num_bad_tx_bcb_blk_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_bad_tx_bcb_blk, 'The singleton value for num_bad_tx_bcb_blk', NULL, sbsp_edd_num_bad_tx_bcb_blk_aid); - -CALL SP__insert_obj_metadata(2, 'num_good_rx_bcb_blk', dtn_namespace_id, sbsp_edd_num_good_rx_bcb_blk); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_good_rx_bcb_blk, 'Total successfully Rx BCB blocks', NULL, 'UINT', sbsp_edd_num_good_rx_bcb_blk_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_good_rx_bcb_blk, 'The singleton value for num_good_rx_bcb_blk', NULL, sbsp_edd_num_good_rx_bcb_blk_aid); - -CALL SP__insert_obj_metadata(2, 'num_bad_rx_bcb_blk', dtn_namespace_id, sbsp_edd_num_bad_rx_bcb_blk); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_bad_rx_bcb_blk, 'Total unsuccessfully Rx BCB blocks', NULL, 'UINT', sbsp_edd_num_bad_rx_bcb_blk_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_bad_rx_bcb_blk, 'The singleton value for num_bad_rx_bcb_blk', NULL, sbsp_edd_num_bad_rx_bcb_blk_aid); - -CALL SP__insert_obj_metadata(2, 'num_missing_rx_bcb_blks', dtn_namespace_id, sbsp_edd_num_missing_rx_bcb_blks); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_missing_rx_bcb_blks, 'Total missing-on-RX BCB blocks', NULL, 'UINT', sbsp_edd_num_missing_rx_bcb_blks_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_missing_rx_bcb_blks, 'The singleton value for num_missing_rx_bcb_blks', NULL, sbsp_edd_num_missing_rx_bcb_blks_aid); - -CALL SP__insert_obj_metadata(2, 'num_fwd_bcb_blks', dtn_namespace_id, sbsp_edd_num_fwd_bcb_blks); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_fwd_bcb_blks, 'Total forward BCB blocks', NULL, 'UINT', sbsp_edd_num_fwd_bcb_blks_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_fwd_bcb_blks, 'The singleton value for num_fwd_bcb_blks', NULL, sbsp_edd_num_fwd_bcb_blks_aid); - -CALL SP__insert_obj_metadata(2, 'num_good_tx_bcb_bytes', dtn_namespace_id, sbsp_edd_num_good_tx_bcb_bytes); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_good_tx_bcb_bytes, 'Total successfully Tx BCB bytes', NULL, 'UINT', sbsp_edd_num_good_tx_bcb_bytes_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_good_tx_bcb_bytes, 'The singleton value for num_good_tx_bcb_bytes', NULL, sbsp_edd_num_good_tx_bcb_bytes_aid); - -CALL SP__insert_obj_metadata(2, 'num_bad_tx_bcb_bytes', dtn_namespace_id, sbsp_edd_num_bad_tx_bcb_bytes); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_bad_tx_bcb_bytes, 'Total unsuccessfully Tx BCB bytes', NULL, 'UINT', sbsp_edd_num_bad_tx_bcb_bytes_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_bad_tx_bcb_bytes, 'The singleton value for num_bad_tx_bcb_bytes', NULL, sbsp_edd_num_bad_tx_bcb_bytes_aid); - -CALL SP__insert_obj_metadata(2, 'num_bad_tx_bcb_blks', dtn_namespace_id, sbsp_edd_num_bad_tx_bcb_blks); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_bad_tx_bcb_blks, 'Total unsuccessfully Tx BCB blocks', NULL, 'UINT', sbsp_edd_num_bad_tx_bcb_blks_aid); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_bad_tx_bcb_blks, 'The singleton value for num_bad_tx_bcb_blks', NULL, sbsp_edd_num_bad_tx_bcb_blks_aid); - -CALL SP__insert_obj_metadata(2, 'num_good_rx_bcb_bytes', dtn_namespace_id, sbsp_edd_num_good_rx_bcb_bytes); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_good_rx_bcb_bytes, 'Total successfully Rx BCB bytes', NULL, 'UINT', sbsp_edd_num_good_rx_bcb_bytes_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_good_rx_bcb_bytes, 'The singleton value for num_good_rx_bcb_bytes', NULL, sbsp_edd_num_good_rx_bcb_bytes_aid); - -CALL SP__insert_obj_metadata(2, 'num_bad_rx_bcb_bytes', dtn_namespace_id, sbsp_edd_num_bad_rx_bcb_bytes); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_bad_rx_bcb_bytes, 'Total unsuccessfully Rx BCB bytes', NULL, 'UINT', sbsp_edd_num_bad_rx_bcb_bytes_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_bad_rx_bcb_bytes, 'The singleton value for num_bad_rx_bcb_bytes', NULL, sbsp_edd_num_bad_rx_bcb_bytes_aid); - -CALL SP__insert_obj_metadata(2, 'num_missing_rx_bcb_bytes', dtn_namespace_id, sbsp_edd_num_missing_rx_bcb_bytes); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_missing_rx_bcb_bytes, 'Total missing-on-Rx BCB bytes', NULL, 'UINT', sbsp_edd_num_missing_rx_bcb_bytes_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_missing_rx_bcb_bytes, 'The singleton value for num_missing_rx_bcb_bytes', NULL, sbsp_edd_num_missing_rx_bcb_bytes_aid); - -CALL SP__insert_obj_metadata(2, 'num_fwd_bcb_bytes', dtn_namespace_id, sbsp_edd_num_fwd_bcb_bytes); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_fwd_bcb_bytes, 'Total forwarded BCB bytes', NULL, 'UINT', sbsp_edd_num_fwd_bcb_bytes_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_fwd_bcb_bytes, 'The singleton value for num_fwd_bcb_bytes', NULL, sbsp_edd_num_fwd_bcb_bytes_aid); - -CALL SP__insert_obj_metadata(2, 'num_good_tx_bib_blks', dtn_namespace_id, sbsp_edd_num_good_tx_bib_blks); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_good_tx_bib_blks, 'Total successfully Tx Block Integrity Block (BIB) blocks', NULL, 'UINT', sbsp_edd_num_good_tx_bib_blks_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_good_tx_bib_blks, 'The singleton value for num_good_tx_bib_blks', NULL, sbsp_edd_num_good_tx_bib_blks_aid); - -CALL SP__insert_obj_metadata(2, 'num_bad_tx_bib_blks', dtn_namespace_id, sbsp_edd_num_bad_tx_bib_blks); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_bad_tx_bib_blks, 'Total unsuccessfully Tx BIB blocks', NULL, 'UINT', sbsp_edd_num_bad_tx_bib_blks_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_bad_tx_bib_blks, 'The singleton value for num_bad_tx_bib_blks', NULL, sbsp_edd_num_bad_tx_bib_blks_aid); - -CALL SP__insert_obj_metadata(2, 'num_good_rx_bib_blks', dtn_namespace_id, sbsp_edd_num_good_rx_bib_blks); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_good_rx_bib_blks, 'Total successfully Rx BIB blocks', NULL, 'UINT', sbsp_edd_num_good_rx_bib_blks_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_good_rx_bib_blks, 'The singleton value for num_good_rx_bib_blks', NULL, sbsp_edd_num_good_rx_bib_blks_aid); - -CALL SP__insert_obj_metadata(2, 'num_bad_rx_bib_blks', dtn_namespace_id, sbsp_edd_num_bad_rx_bib_blks); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_bad_rx_bib_blks, 'Total unsuccessfully Rx BIB blocks', NULL, 'UINT', sbsp_edd_num_bad_rx_bib_blks_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_bad_rx_bib_blks, 'The singleton value for num_bad_rx_bib_blks', NULL, sbsp_edd_num_bad_rx_bib_blks_aid); - -CALL SP__insert_obj_metadata(2, 'num_miss_rx_bib_blks', dtn_namespace_id, sbsp_edd_num_miss_rx_bib_blks); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_miss_rx_bib_blks, 'Total missing-on-Rx BIB blocks', NULL, 'UINT', sbsp_edd_num_miss_rx_bib_blks_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_miss_rx_bib_blks, 'The singleton value for num_miss_rx_bib_blks', NULL, sbsp_edd_num_miss_rx_bib_blks_aid); - -CALL SP__insert_obj_metadata(2, 'num_fwd_bib_blks', dtn_namespace_id, sbsp_edd_num_fwd_bib_blks); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_fwd_bib_blks, 'Total forwarded BIB blocks', NULL, 'UINT', sbsp_edd_num_fwd_bib_blks_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_fwd_bib_blks, 'The singleton value for num_fwd_bib_blks', NULL, sbsp_edd_num_fwd_bib_blks_aid); - -CALL SP__insert_obj_metadata(2, 'num_good_tx_bib_bytes', dtn_namespace_id, sbsp_edd_num_good_tx_bib_bytes); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_good_tx_bib_bytes, 'Total successfully Tx BIB bytes', NULL, 'UINT', sbsp_edd_num_good_tx_bib_bytes_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_good_tx_bib_bytes, 'The singleton value for num_good_tx_bib_bytes', NULL, sbsp_edd_num_good_tx_bib_bytes_aid); - -CALL SP__insert_obj_metadata(2, 'num_bad_tx_bib_bytes', dtn_namespace_id, sbsp_edd_num_bad_tx_bib_bytes); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_bad_tx_bib_bytes, 'Total unsuccessfully Tx BIB bytes', NULL, 'UINT', sbsp_edd_num_bad_tx_bib_bytes_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_bad_tx_bib_bytes, 'The singleton value for num_bad_tx_bib_bytes', NULL, sbsp_edd_num_bad_tx_bib_bytes_aid); - -CALL SP__insert_obj_metadata(2, 'num_good_rx_bib_bytes', dtn_namespace_id, sbsp_edd_num_good_rx_bib_bytes); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_good_rx_bib_bytes, 'Total successfully Rx BIB bytes', NULL, 'UINT', sbsp_edd_num_good_rx_bib_bytes_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_good_rx_bib_bytes, 'The singleton value for num_good_rx_bib_bytes', NULL, sbsp_edd_num_good_rx_bib_bytes_aid); - -CALL SP__insert_obj_metadata(2, 'num_bad_rx_bib_bytes', dtn_namespace_id, sbsp_edd_num_bad_rx_bib_bytes); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_bad_rx_bib_bytes, 'Total unsuccessfully Rx BIB bytes', NULL, 'UINT', sbsp_edd_num_bad_rx_bib_bytes_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_bad_rx_bib_bytes, 'The singleton value for num_bad_rx_bib_bytes', NULL, sbsp_edd_num_bad_rx_bib_bytes_aid); - -CALL SP__insert_obj_metadata(2, 'num_miss_rx_bib_bytes', dtn_namespace_id, sbsp_edd_num_miss_rx_bib_bytes); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_miss_rx_bib_bytes, 'Total missing-on-Rx BIB bytes', NULL, 'UINT', sbsp_edd_num_miss_rx_bib_bytes_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_miss_rx_bib_bytes, 'The singleton value for num_miss_rx_bib_bytes', NULL, sbsp_edd_num_miss_rx_bib_bytes_aid); - -CALL SP__insert_obj_metadata(2, 'num_fwd_bib_bytes', dtn_namespace_id, sbsp_edd_num_fwd_bib_bytes); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_fwd_bib_bytes, 'Total forwarded BIB bytes', NULL, 'UINT', sbsp_edd_num_fwd_bib_bytes_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_fwd_bib_bytes, 'The singleton value for num_fwd_bib_bytes', NULL, sbsp_edd_num_fwd_bib_bytes_aid); - -CALL SP__insert_obj_metadata(2, 'last_update', dtn_namespace_id, sbsp_edd_last_update); -CALL SP__insert_edd_formal_definition(sbsp_edd_last_update, 'Last sbsp update', NULL, 'TV', sbsp_edd_last_update_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_last_update, 'The singleton value for last_update', NULL, sbsp_edd_last_update_aid); - -CALL SP__insert_obj_metadata(2, 'num_known_keys', dtn_namespace_id, sbsp_edd_num_known_keys); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_known_keys, 'Number of known keys', NULL, 'UINT', sbsp_edd_num_known_keys_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_known_keys, 'The singleton value for num_known_keys', NULL, sbsp_edd_num_known_keys_aid); - -CALL SP__insert_obj_metadata(2, 'key_names', dtn_namespace_id, sbsp_edd_key_names); -CALL SP__insert_edd_formal_definition(sbsp_edd_key_names, 'Known key names', NULL, 'STR', sbsp_edd_key_names_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_key_names, 'The singleton value for key_names', NULL, sbsp_edd_key_names_aid); - -CALL SP__insert_obj_metadata(2, 'ciphersuite_names', dtn_namespace_id, sbsp_edd_ciphersuite_names); -CALL SP__insert_edd_formal_definition(sbsp_edd_ciphersuite_names, 'Known ciphersuite names', NULL, 'STR', sbsp_edd_ciphersuite_names_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_ciphersuite_names, 'The singleton value for ciphersuite_names', NULL, sbsp_edd_ciphersuite_names_aid); - -CALL SP__insert_obj_metadata(2, 'rule_source', dtn_namespace_id, sbsp_edd_rule_source); -CALL SP__insert_edd_formal_definition(sbsp_edd_rule_source, 'Known rule sources', NULL, 'STR', sbsp_edd_rule_source_did); -CALL SP__insert_edd_actual_definition(sbsp_edd_rule_source, 'The singleton value for rule_source', NULL, sbsp_edd_rule_source_aid); - -CALL SP__insert_obj_metadata(2, 'num_good_tx_bcb_blks_src', dtn_namespace_id, sbsp_edd_num_good_tx_bcb_blks_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_good_tx_bcb_blks_src', sbsp_edd_num_good_tx_bcb_blks_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_good_tx_bcb_blks_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_good_tx_bcb_blks_src, 'Number of successfully Tx BCB blocks from SRC', sbsp_edd_num_good_tx_bcb_blks_src_fp, 'UINT', sbsp_edd_num_good_tx_bcb_blks_src_did); - -CALL SP__insert_obj_metadata(2, 'num_bad_tx_bcb_blks_src', dtn_namespace_id, sbsp_edd_num_bad_tx_bcb_blks_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_bad_tx_bcb_blks_src', sbsp_edd_num_bad_tx_bcb_blks_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_bad_tx_bcb_blks_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_bad_tx_bcb_blks_src, 'Number of failed TX BCB blocks from SRC', sbsp_edd_num_bad_tx_bcb_blks_src_fp, 'UINT', sbsp_edd_num_bad_tx_bcb_blks_src_did); - -CALL SP__insert_obj_metadata(2, 'num_good_rx_bcb_blks_src', dtn_namespace_id, sbsp_edd_num_good_rx_bcb_blks_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_good_rx_bcb_blks_src', sbsp_edd_num_good_rx_bcb_blks_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_good_rx_bcb_blks_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_good_rx_bcb_blks_src, 'Number of successfully Rx BCB blocks from SRC', sbsp_edd_num_good_rx_bcb_blks_src_fp, 'UINT', sbsp_edd_num_good_rx_bcb_blks_src_did); - -CALL SP__insert_obj_metadata(2, 'num_bad_rx_bcb_blks_src', dtn_namespace_id, sbsp_edd_num_bad_rx_bcb_blks_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_bad_rx_bcb_blks_src', sbsp_edd_num_bad_rx_bcb_blks_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_bad_rx_bcb_blks_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_bad_rx_bcb_blks_src, 'Number of failed RX BCB blocks from SRC', sbsp_edd_num_bad_rx_bcb_blks_src_fp, 'UINT', sbsp_edd_num_bad_rx_bcb_blks_src_did); - -CALL SP__insert_obj_metadata(2, 'num_missing_rx_bcb_blks_src', dtn_namespace_id, sbsp_edd_num_missing_rx_bcb_blks_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_missing_rx_bcb_blks_src', sbsp_edd_num_missing_rx_bcb_blks_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_missing_rx_bcb_blks_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_missing_rx_bcb_blks_src, 'Number of missing-onRX BCB blocks from SRC', sbsp_edd_num_missing_rx_bcb_blks_src_fp, 'UINT', sbsp_edd_num_missing_rx_bcb_blks_src_did); - -CALL SP__insert_obj_metadata(2, 'num_fwd_bcb_blks_src', dtn_namespace_id, sbsp_edd_num_fwd_bcb_blks_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_fwd_bcb_blks_src', sbsp_edd_num_fwd_bcb_blks_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_fwd_bcb_blks_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_fwd_bcb_blks_src, 'Number of forwarded BCB blocks from SRC', sbsp_edd_num_fwd_bcb_blks_src_fp, 'UINT', sbsp_edd_num_fwd_bcb_blks_src_did); - -CALL SP__insert_obj_metadata(2, 'num_good_tx_bcb_bytes_src', dtn_namespace_id, sbsp_edd_num_good_tx_bcb_bytes_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_good_tx_bcb_bytes_src', sbsp_edd_num_good_tx_bcb_bytes_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_good_tx_bcb_bytes_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_good_tx_bcb_bytes_src, 'Number of successfully Tx bcb bytes from SRC', sbsp_edd_num_good_tx_bcb_bytes_src_fp, 'UINT', sbsp_edd_num_good_tx_bcb_bytes_src_did); - -CALL SP__insert_obj_metadata(2, 'num_bad_tx_bcb_bytes_src', dtn_namespace_id, sbsp_edd_num_bad_tx_bcb_bytes_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_bad_tx_bcb_bytes_src', sbsp_edd_num_bad_tx_bcb_bytes_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_bad_tx_bcb_bytes_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_bad_tx_bcb_bytes_src, 'Number of failed Tx bcb bytes from SRC', sbsp_edd_num_bad_tx_bcb_bytes_src_fp, 'UINT', sbsp_edd_num_bad_tx_bcb_bytes_src_did); - -CALL SP__insert_obj_metadata(2, 'num_good_rx_bcb_bytes_src', dtn_namespace_id, sbsp_edd_num_good_rx_bcb_bytes_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_good_rx_bcb_bytes_src', sbsp_edd_num_good_rx_bcb_bytes_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_good_rx_bcb_bytes_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_good_rx_bcb_bytes_src, 'Number of successfully Rx bcb bytes from SRC', sbsp_edd_num_good_rx_bcb_bytes_src_fp, 'UINT', sbsp_edd_num_good_rx_bcb_bytes_src_did); - -CALL SP__insert_obj_metadata(2, 'num_bad_rx_bcb_bytes_src', dtn_namespace_id, sbsp_edd_num_bad_rx_bcb_bytes_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_bad_rx_bcb_bytes_src', sbsp_edd_num_bad_rx_bcb_bytes_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_bad_rx_bcb_bytes_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_bad_rx_bcb_bytes_src, 'Number of failed Rx bcb bytes from SRC', sbsp_edd_num_bad_rx_bcb_bytes_src_fp, 'UINT', sbsp_edd_num_bad_rx_bcb_bytes_src_did); - -CALL SP__insert_obj_metadata(2, 'num_missing_rx_bcb_bytes_src', dtn_namespace_id, sbsp_edd_num_missing_rx_bcb_bytes_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_missing_rx_bcb_bytes_src', sbsp_edd_num_missing_rx_bcb_bytes_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_missing_rx_bcb_bytes_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_missing_rx_bcb_bytes_src, 'Number of missing-on-Rx bcb bytes from SRC', sbsp_edd_num_missing_rx_bcb_bytes_src_fp, 'UINT', sbsp_edd_num_missing_rx_bcb_bytes_src_did); - -CALL SP__insert_obj_metadata(2, 'num_fwd_bcb_bytes_src', dtn_namespace_id, sbsp_edd_num_fwd_bcb_bytes_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_fwd_bcb_bytes_src', sbsp_edd_num_fwd_bcb_bytes_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_fwd_bcb_bytes_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_fwd_bcb_bytes_src, 'Number of forwarded bcb bytes from SRC', sbsp_edd_num_fwd_bcb_bytes_src_fp, 'UINT', sbsp_edd_num_fwd_bcb_bytes_src_did); - -CALL SP__insert_obj_metadata(2, 'num_good_tx_bib_blks_src', dtn_namespace_id, sbsp_edd_num_good_tx_bib_blks_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_good_tx_bib_blks_src', sbsp_edd_num_good_tx_bib_blks_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_good_tx_bib_blks_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_good_tx_bib_blks_src, 'Number of successfully Tx BIB blocks from SRC', sbsp_edd_num_good_tx_bib_blks_src_fp, 'UINT', sbsp_edd_num_good_tx_bib_blks_src_did); - -CALL SP__insert_obj_metadata(2, 'num_bad_tx_bib_blks_src', dtn_namespace_id, sbsp_edd_num_bad_tx_bib_blks_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_bad_tx_bib_blks_src', sbsp_edd_num_bad_tx_bib_blks_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_bad_tx_bib_blks_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_bad_tx_bib_blks_src, 'Number of failed Tx BIB blocks from SRC', sbsp_edd_num_bad_tx_bib_blks_src_fp, 'UINT', sbsp_edd_num_bad_tx_bib_blks_src_did); - -CALL SP__insert_obj_metadata(2, 'num_good_rx_bib_blks_src', dtn_namespace_id, sbsp_edd_num_good_rx_bib_blks_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_good_rx_bib_blks_src', sbsp_edd_num_good_rx_bib_blks_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_good_rx_bib_blks_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_good_rx_bib_blks_src, 'Number of successfully Rx BIB blocks from SRC', sbsp_edd_num_good_rx_bib_blks_src_fp, 'UINT', sbsp_edd_num_good_rx_bib_blks_src_did); - -CALL SP__insert_obj_metadata(2, 'num_bad_rx_bib_blks_src', dtn_namespace_id, sbsp_edd_num_bad_rx_bib_blks_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_bad_rx_bib_blks_src', sbsp_edd_num_bad_rx_bib_blks_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_bad_rx_bib_blks_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_bad_rx_bib_blks_src, 'Number of failed Rx BIB blocks from SRC', sbsp_edd_num_bad_rx_bib_blks_src_fp, 'UINT', sbsp_edd_num_bad_rx_bib_blks_src_did); - -CALL SP__insert_obj_metadata(2, 'num_miss_rx_bib_blks_src', dtn_namespace_id, sbsp_edd_num_miss_rx_bib_blks_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_miss_rx_bib_blks_src', sbsp_edd_num_miss_rx_bib_blks_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_miss_rx_bib_blks_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_miss_rx_bib_blks_src, 'Number of missing-on-Rx BIB blocks from SRC', sbsp_edd_num_miss_rx_bib_blks_src_fp, 'UINT', sbsp_edd_num_miss_rx_bib_blks_src_did); - -CALL SP__insert_obj_metadata(2, 'num_fwd_bib_blks_src', dtn_namespace_id, sbsp_edd_num_fwd_bib_blks_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_fwd_bib_blks_src', sbsp_edd_num_fwd_bib_blks_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_fwd_bib_blks_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_fwd_bib_blks_src, 'Number of forwarded BIB blocks from SRC', sbsp_edd_num_fwd_bib_blks_src_fp, 'UINT', sbsp_edd_num_fwd_bib_blks_src_did); - -CALL SP__insert_obj_metadata(2, 'num_good_tx_bib_bytes_src', dtn_namespace_id, sbsp_edd_num_good_tx_bib_bytes_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_good_tx_bib_bytes_src', sbsp_edd_num_good_tx_bib_bytes_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_good_tx_bib_bytes_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_good_tx_bib_bytes_src, 'Number of successfully Tx BIB bytes from SRC', sbsp_edd_num_good_tx_bib_bytes_src_fp, 'UINT', sbsp_edd_num_good_tx_bib_bytes_src_did); - -CALL SP__insert_obj_metadata(2, 'num_bad_tx_bib_bytes_src', dtn_namespace_id, sbsp_edd_num_bad_tx_bib_bytes_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_bad_tx_bib_bytes_src', sbsp_edd_num_bad_tx_bib_bytes_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_bad_tx_bib_bytes_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_bad_tx_bib_bytes_src, 'Number of failed Tx BIB bytes from SRC', sbsp_edd_num_bad_tx_bib_bytes_src_fp, 'UINT', sbsp_edd_num_bad_tx_bib_bytes_src_did); - -CALL SP__insert_obj_metadata(2, 'num_good_rx_bib_bytes_src', dtn_namespace_id, sbsp_edd_num_good_rx_bib_bytes_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_good_rx_bib_bytes_src', sbsp_edd_num_good_rx_bib_bytes_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_good_rx_bib_bytes_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_good_rx_bib_bytes_src, 'Number of successfully Rx BIB bytes from SRC', sbsp_edd_num_good_rx_bib_bytes_src_fp, 'UINT', sbsp_edd_num_good_rx_bib_bytes_src_did); - -CALL SP__insert_obj_metadata(2, 'num_bad_rx_bib_bytes_src', dtn_namespace_id, sbsp_edd_num_bad_rx_bib_bytes_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_bad_rx_bib_bytes_src', sbsp_edd_num_bad_rx_bib_bytes_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_bad_rx_bib_bytes_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_bad_rx_bib_bytes_src, 'Number of failed Rx BIB bytes from SRC', sbsp_edd_num_bad_rx_bib_bytes_src_fp, 'UINT', sbsp_edd_num_bad_rx_bib_bytes_src_did); - -CALL SP__insert_obj_metadata(2, 'num_missing_rx_bib_bytes_src', dtn_namespace_id, sbsp_edd_num_missing_rx_bib_bytes_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_missing_rx_bib_bytes_src', sbsp_edd_num_missing_rx_bib_bytes_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_missing_rx_bib_bytes_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_missing_rx_bib_bytes_src, 'Number of missing-on-Rx BIB bytes from SRC', sbsp_edd_num_missing_rx_bib_bytes_src_fp, 'UINT', sbsp_edd_num_missing_rx_bib_bytes_src_did); - -CALL SP__insert_obj_metadata(2, 'num_fwd_bib_bytes_src', dtn_namespace_id, sbsp_edd_num_fwd_bib_bytes_src); -CALL SP__insert_formal_parmspec(1, 'parms for num_fwd_bib_bytes_src', sbsp_edd_num_fwd_bib_bytes_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_num_fwd_bib_bytes_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_num_fwd_bib_bytes_src, 'Number of forwarded BIB bytes from SRC', sbsp_edd_num_fwd_bib_bytes_src_fp, 'UINT', sbsp_edd_num_fwd_bib_bytes_src_did); - -CALL SP__insert_obj_metadata(2, 'last_update_src', dtn_namespace_id, sbsp_edd_last_update_src); -CALL SP__insert_formal_parmspec(1, 'parms for last_update_src', sbsp_edd_last_update_src_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_last_update_src_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_last_update_src, 'Last sbsp update from SRC', sbsp_edd_last_update_src_fp, 'TV', sbsp_edd_last_update_src_did); - -CALL SP__insert_obj_metadata(2, 'last_reset', dtn_namespace_id, sbsp_edd_last_reset); -CALL SP__insert_formal_parmspec(1, 'parms for last_reset', sbsp_edd_last_reset_fp); -CALL SP__insert_formal_parmspec_entry(sbsp_edd_last_reset_fp, 1, 'Src', 'STR', null, r_fp_ent); -CALL SP__insert_edd_formal_definition(sbsp_edd_last_reset, 'Last reset', sbsp_edd_last_reset_fp, 'TV', sbsp_edd_last_reset_did); - --- #OPER - --- #VAR -agent_op_plusuint_did = (SELECT obj_actual_definition_id - FROM public.vw_oper_actual where obj_name = 'plusUINT'); - -raise notice 'Value: %', agent_op_plusuint_did; -raise notice 'Value: %', sbsp_edd_num_bad_tx_bib_blks_did; --- create ac for expression -CALL SP__insert_ac_id(3, 'ac for the expression used by sbsp_var_total_bad_tx_blks', var_ac_id); -CALL SP__insert_ac_actual_entry(var_ac_id, sbsp_edd_num_bad_tx_bib_blks_aid, 1, r_ac_entry_id_1 ); -CALL SP__insert_ac_actual_entry(var_ac_id, sbsp_edd_num_bad_tx_bcb_blks_aid, 2, r_ac_entry_id_2 ); -CALL SP__insert_ac_actual_entry(var_ac_id, agent_op_plusuint_did, 3, r_ac_entry_id_3 ); -CALL SP__insert_obj_metadata(12, 'total_bad_tx_blks', dtn_namespace_id, sbsp_var_total_bad_tx_blks); -CALL SP__insert_variable_definition(sbsp_var_total_bad_tx_blks, 'This is the number of failed TX blocks (# failed BIB + # failed bcb).', 20, var_ac_id, sbsp_var_total_bad_tx_blks_did); - --- #TBLT -CALL SP__insert_obj_metadata(10, 'bib_rules', dtn_namespace_id, sbsp_tblt_bib_rules); -CALL SP__insert_tnvc_collection('columns for the bib_rules table', tbl_tnvc_id); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 1, 'SrcEid', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 2, 'DestEid', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 3, 'TgtBlk', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 4, 'csName', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 5, 'keyName', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(sbsp_tblt_bib_rules, 'BIB Rules.', tbl_tnvc_id, sbsp_tblt_bib_rules_did); - -CALL SP__insert_obj_metadata(10, 'bcb_rules', dtn_namespace_id, sbsp_tblt_bcb_rules); -CALL SP__insert_tnvc_collection('columns for the bcb_rules table', tbl_tnvc_id); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 1, 'SrcEid', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 2, 'DestEid', null, tnvc_entry); -CALL SP__insert_tnvc_uint_entry(tbl_tnvc_id, 3, 'TgtBlk', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 4, 'csName', null, tnvc_entry); -CALL SP__insert_tnvc_str_entry(tbl_tnvc_id, 5, 'keyName', null, tnvc_entry); -CALL SP__insert_table_template_actual_definition(sbsp_tblt_bcb_rules, 'BCB Rules.', tbl_tnvc_id, sbsp_tblt_bcb_rules_did); - - --- #RPTT - -CALL SP__insert_obj_metadata(7, 'full_report', dtn_namespace_id, sbsp_rpttpl_full_report); - -CALL SP__insert_ac_id(29, 'ac for report template full_report', rptt_ac_id); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_good_tx_bcb_blk_aid, 1, r_ac_rpt_entry_1); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_bad_tx_bcb_blk_aid, 2, r_ac_rpt_entry_2); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_good_rx_bcb_blk_aid, 3, r_ac_rpt_entry_3); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_bad_rx_bcb_blk_aid, 4, r_ac_rpt_entry_4); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_missing_rx_bcb_blks_aid, 5, r_ac_rpt_entry_5); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_fwd_bcb_blks_aid, 6, r_ac_rpt_entry_6); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_good_tx_bcb_bytes_aid, 7, r_ac_rpt_entry_7); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_bad_tx_bcb_bytes_aid, 8, r_ac_rpt_entry_8); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_good_rx_bcb_bytes_aid, 9, r_ac_rpt_entry_9); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_bad_rx_bcb_bytes_aid, 10, r_ac_rpt_entry_10); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_missing_rx_bcb_bytes_aid, 11, r_ac_rpt_entry_11); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_fwd_bcb_bytes_aid, 12, r_ac_rpt_entry_12); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_good_tx_bib_blks_aid, 13, r_ac_rpt_entry_13); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_bad_tx_bib_blks_aid, 14, r_ac_rpt_entry_14); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_good_rx_bib_blks_aid, 15, r_ac_rpt_entry_15); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_bad_rx_bib_blks_aid, 16, r_ac_rpt_entry_16); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_miss_rx_bib_blks_aid, 17, r_ac_rpt_entry_17); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_fwd_bib_blks_aid, 18, r_ac_rpt_entry_18); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_good_tx_bib_bytes_aid, 19, r_ac_rpt_entry_19); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_bad_tx_bib_bytes_aid, 20, r_ac_rpt_entry_20); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_good_rx_bib_bytes_aid, 21, r_ac_rpt_entry_21); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_bad_rx_bib_bytes_aid, 22, r_ac_rpt_entry_22); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_miss_rx_bib_bytes_aid, 23, r_ac_rpt_entry_23); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_fwd_bib_bytes_aid, 24, r_ac_rpt_entry_24); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_last_update_aid, 25, r_ac_rpt_entry_25); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_known_keys_aid, 26, r_ac_rpt_entry_26); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_key_names_aid, 27, r_ac_rpt_entry_27); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_ciphersuite_names_aid, 28, r_ac_rpt_entry_28); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_rule_source_aid, 29, r_ac_rpt_entry_29); - -CALL SP__insert_report_template_formal_definition(sbsp_rpttpl_full_report, 'all known meta-data, externally defined data, and variables', null, rptt_ac_id, sbsp_rpttpl_full_report_did); -CALL SP__insert_report_actual_definition(sbsp_rpttpl_full_report, null, null, 'Singleton value for full_report', sbsp_rpttpl_full_report_aid); - -CALL SP__insert_obj_metadata(7, 'source_report', dtn_namespace_id, sbsp_rpttpl_source_report); -CALL SP__insert_formal_parmspec(1, 'parms for num_good_tx_bcb_blks_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_good_tx_bcb_blks_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_good_tx_bcb_blks_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_good_tx_bcb_blks_src, NULL, ap_spec_id, sbsp_edd_num_good_tx_bcb_blks_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_bad_tx_bcb_blks_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_bad_tx_bcb_blks_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_bad_tx_bcb_blks_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_bad_tx_bcb_blks_src, NULL, ap_spec_id, sbsp_edd_num_bad_tx_bcb_blks_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_good_rx_bcb_blks_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_good_rx_bcb_blks_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_good_rx_bcb_blks_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_good_rx_bcb_blks_src, NULL, ap_spec_id, sbsp_edd_num_good_rx_bcb_blks_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_bad_rx_bcb_blks_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_bad_rx_bcb_blks_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_bad_rx_bcb_blks_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_bad_rx_bcb_blks_src, NULL, ap_spec_id, sbsp_edd_num_bad_rx_bcb_blks_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_missing_rx_bcb_blks_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_missing_rx_bcb_blks_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_missing_rx_bcb_blks_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_missing_rx_bcb_blks_src, NULL, ap_spec_id, sbsp_edd_num_missing_rx_bcb_blks_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_fwd_bcb_blks_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_fwd_bcb_blks_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_fwd_bcb_blks_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_fwd_bcb_blks_src, NULL, ap_spec_id, sbsp_edd_num_fwd_bcb_blks_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_good_tx_bcb_bytes_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_good_tx_bcb_bytes_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_good_tx_bcb_bytes_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_good_tx_bcb_bytes_src, NULL, ap_spec_id, sbsp_edd_num_good_tx_bcb_bytes_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_bad_tx_bcb_bytes_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_bad_tx_bcb_bytes_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_bad_tx_bcb_bytes_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_bad_tx_bcb_bytes_src, NULL, ap_spec_id, sbsp_edd_num_bad_tx_bcb_bytes_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_good_rx_bcb_bytes_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_good_rx_bcb_bytes_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_good_rx_bcb_bytes_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_good_rx_bcb_bytes_src, NULL, ap_spec_id, sbsp_edd_num_good_rx_bcb_bytes_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_bad_rx_bcb_bytes_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_bad_rx_bcb_bytes_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_bad_rx_bcb_bytes_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_bad_rx_bcb_bytes_src, NULL, ap_spec_id, sbsp_edd_num_bad_rx_bcb_bytes_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_missing_rx_bcb_bytes_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_missing_rx_bcb_bytes_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_missing_rx_bcb_bytes_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_missing_rx_bcb_bytes_src, NULL, ap_spec_id, sbsp_edd_num_missing_rx_bcb_bytes_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_fwd_bcb_bytes_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_fwd_bcb_bytes_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_fwd_bcb_bytes_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_fwd_bcb_bytes_src, NULL, ap_spec_id, sbsp_edd_num_fwd_bcb_bytes_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_good_tx_bib_blks_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_good_tx_bib_blks_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_good_tx_bib_blks_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_good_tx_bib_blks_src, NULL, ap_spec_id, sbsp_edd_num_good_tx_bib_blks_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_bad_tx_bib_blks_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_bad_tx_bib_blks_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_bad_tx_bib_blks_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_bad_tx_bib_blks_src, NULL, ap_spec_id, sbsp_edd_num_bad_tx_bib_blks_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_good_rx_bib_blks_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_good_rx_bib_blks_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_good_rx_bib_blks_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_good_rx_bib_blks_src, NULL, ap_spec_id, sbsp_edd_num_good_rx_bib_blks_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_bad_rx_bib_blks_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_bad_rx_bib_blks_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_bad_rx_bib_blks_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_bad_rx_bib_blks_src, NULL, ap_spec_id, sbsp_edd_num_bad_rx_bib_blks_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_miss_rx_bib_blks_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_miss_rx_bib_blks_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_miss_rx_bib_blks_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_miss_rx_bib_blks_src, NULL, ap_spec_id, sbsp_edd_num_miss_rx_bib_blks_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_fwd_bib_blks_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_fwd_bib_blks_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_fwd_bib_blks_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_fwd_bib_blks_src, NULL, ap_spec_id, sbsp_edd_num_fwd_bib_blks_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_good_tx_bib_bytes_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_good_tx_bib_bytes_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_good_tx_bib_bytes_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_good_tx_bib_bytes_src, NULL, ap_spec_id, sbsp_edd_num_good_tx_bib_bytes_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_bad_tx_bib_bytes_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_bad_tx_bib_bytes_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_bad_tx_bib_bytes_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_bad_tx_bib_bytes_src, NULL, ap_spec_id, sbsp_edd_num_bad_tx_bib_bytes_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_good_rx_bib_bytes_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_good_rx_bib_bytes_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_good_rx_bib_bytes_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_good_rx_bib_bytes_src, NULL, ap_spec_id, sbsp_edd_num_good_rx_bib_bytes_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_bad_rx_bib_bytes_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_bad_rx_bib_bytes_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_bad_rx_bib_bytes_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_bad_rx_bib_bytes_src, NULL, ap_spec_id, sbsp_edd_num_bad_rx_bib_bytes_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_missing_rx_bib_bytes_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_missing_rx_bib_bytes_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_missing_rx_bib_bytes_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_missing_rx_bib_bytes_src, NULL, ap_spec_id, sbsp_edd_num_missing_rx_bib_bytes_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for num_fwd_bib_bytes_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'num_fwd_bib_bytes_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_num_fwd_bib_bytes_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_num_fwd_bib_bytes_src, NULL, ap_spec_id, sbsp_edd_num_fwd_bib_bytes_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for last_update_src', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'last_update_src', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_last_update_src_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_last_update_src, NULL, ap_spec_id, sbsp_edd_last_update_src_aid_source_1); -CALL SP__insert_formal_parmspec(1, 'parms for last_reset', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'last_reset', 'STR', null, r_fp_ent); - -CALL SP__insert_actual_parmspec(sbsp_edd_last_reset_fp, 1, '', ap_spec_id); -CALL SP__insert_actual_parms_names(ap_spec_id, 1, 'STR', r_fp_ent); -CALL SP__insert_edd_actual_definition(sbsp_edd_last_reset, NULL, ap_spec_id, sbsp_edd_last_reset_aid_source_1); - -CALL SP__insert_ac_id(26, 'ac for report template source_report', rptt_ac_id); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_good_tx_bcb_blks_src_aid_source_1, 1, r_ac_rpt_entry_1); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_bad_tx_bcb_blks_src_aid_source_1, 2, r_ac_rpt_entry_2); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_good_rx_bcb_blks_src_aid_source_1, 3, r_ac_rpt_entry_3); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_bad_rx_bcb_blks_src_aid_source_1, 4, r_ac_rpt_entry_4); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_missing_rx_bcb_blks_src_aid_source_1, 5, r_ac_rpt_entry_5); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_fwd_bcb_blks_src_aid_source_1, 6, r_ac_rpt_entry_6); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_good_tx_bcb_bytes_src_aid_source_1, 7, r_ac_rpt_entry_7); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_bad_tx_bcb_bytes_src_aid_source_1, 8, r_ac_rpt_entry_8); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_good_rx_bcb_bytes_src_aid_source_1, 9, r_ac_rpt_entry_9); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_bad_rx_bcb_bytes_src_aid_source_1, 10, r_ac_rpt_entry_10); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_missing_rx_bcb_bytes_src_aid_source_1, 11, r_ac_rpt_entry_11); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_fwd_bcb_bytes_src_aid_source_1, 12, r_ac_rpt_entry_12); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_good_tx_bib_blks_src_aid_source_1, 13, r_ac_rpt_entry_13); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_bad_tx_bib_blks_src_aid_source_1, 14, r_ac_rpt_entry_14); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_good_rx_bib_blks_src_aid_source_1, 15, r_ac_rpt_entry_15); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_bad_rx_bib_blks_src_aid_source_1, 16, r_ac_rpt_entry_16); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_miss_rx_bib_blks_src_aid_source_1, 17, r_ac_rpt_entry_17); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_fwd_bib_blks_src_aid_source_1, 18, r_ac_rpt_entry_18); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_good_tx_bib_bytes_src_aid_source_1, 19, r_ac_rpt_entry_19); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_bad_tx_bib_bytes_src_aid_source_1, 20, r_ac_rpt_entry_20); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_good_rx_bib_bytes_src_aid_source_1, 21, r_ac_rpt_entry_21); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_bad_rx_bib_bytes_src_aid_source_1, 22, r_ac_rpt_entry_22); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_missing_rx_bib_bytes_src_aid_source_1, 23, r_ac_rpt_entry_23); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_num_fwd_bib_bytes_src_aid_source_1, 24, r_ac_rpt_entry_24); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_last_update_src_aid_source_1, 25, r_ac_rpt_entry_25); -CALL SP__insert_ac_actual_entry(rptt_ac_id, sbsp_edd_last_reset_aid_source_1, 26, r_ac_rpt_entry_26); - -CALL SP__insert_report_template_formal_definition(sbsp_rpttpl_source_report, 'security info by source', null, rptt_ac_id, sbsp_rpttpl_source_report_did); -CALL SP__insert_report_actual_definition(sbsp_rpttpl_source_report, null, null, 'Singleton value for source_report', sbsp_rpttpl_source_report_aid); - --- #CTRL -CALL SP__insert_obj_metadata(1, 'rst_all_cnts', dtn_namespace_id, sbsp_ctrl_rst_all_cnts); -CALL SP__insert_control_formal_definition(sbsp_ctrl_rst_all_cnts , 'This control causes the Agent to reset all counts associated with block or byte statistics and to set the Last Reset Time of the sbsp EDD data to the time when the control was run.', null, sbsp_ctrl_rst_all_cnts_did); - -CALL SP__insert_obj_metadata(1, 'rst_src_cnts', dtn_namespace_id, sbsp_ctrl_rst_src_cnts); -CALL SP__insert_formal_parmspec(1, 'parms for the rst_src_cnts control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'src', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(sbsp_ctrl_rst_src_cnts , 'This control causes the Agent to reset all counts (blocks and bytes) associated with a given bundle source and set the Last Reset Time of the source statistics to the time when the control was run.', fp_spec_id, sbsp_ctrl_rst_src_cnts_did); - -CALL SP__insert_obj_metadata(1, 'delete_key', dtn_namespace_id, sbsp_ctrl_delete_key); -CALL SP__insert_formal_parmspec(1, 'parms for the delete_key control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'key_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(sbsp_ctrl_delete_key , 'This control deletes a key from the sbsp system.', fp_spec_id, sbsp_ctrl_delete_key_did); - -CALL SP__insert_obj_metadata(1, 'add_key', dtn_namespace_id, sbsp_ctrl_add_key); -CALL SP__insert_formal_parmspec(2, 'parms for the add_key control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'key_name', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'keyData', 'BYTESTR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(sbsp_ctrl_add_key , 'This control adds a key to the sbsp system.', fp_spec_id, sbsp_ctrl_add_key_did); - -CALL SP__insert_obj_metadata(1, 'add_bib_rule', dtn_namespace_id, sbsp_ctrl_add_bib_rule); -CALL SP__insert_formal_parmspec(5, 'parms for the add_bib_rule control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'source', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'destination', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'target', 'INT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 4, 'ciphersuiteId', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 5, 'key_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(sbsp_ctrl_add_bib_rule , 'This control configures policy on the sbsp protocol implementation that describes how BIB blocks should be applied to bundles in the system. This policy is captured as a rule which states when transmitting a bundle from the given source endpoint ID to the given destination endpoint ID, blocks of type target should have a BIB added to them using the given ciphersuite and the given key.', fp_spec_id, sbsp_ctrl_add_bib_rule_did); - -CALL SP__insert_obj_metadata(1, 'del_bib_rule', dtn_namespace_id, sbsp_ctrl_del_bib_rule); -CALL SP__insert_formal_parmspec(3, 'parms for the del_bib_rule control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'source', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'destination', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'target', 'INT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(sbsp_ctrl_del_bib_rule , 'This control removes any configured policy on the sbsp protocol implementation that describes how BIB blocks should be applied to bundles in the system. A BIB policy is uniquely identified by a source endpoint Id, a destination Id, and a target block type.', fp_spec_id, sbsp_ctrl_del_bib_rule_did); - -CALL SP__insert_obj_metadata(1, 'add_bcb_rule', dtn_namespace_id, sbsp_ctrl_add_bcb_rule); -CALL SP__insert_formal_parmspec(5, 'parms for the add_bcb_rule control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'source', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'destination', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'target', 'INT', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 4, 'ciphersuiteId', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 5, 'key_name', 'STR', null, r_fp_ent); -CALL SP__insert_control_formal_definition(sbsp_ctrl_add_bcb_rule , 'This control configures policy on the sbsp protocol implementation that describes how BCB blocks should be applied to bundles in the system. This policy is captured as a rule which states when transmitting a bundle from the given source endpoint id to the given destination endpoint id, blocks of type target should have a bcb added to them using the given ciphersuite and the given key.', fp_spec_id, sbsp_ctrl_add_bcb_rule_did); - -CALL SP__insert_obj_metadata(1, 'del_bcb_rule', dtn_namespace_id, sbsp_ctrl_del_bcb_rule); -CALL SP__insert_formal_parmspec(3, 'parms for the del_bcb_rule control', fp_spec_id); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 1, 'source', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 2, 'destination', 'STR', null, r_fp_ent); -CALL SP__insert_formal_parmspec_entry(fp_spec_id, 3, 'target', 'INT', null, r_fp_ent); -CALL SP__insert_control_formal_definition(sbsp_ctrl_del_bcb_rule , 'This control removes any configured policy on the sbsp protocol implementation that describes how BCB blocks should be applied to bundles in the system. A bcb policy is uniquely identified by a source endpoint id, a destination endpoint id, and a target block type.', fp_spec_id, sbsp_ctrl_del_bcb_rule_did); - - --- #CONST - --- #MAC - -END -$do$ \ No newline at end of file diff --git a/amp-sql/postgres/Agent_Scripts/nm_example.sql b/amp-sql/postgres/Agent_Scripts/nm_example.sql deleted file mode 100644 index 448bd0a..0000000 --- a/amp-sql/postgres/Agent_Scripts/nm_example.sql +++ /dev/null @@ -1,111 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- creating examples - - -use amp_core; - --- test case for adding some sample report requests and returns --- creating a new report that takes - --- ac of the report --- locate the edds to included -SET @edd1 = (SELECT obj_actual_definition_id from vw_edd_actual where obj_name = 'cur_time'); -SET @edd2 = (SELECT obj_actual_definition_id from vw_edd_actual where obj_name = 'num_pend_fwd'); -SET @edd3 = (SELECT obj_actual_definition_id from vw_edd_actual where obj_name = 'num_pend_dis'); -SET @edd4 = (SELECT obj_actual_definition_id from vw_edd_actual where obj_name = 'num_sbr'); -SET @edd5 = (SELECT obj_actual_definition_id from vw_edd_actual where obj_name = 'num_tbr'); - --- create the ac set -CALL SP__insert_ac_id(5, "ac fpr test report", @r_rpt_ac ); -CALL SP__insert_ac_actual_entry(@r_rpt_ac , @edd1, 1, @r_ac_entry_id); -CALL SP__insert_ac_actual_entry(@r_rpt_ac , @edd2, 2, @r_ac_entry_id); -CALL SP__insert_ac_actual_entry(@r_rpt_ac , @edd3, 3, @r_ac_entry_id); -CALL SP__insert_ac_actual_entry(@r_rpt_ac , @edd4, 4, @r_ac_entry_id); -CALL SP__insert_ac_actual_entry(@r_rpt_ac , @edd5, 5, @r_ac_entry_id); - -CALL SP__insert_obj_metadata(7, 'test_rpt', null, @rptt_obj_id_1); -CALL SP__insert_report_template_formal_definition(@rptt_obj_id_1, 'This is a test report.', null, @r_rpt_ac , @rptt_definition_id_1); --- singleton value of the report since it doesnt have any parameters -CALL SP__insert_report_actual_definition(@rptt_obj_id_1, null, 'this is the singelton of the test report' , @rptt_actual_id_1); - - --- Example ARI command(s) to place in the outgoing message queue, with the intended ARI CBOR or URI equivalents to validate. We have plenty of --- examples in the nm unit-tests that we can start from. --- ION Inserts into register_agents table all known agents, and agents discovered from received registration messages. -CALL SP__insert_agent("test:test", @r_registered_agents_id); -CALL SP__insert_agent("test:test2", @r_registered_agents_id); --- Currently implemented and working as a simple insert. See my prior note on future enhancements here. - --- Tester Inserts into DB a command to generate a report. --- For example, ari:/IANA:amp.agent/Ctrl.gen_rpts([ari:/IANA:amp.agent/Rptt.full_report()],[]) - --- long way of getting state_id could just do 0 i think -CALL SP__insert_outgoing_message_set( DATE('1997-05-07 08:00:00'), null, (SELECT state_id FROM outgoing_state WHERE state_name = 'Initializing'), @r_registered_agents_id, @r_set_id); - - - --- CREATE the ac for the message set ALTER --- Ctrl.gen_rpts([ari:/IANA:amp.agent/Rptt.full_report()],[]) --- SP__insert_control_actual_definition(IN p_obj_definition_id int(10) unsigned, p_ap_spec_id int(10) unsigned, p_use_desc varchar, OUT r_instance_id int(10) unsigned - -CALL SP__insert_ac_id(1, "ac for gen report", @r_rpt_ac ); -CALL SP__insert_ac_actual_entry(@r_rpt_ac , (SELECT obj_actual_definition_id FROM vw_rpt_actual WHERE obj_name = 'full_report'), 1, @r_ac_entry_id); - -CALL SP__insert_tnvc_collection( 'tnvc for gen report', @r_tnvc_id ); - - -CALL SP__insert_actual_parmspec((SELECT fp_spec_id FROM control_formal_definition WHERE obj_formal_definition_id = (SELECT obj_formal_definition_id FROM vw_ctrl_definition WHERE obj_name = 'gen_rpts')), 2, 'actual parms for test gen_rpts', @r_ap_spec_id); -CALL SP__insert_actual_parms_ac(@r_ap_spec_id, 1, @r_rpt_ac); -CALL SP__insert_actual_parms_tnvc(@r_ap_spec_id , 2, @r_tnvc_id ); - -CALL SP__insert_control_actual_definition((SELECT obj_metadata_id FROM vw_ctrl_definition WHERE obj_name = 'gen_rpts' ), @r_ap_spec_id, 'Ctrl.gen_rpts([ari:/IANA:amp.agent/Rptt.full_report()],[])', @r_act_ctrl_id ); - -CALL SP__insert_ac_id(1, "ac for message 1", @r_mes_ac ); -CALL SP__insert_ac_actual_entry(@r_mes_ac , @r_act_ctrl_id, 1, @r_ac_entry_id); - -CALL SP__insert_outgoing_message_entry(@r_set_id,1, DATE('2020-06-24 08:00:00'), @r_mes_ac, @r_message_id); - -SET @p_state = (SELECT state_id - FROM outgoing_state - WHERE state_name = 'ready'); -CALL SP__update_outgoing_message_set(@r_set_id, @p_state); - - - -- testing adding the same agent -CALL SP__insert_agent("test:test", @r_registered_agents_id); - - - - - --- Application SELECTS pending (outgoing) messages and finds the newly inserted record --- This query will be made in a loop for mySQL. If we ever create a Postgresql port, we could use LISTEN/NOTIFY instead. --- Application SELECTS component pieces of the command to build up the appropriate ARI definition and encapsulating message definition, then serializes into CBOR for transmission. --- Application receives a response and INSERTs the received report into the database --- As noted; We can insert the full definition of the received message set, but all we really need are the individual reports (with timestamps). I can grab the CBOR strings for a sample report, or more usefully, the fully decomposed definition as output by my amp.me script to serve as an example of what we need to insert into the database. --- Future: UI or other processing application accesses received reports as needed. - - - - diff --git a/amp-sql/postgres/Database_Scripts/amp_core_functions.sql b/amp-sql/postgres/Database_Scripts/17-amp_core_functions.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/amp_core_functions.sql rename to amp-sql/postgres/Database_Scripts/17-amp_core_functions.sql diff --git a/amp-sql/postgres/Database_Scripts/Routines/all_routines.sql b/amp-sql/postgres/Database_Scripts/Routines/16-all_routines.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Routines/all_routines.sql rename to amp-sql/postgres/Database_Scripts/Routines/16-all_routines.sql diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_agent_delete.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_agent_delete.sql deleted file mode 100644 index 5b3be5d..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_agent_delete.sql +++ /dev/null @@ -1,23 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- -DELETE FROM adm WHERE adm_name = 'amp_agent' AND adm_enum = 1; -DELETE FROM namespace WHERE name_string = 'Amp/Agent' AND namespace_id = 1; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_ac.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_ac.sql deleted file mode 100644 index 747b713..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_ac.sql +++ /dev/null @@ -1,82 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- STORED PROCEDURE(S) for creating an ari collection and entries - --- ================================================================== --- SP__insert_ac_id --- adds an ari collection to the database --- Parameters: --- in --- p_num_entries integer - number of entries in the ac --- p_use_desc varchar - human readable description --- OUT --- r_ac_id integer- id of the ac --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_ac_id(IN p_num_entries integer, p_use_desc varchar, OUT r_ac_id integer) LANGUAGE plpgsql AS $$ BEGIN - INSERT INTO ari_collection(num_entries, use_desc) VALUES(p_num_entries, p_use_desc) RETURNING ari_collection_id INTO r_ac_id; -end$$; - --- ================================================================== --- SP__insert_ac_formal_entry --- adds a formal ari entry into the database. --- stops if the order_num is > the number of entries for the target ac --- Parameters: --- in --- p_ac_id integer - id of the ari collection this entry belongs to --- p_definition_id integer - id of the definition --- p_order_num integer - order number --- OUT --- r_ac_entry_id integer - entry id --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_ac_formal_entry(IN p_ac_id integer, p_definition_id integer, p_order_num integer, INOUT r_ac_entry_id integer) LANGUAGE plpgsql AS $$ BEGIN - /*IF p_order_num < (select num_entries from ari_collection where ari_collection.ac_id = p_definition_id) THEN - LANGUAGE plpgsql*/ - INSERT INTO ari_collection_entry(ac_id, order_num) VALUES(p_ac_id, p_order_num) RETURNING ari_collection_entry_id INTO r_ac_entry_id; - INSERT INTO ari_collection_formal_entry(ac_entry_id, obj_formal_definition_id) VALUES(r_ac_entry_id, p_definition_id); - /*END; - END IF;*/ -end$$; - --- ================================================================== --- SP__insert_ac_actual_entry --- adds a actual ari entry into the database. --- stops if the order_num is > the number of entries for the target ac --- Parameters: --- in --- p_ac_id integer - id of the ari collection this entry belongs to --- p_definition_id integer - id of the definition --- p_order_num integer - order number --- OUT --- r_ac_entry_id integer - entry id --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_ac_actual_entry(IN p_ac_id integer, p_definition_id integer, p_order_num integer, OUT r_ac_entry_id integer) LANGUAGE plpgsql AS $$ BEGIN - -- IF p_order_num < (select num_entries from ari_collection where ari_collection.ac_id = p_definition_id) THEN - - INSERT INTO ari_collection_entry(ac_id, order_num) VALUES(p_ac_id, p_order_num) RETURNING ari_collection_entry_idINTO r_ac_entry_id; - INSERT INTO ari_collection_actual_entry(ac_entry_id, obj_actual_definition_id) VALUES(r_ac_entry_id, p_definition_id); --- END; - -- END IF; -end$$; diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_actual_parmspec.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_actual_parmspec.sql deleted file mode 100644 index 412f8c1..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_actual_parmspec.sql +++ /dev/null @@ -1,165 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- STORED PROCEDURE(S) for the actaul parameters specefications and actual parameter sets. has real data - - --- ================================================================== --- SP__insert_actual_parmspec --- inserting an actual parmspec into db --- IN --- p_fp_spec_id integer - the id of the formal parm spec for this actual parmspec --- p_tnvc_id integer - TNVC corresponding to actual parameter definition --- p_use_desc varchar - human readable describtion --- OUT --- r_ap_spec_id integer - id of the parmspec in the db --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_actual_parmspec_tnvc(IN p_fp_spec_id integer, p_tnvc_id integer, p_use_desc varchar, INOUT r_ap_spec_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - INSERT INTO actual_parmspec(fp_spec_id, tnvc_id, use_desc) VALUES(p_fp_spec_id, p_tnvc_id, p_use_desc) RETURNING ap_spec_id INTO r_ap_spec_id; -end$$; - - --- ================================================================== --- SP__insert_actual_parmspec --- inserting an actual parmspec into db --- IN --- p_fp_spec_id integer - the id of the formal parm spec for this actual parmspec --- p_num_parms integer - number of parms --- p_use_desc varchar - human readable describtion --- OUT --- r_ap_spec_id integer - id of the parmspec in the db --- ================================================================== --- TODO: p_num_parms argument is deprecated and will be removed - -CREATE OR REPLACE PROCEDURE SP__insert_actual_parmspec(IN p_fp_spec_id integer, p_num_parms integer, p_use_desc varchar, INOUT r_ap_spec_id integer) -LANGUAGE plpgsql -AS $$ -DECLARE tnvc_id INT; - BEGIN - - CALL SP__insert_tnvc_collection(p_use_desc, tnvc_id); - CALL SP__insert_actual_parmspec_tnvc(p_fp_spec_id, tnvc_id, p_use_desc, r_ap_spec_id); -end$$; - - --- ================================================================== --- SP__insert_actual_parms_object --- inserting an actual parm object into spec --- IN --- p_ap_spec_id integer - id of the spec this object is being added --- p_order_num integer - order number --- p_data_type_id integer - the id of the datatype in the data type table --- p_obj_actual_definition integer - id of the object for the parm --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_actual_parms_object(IN p_ap_spec_id integer, p_order_num integer, p_data_type_id varchar , p_obj_actual_definition integer) -LANGUAGE plpgsql -AS $$ -DECLARE -ap_tnvc_id int; -r_tnvc_entry_id INT; - BEGIN - - SELECT tnvc_id INTO ap_tnvc_id FROM actual_parmspec WHERE ap_spec_id = p_ap_spec_id; - - - CALL SP__insert_tnvc_obj_entry(ap_tnvc_id, p_order_num, p_data_type_id, p_obj_actual_definition, r_tnvc_entry_id); - - - -end$$; - - --- ================================================================== --- SP__insert_actual_parms_names --- inserting an actual parm reference by name into spec. This parm gets it value from the object that defines this parm spec --- IN --- p_ap_spec_id integer - id of the spec this object is being added --- p_order_num integer - order number --- p_data_type_id integer - the id of the datatype in the data type table --- p_fp_id integer - id of the formal parm this parm reference --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_actual_parms_names(IN p_ap_spec_id integer, p_order_num integer, p_data_type_id varchar, p_fp_id integer) -LANGUAGE plpgsql -AS $$ DECLARE ap_tnvc_id INT; - DECLARE dt_id INT; - - BEGIN - - - SELECT tnvc_id INTO ap_tnvc_id FROM actual_parmspec WHERE ap_spec_id = p_ap_spec_id; - - SELECT data_type_id INTO dt_id FROM data_type WHERE type_name = p_data_type_id; - - INSERT INTO type_name_value_entry(tnvc_id, order_num, data_type_id, data_name, fp_id) VALUES(ap_tnvc_id, p_order_num, dt_id, p_data_Type_id, p_fp_id); - - - -end$$; - - --- ================================================================== --- SP__insert_actual_parms_tnvc --- inserting an actual parm tnvc into spec. --- IN --- p_ap_spec_id integer - id of the spec this object is being added --- p_order_num integer - order number --- p_data_type_id integer - the id of the datatype in the data type table --- p_tnvc_id integer - id of the type name value collection --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_actual_parms_tnvc(IN p_ap_spec_id integer, p_order_num integer, p_tnvc_id integer) -LANGUAGE plpgsql -AS $$ -DECLARE -ap_tnvc_id int; -r_entry_id INT; - BEGIN - - SELECT tnvc_id INTO ap_tnvc_id FROM actual_parmspec WHERE ap_spec_id = p_ap_spec_id; - - CALL SP__insert_tnvc_tnvc_entry(ap_tnvc_id, p_order_num, p_tnvc_id, r_entry_id); -end$$; - - --- ================================================================== --- SP__insert_actual_parms_ac --- inserting an actual parm ac into spec. --- IN --- p_ap_spec_id integer - id of the spec this object is being added --- p_order_num integer - order number --- p_data_type_id integer - the id of the datatype in the data type table --- p_ac_id integer - id of the ari collection --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_actual_parms_ac(IN p_ap_spec_id integer, p_order_num integer, p_ac_id integer) -LANGUAGE plpgsql -AS $$ -DECLARE -ap_tnvc_id int; - r_entry_id INT; -BEGIN - - SELECT ap_tnvc_id=tnvc_id FROM actual_parmspec WHERE ap_spec_id = p_ap_spec_id; - - CALL SP__insert_tnvc_ac_entry(ap_tnvc_id, p_order_num, p_ac_id, r_entry_id); - -end$$; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_agents.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_agents.sql deleted file mode 100644 index 531b077..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_agents.sql +++ /dev/null @@ -1,56 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- inserting reg agents into the db - --- ================================================================== --- SP__insert_agent --- inserting a new agent into the systemß --- IN --- p_agent_id_string- name of the agent to insert --- OUT --- r_registered_agents_id - teh id of the agent in the db --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_agent(IN p_agent_id_string varchar, INOUT r_registered_agents_id integer) -LANGUAGE plpgsql - -AS $$ -DECLARE - cur_time TIMESTAMP; - lower_name varchar; - eid INTEGER; - BEGIN - cur_time := NOW(); - lower_name := LOWER(p_agent_id_string); - eid := NULL; - SELECT registered_agents_id INTO eid FROM registered_agents WHERE lower_name = agent_id_string; - - IF (eid IS NOT NULL) THEN BEGIN - UPDATE registered_agents SET last_registered = cur_time WHERE registered_agents_id=eid; - r_registered_agents_id := eid; - END; - ELSE BEGIN - INSERT INTO registered_agents (agent_id_string,first_registered, last_registered) - VALUES (lower_name, cur_time, cur_time) RETURNING registered_agents_id INTO r_registered_agents_id; - END; - END IF; -end$$; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_const.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_const.sql deleted file mode 100644 index bb210c0..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_const.sql +++ /dev/null @@ -1,80 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- ================================================================== --- Author: David Linko --- --- Description: inserting, updating and removing constant formal and actual definitions --- using the obj routines --- --- ================================================================== - --- ================================================================== --- SP__insert_const_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the constant --- p_data_type varchar - name of the data type for the constant --- p_data_value_string varchar - blob conating the encoded value of the constant --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_const_actual_definition(IN p_obj_id integer, p_use_desc varchar, p_data_type varchar, p_data_value_string varchar, INOUT r_actual_definition_id integer) -LANGUAGE plpgsql - -AS $$ -DECLARE data_id integer; - BEGIN - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_actual_definition_id); - SELECT data_type_id FROM data_type WHERE type_name = p_data_type into data_id; - INSERT INTO const_actual_definition(obj_actual_definition_id, data_type_id, data_value) VALUES(r_actual_definition_id, data_id, p_data_value_string); -end$$; - - - --- ================================================================== --- SP__delete_const_actual_definition --- cna us either hte name or the id of the constant to delete --- Parameters: --- in --- p_obj_id integer - id of the constan to delete --- p_obj_name varchar - name of the constant to delete --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__delete_const_actual_definition(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE plpgsql - -AS $$ -DECLARE -metadata_id INTEGER; -BEGIN - IF (p_obj_id != null) THEN - metadata_id = (SELECT obj_metadata_id FROM obj_actual_definition where obj_actual_definition_id = p_obj_id ); - ELSE - IF (p_obj_name != NULL) THEN - metadata_id = (SELECT obj_metadata_id FROM obj_metadata where obj_name = p_obj_name); - END IF; - END IF; - CALL SP__delete_obj_metadata(metadata_id); - -END$$; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_ctrl.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_ctrl.sql deleted file mode 100644 index f05e9ab..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_ctrl.sql +++ /dev/null @@ -1,140 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- ================================================================== --- Author: David Linko --- --- Description: inserting, updating and removing control formal and actual definitions --- using the obj routines --- --- ================================================================== - - --- ================================================================== --- SP__insert_control_formal_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the constant --- p_data_type varchar - name of the data type for the constant --- p_data_value_string varchar - blob conating the encoded value of the constant --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_control_formal_definition(IN p_obj_id integer, p_use_desc varchar, p_fp_spec_id integer, INOUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_formal_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO control_formal_definition(obj_formal_definition_id, fp_spec_id) VALUES(r_definition_id, p_fp_spec_id); -end$$; - - --- ================================================================== --- SP__delete_control_formal_definition; --- Parameters: --- in --- p_obj_id - id of the control to delete --- p_obj_name - name of the control to delete --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__delete_control_formal_definition(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__delete_obj_formal_definition(p_obj_id, p_obj_name); -end$$; - - - --- ================================================================== --- SP__insert_control_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the constant --- p_data_type varchar - name of the data type for the constant --- p_data_value_string varchar - blob conating the encoded value of the constant --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_control_actual_definition(IN p_obj_definition_id integer, p_ap_spec_id integer, p_use_desc varchar, INOUT r_instance_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_definition_id, p_use_desc, r_instance_id); - - -- TODO: Skip insert if it has no parameters - INSERT INTO control_actual_definition(obj_actual_definition_id, ap_spec_id) VALUES(r_instance_id, p_ap_spec_id); -end$$; - - - --- ================================================================== --- SP__delete_control_actual_definition; --- Parameters: --- in --- p_obj_id integer - actual_definiton id of the control that is to be deleted --- p_obj_name varchar- name of the control to delete, this allows to delete all the actual definitons --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__delete_control_actual_definition(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE plpgsql - -AS $$ <> - - DECLARE done INT DEFAULT FALSE; - DECLARE actual_definition_id_hold integer; - DECLARE ap_spec_id_hold integer; - DECLARE actual_definition_cursor CURSOR - FOR SELECT actual_definition_id, ap_spec_id FROM vw_ctrl_actual_definition WHERE obj_name = p_obj_name; - -- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done := TRUE; - DECLARE ap_id integer; - BEGIN - - -- only one thing to remove - If( p_inst_id is not null) then - ap_id = (SELECT ap_spec_id from ctrl_actual_definition where actual_definition_id = p_inst_id ); - IF( ap_id is not null) THEN - DELETE FROM actual_parmspec WHERE ap_spec_id = ap_id; - END IF; - DELETE FROM ctrl_actual_definition -WHERE - intance_id = p_actual_definition_id; - CALL SP__delete_obj_actual_definition(p_actual_definition_id, p_obj_name); - ELSE -- removing all instances with this name - IF( p_obj_name is null) then -- nothing to do - exit ctrl_actual_definition_del; - END IF; - OPEN actual_definition_cursor; - <> LOOP - FETCH NEXT FROM actual_definition_cursor INTO - actual_definition_id_hold, ap_spec_id_hold; - IF done THEN - exit read_loop; - END IF; - - DELETE FROM actual_parmspec WHERE ap_spec_id = ap_spec_id_hold; - - DELETE FROM ctrl_actual_definition -WHERE - ctrl_actual_definition.actual_definition_id = actual_definition_id_hold; - END LOOP; - CALL SP__delete_obj_actual_definition(null, p_obj_name); - end if; - CLOSE actual_definition_cursor; -END$$; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_data_values.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_data_values.sql deleted file mode 100644 index 0cc4dba..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_data_values.sql +++ /dev/null @@ -1,31 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- STORED PROCEDURE(S) - --- --- --- CREATE OR REPLACE PROCEDURE SP__insert_data_value(IN p_value_converted varchar, p_value_string varchar, INOUT r_value_id integer) - --- INSERT INTO data_value(value_converted, value_string) VALUES(p_value_converted, p_value_string) RETURNING INTO_id INTO ; --- end$$; --- \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_edd.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_edd.sql deleted file mode 100644 index 1a84ee9..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_edd.sql +++ /dev/null @@ -1,172 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- ================================================================== --- Author: David Linko --- --- Description: inserting, updating and removing EDD formal and actual definitions --- using the obj routines --- --- ================================================================== - --- ================================================================== --- SP__insert_edd_formal_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the edd --- p_data_type varchar - name of the data type for the edd --- p_data_value_string varchar - blob conating the encoded value of the edd --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_edd_formal_definition(IN p_obj_id integer, p_use_desc varchar, p_fp_spec_id integer, p_external_data_type varchar, INOUT r_formal_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_formal_definition(p_obj_id, p_use_desc, r_formal_definition_id); - INSERT INTO edd_formal_definition(obj_formal_definition_id, fp_spec_id, data_type_id) VALUES(r_formal_definition_id, p_fp_spec_id, (SELECT data_type_id FROM data_type WHERE type_name = p_external_data_type)); -end$$; - - - - --- ================================================================== --- SP__delete_edd_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the edd to delete --- p_obj_name varchar - name of the edd to delete --- --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__delete_edd_formal_defintion(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE plpgsql - -AS $$ -<> -DECLARE def_id integer; -DECLARE fp_id integer; -BEGIN - IF( p_obj_id is Null AND p_obj_name is not NULL) THEN - select obj_id FROM obj_metadata WHERE obj_name = p_obj_name into p_obj_id; - ELSE - exit edd_def_del; - END IF; - - IF(p_obj_name is NULL) THEN - select obj_name from vw_edd_formal where obj_id = p_obj_id into p_obj_name; - END IF ; - - -- deleting all instances - CALL SP__delete_edd_actual_definition(null, p_obj_name); - - def_id = (select obj_formal_definition_id from obj_formal_definition where obj_metadata_id = p_obj_id); - fp_id = (SELECT fp_spec_id from edd_formal_definition where obj_formal_definition_id = def_id ); - DELETE FROM formal_parmspec WHERE fp_spec_id = fp_id; - - CALL SP__delete_obj_formal_defintion(p_obj_id, p_obj_name); -end$$; - - - --- ================================================================== --- SP__insert_edd_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the constant --- p_data_type varchar - name of the data type for the constant --- p_data_value_string varchar - blob conating the encoded value of the constant --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_edd_actual_definition(IN p_obj_definition_id integer, p_use_desc varchar, p_ap_spec_id integer, INOUT r_actual_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_definition_id, p_use_desc, r_actual_definition_id); - INSERT INTO edd_actual_definition(obj_actual_definition_id, ap_spec_id) VALUES(r_actual_definition_id, p_ap_spec_id); -end$$; - - - --- ================================================================== --- SP__delete_edd_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the constant --- p_data_type varchar - name of the data type for the constant --- p_data_value_string varchar - blob conating the encoded value of the constant --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== --- for instance can supply the definiton name to remove all the instances of that definition or can remove - -CREATE OR REPLACE PROCEDURE SP__delete_edd_actual_definition(IN p_actual_definition_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ -<> -DECLARE - done INT DEFAULT FALSE; - actual_definition_id_hold integer; - ap_spec_id_hold integer; - actual_definition_cursor CURSOR - FOR SELECT actual_definition_id, ap_spec_id FROM vw_edd_actual WHERE obj_name = p_obj_name; - ap_id integer; - -BEGIN - - - -- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - -- only one thing to remove - If( p_inst_id is not null) then - ap_id = (SELECT ap_spec_id from edd_actual_definition where actual_definition_id = p_inst_id ); - IF( ap_id is not null) THEN - DELETE FROM actual_parmspec WHERE ap_spec_id = ap_id; - END IF; - DELETE FROM edd_actual_definition -WHERE - intance_id = p_actual_definition_id; - CALL SP__delete_obj_actual_definition(p_actual_definition_id, p_obj_name); - ELSE -- removing all instances with this name - IF( p_obj_name is null) then -- nothing to do - exit edd_actual_definition_del; - END IF; - OPEN actual_definition_cursor; - <> LOOP - FETCH NEXT FROM actual_definition_cursor INTO - actual_definition_id_hold, ap_spec_id_hold; - IF done THEN - exit read_loop; - END IF; - - DELETE FROM actual_parmspec WHERE ap_spec_id = ap_spec_id_hold; - - DELETE FROM edd_actual_definition -WHERE - edd_actual_definition.actual_definition_id = actual_definition_id_hold; - END LOOP; - CALL SP__delete_obj_actual_definition(null, p_obj_name); - end if; - CLOSE actual_definition_cursor; -end$$; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_expr.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_expr.sql deleted file mode 100644 index db9b0f5..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_expr.sql +++ /dev/null @@ -1,76 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- STORED PROCEDURE(S) for creating expresions that are used in rules and variables - --- --- --- CREATE OR REPLACE PROCEDURE sp_insert_postfix_operations(IN p_num_operators integer, p_operator_ids_list varchar(1000), p_operands_values_list varchar(10000), INOUT r_postfix_operations integer) - -- we get a list of operators and a list of operands need to create an ari collection for both --- -- need to finish --- -- generate an ari collection --- -- add in the airs --- -- call sp_insert_ari_collection(IN p_num_entries integer, p_definition_ids_list varchar(10000), p_instance_ids_list varchar(10000), p_use_desc varchar, INOUT r_ac_id integer) --- --- end$$; --- - - --- ================================================================== --- SP__insert_expression --- adds an expression to the database --- Parameters: --- in --- p_out_type integer - data type id for the return type of the expression --- p_num_operators integer - number of operators --- p_postfix_ids_list varchar(1000) - id of the ac that lists the equation in postfix notation --- OUT --- r_expr_id integer - id of the expr in the database --- ================================================================= - - -CREATE OR REPLACE PROCEDURE SP__insert_expression(IN p_out_type integer, -p_postfix_operations integer, INOUT r_expr_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - -- SELECT p_out_type; - -- IF p_out_type = 2 or p_out_type = 12 or p_out_type = 3 or p_out_type = 0 THEN BEGIN - INSERT INTO expression(data_type_id, ac_id) VALUES(p_out_type, p_postfix_operations) RETURNING expression_id INTO r_expr_id; - -- END; - -- END IF; -end$$; - - - --- ================================================================== --- SP__delete_expression --- Delete an expression from the database --- Parameters: --- in --- p_expr_id integer - id of the expr in the database to delete --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__delete_expression(IN p_expr_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - DELETE from expression WHERE (expression_id = p_expr_id); -end$$; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_formal_parmspec.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_formal_parmspec.sql deleted file mode 100644 index 030c4a6..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_formal_parmspec.sql +++ /dev/null @@ -1,142 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- STORED PROCEDURE(S) for the formal parameters specefications. Stores type name information. - - --- ================================================================== --- SP__insert_formal_parmspec --- inserts a new formal parmspec in the db --- IN --- p_num_parms integer - number if parms in the spec --- p_use_desc varchar - human readable describtion --- OUT --- r_fp_spec_id integer - the id of the spec --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_formal_parmspec(IN p_num_parms integer, p_use_desc varchar, INOUT r_fp_spec_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - INSERT INTO formal_parmspec(num_parms, use_desc) VALUES(p_num_parms, p_use_desc) RETURNING fp_spec_id INTO r_fp_spec_id; -end$$; - - - - --- ================================================================== --- SP__insert_formal_parmspec_entry --- insert a single entry into a formal parm --- IN --- p_fp_spec_id integer - id of the formal parmspec for this entry --- p_order_num integer - order of the entry in the parmspec --- p_parm_name varchar - name of the parm used for parm by name --- p_data_type varchar - data type of the parm --- p_obj_definition_id integer - optional default value of this parm --- OUT --- r_fp_id integer --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_formal_parmspec_entry(IN p_fp_spec_id integer, p_order_num integer, p_parm_name varchar, p_data_type varchar, p_obj_definition_id integer, INOUT r_fp_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - INSERT INTO formal_parm -( -fp_spec_id, -order_num, -parm_name, -data_type_id, -obj_actual_definition_id) -VALUES -(p_fp_spec_id, -p_order_num, -p_parm_name, -(select data_type_id from data_type where type_name = p_data_type), -p_obj_definition_id) RETURNING fp_id INTO r_fp_id; -end$$; - - - - --- ================================================================== --- SP__insert_formal_parmspec --- inserts a list of formal parms into a spec, uses three ',' delimenated lists to --- store type name and default value info for the formal parms --- IN --- p_num_parms integer - number of parms in the parmspec --- p_use_desc varchar - human readable description --- p_data_types_list varchar(10000 ) - list of types for the parms --- p_parm_names_list varchar(10000) - list of the names for the parms --- p_default_values_list varchar(10000) - list of the default values --- OUT --- r_fp_spec_id integer - formal parmspec id --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_formal_parms_set(IN p_num_parms integer, p_use_desc varchar, p_data_types_list varchar(10000), p_parm_names_list varchar(10000), - p_default_values_list varchar(10000), INOUT r_fp_spec_id integer) -LANGUAGE plpgsql -AS $$ -DECLARE -fp_spec_id int; -s varchar; -loops int; -data_type varchar; -parm_name varchar; -default_value varchar; -BEGIN - CALL SP__insert_formal_parmspec(p_num_parms, p_use_desc, r_fp_spec_id); - fp_spec_id := r_fp_spec_id; - s := 'INSERT INTO formal_parm(fp_spec_id, order_num, parm_name, data_type_id, obj_actual_definition_id) VALUES'; - loops := 1; - WHILE loops < p_num_parms DO LOOP - -- @data_type - data_type := TRIM(SUBSTRING_INDEX(p_data_types_list, ',', 1)); - SELECT REPLACE(p_data_types_list, CONCAT(data_type, ','), '') into p_data_types_list ; - - -- parm_name - parm_name := TRIM(SUBSTRING_INDEX(p_parm_names_list, ',', 1)); - SELECT REPLACE(p_parm_names_list, CONCAT(parm_name, ','), '') into p_parm_names_list; - - -- @default_value - default_value := TRIM(SUBSTRING_INDEX(p_default_values_list, ',', 1)); - IF default_value = 'NULL' THEN default_value := null; - ELSEIF default_value = 'null' THEN default_value := null; - END IF; - SELECT REPLACE(p_default_values_list, CONCAT(default_value, ','), '') into p_default_values_list; - - s = CONCAT(s, '(', fp_spec_id, ',', loops, ',', '"', parm_name, '"', ',', (SELECT data_type_id FROM data_type where type_name = data_type), ',', '"', default_value, '"', '),'); - loops := loops + 1; - END loop; - - -- @data_type - data_type := TRIM((SUBSTRING_INDEX(p_data_types_list, ',', 1))); - - -- parm_name - parm_name := TRIM(SUBSTRING_INDEX(p_parm_names_list, ',', 1)); - - -- default_value - IF default_value = 'NULL' THEN default_value := null; - ELSEIF default_value = 'null' THEN default_value := null; - END IF; - SELECT REPLACE(p_default_values_list, CONCAT(default_value, ','), '') into p_default_values_list; - - s = CONCAT(s, '(', fp_spec_id, ',', loops, ',', (SELECT data_type_id FROM data_type where type_name = data_type), ',', '"', parm_name, '"', ',', '"', default_value, '"', ')'); - -- PREPARE stmt as s; - EXECUTE s; - -end$$; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_lit.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_lit.sql deleted file mode 100644 index ecdd272..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_lit.sql +++ /dev/null @@ -1,56 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - - --- STORED PROCEDURE(S) for creating literals --- need to update to allow ot be ari - - --- ================================================================== --- SP__insert_literal_actual_definition --- IN --- p_obj_id integer - id of the metadata info --- p_use_desc varchar - human readable describtion --- p_data_type varchar - primitive data type of the literal --- p_data_value_string varchar - calue of the literal encoded as a string --- OUT --- r_definition_id integer - id of teh literal --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_literal_actual_definition(IN p_obj_id integer, p_use_desc varchar, p_data_type varchar, p_data_value_string varchar, INOUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO literal_actual_definition(obj_actual_definition_id, data_type_id, data_value) VALUES(r_definition_id, (SELECT data_type_id FROM data_type WHERE type_name = p_data_type), p_data_value_string); -end$$; - - - --- ================================================================== --- SP__delete_literal_actual_definition --- IN --- p_obj_id integer - id of the lit to be deleted --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__delete_literal_actual_definition(IN p_obj_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__delete_obj_definition(p_obj_id); -end$$; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_macro.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_macro.sql deleted file mode 100644 index 6b408e6..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_macro.sql +++ /dev/null @@ -1,161 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- STORED PROCEDURE(S) for creating updating and deleting macro definitions and actuals - --- ================================================================== --- SP__insert_macro_formal_definition --- IN --- p_obj_id integer - id of the metadata info --- p_use_desc varchar - human readable describtion --- p_fp_spec_id integer - formal parmspec of the macro --- p_max_call_depth integer - max call depth of the macro --- p_definition_ac integer - ari collection definining the macro --- OUT --- r_definition_id integer - id of the new formal definition --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_macro_formal_definition(IN p_obj_id integer, p_use_desc varchar, p_fp_spec_id integer, p_max_call_depth integer, p_definition_ac integer, INOUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_formal_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO macro_formal_definition(obj_formal_definition_id, fp_spec_id, ac_id, max_call_depth) VALUES(r_definition_id, p_fp_spec_id, p_definition_ac, p_max_call_depth); -end$$; - - - --- ================================================================== --- SP__delete_mac_formal_defintion --- IN --- p_obj_id integer - id of the macro to be deleted --- p_obj_name varchar - name of the macro to delete --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__delete_mac_formal_defintion(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ - -<> -DEClare -def_id int; -fp_id int; -ac_id int; -BEGIN - IF( p_obj_id is Null AND p_obj_name is not NULL) THEN - select obj_id FROM obj_metadata WHERE obj_name = p_obj_name into p_obj_id; - ELSE - EXIT mac_def_del; - END IF; - - IF(p_obj_name is NULL) THEN - select obj_name from vw_mac_formal where obj_id = p_obj_id into p_obj_name; - END IF ; - - -- deleting all actuals - CALL SP__delete_macro_actual(null, p_obj_name); - - def_id = (select definition_id from obj_formal_definition where obj_id = p_obj_id); - fp_id = (SELECT fp_spec_id from macro_formal_definition where definition_id = def_id ); - ac_id = (SELECT ac_id FROM macro_formal_definition where definition_id = def_id ); - - DELETE FROM formal_parmspec WHERE fp_spec_id = fp_id; - DELETE FROM ari_collection WHERE ac_id = ac_id; - - CALL SP__delete_obj_formal_defintion(p_obj_id, p_obj_name); -end$$; - - - --- ================================================================== --- SP__insert_macro_actual_definition --- -- IN --- p_obj_id integer - id of the metadata info --- p_ap_spec_id integer - actual parmspec id --- p_actual_ac integer - ari collection containg all actual ARI for this macro --- p_use_desc varchar - human readable description --- OUT --- r_actual_id integer - id of the new actual definition --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_macro_actual_definition(IN p_obj_definition_id integer, p_ap_spec_id integer, p_actual_ac integer, p_use_desc varchar, INOUT r_actual_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_definition_id, p_use_desc, r_actual_id); - INSERT INTO macro_actual(obj_actual_definition_id, ap_spec_id, ac_id) VALUES(r_actual_id, p_ap_spec_id, p_actual_ac); -end$$; - - --- ================================================================== --- SP__delete_mac_actual_definition --- IN --- p_obj_id integer - id of the macro to be deleted --- p_obj_name varchar - name of the macro to delete --- ================================================================== --- for actual can supply the definiton name to remove all the actuals of that definition or can remove - -CREATE OR REPLACE PROCEDURE SP__delete_mac_actual_definition(IN p_inst_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ -<> -DECLARE -ap_id int; -done INT DEFAULT FALSE; - actual_id_hold int; -ap_spec_id_hold int; -ac_id_hold int; -actual_cursor CURSOR - FOR SELECT actual_id, ap_spec_id, ac_id WHERE obj_name = p_obj_name; - -- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - -BEGIN - - - -- only one thing to remove - If( p_inst_id is not null) then - ap_id = (SELECT ap_spec_id from macro_actual_definition where actual_id = p_inst_id ); - IF( ap_id is not null) THEN - DELETE FROM actual_parmspec WHERE ap_spec_id = ap_id; - END IF; - DELETE FROM macro_actual -WHERE - intance_id = p_inst_id; - CALL SP__delete_obj_actual(p_inst_id, p_obj_name); - ELSE -- removing all actuals with this name - IF( p_obj_name is null) then -- nothing to do - EXIT mac_inst_del ; - END IF; - OPEN actual_cursor; - <> LOOP - FETCH NEXT FROM actual_cursor INTO - actual_id_hold, ap_spec_id_hold, ac_id_hold; - IF done THEN - EXIT read_loop; - END IF; - - DELETE FROM actual_parmspec WHERE ap_spec_id = ap_spec_id_hold; - DELETE FROM ari_collection WHERE ac_id = ac_id_hold; - - DELETE FROM macro_actual_definition -WHERE - macro_actual.actual_id = actual_id_hold; - END LOOP; - CALL SP__delete_obj_actual_definition(null, p_obj_name); - end if; - CLOSE actual_cursor; -end$$; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_messages.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_messages.sql deleted file mode 100644 index 03748ae..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_messages.sql +++ /dev/null @@ -1,212 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- create messages - --- ================================================================== --- SP__insert_outgoing_message_set --- IN --- p_created_ts integer - created timestamp --- p_modified_ts integer - modified timestamp --- p_state integer - state of the message set --- p_agent_id integer - agent of this message --- OUT --- r_set_id integer - id of the set --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_outgoing_message_set(IN p_created_ts timestamp, -p_modified_ts timestamp, p_state integer, p_agent_id integer, INOUT r_set_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN -INSERT INTO outgoing_message_set (created_ts, modified_ts, state, agent_id) -VALUES (p_created_ts, p_modified_ts, p_state, p_agent_id) RETURNING eated_ts_id INTO r_set_id; -END$$; - - - --- ================================================================== --- SP__insert_outgoing_message_entry --- IN --- p_set_id integer - id of the outgoing message set this entry belongs toß --- p_message_order integer - order of this message in the set --- p_start_ts integer - start time --- p_ac_id integer - ac of this message --- OUT --- r_message_id integer - id of this message --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_outgoing_message_entry(IN p_set_id integer, p_message_order integer, p_start_ts timestamp, p_ac_id integer, INOUT r_message_id integer) -LANGUAGE plpgsql -AS $$ BEGIN -INSERT INTO outgoing_message_entry (set_id, message_order, start_ts, ac_id) -VALUES (p_set_id, p_message_order, p_start_ts, p_ac_id) RETURNING outgoing_message_entry_id INTO r_message_id; -END$$; - - - --- ================================================================== --- SP__update_outgoing_message_set --- IN --- p_set_id integer - id of the set to update --- p_state integer - state of the message set --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__update_outgoing_message_set(IN p_set_id integer, p_state integer) -LANGUAGE plpgsql -AS $$ BEGIN - - UPDATE outgoing_message_set - SET - modified_ts = NOW(), - state = p_state - WHERE set_id = p_set_id; -END$$; - - - --- ================================================================== --- SP__insert_incoming_message_set --- IN --- p_created_ts integer - created timestamp --- p_modified_ts integer - modified timestamp --- p_state integer - state of the message set --- p_agent_id integer - agent of this message --- OUT --- r_set_id integer - id of the set --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_incoming_message_set(IN p_created_ts timestamp, -p_modified_ts timestamp, p_state integer, p_agent_id integer, INOUT r_set_id integer) -LANGUAGE plpgsql -AS $$ BEGIN -INSERT INTO incoming_message_set (created_ts, modified_ts, state, agent_id) -VALUES (p_created_ts, p_modified_ts, p_state, p_agent_id) RETURNING eated_ts_id INTO r_set_id; -END$$; - - --- ================================================================== --- SP__insert_incoming_message_entry --- IN --- p_set_id integer - id of the outgoing message set this entry belongs toß --- p_message_order integer - order of this message in the set --- p_start_ts integer - start time --- p_ac_id integer - ac of this message --- OUT --- r_message_id integer - id of this message --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_incoming_message_entry(IN p_set_id integer, p_message_order integer, p_start_ts timestamp, p_ac_id integer, INOUT r_message_id integer) -LANGUAGE plpgsql -AS $$ BEGIN -INSERT INTO incoming_message_entry (set_id, message_order, start_ts, ac_id) -VALUES (p_set_id, p_message_order, p_start_ts, p_ac_id) RETURNING incoming_message_entry_id INTO r_message_id; -END$$; - - - --- ================================================================== --- SP__update_incoming_message_set --- IN --- p_set_id integer - id of the set to update --- p_state integer - state of the message set --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__update_incoming_message_set(IN p_set_id integer, p_state integer) -LANGUAGE plpgsql -AS $$ BEGIN - - UPDATE incoming_message_set - SET - modified_ts = NOW(), - state = p_state - WHERE set_id = p_set_id; -END$$; - - - --- SP__insert_message_report_entry(message_id, order_num, ari_id, tnvc_id, ts) - - -CREATE OR REPLACE PROCEDURE SP__insert_message_report_entry(IN - p_msg_id integer, - p_order_num integer, - p_ari_id integer, - p_tnvc_id integer, - p_ts integer, - INOUT r_obj_id integer - ) -LANGUAGE plpgsql -AS $$ BEGIN - - INSERT INTO report_definition (ari_id, ts, tnvc_id) VALUES (p_ari_id, p_ts, p_tnvc_id) RETURNING report_id INTO r_obj_id; - - IF p_order_num IS NULL THEN - SELECT order_num+1 INTO p_order_num FROM message_report_set_entry WHERE message_id=p_msg_id ORDER BY order_num DESC LIMIT 1; - END IF; - IF p_order_num IS NULL THEN - p_order_num = 0; - END IF; - - INSERT INTO message_report_set_entry (message_id, report_id, order_num) VALUES (p_msg_id, r_obj_id, p_order_num); - -end$$; - - --- SP__insert_message_group_agent_id(group_id, agent_id ) - - -CREATE OR REPLACE PROCEDURE SP__insert_message_group_agent_id(IN - p_group_id integer, - p_agent integer, - INOUT r_obj_id integer - ) -LANGUAGE plpgsql -AS $$ BEGIN - INSERT INTO message_group_agents (group_id, agent_id) VALUES (p_group_id, p_agent) RETURNING message_group_agents_id INTO r_obj_id; -end$$; - - --- SP__insert_message_group_agent_name(group_id, agent_name) - - -CREATE OR REPLACE PROCEDURE SP__insert_message_group_agent_name(IN - p_group_id integer, - p_agent VARCHAR(128), - INOUT r_obj_id integer - ) -LANGUAGE plpgsql -AS $$ DECLARE eid INT; BEGIN - - CALL SP__insert_agent(p_agent, eid); -- Select or Insert Agent ID - INSERT INTO message_group_agents (group_id, agent_id) VALUES (p_group_id, eid) RETURNING message_group_agents_id INTO r_obj_id; - -end$$; - - --- SP__insert_message_entry_agent( message_id, agent_name ) - - -CREATE OR REPLACE PROCEDURE SP__insert_message_entry_agent(IN - p_mid integer, - p_agent VARCHAR(128) - ) -LANGUAGE plpgsql -AS $$ DECLARE eid INT; BEGIN - - CALL SP__insert_agent(p_agent, eid); -- Select or Insert Agent ID - INSERT INTO message_agents (message_id, agent_id) VALUES (p_mid, eid); - -end$$; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_namespace.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_namespace.sql deleted file mode 100644 index fece005..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_namespace.sql +++ /dev/null @@ -1,120 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- STORED PROCEDURE(S) For creating namespaces and adms - --- ================================================================== --- SP__insert_namespace --- insert a new namespace into the db --- Parameters: --- in --- p_namespace_type varchar - type of the namespace --- p_issuing_org varchar - name of the issuing organization for this ADM. --- p_name_string varchar- his is the human-readable name of the ADM that should appear --- in message logs, user-interfaces, and other human-facing --- applications --- p_version varchar -This is a string representation of the version of the ADM. --- ADM version representations are formated at the discretion of --- the publishing organization. --- out --- r_namespace_id integer - id of the namespace in the database --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_namespace(IN p_namespace_type varchar, p_issuing_org varchar, p_name_string -varchar, p_version varchar, INOUT r_namespace_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - - SELECT namespace_id INTO r_namespace_id - FROM namespace - WHERE namespace_type=p_namespace_type AND issuing_org=p_issuing_org AND name_string=p_name_string AND version_name=p_version; - IF (r_namespace_id IS NULL) THEN - INSERT INTO namespace(namespace_type, issuing_org, name_string, version_name) VALUES(p_namespace_type, p_issuing_org, p_name_string, p_version) RETURNING namespace_id INTo r_namespace_id; - END IF; - -end$$; - - - --- ================================================================== --- SP__insert_network_defined_namespace --- insert a new network defined adm into the db --- Parameters: --- in --- p_issuing_org varchar - name of the issuing organization for this ADM. --- p_name_string varchar- this is the human-readable name of the ADM that should appear --- in message logs, user-interfaces, and other human-facing --- applications --- p_version varchar -This is a string representation of the version of the ADM. --- ADM version representations are formated at the discretion of --- the publishing organization. --- p_issuer_binary_string varchar - any string that identifies the organization that is --- defining an AMM object --- p_tag varchar - any string used to disambiguate AMM Objects for an Issuer --- out --- r_namespace_id integer - id of the namespace in the database --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_network_defined_namespace(IN p_issuing_org varchar, p_name_string varchar, -p_version varchar, p_issuer_binary_string varchar, p_tag varchar, INOUT r_namespace_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_namespace('NETWORK_CONFIG', p_issuing_org, p_name_string, p_version, r_namespace_id); - INSERT INTO network_config(namespace_id, issuer_binary_string, tag) VALUES(r_namespace_id, p_issuer_binary_string, p_tag); -end$$; - - - --- ================================================================== --- SP__insert_network_defined_namespace --- insert a new moderated adm into the db --- Parameters: --- in --- p_issuing_org varchar - name of the issuing organization for this ADM. --- p_name_string varchar- this is the human-readable name of the ADM that should appear --- in message logs, user-interfaces, and other human-facing --- applications --- p_version varchar - This is a string representation of the version of the ADM. --- ADM version representations are formated at the discretion of --- the publishing organization. --- p_adm_name_string varchar - this is the human-readable name of the ADM that should appear --- in message logs, user-interfaces, and other human-facing --- applications --- p_adm_enum integer - an unsigned integer in the range of 0 to --- (2^64)/20 --- p_adm_enum_label varchar - labeled based on the number of bytes --- of the Nickname as a function of the size of the ADM enumeration --- p_use_desc varchar - human readable use description --- out --- r_namespace_id integer - id of the namespace in the database --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_adm_defined_namespace(IN p_issuing_org varchar, p_namespace_string varchar, -p_version varchar, p_adm_name_string varchar, p_adm_enum integer, p_adm_enum_label varchar, -p_use_desc varchar, INOUT r_namespace_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_namespace('MODERATED', p_issuing_org, p_namespace_string, p_version, r_namespace_id); - INSERT INTO adm(namespace_id, adm_name, adm_enum, adm_enum_label, use_desc) VALUES(r_namespace_id, - p_adm_name_string, p_adm_enum, p_adm_enum_label, p_use_desc); -end$$; - - - diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_obj.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_obj.sql deleted file mode 100644 index 4d001af..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_obj.sql +++ /dev/null @@ -1,169 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- ================================================================== --- Author: David Linko --- --- Description: inserting, updating and removing object formal and actual defintion. The backbone for the DB and all the objects that make it up. --- since deletes concasde if you remove the obj instance or definiton you remove that entity from the DB --- ================================================================== - - --- ================================================================== --- Parameters: --- in --- p_obj_type varchar - object of the type --- p_obj_name varchar - human readable name of the new object --- p_namespace_id integer - namespace this object belongs to --- out --- r_obj_id integer - id of the new object in the database --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_obj_metadata(IN p_obj_type_id integer, p_obj_name varchar, p_namespace_id integer, INOUT r_obj_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - - SELECT obj_metadata_id INTO r_obj_id - FROM obj_metadata - WHERE data_type_id=p_obj_type_id AND obj_name=p_obj_name AND namespace_id=p_namespace_id; - - IF (r_obj_id IS NULL) THEN - INSERT INTO obj_metadata(data_type_id, obj_name, namespace_id) VALUES(p_obj_type_id, p_obj_name, p_namespace_id) RETURNING obj_metadata_id into r_obj_id; - - END IF; - -end$$; - - --- ================================================================== --- Parameters: --- in --- p_obj_id integer - --- --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__delete_obj_metadata(IN p_obj_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - DELETE FROM obj_metadata -WHERE obj_metadata_id = p_obj_id; - -end$$; - - - - --- ================================================================== --- Parameters: --- in --- p_obj_metadata_id integer - --- p_use_desc varchar - --- out --- r_formal_id integer - --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_obj_formal_definition(IN p_obj_metadata_id integer, p_use_desc varchar, INOUT r_formal_id integer) -LANGUAGE plpgsql - -AS $$ -DECLARE - data_type integer; - adm_enum_this INTEGER; - obj_enum integer; - -BEGIN - - -- Get the next available ID for automatic enumeration of new formal definitions - SELECT data_type_id, vw_obj_metadata.adm_enum INTO data_type, adm_enum_this FROM vw_obj_metadata WHERE obj_metadata_id=p_obj_metadata_id; - SELECT COALESCE(MAX(vof.obj_enum)+1,0) INTO obj_enum FROM vw_obj_formal_def vof WHERE vof.data_type_id=data_type AND vof.adm_enum=adm_enum_this; - - INSERT INTO obj_formal_definition(obj_metadata_id, use_desc, obj_enum) VALUES(p_obj_metadata_id, p_use_desc, obj_enum) RETURNING obj_formal_definition_id INTO r_formal_id; -end$$; - - - - --- ================================================================== --- Parameters: --- in IN p_obj_metadata_id integer, p_use_desc varchar, INOUT r_actual_id integer) --- --- out --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_obj_actual_definition(IN p_obj_metadata_id integer, p_use_desc varchar, INOUT r_actual_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - INSERT INTO obj_actual_definition(obj_metadata_id, use_desc) VALUES(p_obj_metadata_id, p_use_desc) RETURNING obj_actual_definition_id INTO r_actual_id; -end$$; - - --- ================================================================== --- can use name or id for to delete --- Parameters: --- in --- p_obj_id integer - Id of the specific obj to delete --- p_obj_name varchar - name of the obj to delete --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__delete_obj_formal_definition(p_obj_id integer, p_obj_name varchar ) -LANGUAGE plpgsql - -AS $$ -<> -BEGIN - IF( p_obj_id is NULL AND p_obj_name is not NULL) THEN - select obj_id FROM obj_metadata WHERE obj_name = p_obj_name into p_obj_id; - ELSE - exit obj_delete; - END IF; - - DELETE FROM obj_metadata WHERE obj_id = p_obj_id; -END$$; - - - --- ================================================================== --- Parameters: --- in --- p_act_id integer --- p_obj_name varchar --- p_namespace_id integer --- --- ================================================================== --- for just removing the obj instance --- two options for removal if you want to remove a specific instance you can specify the instance id, --- or if you want to remove all the instances of a specific definition you can supply the definition name --- TODO: can add another option of adding a number and only removes up to that number of entries. --- maybe too overloaded -CREATE OR REPLACE PROCEDURE SP__delete_obj_actual_definition(p_act_id integer, p_obj_name varchar ) -LANGUAGE plpgsql -AS $$ -<> -BEGIN - - -- if its just removing one instance - IF( p_inst_id is not null) THEN - DELETE FROM obj_actual_definition WHERE actual_definition_id = p_act_id; - -- if its removing all instances with this defeintion - ELSE -- removing all instances with this name - IF( p_obj_name is null or p_namespace_id) then -- nothing to do - exit obj_inst_del; - END IF; - DELETE FROM obj_actual_definition where obj_metadata_id =(select obj_metadata_id from obj_metadat where obj_name = p_obj_name ); - END IF; -END$$; diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_operator.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_operator.sql deleted file mode 100644 index b379a3d..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_operator.sql +++ /dev/null @@ -1,78 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- STORED PROCEDURE(S) for creating updating an deleting operator definitions - - --- ================================================================== --- SP__insert_operator_actual_definition --- IN --- p_obj_id integer - metadata id for this report --- p_use_desc varchar - human readable use description --- p_use_desc varchar - human readable use description --- p_result_type varchar - data type of the result --- p_num_inputs integer - number of inputs for the operator --- p_tnvc_id integer - --- OUT --- r_definition_id integer - actual id of this operator --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_operator_actual_definition(IN p_obj_id integer, p_use_desc varchar, -p_result_type varchar, p_num_inputs integer, p_tnvc_id integer, INOUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO operator_actual_definition(obj_actual_definition_id, data_type_id, num_operands, tnvc_id) - VALUES(r_definition_id, (SELECT data_type_id FROM data_type WHERE type_name = p_result_type), p_num_inputs, p_tnvc_id); -end$$; - - --- ================================================================== --- SP__delete_oper_actual_defintion --- IN --- p_obj_id integer - id of this op to delete, --- p_obj_name varchar - name of this op to delete --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__delete_oper_actual_defintion(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ -<> -DECLARE -def_id int; -fp_id int; -ac_id int; -BEGIN - IF( p_obj_id is Null AND p_obj_name is not NULL) THEN - select obj_id FROM obj_metadata WHERE obj_name = p_obj_name into p_obj_id; - ELSE - EXIT oper_def_del; - END IF; - - def_id = (select definition_id from obj_actual_definition where obj_actual_definition_id = p_obj_id); - fp_id = (SELECT fp_spec_id from macro_actual_definition where obj_actual_definition_id = def_id ); - ac_id = (SELECT ac_id FROM macro_actual_definition where obj_actual_definition_id = def_id ); - - DELETE FROM formal_parmspec WHERE fp_spec_id = fp_id; - DELETE FROM ari_collection WHERE ac_id = ac_id; - - CALL SP__delete_obj_actual_defintion(p_obj_id, p_obj_name); -end$$; diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_report.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_report.sql deleted file mode 100644 index f8a4a4d..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_report.sql +++ /dev/null @@ -1,103 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - - --- STORED PROCEDURE(S) for the creating updating and deleting reports and report templates - - --- auto adds ac which can be troublesome --- user has to make ac first -/* - -CREATE OR REPLACE PROCEDURE SP__insert_report_template_metadata_format(IN p_metadata_count integer, p_metadata_types_list varchar, p_metadata_names_list varchar, p_metadata_desc varchar, INOUT r_tnvc_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - INSERT INTO type_name_value_collection(num_entries, use_desc) VALUES(p_metadata_count, p_metadata_desc) RETURNING type_name_value_collection_id INTO r_tnvc_id; - @s := 'INSERT INTO type_name_value(tnvc_id, data_type, data_name, order_num) VALUES'; - @loops := 1; - WHILE @loops < p_metadata_count DO - LANGUAGE plpgsql -AS $$ BEGIN - -- @metadata_type - @metadata_type := TRIM(SUBSTRING_INDEX(p_metadata_types_list, ',', 1)); - SELECT REPLACE(p_metadata_types_list, CONCAT(@metadata_type, ','), '') into p_metadata_types_list - - -- @metadata_name - @metadata_name := TRIM(SUBSTRING_INDEX(p_metadata_names_list, ',', 1)); - SELECT REPLACE(p_metadata_names_list, CONCAT(@metadata_name, ','), '') into p_metadata_names_list; - - @s = CONCAT(@s, '(', r_tnvc_id, ',', (SELECT enum_id FROM data_type where type_name = metadata_type), ',', '\'', @metadata_name, '\'', ',', @loops, '),'); - @loops := loops + 1; - END; - END WHILE; - - -- @metadata_type - @metadata_type := TRIM((SUBSTRING_INDEX(p_metadata_types_list, ',', 1))); - - -- @metadata_name - @metadata_name := TRIM(SUBSTRING_INDEX(p_metadata_names_list, ',', 1)); - - @s = CONCAT(@s, '(', r_tnvc_id, ',', (SELECT enum_id FROM data_type where type_name = metadata_type), ',', '\'', @metadata_name, '\'', ',', @loops, ');'); - PREPARE stmt FROM @s; - EXECUTE stmt; - -end$$; - -*/ - - --- ================================================================== --- create a report template formal def --- SP__insert_report_template_metadata_format --- IN --- p_obj_id integer - metadata id for this report --- p_use_desc varchar - human readable use description --- p_formal_parmspec_id integer - formal parameter spec id --- p_ac_id integer - ac for the report definition --- --- OUT --- r_definition_id integer - id of this formal report --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_report_template_formal_definition(IN p_obj_id integer, p_use_desc varchar, p_formal_parmspec_id integer, p_ac_id integer, INOUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_formal_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO report_template_formal_definition(obj_formal_definition_id, fp_spec_id, ac_id) VALUES(r_definition_id, p_formal_parmspec_id, p_ac_id); -end$$; - - - --- ================================================================== --- SP__insert_report_actual_definition --- IN --- p_obj_definition_id integer - metadata id for this report --- p_ap_spec_id integer - id for the actual parmspec for this report --- p_use_desc varchar - human readable use description --- OUT --- r_obj_actual_id integer - id of this actual report definition --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_report_actual_definition(IN p_obj_definition_id integer, p_ap_spec_id integer, p_ts TIMESTAMP, p_use_desc varchar, INOUT r_obj_actual_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_definition_id, p_use_desc, r_obj_actual_id); - INSERT INTO report_template_actual_definition(obj_actual_definition_id, ap_spec_id, ts ) VALUES(r_obj_actual_id, p_ap_spec_id, p_ts); -end$$; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_sbr.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_sbr.sql deleted file mode 100644 index d01cb7b..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_sbr.sql +++ /dev/null @@ -1,81 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- STORED PROCEDURE(S) for adding updating and deleting time base rule defintions and instances - --- ================= --- for adding state based rules into the database --- SP__insert_sbr_actual_definition --- IN --- p_obj_id integer - metadata id of this SBR --- p_use_desc varchar- human readable description --- p_expr_id integer, - id of the expresion for this rule --- p_ac_id integer, - id of the ari collection that defines the action of this rule --- p_start_time time - whem this rule starts --- OUT --- r_definition_id integer - id of the start --- ==================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_sbr_actual_definition(IN p_obj_id integer, p_use_desc varchar, p_expr_id integer, p_ac_id integer, p_start_time time , INOUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO sbr_actual_definition(obj_actual_definition_id, expression_id, run_count, start_time, ac_id) VALUES(r_definition_id, p_expr_id, p_run_count, p_start_time, p_ac_id); -end$$; - - - --- ================================================================== --- SP__delete_sbr_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the sbr to delete --- p_obj_name varchar - name of the sbr to delete -- --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__delete_sbr_actual_definition(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ -<> -DECLARE -exp_id int; -ac_id int; -BEGIN - IF( p_obj_id is Null AND p_obj_name is not NULL) THEN - select obj_id FROM obj_metadata WHERE obj_name = p_obj_name into p_obj_id; - ELSE - EXIT sbr_def_del; - END IF; - - IF(p_obj_name is NULL) THEN - select obj_name from vw_sbr_formal where obj_id = p_obj_id into p_obj_name; - END IF ; - - exp_id = (SELECT expression_id FROM vw_sbr_actual where obj_actual_definition = p_obj_id); - ac_id = (SELECT ac_id FROM vw_sbr_actual where obj_actual_definition = p_obj_id); - - DELETE FROM ari_collection WHERE ac_id = ac_id; - DELETE FROM expression WHERE expression_id = exp_id; - - CALL SP__delete_obj_atual_defintion(p_obj_id, p_obj_name); -end$$; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_string_parsing.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_string_parsing.sql deleted file mode 100644 index 6e4752f..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_string_parsing.sql +++ /dev/null @@ -1,79 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- STORED PROCEDURE(S) - - --- == --- function for string processing used by other sp --- help make inserting large sets of data more user friendly --- == - - -CREATE OR REPLACE PROCEDURE SP__get_delimiter_position(IN p_str varchar, p_delimiter varchar, p_start_position integer, INOUT r_found_position integer) -LANGUAGE plpgsql -AS $$ -DECLARE -length int; -position_index int; -iterator_index int; -char_value varchar; -delimiter_found BOOLEAN; -BEGIN - IF (p_str IS NOT NULL) && (p_start_position IS NOT NULL)THEN - BEGIN - length := CHAR_LENGTH(p_str); - position_index := p_start_position; - iterator_index := p_start_position; - char_value := ''; - delimiter_found := FALSE; - r_found_position := NULL; - WHILE (position_index != length) && (delimiter_found != TRUE) loop - - char_value := SUBSTRING(p_str, iterator_index, 1); - IF char_value LIKE p_delimiter THEN - position_index := iterator_index; - r_found_position := position_index; - delimiter_found := TRUE; - END IF; - iterator_index := iterator_index + 1; - - END LOOP; - END; - ELSE - BEGIN - r_found_position := NULL; - END; - END IF; -end$$; - - - - -CREATE OR REPLACE PROCEDURE SP__null_string_check(INOUT p_string varchar) -LANGUAGE plpgsql -AS $$ BEGIN - IF (p_string LIKE 'null') || (p_string LIKE 'NULL') || (p_string LIKE 'Null') THEN BEGIN - p_string := NULL; - END; - END IF; -end$$; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_table.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_table.sql deleted file mode 100644 index bd99daf..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_table.sql +++ /dev/null @@ -1,88 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - - --- STORED PROCEDURE(S) for adding deleting and updating Table template defintions and instances - - --- ================================================================== --- SP__insert_table_template_actual_definition --- IN --- p_obj_id integer - obj_metadata id --- p_use_desc varchar - human readble use desc --- p_num_columns integer - number of columns in the table --- p_column_names_list varchar(10000) - list of column names --- p_column_types_list varchar(10000) - list of column type --- OUT --- r_definition_id integer - id of the the new table --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_table_template_actual_definition(IN p_obj_id integer, p_use_desc varchar, p_columns_id integer, INOUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO table_template_actual_definition(obj_actual_definition_id, tnvc_id) VALUES(r_definition_id, p_columns_id); -end$$; - - --- ================================================================== --- SP__insert_table_template_actual_definition --- IN --- p_obj_id integer - id of the table to delete --- p_obj_name varchar -- name of the object to delete --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__delete_table_template_actual_definition(IN p_obj_id integer) -LANGUAGE plpgsql -AS $$ -DECLARE -tnvc_id integer; -BEGIN - IF p_obj_id != NULL then BEGIN - tnvc_id = (select tnvc_id from table_template_actual_definition where obj_actual_definition_id = p_obj_id); - END; - ELSE BEGIN - tnvc_id := - (select tnvc_id from table_template_actual_definition where obj_atual_definition_id = - (select obj_actual_definition_id from obj_actual_definition where obj_metadata_id = - (select obj_metadata_id from obj_metadata where obj_name = p_obj_name))); - END; - END IF; - CALL SP__delete_tnvc(tnvc_id); - CALL SP__delete_obj_actual_definition(p_obj_id, null); - -end$$; - - - - --- --- --- -- table_definition_id, use_desc, --- CREATE OR REPLACE PROCEDURE SP__insert_table_instance(IN p_obj_definition_id integer, p_use_desc varchar, p_row_values_list varchar(10000), INOUT r_instance_id integer) - --- --- -- have to visit how to store multiple rows is is just one long value collection splitting at every num_colmns? --- CALL SP__insert_obj_instance(p_obj_definition_id, p_use_desc, r_instance_id); --- @n_rows = (select num_entries from type_name_value_collection where tnvc_id =(select columns_list from table_template_definition where definition_id = p_obj_definition_id)); --- CALL SP__insert_tnv_collection(@num_rows, null, null, p_row_values_list , @tnvc_id); --- INSERT INTO table_instance(instance_id, ap_spec_id) VALUES(r_instance_id, p_ap_spec_id); --- end$$; --- \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_tbr.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_tbr.sql deleted file mode 100644 index 9d3e33e..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_tbr.sql +++ /dev/null @@ -1,82 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- STORED PROCEDURE(S) for adding updating and deleting time base rule defintions and instances --- need type checking for actions, they need to be Macros or controls - - --- =============================================================== --- SP__insert_tbr_actual_definition --- IN --- p_obj_id integer - metadata id --- p_use_desc varchar - human readable descriptionb --- p_wait_per time - how long to wait before starting --- p_run_count bigint - number of times to run --- p_start_time time - when to start --- p_ac_id integer - ac of the actions for this rules --- OUT --- r_definition_id integer - id of this tbr --- =============================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_tbr_actual_definition(IN p_obj_id integer, p_use_desc varchar, -p_wait_per time, p_run_count bigint, p_start_time time, p_ac_id integer, INOUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO tbr_actual_definition(obj_actual_definition_id, wait_period, run_count, start_time, ac_id) VALUES(r_definition_id, p_wait_per, p_run_count, p_start_time, p_ac_id); -end$$; - - - - --- ================================================================== --- SP__delete_tbr_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the tbr to delete --- p_obj_name varchar - name of the tbr to delete -- --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__delete_tbr_actual_definition(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ -<> -DECLARE ac_id int; -BEGIN - IF( p_obj_id is Null AND p_obj_name is not NULL) THEN - select obj_id FROM obj_metadata WHERE obj_name = p_obj_name into p_obj_id; - ELSE - EXIT tbr_def_del; - END IF; - - IF(p_obj_name is NULL) THEN - select obj_name from vw_tbr_formal where obj_id = p_obj_id into p_obj_name; - END IF ; - - - ac_id = (SELECT ac_id FROM vw_tbr_actual where obj_actual_definition = p_obj_id); - - DELETE FROM ari_collection WHERE ac_id = ac_id; - - CALL SP__delete_obj_atual_defintion(p_obj_id, p_obj_name); -end$$; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_tnvc.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_tnvc.sql deleted file mode 100644 index 7b1e6db..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_tnvc.sql +++ /dev/null @@ -1,385 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- STORED PROCEDURE(S) for inserting type name value collections into db - - --- ================================================================== --- SP__insert_tnvc --- inserts a new tnv collection definition into the db --- IN --- p_num_entries integer - number of entries in the collection --- p_use_desc varchar - human readble description for the collection --- OUT --- r_tnvc_id integer - id of the collection --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_collection(IN p_use_desc varchar, INOUT r_tnvc_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - INSERT INTO type_name_value_collection(use_desc) VALUES(p_use_desc) RETURNING tnvc_id INTO r_tnvc_id; -end$$; - - --- ================================================================== --- sp for inserting a single entry into a tnvc --- SP__insert_tnvc_entry --- IN --- p_tnvc_id integer - id of tnvc this entry belongs to --- p_order_num integer - order number of this entry --- p_data_type_name varchar - data type name --- p_data_name varchar - name of the tnvc --- p_definition_id integer - definition of the object could be literal --- OUT --- r_tnvc_entry_id integer - id of this entrty --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_entry(IN p_tnvc_id integer, p_order_num integer, p_data_type_name varchar, p_data_name varchar, INOUT r_tnvc_entry_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - - IF p_order_num IS NULL THEN - SELECT order_num+1 INTO p_order_num FROM type_name_value_entry WHERE tnvc_id=p_tnvc_id ORDER BY order_num DESC LIMIT 1; - END IF; - IF p_order_num IS NULL THEN - p_order_num = 0; - END IF; - - - INSERT INTO type_name_value_entry -(tnvc_id, -order_num, -data_type_id, -data_name) -VALUES -(p_tnvc_id, -p_order_num, -(SELECT data_type_id FROM data_type WHERE type_name = UPPER(p_data_type_name)), -p_data_name) RETURNING tnv_id INTO r_tnvc_entry_id; - -end$$; - - - - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_entry_id(IN p_tnvc_id integer, p_order_num integer, p_data_type_id integer, p_data_name varchar, INOUT r_tnvc_entry_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - - IF p_order_num IS NULL THEN - SELECT order_num+1 INTO p_order_num FROM type_name_value_entry WHERE tnvc_id=p_tnvc_id ORDER BY order_num DESC LIMIT 1; - END IF; - IF p_order_num IS NULL THEN - p_order_num = 0; - END IF; - - -INSERT INTO type_name_value_entry -(tnvc_id, -order_num, -data_type_id, -data_name) -VALUES -(p_tnvc_id, -p_order_num, -p_data_type_id, -p_data_name) RETURNING tnv_id INTO r_tnvc_entry_id; - -end$$; - - --- ================================================================== --- SP__insert_tnvc_obj_entry --- insert a new tnvc entry that is an ADM object --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value integer - id for this actual object --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_obj_entry(IN p_tnvc_id integer, - p_order_num integer, - p_data_type varchar, - p_entry_value integer, - INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry(p_tnvc_id, p_order_num, p_data_type, NULL, r_tnvc_entry_id); - INSERT INTO type_name_value_obj_entry (tnv_id, obj_actual_definition_id) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - - - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_ac_entry(IN p_tnvc_id integer, - p_order_num integer, - p_data_name varchar, - p_entry_value integer, - INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 37, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_ac_entry (tnv_id, ac_id) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_tnvc_entry(IN p_tnvc_id integer, - p_order_num integer, - p_data_name varchar, - p_entry_value integer, - INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 35, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_tnvc_entry (tnv_id, tnvc_id) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - - --- ================================================================== --- SP__insert_tnvc_ari_entry --- insert a new tnvc entry that is an ADM object --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value integer - id for this actual object --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_ari_entry(IN p_tnvc_id integer, - p_order_num integer, - p_data_name varchar, - p_entry_value integer, - INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry(p_tnvc_id, p_order_num, 'ari', p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_obj_entry (tnv_id, obj_actual_definition_id) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_unk_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_unk_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry(p_tnvc_id, p_order_num, 'unk', p_data_name, r_tnvc_entry_id); -end$$; - - - --- ================================================================== --- SP__insert_tnvc_int_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value int- value for this int_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_int_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value int, INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 19, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_int_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_uint_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value integer - value for this uint_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_uint_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value integer , INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 20, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_uint_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_vast_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value bigint - value for this vast_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_vast_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value bigint , INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 21, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_vast_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_uvast_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value bigint - value for this uvast_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_uvast_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value bigint , INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 22, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_uvast_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_tv_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value bigint - value for this uvast_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_tv_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value bigint , INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 32, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_uvast_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_uvast_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value bigint - value for this uvast_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_ts_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value bigint , INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 33, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_uvast_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_real32_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value float- value for this real32_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_real32_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value float, INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 23, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_real32_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_real64_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value double- value for this real64_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_real64_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value double precision, INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 24, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_real64_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_str_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value varchar- value for this string_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_str_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value varchar, INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 18, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_string_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_bool_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value bool- value for this bool_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_bool_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value bool, INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 16, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_bool_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_byte_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value smallint- value for this byte_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_byte_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value smallint, INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 17, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_byte_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - - --- STORED PROCEDURE(S) for creating an ari collection and entries - --- ================================================================== --- SP__insert_ac_id --- adds an ari collection to the database --- Parameters: --- in --- p_num_entries integer - number of entries in the ac --- p_use_desc varchar - human readable description --- OUT --- r_ac_id integer- id of the ac --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_ac_id(IN p_num_entries integer, p_use_desc varchar, INOUT r_ac_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - INSERT INTO ari_collection(num_entries, use_desc) VALUES(p_num_entries, p_use_desc) RETURNING ac_id INTO r_ac_id; -end$$; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_var.sql b/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_var.sql deleted file mode 100644 index 3a19d98..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/amp_core_routines_var.sql +++ /dev/null @@ -1,72 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- STORED PROCEDURE(S) for adding updating and removing variables - --- ================================================================== --- SP__insert_variable_definition --- inserting a new variable --- IN --- p_obj_id integer - metadata id of the variable --- p_use_desc varchar - human readable description --- p_out_type integer - out type of the variable --- p_num_operators integer - number of operators --- p_operator_ids_list varchar - --- OUT --- r_definition_id integer - definition id of the variable --- --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_variable_definition(IN p_obj_id integer, p_use_desc varchar, -p_out_type integer, p_expression_id integer, INOUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ -DECLARE -r_expr_id int; -BEGIN - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - -- call expresion builder for var Initializer - CALL SP__insert_expression(p_out_type, p_expression_id, r_expr_id); - INSERT INTO variable_actual_definition(obj_actual_definition_id, data_type_id, expression_id) VALUES(r_definition_id, p_out_type, r_expr_id); - -end$$; - - - --- ================================================================== --- SP__delete_var_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the var to delete --- p_obj_name varchar - name of the var to delete -- --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__delete_variable_definition(IN p_definition_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ -DECLARE -exp_id int; - BEGIN - -- delete the expresion first - exp_id = (SELECT expression_id from variable_actual_definition where p_definition_id = obj_actual_definition); - CALL SP__delete_expression(exp_id); - CALL SP__delete_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - -end$$; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Routines/delete_test.sql b/amp-sql/postgres/Database_Scripts/Routines/delete_test.sql deleted file mode 100644 index 0f53253..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/delete_test.sql +++ /dev/null @@ -1,2586 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- STORED PROCEDURE(S) for creating an ari collection and entries - --- ================================================================== --- SP__insert_ac_id --- adds an ari collection to the database --- Parameters: --- in --- p_num_entries integer - number of entries in the ac --- p_use_desc varchar - human readable description --- OUT --- r_ac_id integer- id of the ac --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_ac_id(IN p_num_entries integer, p_use_desc varchar, OUT r_ac_id integer) -LANGUAGE SQL -AS $$ - INSERT INTO amp_core.ari_collection(num_entries, use_desc) VALUES(p_num_entries, p_use_desc); - SET r_ac_id = LAST_INSERT_ID(); -$$; - - - --- ================================================================== --- SP__insert_ac_formal_entry --- adds a formal ari entry into the database. --- stops if the order_num is > the number of entries for the target ac --- Parameters: --- in --- p_ac_id integer - id of the ari collection this entry belongs to --- p_definition_id integer - id of the definition --- p_order_num integer - order number --- OUT --- r_ac_entry_id integer - entry id --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_ac_formal_entry(IN p_ac_id integer, p_definition_id integer, p_order_num integer, OUT r_ac_entry_id integer) -LANGUAGE SQL -AS $$ - /*IF p_order_num < (select num_entries from ari_collection where ari_collection.ac_id = p_definition_id) THEN - LANGUAGE SQL -AS $$*/ - INSERT INTO amp_core.ari_collection_entry(ac_id, order_num) VALUES(p_ac_id, p_order_num); - SET r_ac_entry_id = LAST_INSERT_ID(); - INSERT INTO amp_core.ari_collection_formal_entry(ac_entry_id, obj_formal_definition_id) VALUES(r_ac_entry_id, p_definition_id); - /*END; - END IF;*/ -$$; - - - --- ================================================================== --- SP__insert_ac_actual_entry --- adds a actual ari entry into the database. --- stops if the order_num is > the number of entries for the target ac --- Parameters: --- in --- p_ac_id integer - id of the ari collection this entry belongs to --- p_definition_id integer - id of the definition --- p_order_num integer - order number --- OUT --- r_ac_entry_id integer - entry id --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_ac_actual_entry(IN p_ac_id integer, p_definition_id integer, p_order_num integer, -OUT r_ac_entry_id integer) -LANGUAGE SQL -AS $$ - -- IF p_order_num < (select num_entries from ari_collection where ari_collection.ac_id = p_definition_id) THEN - -- LANGUAGE SQL -AS $$ - INSERT INTO amp_core.ari_collection_entry(ac_id, order_num) VALUES(p_ac_id, p_order_num); - SET r_ac_entry_id = LAST_INSERT_ID(); - INSERT INTO amp_core.ari_collection_actual_entry(ac_entry_id, obj_actual_definition_id) VALUES(r_ac_entry_id, p_definition_id); --- END; - -- END IF; -$$; - - --- DROP PROCEDURE IF EXISTS SP__insert_ari_collection; --- --- CREATE OR REPLACE PROCEDURE SP__insert_ari_collection(IN p_num_entries integer, p_definition_ids_list varchar(10000), p_instance_ids_list varchar(10000), p_use_desc varchar, OUT r_ac_id integer) --- LANGUAGE SQL -AS $$ --- CALL SP__insert_ac_id(p_num_entries, p_use_desc, r_ac_id); --- -- TODO -- verify that lists are same size or NULL prior to processing, backout transaction on failure and return NULL --- SET @ac_id = r_ac_id; --- SET @s = 'INSERT INTO amp_core.ari_collection_entry(ac_id, definition_id, instance_id, order_num) VALUES'; --- --- SET @loops = 1; --- -- -- SET @def_id = NULL; --- -- -- SET @inst_id = NULL; --- WHILE @loops < p_num_entries DO --- LANGUAGE SQL -AS $$ --- -- @def_id --- IF p_definition_ids_list IS NOT NULL THEN --- LANGUAGE SQL -AS $$ --- SET @def_id = TRIM(SUBSTRING_INDEX(p_definition_ids_list, ',', 1)); --- SET p_definition_ids_list = REPLACE(p_definition_ids_list, CONCAT(@def_id, ','), ''); --- -- IF strcmp(@def_id, 'NULL') THEN --- -- SET @def_id = NULL; --- -- ELSE --- SET @def_id = CAST(@def_id AS UNSIGNED); --- -- END IF; --- END; --- ELSE --- LANGUAGE SQL -AS $$ --- SET @def_id = 'NULL'; --- END; --- END IF; --- --- -- @inst_id --- IF p_instance_ids_list IS NOT NULL THEN --- LANGUAGE SQL -AS $$ --- SET @inst_id = TRIM(SUBSTRING_INDEX(p_instance_ids_list, ',', 1)); --- SET p_instance_ids_list = REPLACE(p_instance_ids_list, CONCAT(@inst_id, ','), ''); --- -- IF strcmp(@inst_id, 'NULL') THEN --- -- SET @inst_id = NULL; --- -- ELSE --- SET @inst_id = CAST(@inst_id AS UNSIGNED); --- -- END IF; --- END; --- ELSE --- LANGUAGE SQL -AS $$ --- SET @inst_id = 'NULL'; --- END; --- END IF; --- --- SET @s = CONCAT(@s, '(', @ac_id, ',', @def_id , ',', @inst_id, ',', @loops, '),'); --- -- SELECT @s; --- SET @loops = @loops + 1; --- END; --- END WHILE; --- --- -- @def_id --- IF p_definition_ids_list IS NOT NULL THEN --- LANGUAGE SQL -AS $$ --- SET @def_id = TRIM(SUBSTRING_INDEX(p_definition_ids_list, ',', 1)); --- SET p_definition_ids_list = REPLACE(p_definition_ids_list, CONCAT(@def_id, ','), ''); --- -- IF strcmp(@def_id, 'NULL') THEN --- -- SET @def_id = NULL; --- -- ELSE --- SET @def_id = CAST(@def_id AS UNSIGNED); --- -- END IF; --- END; --- ELSE --- LANGUAGE SQL -AS $$ --- SET @def_id = 'NULL'; --- END; --- END IF; --- --- -- @inst_id --- IF p_instance_ids_list IS NOT NULL THEN --- LANGUAGE SQL -AS $$ --- SET @inst_id = TRIM(SUBSTRING_INDEX(p_instance_ids_list, ',', 1)); --- SET p_instance_ids_list = REPLACE(p_instance_ids_list, CONCAT(@inst_id, ','), ''); --- -- IF strcmp(@inst_id, 'NULL') THEN --- -- SET @inst_id = NULL; --- -- ELSE --- SET @inst_id = CAST(@inst_id AS UNSIGNED); --- -- END IF; --- END; --- ELSE --- LANGUAGE SQL -AS $$ --- SET @inst_id = 'NULL'; --- END; --- END IF; --- --- SET @s = CONCAT(@s, '(', @ac_id, ',', @def_id, ',', @inst_id, ',', @loops, ')'); --- -- SELECT @s; --- PREPARE stmt FROM @s; --- EXECUTE stmt; --- $$; - - - -USE amp_core; - --- STORED PROCEDURE(S) for the actaul parameters specefications and actual parameter sets. has real data - - --- ================================================================== --- SP__insert_actual_parmspec --- inserting an actual parmspec into db --- IN --- p_fp_spec_id integer - the id of the formal parm spec for this actual parmspec --- p_tnvc_id integer - TNVC corresponding to actual parameter definition --- p_use_desc varchar - human readable describtion --- OUT --- r_ap_spec_id integer - id of the parmspec in the db --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_actual_parmspec_tnvc(IN p_fp_spec_id integer, p_tnvc_id integer, p_use_desc varchar, OUT r_ap_spec_id integer) -LANGUAGE SQL -AS $$ - INSERT INTO amp_core.actual_parmspec(fp_spec_id, tnvc_id, use_desc) VALUES(p_fp_spec_id, p_tnvc_id, p_use_desc); - SET r_ap_spec_id = LAST_INSERT_ID(); -$$; - - --- ================================================================== --- SP__insert_actual_parmspec --- inserting an actual parmspec into db --- IN --- p_fp_spec_id integer - the id of the formal parm spec for this actual parmspec --- p_num_parms integer - number of parms --- p_use_desc varchar - human readable describtion --- OUT --- r_ap_spec_id integer - id of the parmspec in the db --- ================================================================== --- TODO: p_num_parms argument is deprecated and will be removed - - -CREATE OR REPLACE PROCEDURE SP__insert_actual_parmspec(IN p_fp_spec_id integer, p_num_parms integer, p_use_desc varchar, OUT r_ap_spec_id integer) -LANGUAGE SQL -AS $$ - DECLARE tnvc_id INT; - CALL SP__insert_tnvc_collection(p_use_desc, tnvc_id); - CALL SP__insert_actual_parmspec_tnvc(p_fp_spec_id, tnvc_id, p_use_desc, r_ap_spec_id); -$$; - - --- ================================================================== --- SP__insert_actual_parms_object --- inserting an actual parm object into spec --- IN --- p_ap_spec_id integer - id of the spec this object is being added --- p_order_num integer - order number --- p_data_type_id integer - the id of the datatype in the data type table --- p_obj_actual_definition integer - id of the object for the parm --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_actual_parms_object(IN p_ap_spec_id INT unsigned, p_order_num integer, p_data_type_id varchar , p_obj_actual_definition INT UNSIGNED) -LANGUAGE SQL -AS $$ - DECLARE ap_tnvc_id, r_tnvc_entry_id INT; - SELECT tnvc_id INTO ap_tnvc_id FROM amp_core.actual_parmspec WHERE ap_spec_id = p_ap_spec_id; - - - CALL SP__insert_tnvc_obj_entry(ap_tnvc_id, p_order_num, p_data_type_id, p_obj_actual_definition, r_tnvc_entry_id); - - - -$$; - - --- ================================================================== --- SP__insert_actual_parms_names --- inserting an actual parm reference by name into spec. This parm gets it value from the object that defines this parm spec --- IN --- p_ap_spec_id integer - id of the spec this object is being added --- p_order_num integer - order number --- p_data_type_id integer - the id of the datatype in the data type table --- p_fp_id integer - id of the formal parm this parm reference --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_actual_parms_names(IN p_ap_spec_id INT(10) unsigned, p_order_num integer, p_data_type_id varchar, p_fp_id INT(10) UNSIGNED) -LANGUAGE SQL -AS $$ - DECLARE ap_tnvc_id INT; - DECLARE dt_id INT; - - SELECT tnvc_id INTO ap_tnvc_id FROM amp_core.actual_parmspec WHERE ap_spec_id = p_ap_spec_id; - - SELECT data_type_id INTO dt_id FROM data_type WHERE type_name = p_data_type_id; - - INSERT INTO type_name_value_entry(tnvc_id, order_num, data_type_id, data_name, fp_id) VALUES(ap_tnvc_id, p_order_num, dt_id, p_data_Type_id, p_fp_id); - - - -$$; - - --- ================================================================== --- SP__insert_actual_parms_tnvc --- inserting an actual parm tnvc into spec. --- IN --- p_ap_spec_id integer - id of the spec this object is being added --- p_order_num integer - order number --- p_data_type_id integer - the id of the datatype in the data type table --- p_tnvc_id integer - id of the type name value collection --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_actual_parms_tnvc(IN p_ap_spec_id INT(10) unsigned, p_order_num integer, p_tnvc_id INT(10) UNSIGNED) -LANGUAGE SQL -AS $$ - DECLARE ap_tnvc_id, r_entry_id INT; - SELECT tnvc_id INTO ap_tnvc_id FROM amp_core.actual_parmspec WHERE ap_spec_id = p_ap_spec_id; - - CALL SP__insert_tnvc_tnvc_entry(ap_tnvc_id, p_order_num, p_tnvc_id, r_entry_id); -$$; - - --- ================================================================== --- SP__insert_actual_parms_ac --- inserting an actual parm ac into spec. --- IN --- p_ap_spec_id integer - id of the spec this object is being added --- p_order_num integer - order number --- p_data_type_id integer - the id of the datatype in the data type table --- p_ac_id integer - id of the ari collection --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_actual_parms_ac(IN p_ap_spec_id INT(10) unsigned, p_order_num integer, p_ac_id INT(10) UNSIGNED) -LANGUAGE SQL -AS $$ - DECLARE ap_tnvc_id, r_entry_id INT; - SELECT ap_tnvc_id=tnvc_id FROM amp_core.actual_parmspec WHERE ap_spec_id = p_ap_spec_id; - - CALL SP__insert_tnvc_ac_entry(ap_tnvc_id, p_order_num, p_ac_id, r_entry_id); - -$$; - - - - --- was used before one there wasnt two types of actual_parms so it was easy to parse a --- a list of parms --- --- --- --- CREATE OR REPLACE PROCEDURE SP__insert_actual_parms_set(IN p_num_parms integer, p_fp_spec_id integer, p_data_types_list varchar(10000), p_data_values_list varchar(10000), OUT r_ap_spec_id integer) --- LANGUAGE SQL -AS $$ --- CALL SP__insert_actual_parmspec(p_fp_spec_id, r_ap_spec_id); --- SET @ap_spec_id = r_ap_spec_id; --- SET @s = 'INSERT INTO amp_core.actual_parm(order_num, ap_type, data_value, ap_spec_id) VALUES'; --- SET @loops = 1; --- WHILE @loops < p_num_parms DO --- LANGUAGE SQL -AS $$ --- -- @data_type --- SET @data_type = TRIM(SUBSTRING_INDEX(p_data_types_list, ',', 1)); --- SET p_data_types_list = REPLACE(p_data_types_list, CONCAT(@data_type, ','), ''); --- --- -- @data_value --- SET @data_value = TRIM(SUBSTRING_INDEX(p_data_values_list, ',', 1)); --- SET p_data_values_list = REPLACE(p_data_values_list, CONCAT(@data_value, ','), ''); --- --- SET @s = CONCAT(@s, '(', @loops, ',', (SELECT data_type_id FROM amp_core.data_type WHERE type_name = @data_type), ',', '"', @data_value, '"', ',', @ap_spec_id, '),'); --- SET @loops = @loops + 1; --- END; --- END WHILE; --- --- -- @data_type --- SET @data_type = TRIM((SUBSTRING_INDEX(p_data_types_list, ',', 1))); --- --- --- -- @data_value --- SET @data_value = TRIM(SUBSTRING_INDEX(p_data_values_list, ',', 1)); - --- SET @s = CONCAT(@s, '(', @loops, ',', (SELECT data_type_id FROM amp_core.data_type WHERE type_name = @data_type), ',', '"', @data_value, '"', ',', @ap_spec_id, ')'); --- PREPARE stmt FROM @s; --- EXECUTE stmt; - --- $$; --- - -use amp_core; - --- inserting reg agents into the db - --- ================================================================== --- SP__insert_agent --- inserting a new agent into the systemß --- IN --- p_agent_id_string- name of the agent to insert --- OUT --- r_registered_agents_id - teh id of the agent in the db --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_agent(IN p_agent_id_string varchar, OUT r_registered_agents_id INT unsigned) -LANGUAGE SQL -AS $$ - SET @cur_time = NOW(); - SET @lower_name = LOWER(p_agent_id_string); - SET @eid = NULL; - SELECT registered_agents_id INTO @eid FROM registered_agents WHERE @lower_name = agent_id_string; - - IF (@eid IS NOT NULL) THEN - LANGUAGE SQL -AS $$ - UPDATE registered_agents SET last_registered = @cur_time WHERE registered_agents_id=@eid; - SET r_registered_agents_id = @eid; - END; - ELSE LANGUAGE SQL -AS $$ - INSERT INTO registered_agents (agent_id_string,first_registered, last_registered) - VALUES (@lower_name, @cur_time, @cur_time); - SET r_registered_agents_id = LAST_INSERT_ID(); - END; - END IF; -$$; - - - --- ================================================================== --- Author: David Linko --- --- Description: inserting, updating and removing constant formal and actual definitions --- using the obj routines --- --- ================================================================== - -USE amp_core; - - --- ================================================================== --- SP__insert_const_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the constant --- p_data_type varchar - name of the data type for the constant --- p_data_value_string varchar - blob conating the encoded value of the constant --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_const_actual_definition(IN p_obj_id integer, p_use_desc varchar, p_data_type varchar, p_data_value_string varchar, OUT r_actual_definition_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_actual_definition_id); - Set @data_id = (SELECT data_type_id FROM amp_core.data_type WHERE type_name = p_data_type); - INSERT INTO amp_core.const_actual_definition(obj_actual_definition_id, data_type_id, data_value) VALUES(r_actual_definition_id, @data_id, p_data_value_string); -$$; - - - --- ================================================================== --- SP__delete_const_actual_definition --- cna us either hte name or the id of the constant to delete --- Parameters: --- in --- p_obj_id integer - id of the constan to delete --- p_obj_name varchar - name of the constant to delete --- ================================================================== -DROP PROCEDURE IF EXiSTS SP__delete_const_actual_definition; - -CREATE OR REPLACE PROCEDURE SP__delete_const_actual_definition(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE SQL -AS $$ - IF (p_obj_id != null) THEN - SET @metadata_id = (SELECT obj_metadata_id FROM obj_actual_definition WHERE obj_actual_definition_id = p_obj_id ); - ELSE - IF (p_obj_name != NULL) THEN - SET @metadata_id = (SELECT obj_metadata_id FROM obj_metadata WHERE obj_name = p_obj_name); - END IF; - END IF; - CALL SP__delete_obj_metadata(@metadata_id); - -END// - - --- ================================================================== --- Author: David Linko --- --- Description: inserting, updating and removing control formal and actual definitions --- using the obj routines --- --- ================================================================== - -USE amp_core; - - - --- ================================================================== --- SP__insert_control_formal_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the constant --- p_data_type varchar - name of the data type for the constant --- p_data_value_string varchar - blob conating the encoded value of the constant --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_control_formal_definition(IN p_obj_id integer, p_use_desc varchar, p_fp_spec_id integer, OUT r_definition_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_obj_formal_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO amp_core.control_formal_definition(obj_formal_definition_id, fp_spec_id) VALUES(r_definition_id, p_fp_spec_id); -$$; - - --- ================================================================== --- SP__delete_control_formal_definition; --- Parameters: --- in --- p_obj_id - id of the control to delete --- p_obj_name - name of the control to delete --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__delete_control_formal_definition(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE SQL -AS $$ - CALL SP__delete_obj_formal_definition(p_obj_id, p_obj_name); -$$; - - - --- ================================================================== --- SP__insert_control_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the constant --- p_data_type varchar - name of the data type for the constant --- p_data_value_string varchar - blob conating the encoded value of the constant --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_control_actual_definition(IN p_obj_definition_id integer, p_ap_spec_id integer, p_use_desc varchar, OUT r_instance_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_obj_actual_definition(p_obj_definition_id, p_use_desc, r_instance_id); - - -- TODO: Skip insert if it has no parameters - INSERT INTO amp_core.control_actual_definition(obj_actual_definition_id, ap_spec_id) VALUES(r_instance_id, p_ap_spec_id); -$$; - - - --- ================================================================== --- SP__delete_control_actual_definition; --- Parameters: --- in --- p_obj_id integer - actual_definiton id of the control that is to be deleted --- p_obj_name varchar- name of the control to delete, this allows to delete all the actual definitons --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__delete_control_actual_definition(IN p_obj_id integer, p_obj_name varchar) -ctrl_actual_definition_del:LANGUAGE SQL -AS $$ - - DECLARE done INT DEFAULT FALSE; - DECLARE actual_definition_id_hold, ap_spec_id_hold integer; - DECLARE actual_definition_cursor CURSOR - FOR SELECT actual_definition_id, ap_spec_id FROM vw_ctrl_actual_definition WHERE obj_name = p_obj_name; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - -- only one thing to remove - If( p_inst_id is not null) then - SET @ap_id = (SELECT ap_spec_id from ctrl_actual_definition where actual_definition_id = p_inst_id ); - IF( @ap_id is not null) THEN - DELETE FROM actual_parmspec WHERE ap_spec_id = @ap_id; - END IF; - DELETE FROM ctrl_actual_definition -WHERE - intance_id = p_actual_definition_id; - CALL SP__delete_obj_actual_definition(p_actual_definition_id, p_obj_name); - ELSE -- removing all instances with this name - IF( p_obj_name is null) then -- nothing to do - leave ctrl_actual_definition_del; - END IF; - OPEN actual_definition_cursor; - read_loop: LOOP - FETCH NEXT FROM actual_definition_cursor INTO - actual_definition_id_hold, ap_spec_id_hold; - IF done THEN - LEAVE read_loop; - END IF; - - DELETE FROM actual_parmspec WHERE ap_spec_id = ap_spec_id_hold; - - DELETE FROM ctrl_actual_definition -WHERE - amp_core.ctrl_actual_definition.actual_definition_id = actual_definition_id_hold; - END LOOP; - CALL SP__delete_obj_actual_definition(null, p_obj_name); - end if; - CLOSE actual_definition_cursor; -END // - - -USE amp_core; - --- STORED PROCEDURE(S) - --- --- --- CREATE OR REPLACE PROCEDURE SP__insert_data_value(IN p_value_converted varchar, p_value_string varchar, OUT r_value_id integer) --- LANGUAGE SQL -AS $$ --- INSERT INTO amp_core.data_value(value_converted, value_string) VALUES(p_value_converted, p_value_string); --- SET r_value_id = LAST_INSERT_ID(); --- $$; --- - --- ================================================================== --- Author: David Linko --- --- Description: inserting, updating and removing EDD formal and actual definitions --- using the obj routines --- --- ================================================================== - -USE amp_core; - - --- ================================================================== --- SP__insert_edd_formal_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the edd --- p_data_type varchar - name of the data type for the edd --- p_data_value_string varchar - blob conating the encoded value of the edd --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_edd_formal_definition(IN p_obj_id integer, p_use_desc varchar, p_fp_spec_id integer, p_external_data_type varchar, OUT r_formal_definition_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_obj_formal_definition(p_obj_id, p_use_desc, r_formal_definition_id); - INSERT INTO amp_core.edd_formal_definition(obj_formal_definition_id, fp_spec_id, data_type_id) VALUES(r_formal_definition_id, p_fp_spec_id, (SELECT data_type_id FROM amp_core.data_type WHERE type_name = p_external_data_type)); -$$; - - - - --- ================================================================== --- SP__delete_edd_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the edd to delete --- p_obj_name varchar - name of the edd to delete --- --- ================================================================== -DROP PROCEDURE IF EXISTS SP__delete_edd_formal_defintion; - -CREATE OR REPLACE PROCEDURE SP__delete_edd_formal_defintion(IN p_obj_id integer, p_obj_name varchar) -edd_def_del:LANGUAGE SQL -AS $$ - IF( p_obj_id is Null AND p_obj_name is not NULL) THEN - SET p_obj_id = (select obj_id FROM amp_core.obj_metadata WHERE obj_name = p_obj_name); - ELSE - LEAVE edd_def_del; - END IF; - - IF(p_obj_name is NULL) THEN - SET p_obj_name = (select obj_name from vw_edd_formal where obj_id = p_obj_id); - END IF ; - - -- deleting all instances - CALL SP__delete_edd_actual_definition(null, p_obj_name); - - SET @def_id = (select obj_formal_definition_id from obj_formal_definition where obj_metadata_id = p_obj_id); - SET @fp_id = (SELECT fp_spec_id from edd_formal_definition where obj_formal_definition_id = @def_id ); - DELETE FROM formal_parmspec WHERE fp_spec_id = @fp_id; - - CALL SP__delete_obj_formal_defintion(p_obj_id, p_obj_name); -$$; - - - --- ================================================================== --- SP__insert_edd_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the constant --- p_data_type varchar - name of the data type for the constant --- p_data_value_string varchar - blob conating the encoded value of the constant --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_edd_actual_definition(IN p_obj_definition_id integer, p_use_desc varchar, p_ap_spec_id integer, OUT r_actual_definition_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_obj_actual_definition(p_obj_definition_id, p_use_desc, r_actual_definition_id); - INSERT INTO amp_core.edd_actual_definition(obj_actual_definition_id, ap_spec_id) VALUES(r_actual_definition_id, p_ap_spec_id); -$$; - - - --- ================================================================== --- SP__delete_edd_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the constant --- p_data_type varchar - name of the data type for the constant --- p_data_value_string varchar - blob conating the encoded value of the constant --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== --- for instance can supply the definiton name to remove all the instances of that definition or can remove -DROP PROCEDURE IF EXISTS SP__delete_edd_actual_definition; - -CREATE OR REPLACE PROCEDURE SP__delete_edd_actual_definition(IN p_actual_definition_id integer, p_obj_name varchar) -edd_actual_definition_del:LANGUAGE SQL -AS $$ - - DECLARE done INT DEFAULT FALSE; - DECLARE actual_definition_id_hold, ap_spec_id_hold integer; - DECLARE actual_definition_cursor CURSOR - FOR SELECT actual_definition_id, ap_spec_id FROM vw_edd_actual WHERE obj_name = p_obj_name; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - -- only one thing to remove - If( p_inst_id is not null) then - SET @ap_id = (SELECT ap_spec_id from edd_actual_definition where actual_definition_id = p_inst_id ); - IF( @ap_id is not null) THEN - DELETE FROM actual_parmspec WHERE ap_spec_id = @ap_id; - END IF; - DELETE FROM edd_actual_definition -WHERE - intance_id = p_actual_definition_id; - CALL SP__delete_obj_actual_definition(p_actual_definition_id, p_obj_name); - ELSE -- removing all instances with this name - IF( p_obj_name is null) then -- nothing to do - leave edd_actual_definition_del; - END IF; - OPEN actual_definition_cursor; - read_loop: LOOP - FETCH NEXT FROM actual_definition_cursor INTO - actual_definition_id_hold, ap_spec_id_hold; - IF done THEN - LEAVE read_loop; - END IF; - - DELETE FROM actual_parmspec WHERE ap_spec_id = ap_spec_id_hold; - - DELETE FROM edd_actual_definition -WHERE - amp_core.edd_actual_definition.actual_definition_id = actual_definition_id_hold; - END LOOP; - CALL SP__delete_obj_actual_definition(null, p_obj_name); - end if; - CLOSE actual_definition_cursor; -$$; - -USE amp_core; - --- STORED PROCEDURE(S) for creating expresions that are used in rules and variables - --- DROP PROCEDURE IF EXISTS sp_insert_postfix_operations; --- --- CREATE OR REPLACE PROCEDURE sp_insert_postfix_operations(IN p_num_operators integer, p_operator_ids_list varchar(1000), p_operands_values_list varchar(10000), OUT r_postfix_operations integer) --- LANGUAGE SQL -AS $$ -- we get a list of operators and a list of operands need to create an ari collection for both --- -- need to finish --- -- generate an ari collection --- -- add in the airs --- -- call sp_insert_ari_collection(IN p_num_entries integer, p_definition_ids_list varchar(10000), p_instance_ids_list varchar(10000), p_use_desc varchar, OUT r_ac_id integer) --- --- $$; --- - - --- ================================================================== --- SP__insert_expression --- adds an expression to the database --- Parameters: --- in --- p_out_type integer - data type id for the return type of the expression --- p_num_operators integer - number of operators --- p_postfix_ids_list varchar(1000) - id of the ac that lists the equation in postfix notation --- OUT --- r_expr_id integer - id of the expr in the database --- ================================================================= - - -CREATE OR REPLACE PROCEDURE SP__insert_expression(IN p_out_type INT(10) UNSIGNED, -p_postfix_operations INT(10) UNSIGNED, OUT r_expr_id INT(10) UNSIGNED) -LANGUAGE SQL -AS $$ - -- SELECT p_out_type; - -- IF p_out_type = 2 or p_out_type = 12 or p_out_type = 3 or p_out_type = 0 THEN - -- LANGUAGE SQL -AS $$ - INSERT INTO amp_core.expression(data_type_id, ac_id) VALUES(p_out_type, p_postfix_operations); - SET r_expr_id = LAST_INSERT_ID(); - -- END; - -- END IF; -$$; - - - --- ================================================================== --- SP__delete_expression --- Delete an expression from the database --- Parameters: --- in --- p_expr_id integer - id of the expr in the database to delete --- ================================================================== - - - -CREATE OR REPLACE PROCEDURE SP__delete_expression(IN p_expr_id INT(10) UNSIGNED) -LANGUAGE SQL -AS $$ - DELETE from amp_core.expression WHERE (expression_id = p_expr_id); -$$; - -USE amp_core; - --- STORED PROCEDURE(S) for the formal parameters specefications. Stores type name information. - - --- ================================================================== --- SP__insert_formal_parmspec --- inserts a new formal parmspec in the db --- IN --- p_num_parms integer - number if parms in the spec --- p_use_desc varchar - human readable describtion --- OUT --- r_fp_spec_id integer - the id of the spec --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_formal_parmspec(IN p_num_parms integer, p_use_desc varchar, OUT r_fp_spec_id integer) -LANGUAGE SQL -AS $$ - INSERT INTO amp_core.formal_parmspec(num_parms, use_desc) VALUES(p_num_parms, p_use_desc); - SET r_fp_spec_id = LAST_INSERT_ID(); -$$; - - - - --- ================================================================== --- SP__insert_formal_parmspec_entry --- insert a single entry into a formal parm --- IN --- p_fp_spec_id integer - id of the formal parmspec for this entry --- p_order_num integer - order of the entry in the parmspec --- p_parm_name varchar - name of the parm used for parm by name --- p_data_type varchar - data type of the parm --- p_obj_definition_id integer - optional default value of this parm --- OUT --- r_fp_id integer --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_formal_parmspec_entry(IN p_fp_spec_id integer, p_order_num integer, p_parm_name varchar, p_data_type varchar, p_obj_definition_id integer, OUT r_fp_id integer) -LANGUAGE SQL -AS $$ - INSERT INTO formal_parm -( -fp_spec_id, -order_num, -parm_name, -data_type_id, -obj_actual_definition_id) -VALUES -(p_fp_spec_id, -p_order_num, -p_parm_name, -(select data_type_id from data_type where type_name = p_data_type), -p_obj_definition_id); - -SET r_fp_id = LAST_INSERT_ID(); -$$; - - - - --- ================================================================== --- SP__insert_formal_parmspec --- inserts a list of formal parms into a spec, uses three ',' delimenated lists to --- store type name and default value info for the formal parms --- IN --- p_num_parms integer - number of parms in the parmspec --- p_use_desc varchar - human readable description --- p_data_types_list varchar(10000 ) - list of types for the parms --- p_parm_names_list varchar(10000) - list of the names for the parms --- p_default_values_list varchar(10000) - list of the default values --- OUT --- r_fp_spec_id integer - formal parmspec id --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_formal_parms_set(IN p_num_parms integer, p_use_desc varchar, p_data_types_list varchar(10000), p_parm_names_list varchar(10000), - p_default_values_list varchar(10000), OUT r_fp_spec_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_formal_parmspec(p_num_parms, p_use_desc, r_fp_spec_id); - SET @fp_spec_id = r_fp_spec_id; - SET @s = 'INSERT INTO amp_core.formal_parm(fp_spec_id, order_num, parm_name, data_type_id, obj_actual_definition_id) VALUES'; - SET @loops = 1; - WHILE @loops < p_num_parms DO - LANGUAGE SQL -AS $$ - -- @data_type - SET @data_type = TRIM(SUBSTRING_INDEX(p_data_types_list, ',', 1)); - SET p_data_types_list = REPLACE(p_data_types_list, CONCAT(@data_type, ','), ''); - - -- @parm_name - SET @parm_name = TRIM(SUBSTRING_INDEX(p_parm_names_list, ',', 1)); - SET p_parm_names_list = REPLACE(p_parm_names_list, CONCAT(@parm_name, ','), ''); - - -- @default_value - SET @default_value = TRIM(SUBSTRING_INDEX(p_default_values_list, ',', 1)); - IF @default_value = 'NULL' THEN SET @default_value = null; - ELSEIF @default_value = 'null' THEN SET @default_value = null; - END IF; - SET p_default_values_list = REPLACE(p_default_values_list, CONCAT(@default_value, ','), ''); - - SET @s = CONCAT(@s, '(', @fp_spec_id, ',', @loops, ',', '"', @parm_name, '"', ',', (SELECT data_type_id FROM amp_core.data_type WHERE type_name = @data_type), ',', '"', @default_value, '"', '),'); - SET @loops = @loops + 1; - END; - END WHILE; - - -- @data_type - SET @data_type = TRIM((SUBSTRING_INDEX(p_data_types_list, ',', 1))); - - -- @parm_name - SET @parm_name = TRIM(SUBSTRING_INDEX(p_parm_names_list, ',', 1)); - - -- @default_value - IF @default_value = 'NULL' THEN SET @default_value = null; - ELSEIF @default_value = 'null' THEN SET @default_value = null; - END IF; - SET p_default_values_list = REPLACE(p_default_values_list, CONCAT(@default_value, ','), ''); - - SET @s = CONCAT(@s, '(', @fp_spec_id, ',', @loops, ',', (SELECT data_type_id FROM amp_core.data_type WHERE type_name = @data_type), ',', '"', @parm_name, '"', ',', '"', @default_value, '"', ')'); - PREPARE stmt FROM @s; - EXECUTE stmt; - -$$; - - -USE amp_core; - --- STORED PROCEDURE(S) for creating literals --- need to update to allow ot be ari - - --- ================================================================== --- SP__insert_literal_actual_definition --- IN --- p_obj_id integer - id of the metadata info --- p_use_desc varchar - human readable describtion --- p_data_type varchar - primitive data type of the literal --- p_data_value_string varchar - calue of the literal encoded as a string --- OUT --- r_definition_id integer - id of teh literal --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_literal_actual_definition(IN p_obj_id integer, p_use_desc varchar, p_data_type varchar, p_data_value_string varchar, OUT r_definition_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO amp_core.literal_actual_definition(obj_actual_definition_id, data_type_id, data_value) VALUES(r_definition_id, (SELECT data_type_id FROM amp_core.data_type WHERE type_name = p_data_type), p_data_value_string); -$$; - - - --- ================================================================== --- SP__delete_literal_actual_definition --- IN --- p_obj_id integer - id of the lit to be deleted --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__delete_literal_actual_definition(IN p_obj_id integer) -LANGUAGE SQL -AS $$ - CALL SP__delete_obj_definition(p_obj_id); -$$; -USE amp_core; - --- STORED PROCEDURE(S) for creating updating and deleting macro definitions and actuals - --- ================================================================== --- SP__insert_macro_formal_definition --- IN --- p_obj_id integer - id of the metadata info --- p_use_desc varchar - human readable describtion --- p_fp_spec_id integer - formal parmspec of the macro --- p_max_call_depth integer - max call depth of the macro --- p_definition_ac integer - ari collection definining the macro --- OUT --- r_definition_id integer - id of the new formal definition --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_macro_formal_definition(IN p_obj_id integer, p_use_desc varchar, p_fp_spec_id integer, p_max_call_depth integer, p_definition_ac integer, OUT r_definition_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_obj_formal_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO amp_core.macro_formal_definition(obj_formal_definition_id, fp_spec_id, ac_id, max_call_depth) VALUES(r_definition_id, p_fp_spec_id, p_definition_ac, p_max_call_depth); -$$; - - - --- ================================================================== --- SP__delete_mac_formal_defintion --- IN --- p_obj_id integer - id of the macro to be deleted --- p_obj_name varchar - name of the macro to delete --- ================================================================== -DROP PROCEDURE IF EXISTS SP__delete_mac_formal_defintion; - -CREATE OR REPLACE PROCEDURE SP__delete_mac_formal_defintion(IN p_obj_id integer, p_obj_name varchar) -mac_def_del:LANGUAGE SQL -AS $$ - IF( p_obj_id is Null AND p_obj_name is not NULL) THEN - SET p_obj_id = (select obj_id FROM amp_core.obj_metadata WHERE obj_name = p_obj_name); - ELSE - LEAVE mac_def_del; - END IF; - - IF(p_obj_name is NULL) THEN - SET p_obj_name = (select obj_name from vw_mac_formal where obj_id = p_obj_id); - END IF ; - - -- deleting all actuals - CALL SP__delete_macro_actual(null, p_obj_name); - - SET @def_id = (select definition_id from obj_formal_definition where obj_id = p_obj_id); - SET @fp_id = (SELECT fp_spec_id from macro_formal_definition where definition_id = @def_id ); - SET @ac_id = (SELECT ac_id FROM macro_formal_definition where definition_id = @def_id ); - - DELETE FROM formal_parmspec WHERE fp_spec_id = @fp_id; - DELETE FROM ari_collection WHERE ac_id = @ac_id; - - CALL SP__delete_obj_formal_defintion(p_obj_id, p_obj_name); -$$; - - - --- ================================================================== --- SP__insert_macro_actual_definition --- -- IN --- p_obj_id integer - id of the metadata info --- p_ap_spec_id integer - actual parmspec id --- p_actual_ac integer - ari collection containg all actual ARI for this macro --- p_use_desc varchar - human readable description --- OUT --- r_actual_id integer - id of the new actual definition --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_macro_actual_definition(IN p_obj_definition_id integer, p_ap_spec_id integer, p_actual_ac integer, p_use_desc varchar, OUT r_actual_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_obj_actual_definition(p_obj_definition_id, p_use_desc, r_actual_id); - INSERT INTO amp_core.macro_actual(obj_actual_definition_id, ap_spec_id, ac_id) VALUES(r_actual_id, p_ap_spec_id, p_actual_ac); -$$; - - --- ================================================================== --- SP__delete_mac_actual_definition --- IN --- p_obj_id integer - id of the macro to be deleted --- p_obj_name varchar - name of the macro to delete --- ================================================================== --- for actual can supply the definiton name to remove all the actuals of that definition or can remove -DROP PROCEDURE IF EXISTS SP__delete_mac_actual_definition; - -CREATE OR REPLACE PROCEDURE SP__delete_mac_actual_definition(IN p_inst_id integer, p_obj_name varchar) -mac_inst_del:LANGUAGE SQL -AS $$ - - DECLARE done INT DEFAULT FALSE; - DECLARE actual_id_hold, ap_spec_id_hold, ac_id_hold integer; - DECLARE actual_cursor CURSOR - FOR SELECT actual_id, ap_spec_id, ac_id WHERE obj_name = p_obj_name; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - -- only one thing to remove - If( p_inst_id is not null) then - SET @ap_id = (SELECT ap_spec_id from macro_actual_definition where actual_id = p_inst_id ); - IF( @ap_id is not null) THEN - DELETE FROM actual_parmspec WHERE ap_spec_id = @ap_id; - END IF; - DELETE FROM macro_actual -WHERE - intance_id = p_inst_id; - CALL SP__delete_obj_actual(p_inst_id, p_obj_name); - ELSE -- removing all actuals with this name - IF( p_obj_name is null) then -- nothing to do - leave mac_inst_del; - END IF; - OPEN actual_cursor; - read_loop: LOOP - FETCH NEXT FROM actual_cursor INTO - actual_id_hold, ap_spec_id_hold, ac_id_hold; - IF done THEN - LEAVE read_loop; - END IF; - - DELETE FROM actual_parmspec WHERE ap_spec_id = ap_spec_id_hold; - DELETE FROM ari_collection WHERE ac_id = ac_id_hold; - - DELETE FROM macro_actual_definition -WHERE - amp_core.macro_actual.actual_id = actual_id_hold; - END LOOP; - CALL SP__delete_obj_actual_definition(null, p_obj_name); - end if; - CLOSE actual_cursor; -$$; - --- create messages -use amp_core; - --- ================================================================== --- SP__insert_outgoing_message_set --- IN --- p_created_ts integer - created timestamp --- p_modified_ts integer - modified timestamp --- p_state integer - state of the message set --- p_agent_id integer - agent of this message --- OUT --- r_set_id integer - id of the set --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_outgoing_message_set(IN p_created_ts DATETIME, -p_modified_ts DATETIME, p_state integer, p_agent_id integer, OUT r_set_id integer ) -LANGUAGE SQL -AS $$ -INSERT INTO amp_core.outgoing_message_set (created_ts, modified_ts, state, agent_id) -VALUES (p_created_ts, p_modified_ts, p_state, p_agent_id); - -SET r_set_id = LAST_INSERT_ID(); -END// - - - --- ================================================================== --- SP__insert_outgoing_message_entry --- IN --- p_set_id integer - id of the outgoing message set this entry belongs toß --- p_message_order integer - order of this message in the set --- p_start_ts integer - start time --- p_ac_id integer - ac of this message --- OUT --- r_message_id integer - id of this message --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_outgoing_message_entry(IN p_set_id integer, p_message_order integer, p_start_ts datetime, p_ac_id integer, OUT r_message_id integer) -LANGUAGE SQL -AS $$ -INSERT INTO amp_core.outgoing_message_entry (set_id, message_order, start_ts, ac_id) -VALUES (p_set_id, p_message_order, p_start_ts, p_ac_id); -SET r_message_id = last_insert_id(); -END// - - - --- ================================================================== --- SP__update_outgoing_message_set --- IN --- p_set_id integer - id of the set to update --- p_state integer - state of the message set --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__update_outgoing_message_set(IN p_set_id integer, p_state integer) -LANGUAGE SQL -AS $$ - - UPDATE amp_core.outgoing_message_set - SET - modified_ts = NOW(), - state = p_state - WHERE set_id = p_set_id; -END// - - - --- ================================================================== --- SP__insert_incoming_message_set --- IN --- p_created_ts integer - created timestamp --- p_modified_ts integer - modified timestamp --- p_state integer - state of the message set --- p_agent_id integer - agent of this message --- OUT --- r_set_id integer - id of the set --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_incoming_message_set(IN p_created_ts datetime, -p_modified_ts datetime, p_state integer, p_agent_id integer, OUT r_set_id integer) -LANGUAGE SQL -AS $$ -INSERT INTO amp_core.incoming_message_set (created_ts, modified_ts, state, agent_id) -VALUES (p_created_ts, p_modified_ts, p_state, p_agent_id); - -SET r_set_id = LAST_INSERT_ID(); -END// - - --- ================================================================== --- SP__insert_incoming_message_entry --- IN --- p_set_id integer - id of the outgoing message set this entry belongs toß --- p_message_order integer - order of this message in the set --- p_start_ts integer - start time --- p_ac_id integer - ac of this message --- OUT --- r_message_id integer - id of this message --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_incoming_message_entry(IN p_set_id integer, p_message_order integer, p_start_ts datetime, p_ac_id integer, OUT r_message_id integer) -LANGUAGE SQL -AS $$ -INSERT INTO amp_core.incoming_message_entry (set_id, message_order, start_ts, ac_id) -VALUES (p_set_id, p_message_order, p_start_ts, p_ac_id); -SET r_message_id = last_insert_id(); -END// - - - --- ================================================================== --- SP__update_incoming_message_set --- IN --- p_set_id integer - id of the set to update --- p_state integer - state of the message set --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__update_incoming_message_set(IN p_set_id integer, p_state integer) -LANGUAGE SQL -AS $$ - - UPDATE amp_core.incoming_message_set - SET - modified_ts = NOW(), - state = p_state - WHERE set_id = p_set_id; -END// - - - --- SP__insert_message_report_entry(message_id, order_num, ari_id, tnvc_id, ts) - - -CREATE OR REPLACE PROCEDURE SP__insert_message_report_entry(IN - p_msg_id integer, - p_order_num INT UNSIGNED, - p_ari_id INT UNSIGNED, - p_tnvc_id INT UNSIGNED, - p_ts INT UNSIGNED, - OUT r_obj_id integer - ) -LANGUAGE SQL -AS $$ - - INSERT INTO report_definition (ari_id, ts, tnvc_id) VALUES (p_ari_id, p_ts, p_tnvc_id); - SET r_obj_id = LAST_INSERT_ID(); - - IF p_order_num IS NULL THEN - SELECT order_num+1 INTO p_order_num FROM message_report_set_entry WHERE message_id=p_msg_id ORDER BY order_num DESC LIMIT 1; - END IF; - IF p_order_num IS NULL THEN - SET p_order_num = 0; - END IF; - - INSERT INTO message_report_set_entry (message_id, report_id, order_num) VALUES (p_msg_id, r_obj_id, p_order_num); - -$$; - - --- SP__insert_message_group_agent_id(group_id, agent_id ) - - -CREATE OR REPLACE PROCEDURE SP__insert_message_group_agent_id(IN - p_group_id integer, - p_agent INT UNSIGNED, - OUT r_obj_id integer - ) -LANGUAGE SQL -AS $$ - INSERT INTO message_group_agents (group_id, agent_id) VALUES (p_group_id, p_agent); - SET r_obj_id = LAST_INSERT_ID(); -$$; - - --- SP__insert_message_group_agent_name(group_id, agent_name) - - -CREATE OR REPLACE PROCEDURE SP__insert_message_group_agent_name(IN - p_group_id integer, - p_agent VARCHAR(128), - OUT r_obj_id integer - ) -LANGUAGE SQL -AS $$ - DECLARE eid INT; - CALL SP__insert_agent(p_agent, eid); -- Select or Insert Agent ID - INSERT INTO message_group_agents (group_id, agent_id) VALUES (p_group_id, eid); - SET r_obj_id = LAST_INSERT_ID(); - -$$; - - --- SP__insert_message_entry_agent( message_id, agent_name ) - - -CREATE OR REPLACE PROCEDURE SP__insert_message_entry_agent(IN - p_mid integer, - p_agent VARCHAR(128) - ) -LANGUAGE SQL -AS $$ - DECLARE eid INT; - CALL SP__insert_agent(p_agent, eid); -- Select or Insert Agent ID - INSERT INTO message_agents (message_id, agent_id) VALUES (p_mid, eid); - -$$; - - - -USE amp_core; - --- STORED PROCEDURE(S) For creating namespaces and adms - --- ================================================================== --- SP__insert_namespace --- insert a new namespace into the db --- Parameters: --- in --- p_namespace_type varchar - type of the namespace --- p_issuing_org varchar - name of the issuing organization for this ADM. --- p_name_string varchar- his is the human-readable name of the ADM that should appear --- in message logs, user-interfaces, and other human-facing --- applications --- p_version varchar -This is a string representation of the version of the ADM. --- ADM version representations are formated at the discretion of --- the publishing organization. --- out --- r_namespace_id integer - id of the namespace in the database --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_namespace(IN p_namespace_type varchar, p_issuing_org varchar, p_name_string -varchar, p_version varchar, OUT r_namespace_id integer) -LANGUAGE SQL -AS $$ - - SELECT namespace_id INTO r_namespace_id - FROM amp_core.namespace - WHERE namespace_type=p_namespace_type AND issuing_org=p_issuing_org AND name_string=p_name_string AND version_name=p_version; - IF (r_namespace_id IS NULL) THEN - INSERT INTO amp_core.namespace(namespace_type, issuing_org, name_string, version_name) VALUES(p_namespace_type, p_issuing_org, p_name_string, p_version); - SET r_namespace_id = LAST_INSERT_ID(); - END IF; - -$$; - - - --- ================================================================== --- SP__insert_network_defined_namespace --- insert a new network defined adm into the db --- Parameters: --- in --- p_issuing_org varchar - name of the issuing organization for this ADM. --- p_name_string varchar- this is the human-readable name of the ADM that should appear --- in message logs, user-interfaces, and other human-facing --- applications --- p_version varchar -This is a string representation of the version of the ADM. --- ADM version representations are formated at the discretion of --- the publishing organization. --- p_issuer_binary_string varchar - any string that identifies the organization that is --- defining an AMM object --- p_tag varchar - any string used to disambiguate AMM Objects for an Issuer --- out --- r_namespace_id integer - id of the namespace in the database --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_network_defined_namespace(IN p_issuing_org varchar, p_name_string varchar, -p_version varchar, p_issuer_binary_string varchar, p_tag varchar, OUT r_namespace_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_namespace('NETWORK_CONFIG', p_issuing_org, p_name_string, p_version, r_namespace_id); - INSERT INTO amp_core.network_config(namespace_id, issuer_binary_string, tag) VALUES(r_namespace_id, p_issuer_binary_string, p_tag); -$$; - - - --- ================================================================== --- SP__insert_network_defined_namespace --- insert a new moderated adm into the db --- Parameters: --- in --- p_issuing_org varchar - name of the issuing organization for this ADM. --- p_name_string varchar- this is the human-readable name of the ADM that should appear --- in message logs, user-interfaces, and other human-facing --- applications --- p_version varchar - This is a string representation of the version of the ADM. --- ADM version representations are formated at the discretion of --- the publishing organization. --- p_adm_name_string varchar - this is the human-readable name of the ADM that should appear --- in message logs, user-interfaces, and other human-facing --- applications --- p_adm_enum integer - an unsigned integer in the range of 0 to --- (2^64)/20 --- p_adm_enum_label varchar - labeled based on the number of bytes --- of the Nickname as a function of the size of the ADM enumeration --- p_use_desc varchar - human readable use description --- out --- r_namespace_id integer - id of the namespace in the database --- ================================================================== -DROP PROCEDURE IF EXISTS SP__insert_adm_defined_namespace; - -CREATE OR REPLACE PROCEDURE SP__insert_adm_defined_namespace(IN p_issuing_org varchar, p_namespace_string varchar, -p_version varchar, p_adm_name_string varchar, p_adm_enum integer, p_adm_enum_label varchar, -p_use_desc varchar, OUT r_namespace_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_namespace('MODERATED', p_issuing_org, p_namespace_string, p_version, r_namespace_id); - INSERT INTO amp_core.adm(namespace_id, adm_name, adm_enum, adm_enum_label, use_desc) VALUES(r_namespace_id, - p_adm_name_string, p_adm_enum, p_adm_enum_label, p_use_desc); -$$; - - - - --- ================================================================== --- Author: David Linko --- --- Description: inserting, updating and removing object formal and actual defintion. The backbone for the DB and all the objects that make it up. --- since deletes concasde if you remove the obj instance or definiton you remove that entity from the DB --- ================================================================== - - -USE amp_core; - - --- ================================================================== --- Parameters: --- in --- p_obj_type varchar - object of the type --- p_obj_name varchar - human readable name of the new object --- p_namespace_id integer - namespace this object belongs to --- out --- r_obj_id integer - id of the new object in the database --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_obj_metadata(IN p_obj_type_id INT unsigned, p_obj_name varchar, p_namespace_id integer, OUT r_obj_id integer) -LANGUAGE SQL -AS $$ - - SELECT obj_metadata_id INTO r_obj_id - FROM amp_core.obj_metadata - WHERE data_type_id=p_obj_type_id AND obj_name=p_obj_name AND namespace_id=p_namespace_id; - - IF (r_obj_id IS NULL) THEN - INSERT INTO amp_core.obj_metadata(data_type_id, obj_name, namespace_id) VALUES(p_obj_type_id, p_obj_name, p_namespace_id); - SET r_obj_id = LAST_INSERT_ID(); - END IF; - -$$; - - --- ================================================================== --- Parameters: --- in --- p_obj_id INT UNSIGNED - --- --- ================================================================== -DROP PROCEDURE IF EXISTS SP__delete_obj_metadata; - -CREATE OR REPLACE PROCEDURE SP__delete_obj_metadata(IN p_obj_id INT UNSIGNED) -LANGUAGE SQL -AS $$ - DELETE FROM obj_metadata -WHERE obj_metadata_id = p_obj_id; - -$$; - - - - --- ================================================================== --- Parameters: --- in --- p_obj_metadata_id integer - --- p_use_desc varchar - --- out --- r_formal_id integer - --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_obj_formal_definition(IN p_obj_metadata_id integer, p_use_desc varchar, OUT r_formal_id integer) -LANGUAGE SQL -AS $$ - - -- Get the next available ID for automatic enumeration of new formal definitions - SELECT data_type_id, adm_enum INTO @data_type, @adm_enum FROM vw_obj_metadata WHERE obj_metadata_id=p_obj_metadata_id; - SELECT COALESCE(MAX(vof.obj_enum)+1,0) INTO @obj_enum FROM vw_obj_formal_def vof WHERE vof.data_type_id=@data_type AND vof.adm_enum=@adm_enum; - - INSERT INTO amp_core.obj_formal_definition(obj_metadata_id, use_desc, obj_enum) VALUES(p_obj_metadata_id, p_use_desc, @obj_enum); - - SET r_formal_id = LAST_INSERT_ID(); -$$; - - - - --- ================================================================== --- Parameters: --- in IN p_obj_metadata_id integer, p_use_desc varchar, OUT r_actual_id integer) --- --- out --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_obj_actual_definition(IN p_obj_metadata_id integer, p_use_desc varchar, OUT r_actual_id integer) -LANGUAGE SQL -AS $$ - INSERT INTO amp_core.obj_actual_definition(obj_metadata_id, use_desc) VALUES(p_obj_metadata_id, p_use_desc); - SET r_actual_id = LAST_INSERT_ID(); -$$; - - --- ================================================================== --- can use name or id for to delete --- Parameters: --- in --- p_obj_id integer - Id of the specific obj to delete --- p_obj_name varchar - name of the obj to delete --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__delete_obj_formal_definition(p_obj_id integer, p_obj_name varchar ) -obj_delete:LANGUAGE SQL -AS $$ - IF( p_obj_id is NULL AND p_obj_name is not NULL) THEN - SET p_obj_id = (select obj_id FROM amp_core.obj_metadata WHERE obj_name = p_obj_name); - ELSE - LEAVE obj_delete; - END IF; - - DELETE FROM amp_core.obj_metadata WHERE obj_id = p_obj_id; -END// - - - --- ================================================================== --- Parameters: --- in --- p_act_id int UNSIGNED --- p_obj_name varchar --- p_namespace_id int UNSIGNED --- --- ================================================================== --- for just removing the obj instance --- two options for removal if you want to remove a specific instance you can specify the instance id, --- or if you want to remove all the instances of a specific definition you can supply the definition name --- TODO: can add another option of adding a number and only removes up to that number of entries. --- maybe too overloaded -DROP PROCEDURE IF EXISTS SP__delete_obj_actual_definition; - -CREATE OR REPLACE PROCEDURE SP__delete_obj_actual_definition(p_act_id int UNSIGNED, p_obj_name varchar ) -obj_inst_del:LANGUAGE SQL -AS $$ - - -- if its just removing one instance - IF( p_inst_id is not null) THEN - DELETE FROM obj_actual_definition WHERE actual_definition_id = p_act_id; - -- if its removing all instances with this defeintion - ELSE -- removing all instances with this name - IF( p_obj_name is null or p_namespace_id) then -- nothing to do - leave obj_inst_del; - END IF; - DELETE FROM amp_core.obj_actual_definition where obj_metadata_id =(select obj_metadata_id from obj_metadat where obj_name = p_obj_name ); - END IF; -END// - -USE amp_core; - --- STORED PROCEDURE(S) for creating updating an deleting operator definitions - - --- ================================================================== --- SP__insert_operator_actual_definition --- IN --- p_obj_id integer - metadata id for this report --- p_use_desc varchar - human readable use description --- p_use_desc varchar - human readable use description --- p_result_type varchar - data type of the result --- p_num_inputs integer - number of inputs for the operator --- p_tnvc_id integer - --- OUT --- r_definition_id integer - actual id of this operator --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_operator_actual_definition(IN p_obj_id integer, p_use_desc varchar, -p_result_type varchar, p_num_inputs integer, p_tnvc_id integer, OUT r_definition_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO amp_core.operator_actual_definition(obj_actual_definition_id, data_type_id, num_operands, tnvc_id) - VALUES(r_definition_id, (SELECT data_type_id FROM amp_core.data_type WHERE type_name = p_result_type), p_num_inputs, p_tnvc_id); -$$; - - --- ================================================================== --- SP__delete_oper_actual_defintion --- IN --- p_obj_id integer - id of this op to delete, --- p_obj_name varchar - name of this op to delete --- ================================================================== -DROP PROCEDURE IF EXISTS SP__delete_oper_actual_defintion; - -CREATE OR REPLACE PROCEDURE SP__delete_oper_actual_defintion(IN p_obj_id integer, p_obj_name varchar) -oper_def_del:LANGUAGE SQL -AS $$ - IF( p_obj_id is Null AND p_obj_name is not NULL) THEN - SET p_obj_id = (select obj_id FROM amp_core.obj_metadata WHERE obj_name = p_obj_name); - ELSE - LEAVE oper_def_del; - END IF; - - SET @def_id = (select definition_id from obj_actual_definition where obj_actual_definition_id = p_obj_id); - SET @fp_id = (SELECT fp_spec_id from macro_actual_definition where obj_actual_definition_id = @def_id ); - SET @ac_id = (SELECT ac_id FROM macro_actual_definition where obj_actual_definition_id = @def_id ); - - DELETE FROM formal_parmspec WHERE fp_spec_id = @fp_id; - DELETE FROM ari_collection WHERE ac_id = @ac_id; - - CALL SP__delete_obj_actual_defintion(p_obj_id, p_obj_name); -$$; - - - - - - -USE amp_core; - --- STORED PROCEDURE(S) for the creating updating and deleting reports and report templates - - --- auto adds ac which can be troublesome --- user has to make ac first -/* -DROP PROCEDURE IF EXISTS SP__insert_report_template_metadata_format; - -CREATE OR REPLACE PROCEDURE SP__insert_report_template_metadata_format(IN p_metadata_count integer, p_metadata_types_list varchar, p_metadata_names_list varchar, p_metadata_desc varchar, OUT r_tnvc_id integer) -LANGUAGE SQL -AS $$ - INSERT INTO amp_core.type_name_value_collection(num_entries, use_desc) VALUES(p_metadata_count, p_metadata_desc); - SET r_tnvc_id = LAST_INSERT_ID(); - SET @s = 'INSERT INTO amp_core.type_name_value(tnvc_id, data_type, data_name, order_num) VALUES'; - SET @loops = 1; - WHILE @loops < p_metadata_count DO - LANGUAGE SQL -AS $$ - -- @metadata_type - SET @metadata_type = TRIM(SUBSTRING_INDEX(p_metadata_types_list, ',', 1)); - SET p_metadata_types_list = REPLACE(p_metadata_types_list, CONCAT(@metadata_type, ','), ''); - - -- @metadata_name - SET @metadata_name = TRIM(SUBSTRING_INDEX(p_metadata_names_list, ',', 1)); - SET p_metadata_names_list = REPLACE(p_metadata_names_list, CONCAT(@metadata_name, ','), ''); - - SET @s = CONCAT(@s, '(', r_tnvc_id, ',', (SELECT enum_id FROM amp_core.data_type WHERE type_name = @metadata_type), ',', '\'', @metadata_name, '\'', ',', @loops, '),'); - SET @loops = @loops + 1; - END; - END WHILE; - - -- @metadata_type - SET @metadata_type = TRIM((SUBSTRING_INDEX(p_metadata_types_list, ',', 1))); - - -- @metadata_name - SET @metadata_name = TRIM(SUBSTRING_INDEX(p_metadata_names_list, ',', 1)); - - SET @s = CONCAT(@s, '(', r_tnvc_id, ',', (SELECT enum_id FROM amp_core.data_type WHERE type_name = @metadata_type), ',', '\'', @metadata_name, '\'', ',', @loops, ');'); - PREPARE stmt FROM @s; - EXECUTE stmt; - -$$; - -*/ - - --- ================================================================== --- create a report template formal def --- SP__insert_report_template_metadata_format --- IN --- p_obj_id integer - metadata id for this report --- p_use_desc varchar - human readable use description --- p_formal_parmspec_id integer - formal parameter spec id --- p_ac_id integer - ac for the report definition --- --- OUT --- r_definition_id integer - id of this formal report --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_report_template_formal_definition(IN p_obj_id integer, p_use_desc varchar, p_formal_parmspec_id integer, p_ac_id integer, OUT r_definition_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_obj_formal_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO amp_core.report_template_formal_definition(obj_formal_definition_id, fp_spec_id, ac_id) VALUES(r_definition_id, p_formal_parmspec_id, p_ac_id); -$$; - - - --- ================================================================== --- SP__insert_report_actual_definition --- IN --- p_obj_definition_id integer - metadata id for this report --- p_ap_spec_id integer - id for the actual parmspec for this report --- p_use_desc varchar - human readable use description --- OUT --- r_obj_actual_id integer - id of this actual report definition --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_report_actual_definition(IN p_obj_definition_id integer, p_ap_spec_id integer, p_ts TIMESTAMP, p_use_desc varchar, OUT r_obj_actual_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_obj_actual_definition(p_obj_definition_id, p_use_desc, r_obj_actual_id); - INSERT INTO amp_core.report_template_actual_definition(obj_actual_definition_id, ap_spec_id, ts ) VALUES(r_obj_actual_id, p_ap_spec_id, p_ts); -$$; - -USE amp_core; - --- STORED PROCEDURE(S) for adding updating and deleting time base rule defintions and instances - --- ================= --- for adding state based rules into the database --- SP__insert_sbr_actual_definition --- IN --- p_obj_id integer - metadata id of this SBR --- p_use_desc varchar- human readable description --- p_expr_id int UNSIGNED, - id of the expresion for this rule --- p_ac_id int UNSIGNED, - id of the ari collection that defines the action of this rule --- p_start_time time - whem this rule starts --- OUT --- r_definition_id integer - id of the start --- ==================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_sbr_actual_definition(IN p_obj_id integer, p_use_desc varchar, p_expr_id int UNSIGNED, p_ac_id int UNSIGNED, p_start_time time , OUT r_definition_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO amp_core.sbr_actual_definition(obj_actual_definition_id, expression_id, run_count, start_time, ac_id) VALUES(r_definition_id, p_expr_id, p_run_count, p_start_time, p_ac_id); -$$; - - - --- ================================================================== --- SP__delete_sbr_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the sbr to delete --- p_obj_name varchar - name of the sbr to delete -- --- ================================================================== -DROP PROCEDURE IF EXISTS SP__delete_sbr_actual_definition; - -CREATE OR REPLACE PROCEDURE SP__delete_sbr_actual_definition(IN p_obj_id integer, p_obj_name varchar) -sbr_def_del:LANGUAGE SQL -AS $$ - IF( p_obj_id is Null AND p_obj_name is not NULL) THEN - SET p_obj_id = (select obj_id FROM amp_core.obj_metadata WHERE obj_name = p_obj_name); - ELSE - LEAVE sbr_def_del; - END IF; - - IF(p_obj_name is NULL) THEN - SET p_obj_name = (select obj_name from vw_sbr_formal where obj_id = p_obj_id); - END IF ; - - SET @exp_id = (SELECT expression_id FROM vw_sbr_actual WHERE obj_actual_definition = p_obj_id); - SET @ac_id = (SELECT ac_id FROM vw_sbr_actual WHERE obj_actual_definition = p_obj_id); - - DELETE FROM ari_collection WHERE ac_id = @ac_id; - DELETE FROM expression WHERE expression_id = @exp_id; - - CALL SP__delete_obj_atual_defintion(p_obj_id, p_obj_name); -$$; - -USE amp_core; - --- STORED PROCEDURE(S) - - --- == --- function for string processing used by other sp --- help make inserting large sets of data more user friendly --- == - - -CREATE OR REPLACE PROCEDURE SP__get_delimiter_position(IN p_str varchar, p_delimiter varchar, p_start_position integer, OUT r_found_position integer) -LANGUAGE SQL -AS $$ - IF (p_str IS NOT NULL) && (p_start_position IS NOT NULL)THEN - LANGUAGE SQL -AS $$ - SET @length = CHAR_LENGTH(p_str); - SET @position_index = p_start_position; - SET @iterator_index = p_start_position; - SET @char_value = ''; - SET @delimiter_found = FALSE; - SET r_found_position = NULL; - WHILE (@position_index != @length) && (@delimiter_found != TRUE) DO - LANGUAGE SQL -AS $$ - SET @char_value = SUBSTRING(p_str, @iterator_index, 1); - IF @char_value LIKE p_delimiter THEN - SET @position_index = @iterator_index; - SET r_found_position = @position_index; - SET @delimiter_found = TRUE; - END IF; - SET @iterator_index = @iterator_index + 1; - END; - END WHILE; - END; - ELSE - LANGUAGE SQL -AS $$ - SET r_found_position = NULL; - END; - END IF; -$$; - - - - -CREATE OR REPLACE PROCEDURE SP__null_string_check(INOUT p_string varchar) -LANGUAGE SQL -AS $$ - IF (p_string LIKE 'null') || (p_string LIKE 'NULL') || (p_string LIKE 'Null') THEN - LANGUAGE SQL -AS $$ - SET p_string = NULL; - END; - END IF; -$$; -USE amp_core; - --- STORED PROCEDURE(S) for adding deleting and updating Table template defintions and instances - - --- ================================================================== --- SP__insert_table_template_actual_definition --- IN --- p_obj_id integer - obj_metadata id --- p_use_desc varchar - human readble use desc --- p_num_columns integer - number of columns in the table --- p_column_names_list varchar(10000) - list of column names --- p_column_types_list varchar(10000) - list of column type --- OUT --- r_definition_id integer - id of the the new table --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_table_template_actual_definition(IN p_obj_id integer, p_use_desc varchar, p_columns_id integer, OUT r_definition_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO amp_core.table_template_actual_definition(obj_actual_definition_id, tnvc_id) VALUES(r_definition_id, p_columns_id); -$$; - - --- ================================================================== --- SP__insert_table_template_actual_definition --- IN --- p_obj_id integer - id of the table to delete --- p_obj_name varchar -- name of the object to delete --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__delete_table_template_actual_definition(IN p_obj_id integer) -LANGUAGE SQL -AS $$ - IF p_obj_id != NULL THEN LANGUAGE SQL -AS $$ - SET @tnvc_id = (select tnvc_id from table_template_actual_definition where obj_actual_definition_id = p_obj_id); - END; - ELSE LANGUAGE SQL -AS $$ - SET @tnvc_id = - (select tnvc_id from table_template_actual_definition where obj_atual_definition_id = - (select obj_actual_definition_id from obj_actual_definition where obj_metadata_id = - (select obj_metadata_id from obj_metadata where obj_name = p_obj_name))); - END; - END IF; - CALL SP__delete_tnvc(@tnvc_id); - CALL SP__delete_obj_actual_definition(p_obj_id, null); - -$$; - - - - --- --- --- -- table_definition_id, use_desc, --- CREATE OR REPLACE PROCEDURE SP__insert_table_instance(IN p_obj_definition_id integer, p_use_desc varchar, p_row_values_list varchar(10000), OUT r_instance_id integer) --- LANGUAGE SQL -AS $$ --- --- -- have to visit how to store multiple rows is is just one long value collection splitting at every num_colmns? --- CALL SP__insert_obj_instance(p_obj_definition_id, p_use_desc, r_instance_id); --- SET @n_rows = (select num_entries from amp_core.type_name_value_collection where tnvc_id =(select columns_list from amp_core.table_template_definition where definition_id = p_obj_definition_id)); --- CALL SP__insert_tnv_collection(@num_rows, null, null, p_row_values_list , @tnvc_id); --- INSERT INTO amp_core.table_instance(instance_id, ap_spec_id) VALUES(r_instance_id, p_ap_spec_id); --- $$; --- -USE amp_core; - --- STORED PROCEDURE(S) for adding updating and deleting time base rule defintions and instances --- need type checking for actions, they need to be Macros or controls - - --- =============================================================== --- SP__insert_tbr_actual_definition --- IN --- p_obj_id integer - metadata id --- p_use_desc varchar - human readable descriptionb --- p_wait_per time - how long to wait before starting --- p_run_count biginteger - number of times to run --- p_start_time time - when to start --- p_ac_id int UNSIGNED - ac of the actions for this rules --- OUT --- r_definition_id integer - id of this tbr --- =============================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_tbr_actual_definition(IN p_obj_id integer, p_use_desc varchar, -p_wait_per time, p_run_count biginteger, p_start_time time, p_ac_id int UNSIGNED, OUT r_definition_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO amp_core.tbr_actual_definition(obj_actual_definition_id, wait_period, run_count, start_time, ac_id) VALUES(r_definition_id, p_wait_per, p_run_count, p_start_time, p_ac_id); -$$; - - - - --- ================================================================== --- SP__delete_tbr_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the tbr to delete --- p_obj_name varchar - name of the tbr to delete -- --- ================================================================== -DROP PROCEDURE IF EXISTS SP__delete_tbr_actual_definition; - -CREATE OR REPLACE PROCEDURE SP__delete_tbr_actual_definition(IN p_obj_id integer, p_obj_name varchar) -tbr_def_del:LANGUAGE SQL -AS $$ - IF( p_obj_id is Null AND p_obj_name is not NULL) THEN - SET p_obj_id = (select obj_id FROM amp_core.obj_metadata WHERE obj_name = p_obj_name); - ELSE - LEAVE tbr_def_del; - END IF; - - IF(p_obj_name is NULL) THEN - SET p_obj_name = (select obj_name from vw_tbr_formal where obj_id = p_obj_id); - END IF ; - - - SET @ac_id = (SELECT ac_id FROM vw_tbr_actual WHERE obj_actual_definition = p_obj_id); - - DELETE FROM ari_collection WHERE ac_id = @ac_id; - - CALL SP__delete_obj_atual_defintion(p_obj_id, p_obj_name); -$$; -USE amp_core; - --- STORED PROCEDURE(S) for inserting type name value collections into db - - --- ================================================================== --- SP__insert_tnvc --- inserts a new tnv collection definition into the db --- IN --- p_num_entries integer - number of entries in the collection --- p_use_desc varchar - human readble description for the collection --- OUT --- r_tnvc_id integer - id of the collection --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_collection(IN p_use_desc varchar, OUT r_tnvc_id integer) -LANGUAGE SQL -AS $$ - INSERT INTO amp_core.type_name_value_collection(use_desc) VALUES(p_use_desc); - SET r_tnvc_id = LAST_INSERT_ID(); -$$; - - --- ================================================================== --- sp for inserting a single entry into a tnvc --- SP__insert_tnvc_entry --- IN --- p_tnvc_id integer - id of tnvc this entry belongs to --- p_order_num integer - order number of this entry --- p_data_type_name varchar - data type name --- p_data_name varchar - name of the tnvc --- p_definition_id integer - definition of the object could be literal --- OUT --- r_tnvc_entry_id integer - id of this entrty --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_entry(IN p_tnvc_id integer, p_order_num integer, p_data_type_name varchar, p_data_name varchar, OUT r_tnvc_entry_id integer) -LANGUAGE SQL -AS $$ - - IF p_order_num IS NULL THEN - SELECT order_num+1 INTO p_order_num FROM type_name_value_entry WHERE tnvc_id=p_tnvc_id ORDER BY order_num DESC LIMIT 1; - END IF; - IF p_order_num IS NULL THEN - SET p_order_num = 0; - END IF; - - - INSERT INTO `amp_core`.`type_name_value_entry` -(`tnvc_id`, -`order_num`, -`data_type_id`, -`data_name`) -VALUES -(p_tnvc_id, -p_order_num, -(SELECT data_type_id FROM data_type WHERE type_name = UPPER(p_data_type_name)), -p_data_name); - -SET r_tnvc_entry_id = LAST_INSERT_ID(); - -$$; - - - - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_entry_id(IN p_tnvc_id integer, p_order_num integer, p_data_type_id integer, p_data_name varchar, OUT r_tnvc_entry_id integer) -LANGUAGE SQL -AS $$ - - IF p_order_num IS NULL THEN - SELECT order_num+1 INTO p_order_num FROM type_name_value_entry WHERE tnvc_id=p_tnvc_id ORDER BY order_num DESC LIMIT 1; - END IF; - IF p_order_num IS NULL THEN - SET p_order_num = 0; - END IF; - - -INSERT INTO `amp_core`.`type_name_value_entry` -(`tnvc_id`, -`order_num`, -`data_type_id`, -`data_name`) -VALUES -(p_tnvc_id, -p_order_num, -p_data_type_id, -p_data_name); - -SET r_tnvc_entry_id = LAST_INSERT_ID(); - -$$; - - --- ================================================================== --- SP__insert_tnvc_obj_entry --- insert a new tnvc entry that is an ADM object --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value integer - id for this actual object --- ================================================================== -DROP PROCEDURE IF EXISTS SP__insert_tnvc_obj_entry; - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_obj_entry(IN p_tnvc_id integer, - p_order_num integer, - p_data_type varchar, - p_entry_value integer, - OUT r_tnvc_entry_id integer ) -LANGUAGE SQL -AS $$ - CALL SP__insert_tnvc_entry(p_tnvc_id, p_order_num, p_data_type, NULL, r_tnvc_entry_id); - INSERT INTO type_name_value_obj_entry (tnv_id, obj_actual_definition_id) VALUES (r_tnvc_entry_id, p_entry_value); -$$; - - - -DROP PROCEDURE IF EXISTS SP__insert_tnvc_ac_entry; - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_ac_entry(IN p_tnvc_id integer, - p_order_num integer, - p_data_name varchar, - p_entry_value integer, - OUT r_tnvc_entry_id integer ) -LANGUAGE SQL -AS $$ - - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 37, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_ac_entry (tnv_id, ac_id) VALUES (r_tnvc_entry_id, p_entry_value); -$$; - - -DROP PROCEDURE IF EXISTS SP__insert_tnvc_tnvc_entry; - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_tnvc_entry(IN p_tnvc_id integer, - p_order_num integer, - p_data_name varchar, - p_entry_value integer, - OUT r_tnvc_entry_id integer ) -LANGUAGE SQL -AS $$ - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 35, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_tnvc_entry (tnv_id, tnvc_id) VALUES (r_tnvc_entry_id, p_entry_value); -$$; - - - --- ================================================================== --- SP__insert_tnvc_ari_entry --- insert a new tnvc entry that is an ADM object --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value integer - id for this actual object --- ================================================================== -DROP PROCEDURE IF EXISTS SP__insert_tnvc_ari_entry; - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_ari_entry(IN p_tnvc_id integer, - p_order_num integer, - p_data_name varchar, - p_entry_value integer, - OUT r_tnvc_entry_id integer ) -LANGUAGE SQL -AS $$ - CALL SP__insert_tnvc_entry(p_tnvc_id, p_order_num, 'ari', p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_obj_entry (tnv_id, obj_actual_definition_id) VALUES (r_tnvc_entry_id, p_entry_value); -$$; - - --- ================================================================== --- SP__insert_tnvc_unk_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- ================================================================== -DROP PROCEDURE IF EXISTS SP__insert_tnvc_unk_entry; - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_unk_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, OUT r_tnvc_entry_id integer ) -LANGUAGE SQL -AS $$ - CALL SP__insert_tnvc_entry(p_tnvc_id, p_order_num, 'unk', p_data_name, r_tnvc_entry_id); -$$; - - - --- ================================================================== --- SP__insert_tnvc_int_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value int- value for this int_entry --- ================================================================== -DROP PROCEDURE IF EXISTS SP__insert_tnvc_int_entry; - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_int_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value int, OUT r_tnvc_entry_id integer ) -LANGUAGE SQL -AS $$ - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 19, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_int_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -$$; - - --- ================================================================== --- SP__insert_tnvc_uint_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value integer - value for this uint_entry --- ================================================================== -DROP PROCEDURE IF EXISTS SP__insert_tnvc_uint_entry; - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_uint_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value integer , OUT r_tnvc_entry_id integer ) -LANGUAGE SQL -AS $$ - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 20, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_uint_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -$$; - - --- ================================================================== --- SP__insert_tnvc_vast_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value bigint - value for this vast_entry --- ================================================================== -DROP PROCEDURE IF EXISTS SP__insert_tnvc_vast_entry; - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_vast_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value bigint , OUT r_tnvc_entry_id integer ) -LANGUAGE SQL -AS $$ - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 21, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_vast_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -$$; - - --- ================================================================== --- SP__insert_tnvc_uvast_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value biginteger - value for this uvast_entry --- ================================================================== -DROP PROCEDURE IF EXISTS SP__insert_tnvc_uvast_entry; - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_uvast_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value biginteger , OUT r_tnvc_entry_id integer ) -LANGUAGE SQL -AS $$ - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 22, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_uvast_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -$$; - - --- ================================================================== --- SP__insert_tnvc_tv_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value biginteger - value for this uvast_entry --- ================================================================== -DROP PROCEDURE IF EXISTS SP__insert_tnvc_tv_entry; - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_tv_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value biginteger , OUT r_tnvc_entry_id integer ) -LANGUAGE SQL -AS $$ - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 32, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_uvast_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -$$; - - --- ================================================================== --- SP__insert_tnvc_uvast_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value biginteger - value for this uvast_entry --- ================================================================== -DROP PROCEDURE IF EXISTS SP__insert_tnvc_ts_entry; - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_ts_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value biginteger , OUT r_tnvc_entry_id integer ) -LANGUAGE SQL -AS $$ - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 33, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_uvast_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -$$; - - --- ================================================================== --- SP__insert_tnvc_real32_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value float- value for this real32_entry --- ================================================================== -DROP PROCEDURE IF EXISTS SP__insert_tnvc_real32_entry; - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_real32_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value float, OUT r_tnvc_entry_id integer ) -LANGUAGE SQL -AS $$ - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 23, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_real32_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -$$; - - --- ================================================================== --- SP__insert_tnvc_real64_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value double- value for this real64_entry --- ================================================================== -DROP PROCEDURE IF EXISTS SP__insert_tnvc_real64_entry; - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_real64_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value double, OUT r_tnvc_entry_id integer ) -LANGUAGE SQL -AS $$ - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 24, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_real64_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -$$; - - --- ================================================================== --- SP__insert_tnvc_str_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value varchar- value for this string_entry --- ================================================================== -DROP PROCEDURE IF EXISTS SP__insert_tnvc_str_entry; - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_str_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value varchar, OUT r_tnvc_entry_id integer ) -LANGUAGE SQL -AS $$ - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 18, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_string_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -$$; - - --- ================================================================== --- SP__insert_tnvc_bool_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value bool- value for this bool_entry --- ================================================================== -DROP PROCEDURE IF EXISTS SP__insert_tnvc_bool_entry; - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_bool_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value bool, OUT r_tnvc_entry_id integer ) -LANGUAGE SQL -AS $$ - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 16, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_bool_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -$$; - - --- ================================================================== --- SP__insert_tnvc_byte_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value tinyint- value for this byte_entry --- ================================================================== -DROP PROCEDURE IF EXISTS SP__insert_tnvc_byte_entry; - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_byte_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value tinyint, OUT r_tnvc_entry_id integer ) -LANGUAGE SQL -AS $$ - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 17, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_byte_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -$$; - - - - - - - --- ================================================================== --- SP__insert_tnv_collection --- inserts entries into the collection using ',' lists --- IN --- p_num_entries integer - number of entries in the collection --- p_data_types_list varchar(10000) - list of the data types --- p_data_names_list varchar(10000) - list of the names --- p_data_values_list varchar(10000) - list of the values --- OUT --- r_tnvc_id integer - id of the collection --- ================================================================== --- --- --- CREATE OR REPLACE PROCEDURE SP__insert_tnv_collection(IN p_num_entries integer, p_data_types_list varchar(10000), p_data_names_list varchar(10000), p_data_values_list varchar(10000), OUT r_tnvc_id integer) --- LANGUAGE SQL -AS $$ --- CALL SP__insert_tnvc(p_num_entries, r_tnvc_id); --- SET @tnvc_id = r_tnvc_id; --- SET @s = 'INSERT INTO amp_core.type_name_value(tnvc_id, order_num, data_type_id, data_name, obj_actual_definition_id) VALUES'; --- SET @loops = 1; --- WHILE @loops < p_num_entries DO --- LANGUAGE SQL -AS $$ --- -- @data_type --- IF p_data_types_list IS NOT NULL THEN --- LANGUAGE SQL -AS $$ --- SET @data_type = TRIM(SUBSTRING_INDEX(p_data_types_list, ',', 1)); --- SET p_data_types_list = REPLACE(p_data_types_list, CONCAT(@data_type, ','), ''); --- END; --- ELSE --- LANGUAGE SQL -AS $$ --- SET @data_type = 'NULL'; --- END; --- END IF; --- --- -- @data_name --- IF p_data_names_list IS NOT NULL THEN --- LANGUAGE SQL -AS $$ --- SET @data_name = TRIM(SUBSTRING_INDEX(p_data_names_list, ',', 1)); --- SET p_data_names_list = REPLACE(p_data_names_list, CONCAT(@data_name, ','), ''); --- END; --- ELSE --- LANGUAGE SQL -AS $$ --- SET @data_name = 'NULL'; --- END; --- END IF; --- --- -- @data_value --- IF p_data_values_list IS NOT NULL THEN --- LANGUAGE SQL -AS $$ --- SET @data_value = TRIM(SUBSTRING_INDEX(p_data_values_list, ',', 1)); --- SET p_data_values_list = REPLACE(p_data_values_list, CONCAT(@data_value, ','), ''); --- END; --- ELSE --- LANGUAGE SQL -AS $$ --- SET @data_value = 'NULL'; --- END; --- END IF; --- SET @s = CONCAT(@s, '(', @tnvc_id, ',', @loops, ',', (SELECT data_type_id FROM amp_core.data_type WHERE type_name = @data_type), ',', '"', @data_name, '"', ',', '"', @data_value, '"', '),'); --- SET @loops = @loops + 1; --- END; --- END WHILE; --- --- -- @data_type --- IF p_data_types_list IS NOT NULL THEN --- LANGUAGE SQL -AS $$ --- SET @data_type = TRIM((SUBSTRING_INDEX(p_data_types_list, ',', 1))); --- END; --- ELSE --- LANGUAGE SQL -AS $$ --- SET @data_type = 'NULL'; --- END; --- END IF; --- --- -- @data_name --- IF p_data_names_list IS NOT NULL THEN --- LANGUAGE SQL -AS $$ --- SET @data_name = TRIM(SUBSTRING_INDEX(p_data_names_list, ',', 1)); --- END; --- ELSE --- LANGUAGE SQL -AS $$ --- SET @data_name = 'NULL'; --- END; --- END IF; --- --- -- @data_value --- IF p_data_values_list IS NOT NULL THEN --- LANGUAGE SQL -AS $$ --- SET @data_value = TRIM(SUBSTRING_INDEX(p_data_values_list, ',', 1)); --- END; --- ELSE --- LANGUAGE SQL -AS $$ --- SET @data_value = 'NULL'; --- END; --- END IF; --- SET @s = CONCAT(@s, '(', @tnvc_id, ',', @loops, ',', (SELECT data_type_id FROM amp_core.data_type WHERE type_name = @data_type), ',', '"', @data_name, '"', ',', '"', @data_value, '"', ')'); --- PREPARE stmt FROM @s; --- EXECUTE stmt; - --- $$; --- - -USE amp_core; - --- STORED PROCEDURE(S) for adding updating and removing variables - --- ================================================================== --- SP__insert_variable_definition --- inserting a new variable --- IN --- p_obj_id integer - metadata id of the variable --- p_use_desc varchar - human readable description --- p_out_type integer - out type of the variable --- p_num_operators integer - number of operators --- p_operator_ids_list varchar - --- OUT --- r_definition_id integer - definition id of the variable --- --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_variable_definition(IN p_obj_id integer, p_use_desc varchar, -p_out_type integer, p_expression_id integer, OUT r_definition_id integer) -LANGUAGE SQL -AS $$ - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - -- call expresion builder for var Initializer - CALL SP__insert_expression(p_out_type, p_expression_id, @r_expr_id); - INSERT INTO amp_core.variable_actual_definition(obj_actual_definition_id, data_type_id, expression_id) VALUES(r_definition_id, p_out_type, @r_expr_id); - -$$; - - - --- ================================================================== --- SP__delete_var_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the var to delete --- p_obj_name varchar - name of the var to delete -- --- ================================================================== - - -CREATE OR REPLACE PROCEDURE SP__delete_variable_definition(IN p_definition_id integer, p_obj_name varchar) -LANGUAGE SQL -AS $$ - -- delete the expresion first - SET @exp_id = (SELECT expression_id from variable_actual_definition where p_definition_id = obj_actual_definition); - CALL SP__delete_expression(@exp_id); - CALL SP__delete_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - -$$; - -# for testing the delete function - -USE amp_core; - -set @p_obj_name = 'bundles_by_priority'; -select * from obj_definition join obj_identifier on obj_definition.obj_id = obj_identifier.obj_id; --- select definition_id from obj_definition where obj_id = (SELECT obj_id FROM amp_core.obj_identifier WHERE obj_name = @p_obj_name); - --- set @fp_spec_id_control_definitionobj_definitionformal_parmspecedd1 = (select fp_spec_id from amp_core.edd_definition where definition_id = (select definition_id from obj_definition where obj_id = (SELECT obj_id FROM amp_core.obj_identifier WHERE obj_name = @p_obj_name))); --- CALL SP__insert_actual_parms_set(1, @fp_spec_id_edd1, 'UINT', '1', @ap_spec_id); --- CALL SP__insert_edd_instance(@edd_definition_id_9, @ap_spec_id,NULL, @edd_inst_id_1); - - --- Select * from amp_core.obj_definition; --- SELECT obj_id FROM amp_core.obj_identifier WHERE obj_name = @p_obj_name; --- SELECT * from amp_core.obj_definition where obj_id = (SELECT obj_id FROM amp_core.obj_identifier WHERE obj_name = @p_obj_name); - -SELECT * FROM vw_edd_instance; --- CALL SP__delete_obj_definition(0, null, @p_obj_name); -call SP__delete_edd_instance(null, 'bundles_by_priority'); --- CALL SP__delete_edd_instance(null, @p_o-- bj_name); - -SELECT * FROM vw_edd_instance; - - diff --git a/amp-sql/postgres/Database_Scripts/Routines/test.sql b/amp-sql/postgres/Database_Scripts/Routines/test.sql deleted file mode 100644 index a98606e..0000000 --- a/amp-sql/postgres/Database_Scripts/Routines/test.sql +++ /dev/null @@ -1,2411 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- ================================================================== --- Author: David Linko --- --- Description: inserting, updating and removing object formal and actual defintion. The backbone for the DB and all the objects that make it up. --- since deletes concasde if you remove the obj instance or definiton you remove that entity from the DB --- ================================================================== - - --- ================================================================== --- Parameters: --- in --- p_obj_type varchar - object of the type --- p_obj_name varchar - human readable name of the new object --- p_namespace_id integer - namespace this object belongs to --- out --- r_obj_id integer - id of the new object in the database --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_obj_metadata(IN p_obj_type_id integer, p_obj_name varchar, p_namespace_id integer, INOUT r_obj_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - - SELECT obj_metadata_id INTO r_obj_id - FROM obj_metadata - WHERE data_type_id=p_obj_type_id AND obj_name=p_obj_name AND namespace_id=p_namespace_id; - - IF (r_obj_id IS NULL) THEN - INSERT INTO obj_metadata(data_type_id, obj_name, namespace_id) VALUES(p_obj_type_id, p_obj_name, p_namespace_id)RETURNING r_obj_id; - - END IF; - -end$$; - - --- ================================================================== --- Parameters: --- in --- p_obj_id integer - --- --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__delete_obj_metadata(IN p_obj_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - DELETE FROM obj_metadata -WHERE obj_metadata_id = p_obj_id; - -end$$; - - - - --- ================================================================== --- Parameters: --- in --- p_obj_metadata_id integer - --- p_use_desc varchar - --- out --- r_formal_id integer - --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_obj_formal_definition(IN p_obj_metadata_id integer, p_use_desc varchar, INOUT r_formal_id integer) -LANGUAGE plpgsql -AS $$ -DECLARE - data_type integer; - adm_enum integer; - obj_enum integer; -BEGIN - - -- Get the next available ID for automatic enumeration of new formal definitions - SELECT data_type_id, adm_enum INTO data_type, adm_enum FROM vw_obj_metadata WHERE obj_metadata_id=p_obj_metadata_id; - SELECT COALESCE(MAX(vof.obj_enum)+1,0) INTO obj_enum FROM vw_obj_formal_def vof WHERE vof.data_type_id=data_type AND vof.adm_enum=adm_enum; - - INSERT INTO obj_formal_definition(obj_metadata_id, use_desc, obj_enum) VALUES(p_obj_metadata_id, p_use_desc, @obj_enum) Returning obj_formal_definition_id as r_formal_id ; - -end$$; - - - - --- ================================================================== --- Parameters: --- in IN p_obj_metadata_id integer, p_use_desc varchar, INOUT r_actual_id integer) --- --- out --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_obj_actual_definition(IN p_obj_metadata_id integer, p_use_desc varchar, INOUT r_actual_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - INSERT INTO obj_actual_definition(obj_metadata_id, use_desc) VALUES(p_obj_metadata_id, p_use_desc) RETURNING obj_actual_definition_id as r_actual_id; - -end$$; - - --- ================================================================== --- can use name or id for to delete --- Parameters: --- in --- p_obj_id integer - Id of the specific obj to delete --- p_obj_name varchar - name of the obj to delete --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__delete_obj_formal_definition(p_obj_id integer, p_obj_name varchar ) -LANGUAGE plpgsql -AS $$ BEGIN - IF( p_obj_id is NULL AND p_obj_name is not NULL) THEN - select obj_id FROM obj_metadata WHERE obj_name = p_obj_name INTO p_obj_id; - ELSE - LEAVE obj_delete; - END IF; - - DELETE FROM obj_metadata WHERE obj_id = p_obj_id; -END$$; - - - --- ================================================================== --- Parameters: --- in --- p_act_id integer --- p_obj_name varchar --- p_namespace_id integer --- --- ================================================================== --- for just removing the obj instance --- two options for removal if you want to remove a specific instance you can specify the instance id, --- or if you want to remove all the instances of a specific definition you can supply the definition name --- TODO: can add another option of adding a number and only removes up to that number of entries. --- maybe too overloaded -CREATE OR REPLACE PROCEDURE SP__delete_obj_actual_definition(p_act_id integer, p_obj_name varchar ) -LANGUAGE plpgsql -AS $$ -<> -BEGIN - - -- if its just removing one instance - IF( p_inst_id is not null) THEN - DELETE FROM obj_actual_definition WHERE actual_definition_id = p_act_id; - -- if its removing all instances with this defeintion - ELSE -- removing all instances with this name - IF( p_obj_name is null or p_namespace_id) then -- nothing to do - exit obj_inst_del; - END IF; - DELETE FROM obj_actual_definition where obj_metadata_id =(select obj_metadata_id from obj_metadat where obj_name = p_obj_name ); - END IF; -END$$; - --- STORED PROCEDURE(S) for creating an ari collection and entries - --- ================================================================== --- SP__insert_ac_id --- adds an ari collection to the database --- Parameters: --- in --- p_num_entries integer - number of entries in the ac --- p_use_desc varchar - human readable description --- OUT --- r_ac_id integer- id of the ac --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_ac_id(IN p_num_entries integer, p_use_desc varchar, OUT r_ac_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - INSERT INTO ari_collection(num_entries, use_desc) VALUES(p_num_entries, p_use_desc) RETURNING ari_collection_id as r_ac_id; - -end$$; - - - --- ================================================================== --- SP__insert_ac_formal_entry --- adds a formal ari entry into the database. --- stops if the order_num is > the number of entries for the target ac --- Parameters: --- in --- p_ac_id integer - id of the ari collection this entry belongs to --- p_definition_id integer - id of the definition --- p_order_num integer - order number --- OUT --- r_ac_entry_id integer - entry id --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_ac_formal_entry(IN p_ac_id integer, p_definition_id integer, p_order_num integer, INOUT r_ac_entry_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - /*IF p_order_num < (select num_entries from ari_collection where ari_collection.ac_id = p_definition_id) THEN - LANGUAGE plpgsql*/ - INSERT INTO ari_collection_entry(ac_id, order_num) VALUES(p_ac_id, p_order_num) RETURNING ari_collection_entry_id as r_ac_entry_id; - - INSERT INTO ari_collection_formal_entry(ac_entry_id, obj_formal_definition_id) VALUES(r_ac_entry_id, p_definition_id); - /*END; - END IF;*/ -end$$; - - - --- ================================================================== --- SP__insert_ac_actual_entry --- adds a actual ari entry into the database. --- stops if the order_num is > the number of entries for the target ac --- Parameters: --- in --- p_ac_id integer - id of the ari collection this entry belongs to --- p_definition_id integer - id of the definition --- p_order_num integer - order number --- OUT --- r_ac_entry_id integer - entry id --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_ac_actual_entry(IN p_ac_id integer, p_definition_id integer, p_order_num integer, -OUT r_ac_entry_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - -- IF p_order_num < (select num_entries from ari_collection where ari_collection.ac_id = p_definition_id) THEN - - INSERT INTO ari_collection_entry(ac_id, order_num) VALUES(p_ac_id, p_order_num) RETURNING ari_collection_entry_id as r_ac_entry_id; - - INSERT INTO ari_collection_actual_entry(ac_entry_id, obj_actual_definition_id) VALUES(r_ac_entry_id, p_definition_id); --- END; - -- END IF; -end$$; - - --- --- --- CREATE OR REPLACE PROCEDURE SP__insert_ari_collection(IN p_num_entries integer, p_definition_ids_list varchar(10000), p_instance_ids_list varchar(10000), p_use_desc varchar, INOUT r_ac_id integer) - --- CALL SP__insert_ac_id(p_num_entries, p_use_desc, r_ac_id); --- -- TODO -- verify that lists are same size or NULL prior to processing, backout transaction on failure and return NULL --- @ac_id := r_ac_id; --- @s := 'INSERT INTO ari_collection_entry(ac_id, definition_id, instance_id, order_num) VALUES'; --- --- @loops := 1; --- -- -- @def_id := NULL; --- -- -- @inst_id := NULL; --- WHILE @loops < p_num_entries DO - --- -- @def_id --- IF p_definition_ids_list IS NOT NULL THEN --- LANGUAGE plpgsql ---AS $$ --- @def_id := TRIM(SUBSTRING_INDEX(p_definition_ids_list, ',', 1)); --- SET p_definition_ids_list = REPLACE(p_definition_ids_list, CONCAT(@def_id, ','), ''); --- -- IF strcmp(@def_id, 'NULL') THEN --- -- @def_id := NULL; --- -- ELSE --- @def_id := CAST(@def_id AS UNSIGNED); --- -- END IF; --- END; --- ELSE --- LANGUAGE plpgsql --- AS $$ --- @def_id := 'NULL'; --- END; --- END IF; --- --- -- @inst_id --- IF p_instance_ids_list IS NOT NULL THEN --- LANGUAGE plpgsql --- AS $$ --- @inst_id := TRIM(SUBSTRING_INDEX(p_instance_ids_list, ',', 1)); --- SET p_instance_ids_list = REPLACE(p_instance_ids_list, CONCAT(@inst_id, ','), ''); --- -- IF strcmp(@inst_id, 'NULL') THEN --- -- @inst_id := NULL; --- -- ELSE --- @inst_id := CAST(@inst_id AS UNSIGNED); --- -- END IF; --- END; --- ELSE --- LANGUAGE plpgsql --- AS $$ --- @inst_id := 'NULL'; --- END; --- END IF; --- --- @s := CONCAT(@s, '(', @ac_id, ',', @def_id , ',', @inst_id, ',', @loops, '),'); --- -- SELECT @s; --- @loops := @loops + 1; --- END; --- END WHILE; --- --- -- @def_id --- IF p_definition_ids_list IS NOT NULL THEN --- LANGUAGE plpgsql --- AS $$ --- @def_id := TRIM(SUBSTRING_INDEX(p_definition_ids_list, ',', 1)); --- SET p_definition_ids_list = REPLACE(p_definition_ids_list, CONCAT(@def_id, ','), ''); --- -- IF strcmp(@def_id, 'NULL') THEN --- -- @def_id := NULL; --- -- ELSE --- @def_id := CAST(@def_id AS UNSIGNED); --- -- END IF; --- END; --- ELSE --- LANGUAGE plpgsql --- AS $$ --- @def_id := 'NULL'; --- END; --- END IF; --- --- -- @inst_id --- IF p_instance_ids_list IS NOT NULL THEN --- LANGUAGE plpgsql --- AS $$ --- @inst_id := TRIM(SUBSTRING_INDEX(p_instance_ids_list, ',', 1)); --- SET p_instance_ids_list = REPLACE(p_instance_ids_list, CONCAT(@inst_id, ','), ''); --- -- IF strcmp(@inst_id, 'NULL') THEN --- -- @inst_id := NULL; --- -- ELSE --- @inst_id := CAST(@inst_id AS UNSIGNED); --- -- END IF; --- END; --- ELSE --- LANGUAGE plpgsql --- AS $$ --- @inst_id := 'NULL'; --- END; --- END IF; --- --- @s := CONCAT(@s, '(', @ac_id, ',', @def_id, ',', @inst_id, ',', @loops, ')'); --- -- SELECT @s; --- PREPARE stmt FROM @s; --- EXECUTE stmt; --- end$$; - - - - --- STORED PROCEDURE(S) for the actaul parameters specefications and actual parameter sets. has real data - - --- ================================================================== --- SP__insert_actual_parmspec --- inserting an actual parmspec into db --- IN --- p_fp_spec_id integer - the id of the formal parm spec for this actual parmspec --- p_tnvc_id integer - TNVC corresponding to actual parameter definition --- p_use_desc varchar - human readable describtion --- OUT --- r_ap_spec_id integer - id of the parmspec in the db --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_actual_parmspec_tnvc(IN p_fp_spec_id integer, p_tnvc_id integer, p_use_desc varchar, INOUT r_ap_spec_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - INSERT INTO actual_parmspec(fp_spec_id, tnvc_id, use_desc) VALUES(p_fp_spec_id, p_tnvc_id, p_use_desc) RETURNING actual_parmspec_id as r_ap_spec_id; - -end$$; - - --- ================================================================== --- SP__insert_actual_parmspec --- inserting an actual parmspec into db --- IN --- p_fp_spec_id integer - the id of the formal parm spec for this actual parmspec --- p_num_parms integer - number of parms --- p_use_desc varchar - human readable describtion --- OUT --- r_ap_spec_id integer - id of the parmspec in the db --- ================================================================== --- TODO: p_num_parms argument is deprecated and will be removed - - -CREATE OR REPLACE PROCEDURE SP__insert_actual_parmspec(IN p_fp_spec_id integer, p_num_parms integer, p_use_desc varchar, INOUT r_ap_spec_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - DECLARE tnvc_id INT; - CALL SP__insert_tnvc_collection(p_use_desc, tnvc_id); - CALL SP__insert_actual_parmspec_tnvc(p_fp_spec_id, tnvc_id, p_use_desc, r_ap_spec_id); -end$$; - - --- ================================================================== --- SP__insert_actual_parms_object --- inserting an actual parm object into spec --- IN --- p_ap_spec_id integer - id of the spec this object is being added --- p_order_num integer - order number --- p_data_type_id integer - the id of the datatype in the data type table --- p_obj_actual_definition integer - id of the object for the parm --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_actual_parms_object(IN p_ap_spec_id integer, p_order_num integer, p_data_type_id varchar , p_obj_actual_definition integer) -LANGUAGE plpgsql -AS $$ BEGIN - DECLARE ap_tnvc_id, r_tnvc_entry_id INT; - SELECT tnvc_id INTO ap_tnvc_id FROM actual_parmspec WHERE ap_spec_id = p_ap_spec_id; - - - CALL SP__insert_tnvc_obj_entry(ap_tnvc_id, p_order_num, p_data_type_id, p_obj_actual_definition, r_tnvc_entry_id); - - - -end$$; - - --- ================================================================== --- SP__insert_actual_parms_names --- inserting an actual parm reference by name into spec. This parm gets it value from the object that defines this parm spec --- IN --- p_ap_spec_id integer - id of the spec this object is being added --- p_order_num integer - order number --- p_data_type_id integer - the id of the datatype in the data type table --- p_fp_id integer - id of the formal parm this parm reference --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_actual_parms_names(IN p_ap_spec_id integer, p_order_num integer, p_data_type_id varchar, p_fp_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - DECLARE ap_tnvc_id INT; - DECLARE dt_id INT; - - SELECT tnvc_id INTO ap_tnvc_id FROM actual_parmspec WHERE ap_spec_id = p_ap_spec_id; - - SELECT data_type_id INTO dt_id FROM data_type WHERE type_name = p_data_type_id; - - INSERT INTO type_name_value_entry(tnvc_id, order_num, data_type_id, data_name, fp_id) VALUES(ap_tnvc_id, p_order_num, dt_id, p_data_Type_id, p_fp_id); - - - -end$$; - - --- ================================================================== --- SP__insert_actual_parms_tnvc --- inserting an actual parm tnvc into spec. --- IN --- p_ap_spec_id integer - id of the spec this object is being added --- p_order_num integer - order number --- p_data_type_id integer - the id of the datatype in the data type table --- p_tnvc_id integer - id of the type name value collection --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_actual_parms_tnvc(IN p_ap_spec_id integer, p_order_num integer, p_tnvc_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - DECLARE ap_tnvc_id, r_entry_id INT; - SELECT tnvc_id INTO ap_tnvc_id FROM actual_parmspec WHERE ap_spec_id = p_ap_spec_id; - - CALL SP__insert_tnvc_tnvc_entry(ap_tnvc_id, p_order_num, p_tnvc_id, r_entry_id); -end$$; - - --- ================================================================== --- SP__insert_actual_parms_ac --- inserting an actual parm ac into spec. --- IN --- p_ap_spec_id integer - id of the spec this object is being added --- p_order_num integer - order number --- p_data_type_id integer - the id of the datatype in the data type table --- p_ac_id integer - id of the ari collection --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_actual_parms_ac(IN p_ap_spec_id integer, p_order_num integer, p_ac_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - DECLARE ap_tnvc_id, r_entry_id INT; - SELECT ap_tnvc_id=tnvc_id FROM actual_parmspec WHERE ap_spec_id = p_ap_spec_id; - - CALL SP__insert_tnvc_ac_entry(ap_tnvc_id, p_order_num, p_ac_id, r_entry_id); - -end$$; - - - - --- was used before one there wasnt two types of actual_parms so it was easy to parse a --- a list of parms --- --- --- --- CREATE OR REPLACE PROCEDURE SP__insert_actual_parms_set(IN p_num_parms integer, p_fp_spec_id integer, p_data_types_list varchar(10000), p_data_values_list varchar(10000), INOUT r_ap_spec_id integer) - --- CALL SP__insert_actual_parmspec(p_fp_spec_id, r_ap_spec_id); --- @ap_spec_id := r_ap_spec_id; --- @s := 'INSERT INTO actual_parm(order_num, ap_type, data_value, ap_spec_id) VALUES'; --- @loops := 1; --- WHILE @loops < p_num_parms DO - --- -- @data_type --- @data_type := TRIM(SUBSTRING_INDEX(p_data_types_list, ',', 1)); --- SET p_data_types_list = REPLACE(p_data_types_list, CONCAT(@data_type, ','), ''); --- --- -- @data_value --- @data_value := TRIM(SUBSTRING_INDEX(p_data_values_list, ',', 1)); --- SET p_data_values_list = REPLACE(p_data_values_list, CONCAT(@data_value, ','), ''); --- --- @s = CONCAT(@s, '(', @loops, ',', (SELECT data_type_id FROM data_type WHERE type_name := @data_type), ',', '"', @data_value, '"', ',', @ap_spec_id, '),'); --- @loops := @loops + 1; --- END; --- END WHILE; --- --- -- @data_type --- @data_type := TRIM((SUBSTRING_INDEX(p_data_types_list, ',', 1))); --- --- --- -- @data_value --- @data_value := TRIM(SUBSTRING_INDEX(p_data_values_list, ',', 1)); - --- @s = CONCAT(@s, '(', @loops, ',', (SELECT data_type_id FROM data_type WHERE type_name := @data_type), ',', '"', @data_value, '"', ',', @ap_spec_id, ')'); --- PREPARE stmt FROM @s; --- EXECUTE stmt; - --- end$$; --- - - --- inserting reg agents into the db - --- ================================================================== --- SP__insert_agent --- inserting a new agent into the systemß --- IN --- p_agent_id_string- name of the agent to insert --- OUT --- r_registered_agents_id - teh id of the agent in the db --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_agent(IN p_agent_id_string varchar, INOUT r_registered_agents_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - @cur_time := NOW(); - @lower_name := LOWER(p_agent_id_string); - @eid := NULL; - SELECT registered_agents_id INTO @eid FROM registered_agents WHERE @lower_name = agent_id_string; - - IF (@eid IS NOT NULL) THEN BEGIN - UPDATE registered_agents SET last_registered = @cur_time WHERE registered_agents_id=@eid; - SET r_registered_agents_id = @eid; - END; - ELSE BEGIN - INSERT INTO registered_agents (agent_id_string,first_registered, last_registered) - VALUES (@lower_name, @cur_time, @cur_time) RETURNING ower_name_id as r_registered_agents_id; - - END; - END IF; -end$$; - - - --- ================================================================== --- Author: David Linko --- --- Description: inserting, updating and removing constant formal and actual definitions --- using the obj routines --- --- ================================================================== - --- ================================================================== --- SP__insert_const_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the constant --- p_data_type varchar - name of the data type for the constant --- p_data_value_string varchar - blob conating the encoded value of the constant --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_const_actual_definition(IN p_obj_id integer, p_use_desc varchar, p_data_type varchar, p_data_value_string varchar, INOUT r_actual_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_actual_definition_id); - @data_id = (SELECT data_type_id FROM data_type WHERE type_name := p_data_type); - INSERT INTO const_actual_definition(obj_actual_definition_id, data_type_id, data_value) VALUES(r_actual_definition_id, @data_id, p_data_value_string); -end$$; - - - --- ================================================================== --- SP__delete_const_actual_definition --- cna us either hte name or the id of the constant to delete --- Parameters: --- in --- p_obj_id integer - id of the constan to delete --- p_obj_name varchar - name of the constant to delete --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__delete_const_actual_definition(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ BEGIN - IF (p_obj_id != null) THEN - @metadata_id = (SELECT obj_metadata_id FROM obj_actual_definition WHERE obj_actual_definition_id := p_obj_id ); - ELSE - IF (p_obj_name != NULL) THEN - @metadata_id = (SELECT obj_metadata_id FROM obj_metadata WHERE obj_name := p_obj_name); - END IF; - END IF; - CALL SP__delete_obj_metadata(@metadata_id); - -END$$; - - --- ================================================================== --- Author: David Linko --- --- Description: inserting, updating and removing control formal and actual definitions --- using the obj routines --- --- ================================================================== - - --- ================================================================== --- SP__insert_control_formal_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the constant --- p_data_type varchar - name of the data type for the constant --- p_data_value_string varchar - blob conating the encoded value of the constant --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_control_formal_definition(IN p_obj_id integer, p_use_desc varchar, p_fp_spec_id integer, INOUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_formal_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO control_formal_definition(obj_formal_definition_id, fp_spec_id) VALUES(r_definition_id, p_fp_spec_id); -end$$; - - --- ================================================================== --- SP__delete_control_formal_definition; --- Parameters: --- in --- p_obj_id - id of the control to delete --- p_obj_name - name of the control to delete --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__delete_control_formal_definition(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__delete_obj_formal_definition(p_obj_id, p_obj_name); -end$$; - - - --- ================================================================== --- SP__insert_control_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the constant --- p_data_type varchar - name of the data type for the constant --- p_data_value_string varchar - blob conating the encoded value of the constant --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_control_actual_definition(IN p_obj_definition_id integer, p_ap_spec_id integer, p_use_desc varchar, INOUT r_instance_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_definition_id, p_use_desc, r_instance_id); - - -- TODO: Skip insert if it has no parameters - INSERT INTO control_actual_definition(obj_actual_definition_id, ap_spec_id) VALUES(r_instance_id, p_ap_spec_id); -end$$; - - - --- ================================================================== --- SP__delete_control_actual_definition; --- Parameters: --- in --- p_obj_id integer - actual_definiton id of the control that is to be deleted --- p_obj_name varchar- name of the control to delete, this allows to delete all the actual definitons --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__delete_control_actual_definition(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ -<>BEGIN - - DECLARE done INT DEFAULT FALSE; - DECLARE actual_definition_id_hold, ap_spec_id_hold integer; - DECLARE actual_definition_cursor CURSOR - FOR SELECT actual_definition_id, ap_spec_id FROM vw_ctrl_actual_definition WHERE obj_name = p_obj_name; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - -- only one thing to remove - If( p_inst_id is not null) then - @ap_id = (SELECT ap_spec_id from ctrl_actual_definition where actual_definition_id := p_inst_id ); - IF( @ap_id is not null) THEN - DELETE FROM actual_parmspec WHERE ap_spec_id = @ap_id; - END IF; - DELETE FROM ctrl_actual_definition -WHERE - intance_id = p_actual_definition_id; - CALL SP__delete_obj_actual_definition(p_actual_definition_id, p_obj_name); - ELSE -- removing all instances with this name - IF( p_obj_name is null) then -- nothing to do - exit ctrl_actual_definition_del; - END IF; - OPEN actual_definition_cursor; - <> LOOP - FETCH NEXT FROM actual_definition_cursor INTO - actual_definition_id_hold, ap_spec_id_hold; - IF done THEN - exit read_loop; - END IF; - - DELETE FROM actual_parmspec WHERE ap_spec_id = ap_spec_id_hold; - - DELETE FROM ctrl_actual_definition -WHERE - ctrl_actual_definition.actual_definition_id = actual_definition_id_hold; - END LOOP; - CALL SP__delete_obj_actual_definition(null, p_obj_name); - end if; - CLOSE actual_definition_cursor; -END$$; - - - --- STORED PROCEDURE(S) - --- --- --- CREATE OR REPLACE PROCEDURE SP__insert_data_value(IN p_value_converted varchar, p_value_string varchar, INOUT r_value_id integer) - --- INSERT INTO data_value(value_converted, value_string) VALUES(p_value_converted, p_value_string) RETURNING INTO_id as r_value_id; - --- end$$; --- - --- ================================================================== --- Author: David Linko --- --- Description: inserting, updating and removing EDD formal and actual definitions --- using the obj routines --- --- ================================================================== - --- ================================================================== --- SP__insert_edd_formal_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the edd --- p_data_type varchar - name of the data type for the edd --- p_data_value_string varchar - blob conating the encoded value of the edd --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_edd_formal_definition(IN p_obj_id integer, p_use_desc varchar, p_fp_spec_id integer, p_external_data_type varchar, INOUT r_formal_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_formal_definition(p_obj_id, p_use_desc, r_formal_definition_id); - INSERT INTO edd_formal_definition(obj_formal_definition_id, fp_spec_id, data_type_id) VALUES(r_formal_definition_id, p_fp_spec_id, (SELECT data_type_id FROM data_type WHERE type_name = p_external_data_type)); -end$$; - - - - --- ================================================================== --- SP__delete_edd_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the edd to delete --- p_obj_name varchar - name of the edd to delete --- --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__delete_edd_formal_defintion(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ BEGIN - IF( p_obj_id is Null AND p_obj_name is not NULL) THEN - SET p_obj_id = (select obj_id FROM obj_metadata WHERE obj_name = p_obj_name); - ELSE - LEAVE edd_def_del; - END IF; - - IF(p_obj_name is NULL) THEN - SET p_obj_name = (select obj_name from vw_edd_formal where obj_id = p_obj_id); - END IF ; - - -- deleting all instances - CALL SP__delete_edd_actual_definition(null, p_obj_name); - - @def_id = (select obj_formal_definition_id from obj_formal_definition where obj_metadata_id := p_obj_id); - @fp_id = (SELECT fp_spec_id from edd_formal_definition where obj_formal_definition_id := @def_id ); - DELETE FROM formal_parmspec WHERE fp_spec_id = @fp_id; - - CALL SP__delete_obj_formal_defintion(p_obj_id, p_obj_name); -end$$; - - - --- ================================================================== --- SP__insert_edd_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the constant --- p_data_type varchar - name of the data type for the constant --- p_data_value_string varchar - blob conating the encoded value of the constant --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_edd_actual_definition(IN p_obj_definition_id integer, p_use_desc varchar, p_ap_spec_id integer, OUT r_actual_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_definition_id, p_use_desc, r_actual_definition_id); - INSERT INTO edd_actual_definition(obj_actual_definition_id, ap_spec_id) VALUES(r_actual_definition_id, p_ap_spec_id); -end$$; - - - --- ================================================================== --- SP__delete_edd_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the object metadata --- p_use_desc varchar - humanreadable description of the constant --- p_data_type varchar - name of the data type for the constant --- p_data_value_string varchar - blob conating the encoded value of the constant --- out --- r_actual_definition_id integer id of the actual defintion entry --- ================================================================== --- for instance can supply the definiton name to remove all the instances of that definition or can remove - -CREATE OR REPLACE PROCEDURE SP__delete_edd_actual_definition(IN p_actual_definition_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ BEGIN - - DECLARE done INT DEFAULT FALSE; - DECLARE actual_definition_id_hold, ap_spec_id_hold integer; - DECLARE actual_definition_cursor CURSOR - FOR SELECT actual_definition_id, ap_spec_id FROM vw_edd_actual WHERE obj_name = p_obj_name; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - -- only one thing to remove - If( p_inst_id is not null) then - @ap_id = (SELECT ap_spec_id from edd_actual_definition where actual_definition_id := p_inst_id ); - IF( @ap_id is not null) THEN - DELETE FROM actual_parmspec WHERE ap_spec_id = @ap_id; - END IF; - DELETE FROM edd_actual_definition -WHERE - intance_id = p_actual_definition_id; - CALL SP__delete_obj_actual_definition(p_actual_definition_id, p_obj_name); - ELSE -- removing all instances with this name - IF( p_obj_name is null) then -- nothing to do - leave edd_actual_definition_del; - END IF; - OPEN actual_definition_cursor; - <> LOOP - FETCH NEXT FROM actual_definition_cursor INTO - actual_definition_id_hold, ap_spec_id_hold; - IF done THEN - LEAVE read_loop; - END IF; - - DELETE FROM actual_parmspec WHERE ap_spec_id = ap_spec_id_hold; - - DELETE FROM edd_actual_definition -WHERE - edd_actual_definition.actual_definition_id = actual_definition_id_hold; - END LOOP; - CALL SP__delete_obj_actual_definition(null, p_obj_name); - end if; - CLOSE actual_definition_cursor; -end$$; - - --- STORED PROCEDURE(S) for creating expresions that are used in rules and variables - --- DROP PROCEDURE IF EXISTS sp_insert_postfix_operations; --- --- CREATE OR REPLACE PROCEDURE sp_insert_postfix_operations(IN p_num_operators integer, p_operator_ids_list varchar(1000), p_operands_values_list varchar(10000), INOUT r_postfix_operations integer) - -- we get a list of operators and a list of operands need to create an ari collection for both --- -- need to finish --- -- generate an ari collection --- -- add in the airs --- -- call sp_insert_ari_collection(IN p_num_entries integer, p_definition_ids_list varchar(10000), p_instance_ids_list varchar(10000), p_use_desc varchar, INOUT r_ac_id integer) --- --- end$$; --- - - --- ================================================================== --- SP__insert_expression --- adds an expression to the database --- Parameters: --- in --- p_out_type integer - data type id for the return type of the expression --- p_num_operators integer - number of operators --- p_postfix_ids_list varchar(1000) - id of the ac that lists the equation in postfix notation --- OUT --- r_expr_id integer - id of the expr in the database --- ================================================================= - - -CREATE OR REPLACE PROCEDURE SP__insert_expression(IN p_out_type integer, -p_postfix_operations integer, INOUT r_expr_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - -- SELECT p_out_type; - -- IF p_out_type = 2 or p_out_type = 12 or p_out_type = 3 or p_out_type = 0 THEN BEGIN - INSERT INTO expression(data_type_id, ac_id) VALUES(p_out_type, p_postfix_operations) RETURNING expression_id as r_expr_id; - - -- END; - -- END IF; -end$$; - - - --- ================================================================== --- SP__delete_expression --- Delete an expression from the database --- Parameters: --- in --- p_expr_id integer - id of the expr in the database to delete --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__delete_expression(IN p_expr_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - DELETE from expression WHERE (expression_id = p_expr_id); -end$$; - - --- STORED PROCEDURE(S) for the formal parameters specefications. Stores type name information. - - --- ================================================================== --- SP__insert_formal_parmspec --- inserts a new formal parmspec in the db --- IN --- p_num_parms integer - number if parms in the spec --- p_use_desc varchar - human readable describtion --- OUT --- r_fp_spec_id integer - the id of the spec --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_formal_parmspec(IN p_num_parms integer, p_use_desc varchar, OUT r_fp_spec_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - INSERT INTO formal_parmspec(num_parms, use_desc) VALUES(p_num_parms, p_use_desc) RETURNING formal_parmspec_id as r_fp_spec_id; - -end$$; - - - - --- ================================================================== --- SP__insert_formal_parmspec_entry --- insert a single entry into a formal parm --- IN --- p_fp_spec_id integer - id of the formal parmspec for this entry --- p_order_num integer - order of the entry in the parmspec --- p_parm_name varchar - name of the parm used for parm by name --- p_data_type varchar - data type of the parm --- p_obj_definition_id integer - optional default value of this parm --- OUT --- r_fp_id integer --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_formal_parmspec_entry(IN p_fp_spec_id integer, p_order_num integer, p_parm_name varchar, p_data_type varchar, p_obj_definition_id integer, INOUT r_fp_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - INSERT INTO formal_parm -( -fp_spec_id, -order_num, -parm_name, -data_type_id, -obj_actual_definition_id) -VALUES -(p_fp_spec_id, -p_order_num, -p_parm_name, -(select data_type_id from data_type where type_name = p_data_type), -p_obj_definition_id) RETURNING RETURNING_id as r_fp_id; - - -end$$; - - - - --- ================================================================== --- SP__insert_formal_parmspec --- inserts a list of formal parms into a spec, uses three ',' delimenated lists to --- store type name and default value info for the formal parms --- IN --- p_num_parms integer - number of parms in the parmspec --- p_use_desc varchar - human readable description --- p_data_types_list varchar(10000 ) - list of types for the parms --- p_parm_names_list varchar(10000) - list of the names for the parms --- p_default_values_list varchar(10000) - list of the default values --- OUT --- r_fp_spec_id integer - formal parmspec id --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_formal_parms_set(IN p_num_parms integer, p_use_desc varchar, p_data_types_list varchar(10000), p_parm_names_list varchar(10000), - p_default_values_list varchar(10000), INOUT r_fp_spec_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_formal_parmspec(p_num_parms, p_use_desc, r_fp_spec_id); - @fp_spec_id := r_fp_spec_id; - @s := 'INSERT INTO formal_parm(fp_spec_id, order_num, parm_name, data_type_id, obj_actual_definition_id) VALUES'; - @loops := 1; - WHILE @loops < p_num_parms DO - BEGIN - -- @data_type - @data_type := TRIM(SUBSTRING_INDEX(p_data_types_list, ',', 1)); - SET p_data_types_list = REPLACE(p_data_types_list, CONCAT(@data_type, ','), ''); - - -- @parm_name - @parm_name := TRIM(SUBSTRING_INDEX(p_parm_names_list, ',', 1)); - SET p_parm_names_list = REPLACE(p_parm_names_list, CONCAT(@parm_name, ','), ''); - - -- @default_value - @default_value := TRIM(SUBSTRING_INDEX(p_default_values_list, ',', 1)); - IF @default_value = 'NULL' THEN @default_value := null; - ELSEIF @default_value = 'null' THEN @default_value := null; - END IF; - SET p_default_values_list = REPLACE(p_default_values_list, CONCAT(@default_value, ','), ''); - - @s = CONCAT(@s, '(', @fp_spec_id, ',', @loops, ',', '"', @parm_name, '"', ',', (SELECT data_type_id FROM data_type WHERE type_name := @data_type), ',', '"', @default_value, '"', '),'); - @loops := @loops + 1; - END; - END WHILE; - - -- @data_type - @data_type := TRIM((SUBSTRING_INDEX(p_data_types_list, ',', 1))); - - -- @parm_name - @parm_name := TRIM(SUBSTRING_INDEX(p_parm_names_list, ',', 1)); - - -- @default_value - IF @default_value = 'NULL' THEN @default_value := null; - ELSEIF @default_value = 'null' THEN @default_value := null; - END IF; - SET p_default_values_list = REPLACE(p_default_values_list, CONCAT(@default_value, ','), ''); - - @s = CONCAT(@s, '(', @fp_spec_id, ',', @loops, ',', (SELECT data_type_id FROM data_type WHERE type_name := @data_type), ',', '"', @parm_name, '"', ',', '"', @default_value, '"', ')'); - PREPARE stmt FROM @s; - EXECUTE stmt; - -end$$; - - - --- STORED PROCEDURE(S) for creating literals --- need to update to allow ot be ari - - --- ================================================================== --- SP__insert_literal_actual_definition --- IN --- p_obj_id integer - id of the metadata info --- p_use_desc varchar - human readable describtion --- p_data_type varchar - primitive data type of the literal --- p_data_value_string varchar - calue of the literal encoded as a string --- OUT --- r_definition_id integer - id of teh literal --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_literal_actual_definition(IN p_obj_id integer, p_use_desc varchar, p_data_type varchar, p_data_value_string varchar, INOUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO literal_actual_definition(obj_actual_definition_id, data_type_id, data_value) VALUES(r_definition_id, (SELECT data_type_id FROM data_type WHERE type_name = p_data_type), p_data_value_string); -end$$; - - - --- ================================================================== --- SP__delete_literal_actual_definition --- IN --- p_obj_id integer - id of the lit to be deleted --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__delete_literal_actual_definition(IN p_obj_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__delete_obj_definition(p_obj_id); -end$$; - --- STORED PROCEDURE(S) for creating updating and deleting macro definitions and actuals - --- ================================================================== --- SP__insert_macro_formal_definition --- IN --- p_obj_id integer - id of the metadata info --- p_use_desc varchar - human readable describtion --- p_fp_spec_id integer - formal parmspec of the macro --- p_max_call_depth integer - max call depth of the macro --- p_definition_ac integer - ari collection definining the macro --- OUT --- r_definition_id integer - id of the new formal definition --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_macro_formal_definition(IN p_obj_id integer, p_use_desc varchar, p_fp_spec_id integer, p_max_call_depth integer, p_definition_ac integer, INOUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_formal_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO macro_formal_definition(obj_formal_definition_id, fp_spec_id, ac_id, max_call_depth) VALUES(r_definition_id, p_fp_spec_id, p_definition_ac, p_max_call_depth); -end$$; - - - --- ================================================================== --- SP__delete_mac_formal_defintion --- IN --- p_obj_id integer - id of the macro to be deleted --- p_obj_name varchar - name of the macro to delete --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__delete_mac_formal_defintion(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ BEGIN - IF( p_obj_id is Null AND p_obj_name is not NULL) THEN - SET p_obj_id = (select obj_id FROM obj_metadata WHERE obj_name = p_obj_name); - ELSE - LEAVE mac_def_del; - END IF; - - IF(p_obj_name is NULL) THEN - SET p_obj_name = (select obj_name from vw_mac_formal where obj_id = p_obj_id); - END IF ; - - -- deleting all actuals - CALL SP__delete_macro_actual(null, p_obj_name); - - @def_id = (select definition_id from obj_formal_definition where obj_id := p_obj_id); - @fp_id = (SELECT fp_spec_id from macro_formal_definition where definition_id := @def_id ); - @ac_id = (SELECT ac_id FROM macro_formal_definition where definition_id := @def_id ); - - DELETE FROM formal_parmspec WHERE fp_spec_id = @fp_id; - DELETE FROM ari_collection WHERE ac_id = @ac_id; - - CALL SP__delete_obj_formal_defintion(p_obj_id, p_obj_name); -end$$; - - - --- ================================================================== --- SP__insert_macro_actual_definition --- -- IN --- p_obj_id integer - id of the metadata info --- p_ap_spec_id integer - actual parmspec id --- p_actual_ac integer - ari collection containg all actual ARI for this macro --- p_use_desc varchar - human readable description --- OUT --- r_actual_id integer - id of the new actual definition --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_macro_actual_definition(IN p_obj_definition_id integer, p_ap_spec_id integer, p_actual_ac integer, p_use_desc varchar, INOUT r_actual_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_definition_id, p_use_desc, r_actual_id); - INSERT INTO macro_actual(obj_actual_definition_id, ap_spec_id, ac_id) VALUES(r_actual_id, p_ap_spec_id, p_actual_ac); -end$$; - - --- ================================================================== --- SP__delete_mac_actual_definition --- IN --- p_obj_id integer - id of the macro to be deleted --- p_obj_name varchar - name of the macro to delete --- ================================================================== --- for actual can supply the definiton name to remove all the actuals of that definition or can remove - -CREATE OR REPLACE PROCEDURE SP__delete_mac_actual_definition(IN p_inst_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ BEGIN - - DECLARE done INT DEFAULT FALSE; - DECLARE actual_id_hold, ap_spec_id_hold, ac_id_hold integer; - DECLARE actual_cursor CURSOR - FOR SELECT actual_id, ap_spec_id, ac_id WHERE obj_name = p_obj_name; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - -- only one thing to remove - If( p_inst_id is not null) then - @ap_id = (SELECT ap_spec_id from macro_actual_definition where actual_id := p_inst_id ); - IF( @ap_id is not null) THEN - DELETE FROM actual_parmspec WHERE ap_spec_id = @ap_id; - END IF; - DELETE FROM macro_actual -WHERE - intance_id = p_inst_id; - CALL SP__delete_obj_actual(p_inst_id, p_obj_name); - ELSE -- removing all actuals with this name - IF( p_obj_name is null) then -- nothing to do - leave mac_inst_del; - END IF; - OPEN actual_cursor; - <> LOOP - FETCH NEXT FROM actual_cursor INTO - actual_id_hold, ap_spec_id_hold, ac_id_hold; - IF done THEN - LEAVE read_loop; - END IF; - - DELETE FROM actual_parmspec WHERE ap_spec_id = ap_spec_id_hold; - DELETE FROM ari_collection WHERE ac_id = ac_id_hold; - - DELETE FROM macro_actual_definition -WHERE - macro_actual.actual_id = actual_id_hold; - END LOOP; - CALL SP__delete_obj_actual_definition(null, p_obj_name); - end if; - CLOSE actual_cursor; -end$$; - --- create messages - --- ================================================================== --- SP__insert_outgoing_message_set --- IN --- p_created_ts integer - created timestamp --- p_modified_ts integer - modified timestamp --- p_state integer - state of the message set --- p_agent_id integer - agent of this message --- OUT --- r_set_id integer - id of the set --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_outgoing_message_set(IN p_created_ts DATETIME, -p_modified_ts DATETIME, p_state integer, p_agent_id integer, INOUT r_set_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN -INSERT INTO outgoing_message_set (created_ts, modified_ts, state, agent_id) -VALUES (p_created_ts, p_modified_ts, p_state, p_agent_id) RETURNING VALUES (p_created_ts, p_modified_ts, p_state, p_agent_id) RETURNING as r_set_id;_id as r_set_id; - - -END$$; - - - --- ================================================================== --- SP__insert_outgoing_message_entry --- IN --- p_set_id integer - id of the outgoing message set this entry belongs toß --- p_message_order integer - order of this message in the set --- p_start_ts integer - start time --- p_ac_id integer - ac of this message --- OUT --- r_message_id integer - id of this message --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_outgoing_message_entry(IN p_set_id integer, p_message_order integer, p_start_ts datetime, p_ac_id integer, INOUT r_message_id integer) -LANGUAGE plpgsql -AS $$ BEGIN -INSERT INTO outgoing_message_entry (set_id, message_order, start_ts, ac_id) -VALUES (p_set_id, p_message_order, p_start_ts, p_ac_id) RETURNING VALUES (p_set_id, p_message_order, p_start_ts, p_ac_id) RETURNING as r_message_id;_id as r_message_id; - -END$$; - - - --- ================================================================== --- SP__update_outgoing_message_set --- IN --- p_set_id integer - id of the set to update --- p_state integer - state of the message set --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__update_outgoing_message_set(IN p_set_id integer, p_state integer) -LANGUAGE plpgsql -AS $$ BEGIN - - UPDATE outgoing_message_set - SET - modified_ts = NOW(), - state = p_state - WHERE set_id = p_set_id; -END$$; - - - --- ================================================================== --- SP__insert_incoming_message_set --- IN --- p_created_ts integer - created timestamp --- p_modified_ts integer - modified timestamp --- p_state integer - state of the message set --- p_agent_id integer - agent of this message --- OUT --- r_set_id integer - id of the set --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_incoming_message_set(IN p_created_ts datetime, -p_modified_ts datetime, p_state integer, p_agent_id integer, INOUT r_set_id integer) -LANGUAGE plpgsql -AS $$ BEGIN -INSERT INTO incoming_message_set (created_ts, modified_ts, state, agent_id) -VALUES (p_created_ts, p_modified_ts, p_state, p_agent_id) RETURNING VALUES (p_created_ts, p_modified_ts, p_state, p_agent_id) RETURNING as r_set_id;_id as r_set_id; - - -END$$; - - --- ================================================================== --- SP__insert_incoming_message_entry --- IN --- p_set_id integer - id of the outgoing message set this entry belongs toß --- p_message_order integer - order of this message in the set --- p_start_ts integer - start time --- p_ac_id integer - ac of this message --- OUT --- r_message_id integer - id of this message --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_incoming_message_entry(IN p_set_id integer, p_message_order integer, p_start_ts datetime, p_ac_id integer, INOUT r_message_id integer) -LANGUAGE plpgsql -AS $$ BEGIN -INSERT INTO incoming_message_entry (set_id, message_order, start_ts, ac_id) -VALUES (p_set_id, p_message_order, p_start_ts, p_ac_id) RETURNING VALUES (p_set_id, p_message_order, p_start_ts, p_ac_id) RETURNING as r_message_id;_id as r_message_id; - -END$$; - - - --- ================================================================== --- SP__update_incoming_message_set --- IN --- p_set_id integer - id of the set to update --- p_state integer - state of the message set --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__update_incoming_message_set(IN p_set_id integer, p_state integer) -LANGUAGE plpgsql -AS $$ BEGIN - - UPDATE incoming_message_set - SET - modified_ts = NOW(), - state = p_state - WHERE set_id = p_set_id; -END$$; - - - --- SP__insert_message_report_entry(message_id, order_num, ari_id, tnvc_id, ts) - - -CREATE OR REPLACE PROCEDURE SP__insert_message_report_entry(IN - p_msg_id integer, - p_order_num integer, - p_ari_id integer, - p_tnvc_id integer, - p_ts integer, - OUT r_obj_id integer - ) -LANGUAGE plpgsql -AS $$ BEGIN - - INSERT INTO report_definition (ari_id, ts, tnvc_id) VALUES (p_ari_id, p_ts, p_tnvc_id) RETURNING report_definition_id as r_obj_id; - - - IF p_order_num IS NULL THEN - SELECT order_num+1 INTO p_order_num FROM message_report_set_entry WHERE message_id=p_msg_id ORDER BY order_num DESC LIMIT 1; - END IF; - IF p_order_num IS NULL THEN - SET p_order_num = 0; - END IF; - - INSERT INTO message_report_set_entry (message_id, report_id, order_num) VALUES (p_msg_id, r_obj_id, p_order_num); - -end$$; - - --- SP__insert_message_group_agent_id(group_id, agent_id ) - - -CREATE OR REPLACE PROCEDURE SP__insert_message_group_agent_id(IN - p_group_id integer, - p_agent integer, - OUT r_obj_id integer - ) -LANGUAGE plpgsql -AS $$ BEGIN - INSERT INTO message_group_agents (group_id, agent_id) VALUES (p_group_id, p_agent) RETURNING message_group_agents_id as r_obj_id; - -end$$; - - --- SP__insert_message_group_agent_name(group_id, agent_name) - - -CREATE OR REPLACE PROCEDURE SP__insert_message_group_agent_name(IN - p_group_id integer, - p_agent VARCHAR(128), - OUT r_obj_id integer - ) -LANGUAGE plpgsql -AS $$ BEGIN - DECLARE eid INT; - CALL SP__insert_agent(p_agent, eid); -- Select or Insert Agent ID - INSERT INTO message_group_agents (group_id, agent_id) VALUES (p_group_id, eid) RETURNING message_group_agents_id as r_obj_id; - - -end$$; - - --- SP__insert_message_entry_agent( message_id, agent_name ) - - -CREATE OR REPLACE PROCEDURE SP__insert_message_entry_agent(IN - p_mid integer, - p_agent VARCHAR(128) - ) -LANGUAGE plpgsql -AS $$ BEGIN - DECLARE eid INT; - CALL SP__insert_agent(p_agent, eid); -- Select or Insert Agent ID - INSERT INTO message_agents (message_id, agent_id) VALUES (p_mid, eid); - -end$$; - - - - --- STORED PROCEDURE(S) For creating namespaces and adms - --- ================================================================== --- SP__insert_namespace --- insert a new namespace into the db --- Parameters: --- in --- p_namespace_type varchar - type of the namespace --- p_issuing_org varchar - name of the issuing organization for this ADM. --- p_name_string varchar- his is the human-readable name of the ADM that should appear --- in message logs, user-interfaces, and other human-facing --- applications --- p_version varchar -This is a string representation of the version of the ADM. --- ADM version representations are formated at the discretion of --- the publishing organization. --- out --- r_namespace_id integer - id of the namespace in the database --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_namespace(IN p_namespace_type varchar, p_issuing_org varchar, p_name_string -varchar, p_version varchar, INOUT r_namespace_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - - SELECT namespace_id INTO r_namespace_id - FROM namespace - WHERE namespace_type=p_namespace_type AND issuing_org=p_issuing_org AND name_string=p_name_string AND version_name=p_version; - IF (r_namespace_id IS NULL) THEN - INSERT INTO namespace(namespace_type, issuing_org, name_string, version_name) VALUES(p_namespace_type, p_issuing_org, p_name_string, p_version) RETURNING namespace_id as r_namespace_id; - - END IF; - -end$$; - - - --- ================================================================== --- SP__insert_network_defined_namespace --- insert a new network defined adm into the db --- Parameters: --- in --- p_issuing_org varchar - name of the issuing organization for this ADM. --- p_name_string varchar- this is the human-readable name of the ADM that should appear --- in message logs, user-interfaces, and other human-facing --- applications --- p_version varchar -This is a string representation of the version of the ADM. --- ADM version representations are formated at the discretion of --- the publishing organization. --- p_issuer_binary_string varchar - any string that identifies the organization that is --- defining an AMM object --- p_tag varchar - any string used to disambiguate AMM Objects for an Issuer --- out --- r_namespace_id integer - id of the namespace in the database --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_network_defined_namespace(IN p_issuing_org varchar, p_name_string varchar, -p_version varchar, p_issuer_binary_string varchar, p_tag varchar, INOUT r_namespace_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_namespace('NETWORK_CONFIG', p_issuing_org, p_name_string, p_version, r_namespace_id); - INSERT INTO network_config(namespace_id, issuer_binary_string, tag) VALUES(r_namespace_id, p_issuer_binary_string, p_tag); -end$$; - - - --- ================================================================== --- SP__insert_network_defined_namespace --- insert a new moderated adm into the db --- Parameters: --- in --- p_issuing_org varchar - name of the issuing organization for this ADM. --- p_name_string varchar- this is the human-readable name of the ADM that should appear --- in message logs, user-interfaces, and other human-facing --- applications --- p_version varchar - This is a string representation of the version of the ADM. --- ADM version representations are formated at the discretion of --- the publishing organization. --- p_adm_name_string varchar - this is the human-readable name of the ADM that should appear --- in message logs, user-interfaces, and other human-facing --- applications --- p_adm_enum integer - an unsigned integer in the range of 0 to --- (2^64)/20 --- p_adm_enum_label varchar - labeled based on the number of bytes --- of the Nickname as a function of the size of the ADM enumeration --- p_use_desc varchar - human readable use description --- out --- r_namespace_id integer - id of the namespace in the database --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_adm_defined_namespace(IN p_issuing_org varchar, p_namespace_string varchar, -p_version varchar, p_adm_name_string varchar, p_adm_enum integer, p_adm_enum_label varchar, -p_use_desc varchar, INOUT r_namespace_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_namespace('MODERATED', p_issuing_org, p_namespace_string, p_version, r_namespace_id); - INSERT INTO adm(namespace_id, adm_name, adm_enum, adm_enum_label, use_desc) VALUES(r_namespace_id, - p_adm_name_string, p_adm_enum, p_adm_enum_label, p_use_desc); -end$$; - - - - - - - --- STORED PROCEDURE(S) for creating updating an deleting operator definitions - - --- ================================================================== --- SP__insert_operator_actual_definition --- IN --- p_obj_id integer - metadata id for this report --- p_use_desc varchar - human readable use description --- p_use_desc varchar - human readable use description --- p_result_type varchar - data type of the result --- p_num_inputs integer - number of inputs for the operator --- p_tnvc_id integer - --- OUT --- r_definition_id integer - actual id of this operator --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_operator_actual_definition(IN p_obj_id integer, p_use_desc varchar, -p_result_type varchar, p_num_inputs integer, p_tnvc_id integer, OUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO operator_actual_definition(obj_actual_definition_id, data_type_id, num_operands, tnvc_id) - VALUES(r_definition_id, (SELECT data_type_id FROM data_type WHERE type_name = p_result_type), p_num_inputs, p_tnvc_id); -end$$; - - --- ================================================================== --- SP__delete_oper_actual_defintion --- IN --- p_obj_id integer - id of this op to delete, --- p_obj_name varchar - name of this op to delete --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__delete_oper_actual_defintion(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ BEGIN - IF( p_obj_id is Null AND p_obj_name is not NULL) THEN - SET p_obj_id = (select obj_id FROM obj_metadata WHERE obj_name = p_obj_name); - ELSE - LEAVE oper_def_del; - END IF; - - @def_id = (select definition_id from obj_actual_definition where obj_actual_definition_id := p_obj_id); - @fp_id = (SELECT fp_spec_id from macro_actual_definition where obj_actual_definition_id := @def_id ); - @ac_id = (SELECT ac_id FROM macro_actual_definition where obj_actual_definition_id := @def_id ); - - DELETE FROM formal_parmspec WHERE fp_spec_id = @fp_id; - DELETE FROM ari_collection WHERE ac_id = @ac_id; - - CALL SP__delete_obj_actual_defintion(p_obj_id, p_obj_name); -end$$; - - - - - - - --- STORED PROCEDURE(S) for the creating updating and deleting reports and report templates - - --- auto adds ac which can be troublesome --- user has to make ac first -/* - -CREATE OR REPLACE PROCEDURE SP__insert_report_template_metadata_format(IN p_metadata_count integer, p_metadata_types_list varchar, p_metadata_names_list varchar, p_metadata_desc varchar, INOUT r_tnvc_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - INSERT INTO type_name_value_collection(num_entries, use_desc) VALUES(p_metadata_count, p_metadata_desc) RETURNING type_name_value_collection_id as r_tnvc_id; - - @s := 'INSERT INTO type_name_value(tnvc_id, data_type, data_name, order_num) VALUES'; - @loops := 1; - WHILE @loops < p_metadata_count DO BEGIN - -- @metadata_type - @metadata_type := TRIM(SUBSTRING_INDEX(p_metadata_types_list, ',', 1)); - SET p_metadata_types_list = REPLACE(p_metadata_types_list, CONCAT(@metadata_type, ','), ''); - - -- @metadata_name - @metadata_name := TRIM(SUBSTRING_INDEX(p_metadata_names_list, ',', 1)); - SET p_metadata_names_list = REPLACE(p_metadata_names_list, CONCAT(@metadata_name, ','), ''); - - @s = CONCAT(@s, '(', r_tnvc_id, ',', (SELECT enum_id FROM data_type WHERE type_name := @metadata_type), ',', '\'', @metadata_name, '\'', ',', @loops, '),'); - @loops := @loops + 1; - END; - END WHILE; - - -- @metadata_type - @metadata_type := TRIM((SUBSTRING_INDEX(p_metadata_types_list, ',', 1))); - - -- @metadata_name - @metadata_name := TRIM(SUBSTRING_INDEX(p_metadata_names_list, ',', 1)); - - @s = CONCAT(@s, '(', r_tnvc_id, ',', (SELECT enum_id FROM data_type WHERE type_name := @metadata_type), ',', '\'', @metadata_name, '\'', ',', @loops, ');'); - PREPARE stmt FROM @s; - EXECUTE stmt; - -end$$; - -*/ - - --- ================================================================== --- create a report template formal def --- SP__insert_report_template_metadata_format --- IN --- p_obj_id integer - metadata id for this report --- p_use_desc varchar - human readable use description --- p_formal_parmspec_id integer - formal parameter spec id --- p_ac_id integer - ac for the report definition --- --- OUT --- r_definition_id integer - id of this formal report --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_report_template_formal_definition(IN p_obj_id integer, p_use_desc varchar, p_formal_parmspec_id integer, p_ac_id integer, INOUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_formal_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO report_template_formal_definition(obj_formal_definition_id, fp_spec_id, ac_id) VALUES(r_definition_id, p_formal_parmspec_id, p_ac_id); -end$$; - - - --- ================================================================== --- SP__insert_report_actual_definition --- IN --- p_obj_definition_id integer - metadata id for this report --- p_ap_spec_id integer - id for the actual parmspec for this report --- p_use_desc varchar - human readable use description --- OUT --- r_obj_actual_id integer - id of this actual report definition --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_report_actual_definition(IN p_obj_definition_id integer, p_ap_spec_id integer, p_ts TIMESTAMP, p_use_desc varchar, INOUT r_obj_actual_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_definition_id, p_use_desc, r_obj_actual_id); - INSERT INTO report_template_actual_definition(obj_actual_definition_id, ap_spec_id, ts ) VALUES(r_obj_actual_id, p_ap_spec_id, p_ts); -end$$; - - --- STORED PROCEDURE(S) for adding updating and deleting time base rule defintions and instances - --- ================= --- for adding state based rules into the database --- SP__insert_sbr_actual_definition --- IN --- p_obj_id integer - metadata id of this SBR --- p_use_desc varchar- human readable description --- p_expr_id integer, - id of the expresion for this rule --- p_ac_id integer, - id of the ari collection that defines the action of this rule --- p_start_time time - whem this rule starts --- OUT --- r_definition_id integer - id of the start --- ==================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_sbr_actual_definition(IN p_obj_id integer, p_use_desc varchar, p_expr_id integer, p_ac_id integer, p_start_time time , INOUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO sbr_actual_definition(obj_actual_definition_id, expression_id, run_count, start_time, ac_id) VALUES(r_definition_id, p_expr_id, p_run_count, p_start_time, p_ac_id); -end$$; - - - --- ================================================================== --- SP__delete_sbr_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the sbr to delete --- p_obj_name varchar - name of the sbr to delete -- --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__delete_sbr_actual_definition(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ BEGIN - IF( p_obj_id is Null AND p_obj_name is not NULL) THEN - SET p_obj_id = (select obj_id FROM obj_metadata WHERE obj_name = p_obj_name); - ELSE - LEAVE sbr_def_del; - END IF; - - IF(p_obj_name is NULL) THEN - SET p_obj_name = (select obj_name from vw_sbr_formal where obj_id = p_obj_id); - END IF ; - - @exp_id = (SELECT expression_id FROM vw_sbr_actual WHERE obj_actual_definition := p_obj_id); - @ac_id = (SELECT ac_id FROM vw_sbr_actual WHERE obj_actual_definition := p_obj_id); - - DELETE FROM ari_collection WHERE ac_id = @ac_id; - DELETE FROM expression WHERE expression_id = @exp_id; - - CALL SP__delete_obj_atual_defintion(p_obj_id, p_obj_name); -end$$; - - --- STORED PROCEDURE(S) - - --- == --- function for string processing used by other sp --- help make inserting large sets of data more user friendly --- == - - -CREATE OR REPLACE PROCEDURE SP__get_delimiter_position(IN p_str varchar, p_delimiter varchar, p_start_position integer, INOUT r_found_position integer) -LANGUAGE plpgsql -AS $$ BEGIN - IF (p_str IS NOT NULL) && (p_start_position IS NOT NULL)THEN BEGIN - @length := CHAR_LENGTH(p_str); - @position_index := p_start_position; - @iterator_index := p_start_position; - @char_value := ''; - @delimiter_found := FALSE; - SET r_found_position = NULL; - WHILE (@position_index != @length) && (@delimiter_found != TRUE) DO BEGIN - @char_value := SUBSTRING(p_str, @iterator_index, 1); - IF @char_value LIKE p_delimiter THEN - @position_index := @iterator_index; - SET r_found_position = @position_index; - @delimiter_found := TRUE; - END IF; - @iterator_index := @iterator_index + 1; - END; - END WHILE; - END; - ELSE BEGIN - SET r_found_position = NULL; - END; - END IF; -end$$; - - - - -CREATE OR REPLACE PROCEDURE SP__null_string_check(INOUT p_string varchar) -LANGUAGE plpgsql -AS $$ BEGIN - IF (p_string LIKE 'null') || (p_string LIKE 'NULL') || (p_string LIKE 'Null') THEN BEGIN - SET p_string = NULL; - END; - END IF; -end$$; - --- STORED PROCEDURE(S) for adding deleting and updating Table template defintions and instances - - --- ================================================================== --- SP__insert_table_template_actual_definition --- IN --- p_obj_id integer - obj_metadata id --- p_use_desc varchar - human readble use desc --- p_num_columns integer - number of columns in the table --- p_column_names_list varchar(10000) - list of column names --- p_column_types_list varchar(10000) - list of column type --- OUT --- r_definition_id integer - id of the the new table --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_table_template_actual_definition(IN p_obj_id integer, p_use_desc varchar, p_columns_id integer, INOUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO table_template_actual_definition(obj_actual_definition_id, tnvc_id) VALUES(r_definition_id, p_columns_id); -end$$; - - --- ================================================================== --- SP__insert_table_template_actual_definition --- IN --- p_obj_id integer - id of the table to delete --- p_obj_name varchar -- name of the object to delete --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__delete_table_template_actual_definition(IN p_obj_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - IF p_obj_id != NULL THEN BEGIN - @tnvc_id = (select tnvc_id from table_template_actual_definition where obj_actual_definition_id := p_obj_id); - END; - ELSE BEGIN - SET @tnvc_id = - (select tnvc_id from table_template_actual_definition where obj_atual_definition_id = - (select obj_actual_definition_id from obj_actual_definition where obj_metadata_id = - (select obj_metadata_id from obj_metadata where obj_name = p_obj_name))); - END; - END IF; - CALL SP__delete_tnvc(@tnvc_id); - CALL SP__delete_obj_actual_definition(p_obj_id, null); - -end$$; - - - - --- --- --- -- table_definition_id, use_desc, --- CREATE OR REPLACE PROCEDURE SP__insert_table_instance(IN p_obj_definition_id integer, p_use_desc varchar, p_row_values_list varchar(10000), INOUT r_instance_id integer) - --- --- -- have to visit how to store multiple rows is is just one long value collection splitting at every num_colmns? --- CALL SP__insert_obj_instance(p_obj_definition_id, p_use_desc, r_instance_id); --- @n_rows = (select num_entries from type_name_value_collection where tnvc_id =(select columns_list from table_template_definition where definition_id := p_obj_definition_id)); --- CALL SP__insert_tnv_collection(@num_rows, null, null, p_row_values_list , @tnvc_id); --- INSERT INTO table_instance(instance_id, ap_spec_id) VALUES(r_instance_id, p_ap_spec_id); --- end$$; --- - --- STORED PROCEDURE(S) for adding updating and deleting time base rule defintions and instances --- need type checking for actions, they need to be Macros or controls - - --- =============================================================== --- SP__insert_tbr_actual_definition --- IN --- p_obj_id integer - metadata id --- p_use_desc varchar - human readable descriptionb --- p_wait_per time - how long to wait before starting --- p_run_count biginteger - number of times to run --- p_start_time time - when to start --- p_ac_id integer - ac of the actions for this rules --- OUT --- r_definition_id integer - id of this tbr --- =============================================================== - - -CREATE OR REPLACE PROCEDURE SP__insert_tbr_actual_definition(IN p_obj_id integer, p_use_desc varchar, -p_wait_per time, p_run_count biginteger, p_start_time time, p_ac_id integer, INOUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - INSERT INTO tbr_actual_definition(obj_actual_definition_id, wait_period, run_count, start_time, ac_id) VALUES(r_definition_id, p_wait_per, p_run_count, p_start_time, p_ac_id); -end$$; - - - - --- ================================================================== --- SP__delete_tbr_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the tbr to delete --- p_obj_name varchar - name of the tbr to delete -- --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__delete_tbr_actual_definition(IN p_obj_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ BEGIN - IF( p_obj_id is Null AND p_obj_name is not NULL) THEN - SET p_obj_id = (select obj_id FROM obj_metadata WHERE obj_name = p_obj_name); - ELSE - LEAVE tbr_def_del; - END IF; - - IF(p_obj_name is NULL) THEN - SET p_obj_name = (select obj_name from vw_tbr_formal where obj_id = p_obj_id); - END IF ; - - - @ac_id = (SELECT ac_id FROM vw_tbr_actual WHERE obj_actual_definition := p_obj_id); - - DELETE FROM ari_collection WHERE ac_id = @ac_id; - - CALL SP__delete_obj_atual_defintion(p_obj_id, p_obj_name); -end$$; - --- STORED PROCEDURE(S) for inserting type name value collections into db - - --- ================================================================== --- SP__insert_tnvc --- inserts a new tnv collection definition into the db --- IN --- p_num_entries integer - number of entries in the collection --- p_use_desc varchar - human readble description for the collection --- OUT --- r_tnvc_id integer - id of the collection --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_collection(IN p_use_desc varchar, INOUT r_tnvc_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - INSERT INTO type_name_value_collection(use_desc) VALUES(p_use_desc) RETURNING type_name_value_collection_id as r_tnvc_id; - -end$$; - - --- ================================================================== --- sp for inserting a single entry into a tnvc --- SP__insert_tnvc_entry --- IN --- p_tnvc_id integer - id of tnvc this entry belongs to --- p_order_num integer - order number of this entry --- p_data_type_name varchar - data type name --- p_data_name varchar - name of the tnvc --- p_definition_id integer - definition of the object could be literal --- OUT --- r_tnvc_entry_id integer - id of this entrty --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_entry(IN p_tnvc_id integer, p_order_num integer, p_data_type_name varchar, p_data_name varchar, INOUT r_tnvc_entry_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - - IF p_order_num IS NULL THEN - SELECT order_num+1 INTO p_order_num FROM type_name_value_entry WHERE tnvc_id=p_tnvc_id ORDER BY order_num DESC LIMIT 1; - END IF; - IF p_order_num IS NULL THEN - SET p_order_num = 0; - END IF; - - - INSERT INTO `amp_core`.`type_name_value_entry` -(`tnvc_id`, -`order_num`, -`data_type_id`, -`data_name`) -VALUES -(p_tnvc_id, -p_order_num, -(SELECT data_type_id FROM data_type WHERE type_name = UPPER(p_data_type_name)), -p_data_name) RETURNING RETURNING_id as r_tnvc_entry_id; - - - -end$$; - - - - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_entry_id(IN p_tnvc_id integer, p_order_num integer, p_data_type_id integer, p_data_name varchar, INOUT r_tnvc_entry_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - - IF p_order_num IS NULL THEN - SELECT order_num+1 INTO p_order_num FROM type_name_value_entry WHERE tnvc_id=p_tnvc_id ORDER BY order_num DESC LIMIT 1; - END IF; - IF p_order_num IS NULL THEN - SET p_order_num = 0; - END IF; - - -INSERT INTO `amp_core`.`type_name_value_entry` -(`tnvc_id`, -`order_num`, -`data_type_id`, -`data_name`) -VALUES -(p_tnvc_id, -p_order_num, -p_data_type_id, -p_data_name) RETURNING RETURNING_id as r_tnvc_entry_id; - - - -end$$; - - --- ================================================================== --- SP__insert_tnvc_obj_entry --- insert a new tnvc entry that is an ADM object --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value integer - id for this actual object --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_obj_entry(IN p_tnvc_id integer, - p_order_num integer, - p_data_type varchar, - p_entry_value integer, - OUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry(p_tnvc_id, p_order_num, p_data_type, NULL, r_tnvc_entry_id); - INSERT INTO type_name_value_obj_entry (tnv_id, obj_actual_definition_id) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - - - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_ac_entry(IN p_tnvc_id integer, - p_order_num integer, - p_data_name varchar, - p_entry_value integer, - OUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 37, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_ac_entry (tnv_id, ac_id) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_tnvc_entry(IN p_tnvc_id integer, - p_order_num integer, - p_data_name varchar, - p_entry_value integer, - OUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 35, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_tnvc_entry (tnv_id, tnvc_id) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - - --- ================================================================== --- SP__insert_tnvc_ari_entry --- insert a new tnvc entry that is an ADM object --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value integer - id for this actual object --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_ari_entry(IN p_tnvc_id integer, - p_order_num integer, - p_data_name varchar, - p_entry_value integer, - OUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry(p_tnvc_id, p_order_num, 'ari', p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_obj_entry (tnv_id, obj_actual_definition_id) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_unk_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_unk_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, OUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry(p_tnvc_id, p_order_num, 'unk', p_data_name, r_tnvc_entry_id); -end$$; - - - --- ================================================================== --- SP__insert_tnvc_int_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value int- value for this int_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_int_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value int, INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 19, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_int_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_uint_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value integer - value for this uint_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_uint_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value integer , INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 20, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_uint_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_vast_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value bigint - value for this vast_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_vast_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value bigint , INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 21, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_vast_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_uvast_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value biginteger - value for this uvast_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_uvast_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value biginteger , INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 22, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_uvast_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_tv_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value biginteger - value for this uvast_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_tv_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value biginteger , INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 32, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_uvast_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_uvast_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value biginteger - value for this uvast_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_ts_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value biginteger , INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 33, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_uvast_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_real32_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value float- value for this real32_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_real32_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value float, INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 23, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_real32_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_real64_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value double- value for this real64_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_real64_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value double, INOUT r_tnvc_entry_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 24, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_real64_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_str_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value varchar- value for this string_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_str_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value varchar, INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 18, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_string_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_bool_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value bool- value for this bool_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_bool_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value bool, INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 16, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_bool_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - --- ================================================================== --- SP__insert_tnvc_byte_entry --- insert a new tnvc entry for the specific primitive data type --- in --- p_tnv_entry_id integer - the id for this tnv entry --- p_entry_value tinyint- value for this byte_entry --- ================================================================== - -CREATE OR REPLACE PROCEDURE SP__insert_tnvc_byte_entry(IN p_tnvc_id integer, p_order_num integer, p_data_name varchar, p_entry_value tinyint, INOUT r_tnvc_entry_id integer ) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_tnvc_entry_id(p_tnvc_id, p_order_num, 17, p_data_name, r_tnvc_entry_id); - INSERT INTO type_name_value_byte_entry (tnv_id, entry_value) VALUES (r_tnvc_entry_id, p_entry_value); -end$$; - - - - - - - --- ================================================================== --- SP__insert_tnv_collection --- inserts entries into the collection using ',' lists --- IN --- p_num_entries integer - number of entries in the collection --- p_data_types_list varchar(10000) - list of the data types --- p_data_names_list varchar(10000) - list of the names --- p_data_values_list varchar(10000) - list of the values --- OUT --- r_tnvc_id integer - id of the collection --- ================================================================== --- --- --- CREATE OR REPLACE PROCEDURE SP__insert_tnv_collection(IN p_num_entries integer, p_data_types_list varchar(10000), p_data_names_list varchar(10000), p_data_values_list varchar(10000), INOUT r_tnvc_id integer) - --- CALL SP__insert_tnvc(p_num_entries, r_tnvc_id); --- @tnvc_id := r_tnvc_id; --- @s := 'INSERT INTO type_name_value(tnvc_id, order_num, data_type_id, data_name, obj_actual_definition_id) VALUES'; --- @loops := 1; --- WHILE @loops < p_num_entries DO - --- -- @data_type --- IF p_data_types_list IS NOT NULL THEN --- LANGUAGE plpgsql --- AS $$ --- @data_type := TRIM(SUBSTRING_INDEX(p_data_types_list, ',', 1)); --- SET p_data_types_list = REPLACE(p_data_types_list, CONCAT(@data_type, ','), ''); --- END; --- ELSE --- LANGUAGE plpgsql --- AS $$ --- @data_type := 'NULL'; --- END; --- END IF; --- --- -- @data_name --- IF p_data_names_list IS NOT NULL THEN --- LANGUAGE plpgsql --- AS $$ --- @data_name := TRIM(SUBSTRING_INDEX(p_data_names_list, ',', 1)); --- SET p_data_names_list = REPLACE(p_data_names_list, CONCAT(@data_name, ','), ''); --- END; --- ELSE --- LANGUAGE plpgsql --- AS $$ --- @data_name := 'NULL'; --- END; --- END IF; --- --- -- @data_value --- IF p_data_values_list IS NOT NULL THEN --- LANGUAGE plpgsql --- AS $$ --- @data_value := TRIM(SUBSTRING_INDEX(p_data_values_list, ',', 1)); --- SET p_data_values_list = REPLACE(p_data_values_list, CONCAT(@data_value, ','), ''); --- END; --- ELSE --- LANGUAGE plpgsql --- AS $$ --- @data_value := 'NULL'; --- END; --- END IF; --- @s = CONCAT(@s, '(', @tnvc_id, ',', @loops, ',', (SELECT data_type_id FROM data_type WHERE type_name := @data_type), ',', '"', @data_name, '"', ',', '"', @data_value, '"', '),'); --- @loops := @loops + 1; --- END; --- END WHILE; --- --- -- @data_type --- IF p_data_types_list IS NOT NULL THEN - --- @data_type := TRIM((SUBSTRING_INDEX(p_data_types_list, ',', 1))); --- END; --- ELSE - --- @data_type := 'NULL'; --- END; --- END IF; --- --- -- @data_name --- IF p_data_names_list IS NOT NULL THEN - --- @data_name := TRIM(SUBSTRING_INDEX(p_data_names_list, ',', 1)); --- END; --- ELSE - --- @data_name := 'NULL'; --- END; --- END IF; --- --- -- @data_value --- IF p_data_values_list IS NOT NULL THEN - --- @data_value := TRIM(SUBSTRING_INDEX(p_data_values_list, ',', 1)); --- END; --- ELSE - --- @data_value := 'NULL'; --- END; --- END IF; --- @s = CONCAT(@s, '(', @tnvc_id, ',', @loops, ',', (SELECT data_type_id FROM data_type WHERE type_name := @data_type), ',', '"', @data_name, '"', ',', '"', @data_value, '"', ')'); --- PREPARE stmt FROM @s; --- EXECUTE stmt; - --- end$$; --- - - --- STORED PROCEDURE(S) for adding updating and removing variables - --- ================================================================== --- SP__insert_variable_definition --- inserting a new variable --- IN --- p_obj_id integer - metadata id of the variable --- p_use_desc varchar - human readable description --- p_out_type integer - out type of the variable --- p_num_operators integer - number of operators --- p_operator_ids_list varchar - --- OUT --- r_definition_id integer - definition id of the variable --- --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__insert_variable_definition(IN p_obj_id integer, p_use_desc varchar, -p_out_type integer, p_expression_id integer, INOUT r_definition_id integer) -LANGUAGE plpgsql -AS $$ BEGIN - CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - -- call expresion builder for var Initializer - CALL SP__insert_expression(p_out_type, p_expression_id, @r_expr_id); - INSERT INTO variable_actual_definition(obj_actual_definition_id, data_type_id, expression_id) VALUES(r_definition_id, p_out_type, @r_expr_id); - -end$$; - - - --- ================================================================== --- SP__delete_var_actual_definition; --- Parameters: --- in --- p_obj_id integer - id for the var to delete --- p_obj_name varchar - name of the var to delete -- --- ================================================================== -CREATE OR REPLACE PROCEDURE SP__delete_variable_definition(IN p_definition_id integer, p_obj_name varchar) -LANGUAGE plpgsql -AS $$ BEGIN - -- delete the expresion first - @exp_id = (SELECT expression_id from variable_actual_definition where p_definition_id := obj_actual_definition); - CALL SP__delete_expression(@exp_id); - CALL SP__delete_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id); - -end$$; - ---# for testing the delete function - - ---@p_obj_name := 'bundles_by_priority'; ---select * from obj_definition join obj_identifier on obj_definition.obj_id = obj_identifier.obj_id; --- select definition_id from obj_definition where obj_id = (SELECT obj_id FROM obj_identifier WHERE obj_name = @p_obj_name); - --- set @fp_spec_id_control_definitionobj_definitionformal_parmspecedd1 = (select fp_spec_id from edd_definition where definition_id = (select definition_id from obj_definition where obj_id = (SELECT obj_id FROM obj_identifier WHERE obj_name = @p_obj_name))); --- CALL SP__insert_actual_parms_set(1, @fp_spec_id_edd1, 'UINT', '1', @ap_spec_id); --- CALL SP__insert_edd_instance(@edd_definition_id_9, @ap_spec_id,NULL, @edd_inst_id_1); - - --- Select * from obj_definition; --- SELECT obj_id FROM obj_identifier WHERE obj_name = @p_obj_name; --- SELECT * from obj_definition where obj_id = (SELECT obj_id FROM obj_identifier WHERE obj_name = @p_obj_name); - ---SELECT * FROM vw_edd_instance; --- CALL SP__delete_obj_definition(0, null, @p_obj_name); ---call SP__delete_edd_instance(null, 'bundles_by_priority'); --- CALL SP__delete_edd_instance(null, @p_o-- bj_name); - ---SELECT * FROM vw_edd_instance; - - diff --git a/amp-sql/postgres/Database_Scripts/Tables/amp_core_create_database.sql b/amp-sql/postgres/Database_Scripts/Tables/00-amp_core_create_database.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Tables/amp_core_create_database.sql rename to amp-sql/postgres/Database_Scripts/Tables/00-amp_core_create_database.sql diff --git a/amp-sql/postgres/Database_Scripts/Tables/transcoder.sql b/amp-sql/postgres/Database_Scripts/Tables/00-transcoder.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Tables/transcoder.sql rename to amp-sql/postgres/Database_Scripts/Tables/00-transcoder.sql diff --git a/amp-sql/postgres/Database_Scripts/Tables/adm_data.sql b/amp-sql/postgres/Database_Scripts/Tables/01-adm_data.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Tables/adm_data.sql rename to amp-sql/postgres/Database_Scripts/Tables/01-adm_data.sql diff --git a/amp-sql/postgres/Database_Scripts/Tables/healthcheck_roles.sql b/amp-sql/postgres/Database_Scripts/Tables/17-healthcheck_roles.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Tables/healthcheck_roles.sql rename to amp-sql/postgres/Database_Scripts/Tables/17-healthcheck_roles.sql diff --git a/amp-sql/postgres/Database_Scripts/Tables/amp_core_drop_database.sql b/amp-sql/postgres/Database_Scripts/Tables/amp_core_drop_database.sql deleted file mode 100644 index 14625c5..0000000 --- a/amp-sql/postgres/Database_Scripts/Tables/amp_core_drop_database.sql +++ /dev/null @@ -1,27 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- -SET GLOBAL sql_mode='NO_AUTO_VALUE_ON_ZERO'; -SET SESSION sql_mode='NO_AUTO_VALUE_ON_ZERO'; -SELECT @@GLOBAL.sql_mode; -SELECT @@SESSION.sql_mode; - -drop database amp_core; \ No newline at end of file diff --git a/amp-sql/postgres/Database_Scripts/Tables/clean_tables.sql b/amp-sql/postgres/Database_Scripts/Tables/clean_tables.sql deleted file mode 100644 index f6b09e9..0000000 --- a/amp-sql/postgres/Database_Scripts/Tables/clean_tables.sql +++ /dev/null @@ -1,91 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- cleaning out the tables - -use amp_core; - -DELETE FROM adm; -DELETE FROM amp_core.namespace; - -DELETE FROM amp_core.edd_formal_definition -WHERE - TRUE; - -DELETE FROM amp_core.adm -WHERE - TRUE; - -DELETE FROM amp_core.ari_collection -WHERE - TRUE; - -DELETE FROM amp_core.ari_collection_entry -WHERE - TRUE; - -DELETE FROM amp_core.expression -WHERE - TRUE; - -DELETE FROM amp_core.obj_formal_definition -WHERE - TRUE; - -DELETE FROM amp_core.obj_metadata -WHERE - TRUE; - -DELETE FROM amp_core.obj_actual_definition -WHERE - TRUE; - -DELETE FROM amp_core.operator_actual_definition -WHERE - TRUE; - -DELETE FROM amp_core.variable_actual_definition -WHERE - TRUE; - -DELETE FROM amp_core.control_formal_definition; - -DELETE FROM amp_core.control_actual_definition; - -DELETE FROM `amp_core`.`outgoing_message_set` -WHERE TRUE; - -DELETE FROM `amp_core`.`incoming_message_set` -WHERE TRUE; - -DELETE FROM `amp_core`.`formal_parmspec` -WHERE TRUE; - -DELETE FROM amp_core.registered_agents -Where TRUE; - - - - - - - diff --git a/amp-sql/postgres/Database_Scripts/Tables/initial_ui_table_data.sql b/amp-sql/postgres/Database_Scripts/Tables/initial_ui_table_data.sql deleted file mode 100644 index 726c365..0000000 --- a/amp-sql/postgres/Database_Scripts/Tables/initial_ui_table_data.sql +++ /dev/null @@ -1,45 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- INSERT INTO registered_agents(registered_agents_id, agent_id_string) VALUES(0, 'Agent 0'); --- INSERT INTO registered_agents(registered_agents_id, agent_id_string) VALUES(1, 'Agent 1'); --- INSERT INTO registered_agents(registered_agents_id, agent_id_string) VALUES(2, 'Agent 2'); --- --- INSERT INTO message_group(group_id, ts, is_outgoing, state_id) VALUES(0, 0, false, 0); --- INSERT INTO message_group(group_id, ts, is_outgoing, state_id) VALUES(1, 0, false, 1); --- INSERT INTO message_group(group_id, ts, is_outgoing, state_id) VALUES(2, 0, false, 2); --- --- INSERT INTO message_group_entry(group_id, ack, nak, acl, order_num, type_id) VALUES(0, true, false, true, 0, 0); --- INSERT INTO message_group_entry(group_id, ack, nak, acl, order_num, type_id) VALUES(1, false, false, true, 1, 1); --- INSERT INTO message_group_entry(group_id, ack, nak, acl, order_num, type_id) VALUES(2, true, true, true, 2, 2); --- INSERT INTO message_group_entry(group_id, ack, nak, acl, order_num, type_id) VALUES(1, true, true, true, 2, 2); --- --- INSERT INTO alert(title, status, message) VALUES('Alert 0', 0, 'Alert 0 Message'); --- INSERT INTO alert(title, status, message) VALUES('Alert 1', 1, 'Alert 1 Message'); --- INSERT INTO alert(title, status, message) VALUES('Alert 2', 2, 'Alert 2 Message'); --- --- INSERT INTO message_agents(message_id, agent_id) VALUES(1,0); --- INSERT INTO message_agents(message_id, agent_id) VALUES(2,1); --- INSERT INTO message_agents(message_id, agent_id) VALUES(3,2); --- INSERT INTO message_agents(message_id, agent_id) VALUES(4,2); - -INSERT INTO "user" (id, username, email, first_name, last_name, password, is_enabled, roles, permissions) VALUES(0, 'admin', 'admin@admin.com', 'Admin', 'User', '$2b$12$S5hnlzHa9n.2St0WrJCNf.wiNYRCY/iA7SRQvkmDG8DNql6Uo3VT2', true, ARRAY[0], ARRAY[0]); diff --git a/amp-sql/postgres/Database_Scripts/Tables/postgres_amp_core_tables.sql b/amp-sql/postgres/Database_Scripts/Tables/postgres_amp_core_tables.sql deleted file mode 100644 index 87bc753..0000000 --- a/amp-sql/postgres/Database_Scripts/Tables/postgres_amp_core_tables.sql +++ /dev/null @@ -1,859 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- A DB for storing and using the ADMs and ADM objects --- --- Version 1.0 of the amp database --- Changes: --- All sp_ are changed to SP__ to follow good sql practices. --- --- Updated the constraints of Constants included derived types. --- --- Reworking SBR and TBR instance and definitons. All the base info will be in definition and Instances will be used for holding parameter info --- and when to run. --- can store what the previous events and every so often remove old instances or move them to long term storage. --- --- Updated obj_defintion to cascade on delete --- --- updated some naming conventions, making sure fk agree with pk, and pk follow table name. obj_identifer to obj_metadata. --- - - --- SET GLOBAL sql_mode='NO_AUTO_VALUE_ON_ZERO'; --- SET SESSION sql_mode='NO_AUTO_VALUE_ON_ZERO'; --- SELECT @@GLOBAL .sql_mode; --- SELECT @@SESSION .sql_mode; - --- CREATE DATABASE /*!32312 IF NOT EXISTS*/ /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; - - -CREATE OR REPLACE FUNCTION update_changetimestamp_column() -RETURNS TRIGGER AS $$ -BEGIN - NEW.changetimestamp = now(); - RETURN NEW; -END; -$$ language 'plpgsql'; - -CREATE SEQUENCE data_type_id_seq minvalue 0; -CREATE TABLE data_type ( - data_type_id integer NOT NULL DEFAULT nextval('data_type_id_seq'), - type_name VARCHAR(50) NOT NULL UNIQUE, - use_desc varchar NOT NULL, - PRIMARY KEY (data_type_id) -); -ALTER SEQUENCE data_type_id_seq OWNED BY data_type.data_type_id; -ALTER SEQUENCE data_type_id_seq RESTART WITH 0; --- AMM Object Types -INSERT INTO data_type(type_name, use_desc) VALUES('CONST','Constant'); -- to start Auto increment at 0 -INSERT INTO data_type(type_name, use_desc) VALUES('CTRL','Control'); -INSERT INTO data_type(type_name, use_desc) VALUES('EDD','Externally Defined Data'); -INSERT INTO data_type(type_name, use_desc) VALUES('LIT','Literal'); -INSERT INTO data_type(type_name, use_desc) VALUES('MAC','Macro'); -INSERT INTO data_type(type_name, use_desc) VALUES('OPER','Operator'); -INSERT INTO data_type(type_name, use_desc) VALUES('RPT','Report'); -INSERT INTO data_type(type_name, use_desc) VALUES('RPTT','Report Template'); -INSERT INTO data_type(type_name, use_desc) VALUES('SBR','State Based Rules'); -INSERT INTO data_type(type_name, use_desc) VALUES('TBL','Table'); -INSERT INTO data_type(type_name, use_desc) VALUES('TBLT','Table Template'); -INSERT INTO data_type(type_name, use_desc) VALUES('TBR','Time Based Rules'); -INSERT INTO data_type(type_name, use_desc) VALUES('VAR','Variable'); -INSERT INTO data_type(type_name, use_desc) VALUES('MDAT','Metadata'); - -ALTER SEQUENCE data_type_id_seq RESTART WITH 16; --- Primative Types -INSERT INTO data_type(type_name, use_desc) VALUES('BOOL','Boolean'); -- to start Auto increment at 16 -INSERT INTO data_type(type_name, use_desc) VALUES('BYTE','8 bits, Standard Byte'); -INSERT INTO data_type(type_name, use_desc) VALUES('STR','Character String'); -INSERT INTO data_type(type_name, use_desc) VALUES('INT','Signed 32 bit Integer'); -INSERT INTO data_type(type_name, use_desc) VALUES('UINT',' 32 bit Integer'); -INSERT INTO data_type(type_name, use_desc) VALUES('VAST','Signed 64 bit Integer'); -INSERT INTO data_type(type_name, use_desc) VALUES('UVAST',' 64 bit Integer'); -INSERT INTO data_type(type_name, use_desc) VALUES('REAL32','Single precision Floating Point'); -INSERT INTO data_type(type_name, use_desc) VALUES('REAL64','double precision precision Floating Point'); - -ALTER SEQUENCE data_type_id_seq RESTART WITH 32; --- Compound/Derived Types -INSERT INTO data_type(type_name, use_desc) VALUES('TV','Time Value'); -- to start Auto increment at 32 -INSERT INTO data_type(type_name, use_desc) VALUES('TS','Timestamp'); -INSERT INTO data_type(type_name, use_desc) VALUES('TNV','Type-Name-Value'); -INSERT INTO data_type(type_name, use_desc) VALUES('TNVC','Type-Name-Value Collection'); -INSERT INTO data_type(type_name, use_desc) VALUES('ARI','AMM Resource Identifier'); -INSERT INTO data_type(type_name, use_desc) VALUES('AC','ARI Collection'); -INSERT INTO data_type(type_name, use_desc) VALUES('EXPR','Expression'); -INSERT INTO data_type(type_name, use_desc) VALUES('BYTESTR','Bytestring'); -INSERT INTO data_type(type_name, use_desc) VALUES ('PARMNAME','parameter name'); -INSERT INTO data_type(type_name, use_desc) VALUES('FP','formal parameter'); -INSERT INTO data_type(type_name, use_desc) VALUES ('APV','actual parameter-by-value'); -INSERT INTO data_type(type_name, use_desc) VALUES('APN', 'actual parameter-by-name'); - - -CREATE TABLE IF NOT EXISTS ADM_Type_Enumeration ( - data_type_id INT NOT NULL, - Enumeration INT NOT NULL, - PRIMARY KEY (data_type_id), - CONSTRAINT fk1 FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE ON UPDATE NO ACTION -); - --- Table 1: ADM Type Enumerations -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (0, 0); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (1, 1); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (2, 2); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (3, 3); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (5, 4); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (7, 5); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (8, 6); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (10, 7); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (11, 8); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (12, 9); - - - -CREATE TABLE registered_agents ( - registered_agents_id INT NOT NULL , - agent_id_string VARCHAR(128) NOT NULL DEFAULT 'ipn:0.0', - first_registered TIMESTAMP NOT NULL DEFAULT NOW(), - last_registered TIMESTAMP NOT NULL DEFAULT NOW(), - PRIMARY KEY (registered_agents_id), - UNIQUE (agent_id_string) -); - -CREATE TABLE namespace ( - namespace_id INT NOT NULL , - namespace_type varchar NOT NULL, - issuing_org varchar NOT NULL, - name_string varchar NOT NULL, - version_name varchar NOT NULL DEFAULT '0.0.0', - PRIMARY KEY (namespace_id) - -- Below UNIQUE key not valid. Explicit check in SP instead instead. TODO: Add appropriate indexes - -- UNIQUE (namespace_type, issuing_org , name_string , version_name) -); - - -CREATE TABLE adm ( - namespace_id INT NOT NULL, - adm_name varchar, - adm_enum INT , - adm_enum_label varchar, - use_desc varchar DEFAULT NULL, - PRIMARY KEY (namespace_id), - FOREIGN KEY (namespace_id) - REFERENCES namespace (namespace_id), - UNIQUE (adm_enum) -); - -CREATE TABLE network_config ( - namespace_id INT NOT NULL, - issuer_binary_string varchar NOT NULL, - tag varchar DEFAULT NULL, - PRIMARY KEY (namespace_id), - FOREIGN KEY (namespace_id) - REFERENCES namespace (namespace_id) -); - - -CREATE TABLE obj_metadata ( - obj_metadata_id INT NOT NULL , - data_type_id INT NOT NULL, - obj_name varchar NOT NULL, - namespace_id INT , - PRIMARY KEY (obj_metadata_id), - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, - FOREIGN KEY (namespace_id) - REFERENCES namespace (namespace_id) - ON DELETE CASCADE, - UNIQUE (data_type_id , obj_name , namespace_id) -); - - -CREATE TABLE obj_formal_definition ( - obj_formal_definition_id INT NOT NULL , - obj_metadata_id INT NOT NULL, - obj_enum INT DEFAULT NULL, -- Nominally obj_enum, data_type_id, and adm_enum would make a UNIQUE KEY, but tables are too normalized to enforce this - use_desc varchar DEFAULT NULL, - PRIMARY KEY (obj_formal_definition_id), - FOREIGN KEY (obj_metadata_id) - REFERENCES obj_metadata (obj_metadata_id) - ON DELETE CASCADE -); - -CREATE TABLE obj_actual_definition ( - obj_actual_definition_id INT NOT NULL , - obj_metadata_id INT NOT NULL, - use_desc varchar DEFAULT ' ', - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_metadata_id) - REFERENCES obj_metadata (obj_metadata_id) - ON DELETE CASCADE -); - -CREATE TABLE formal_parmspec ( - fp_spec_id INT NOT NULL , - num_parms INT NOT NULL, - use_desc varchar DEFAULT NULL, - PRIMARY KEY (fp_spec_id) -); - - -CREATE TABLE IF NOT EXISTS formal_parm ( - fp_id INT NOT NULL , - fp_spec_id INT NOT NULL, - order_num INT NOT NULL, - parm_name varchar DEFAULT NULL, - data_type_id INT NOT NULL, - obj_actual_definition_id INT NULL DEFAULT NULL, - PRIMARY KEY (fp_id), - FOREIGN KEY (fp_spec_id) - REFERENCES formal_parmspec (fp_spec_id) - ON DELETE CASCADE ON UPDATE NO ACTION, - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE SET NULL, - UNIQUE (fp_id , order_num) -); - -CREATE TABLE ari_collection ( - ac_id INT NOT NULL , - num_entries INT NOT NULL DEFAULT 0, - use_desc varchar, - PRIMARY KEY (ac_id) -); - - -CREATE TABLE type_name_value_collection ( - tnvc_id INT NOT NULL , - use_desc varchar DEFAULT NULL, - PRIMARY KEY (tnvc_id) -); - -CREATE TABLE type_name_value_entry ( - tnv_id INT NOT NULL , - tnvc_id INT NOT NULL, - order_num INT DEFAULT 0, - data_type_id INT , - data_name varchar DEFAULT NULL, - fp_id INT DEFAULT NULL, - PRIMARY KEY (tnv_id), - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, - FOREIGN KEY (tnvc_id) - REFERENCES type_name_value_collection (tnvc_id) - ON DELETE CASCADE, - FOREIGN KEY (fp_id) REFERENCES formal_parm (fp_id), -UNIQUE (tnvc_id , order_num) -); - -CREATE TABLE type_name_value_obj_entry ( -tnv_id INT NOT NULL, -obj_actual_definition_id INT DEFAULT NULL, -FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE SET NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE type_name_value_int_entry ( -tnv_id INT NOT NULL, -entry_value INT DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE type_name_value_ac_entry ( -tnv_id INT NOT NULL, -ac_id INT DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE, -FOREIGN KEY (ac_id) - REFERENCES ari_collection (ac_id) -); - -CREATE TABLE type_name_value_tnvc_entry ( -tnv_id INT NOT NULL, -tnvc_id INT DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE, -FOREIGN KEY (tnvc_id) - REFERENCES type_name_value_collection (tnvc_id) -); - - -CREATE TABLE type_name_value_uint_entry ( -tnv_id INT NOT NULL, -entry_value INT DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE type_name_value_vast_entry ( -tnv_id INT NOT NULL, -entry_value BIGINT DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE type_name_value_uvast_entry ( -tnv_id INT NOT NULL, -entry_value BIGINT DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE type_name_value_real32_entry ( -tnv_id INT NOT NULL, -entry_value FLOAT DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - - -CREATE TABLE type_name_value_real64_entry ( -tnv_id INT NOT NULL, -entry_value double precision DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE type_name_value_string_entry ( -tnv_id INT NOT NULL, -entry_value varchar DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE type_name_value_bool_entry ( -tnv_id INT NOT NULL, -entry_value BOOL DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE type_name_value_byte_entry ( -tnv_id INT NOT NULL, -entry_value smallint DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE ari_collection_entry ( - ac_entry_id INT NOT NULL , - ac_id INT NOT NULL, - order_num INT NOT NULL, - PRIMARY KEY (ac_entry_id), - FOREIGN KEY (ac_id) - REFERENCES ari_collection (ac_id) - ON DELETE CASCADE, - UNIQUE (ac_id , order_num) -); - -CREATE TABLE ari_collection_formal_entry ( - ac_entry_id INT NOT NULL, - obj_formal_definition_id INT NOT NULL, - PRIMARY KEY (ac_entry_id), - FOREIGN KEY (ac_entry_id) - REFERENCES ari_collection_entry (ac_entry_id) - ON DELETE CASCADE, - FOREIGN KEY (obj_formal_definition_id) - REFERENCES obj_formal_definition (obj_formal_definition_id) - ON DELETE CASCADE -); - - -CREATE TABLE ari_collection_actual_entry ( - ac_entry_id INT NOT NULL , - obj_actual_definition_id INT NOT NULL, - PRIMARY KEY (ac_entry_id), - FOREIGN KEY (ac_entry_id) - REFERENCES ari_collection_entry (ac_entry_id) - ON DELETE CASCADE, - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE -); - - - - -CREATE TABLE actual_parmspec ( - ap_spec_id INT NOT NULL , - fp_spec_id INT NOT NULL, - tnvc_id INT NOT NULL, - use_desc varchar DEFAULT NULL, - PRIMARY KEY (ap_spec_id), - FOREIGN KEY (fp_spec_id) - REFERENCES formal_parmspec (fp_spec_id) - ON DELETE CASCADE, - FOREIGN KEY (tnvc_id) - REFERENCES type_name_value_collection (tnvc_id) - ON DELETE CASCADE - -); - - - -CREATE TABLE edd_formal_definition ( - obj_formal_definition_id INT NOT NULL, - fp_spec_id INT , - data_type_id INT NOT NULL, - PRIMARY KEY (obj_formal_definition_id), - FOREIGN KEY (obj_formal_definition_id) - REFERENCES obj_formal_definition (obj_formal_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (fp_spec_id) - REFERENCES formal_parmspec (fp_spec_id) - ON DELETE CASCADE, - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, - UNIQUE (fp_spec_id) -); - -CREATE TABLE edd_actual_definition ( - obj_actual_definition_id INT NOT NULL, - ap_spec_id INT , - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (ap_spec_id) - REFERENCES actual_parmspec (ap_spec_id) - ON DELETE CASCADE, - UNIQUE (ap_spec_id) -); - - -CREATE TABLE const_actual_definition ( - obj_actual_definition_id INT NOT NULL, - data_type_id INT NOT NULL, - data_value varchar NOT NULL, - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, --- UNIQUE (data_type_id , data_value), -- TODO: Update SP to auto-select existing, joining on metadata_id to enforce constraint. The columns in this table alone are insufficient - CHECK (data_type_id > 15 AND data_type_id < 40) -); - -CREATE TABLE control_formal_definition ( - obj_formal_definition_id INT NOT NULL, - fp_spec_id INT , - PRIMARY KEY (obj_formal_definition_id), - FOREIGN KEY (obj_formal_definition_id) - REFERENCES obj_formal_definition (obj_formal_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (fp_spec_id) - REFERENCES formal_parmspec (fp_spec_id) - ON DELETE CASCADE, - UNIQUE (fp_spec_id) -); - -CREATE TABLE control_actual_definition ( - obj_actual_definition_id INT NOT NULL, - ap_spec_id INT , - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (ap_spec_id) - REFERENCES actual_parmspec (ap_spec_id) - ON DELETE CASCADE, - UNIQUE (ap_spec_id) -); - -CREATE TABLE macro_formal_definition ( - obj_formal_definition_id INT NOT NULL, - fp_spec_id INT , - ac_id INT NOT NULL, - max_call_depth INT DEFAULT 4, - PRIMARY KEY (obj_formal_definition_id), - FOREIGN KEY (obj_formal_definition_id) - REFERENCES obj_formal_definition (obj_formal_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (fp_spec_id) - REFERENCES formal_parmspec (fp_spec_id) - ON DELETE CASCADE, - FOREIGN KEY (ac_id) - REFERENCES ari_collection (ac_id) - ON DELETE CASCADE, - UNIQUE (fp_spec_id) -); - - -CREATE TABLE macro_actual_definition ( - obj_actual_definition_id INT NOT NULL, - ap_spec_id INT , - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (ap_spec_id) - REFERENCES actual_parmspec (ap_spec_id) - ON DELETE CASCADE, - UNIQUE (ap_spec_id) -); - -CREATE TABLE operator_actual_definition ( - obj_actual_definition_id INT NOT NULL, - data_type_id INT NOT NULL, - num_operands INT NOT NULL, - tnvc_id INT NOT NULL, - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, - FOREIGN KEY (tnvc_id) - REFERENCES type_name_value_collection (tnvc_id) - ON DELETE CASCADE -); - -CREATE TABLE literal_actual_definition ( - obj_actual_definition_id INT NOT NULL, - data_type_id INT NOT NULL, - data_value varchar NOT NULL, - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, - CHECK (data_type_id > 16) - -- UNIQUE (data_value) -- TODO: Unique constraint must include metadata_id, so we will have to enforce via SP later -); - - -CREATE TABLE expression ( - expression_id INT NOT NULL , - data_type_id INT NOT NULL, - ac_id INT NOT NULL, - PRIMARY KEY (expression_id), - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, - FOREIGN KEY (ac_id) - REFERENCES ari_collection (ac_id) - ON DELETE CASCADE, - UNIQUE (data_type_id , ac_id) -); - -CREATE TABLE report_template_formal_definition ( - obj_formal_definition_id INT NOT NULL, - fp_spec_id INT , - ac_id INT NOT NULL, - PRIMARY KEY (obj_formal_definition_id), - FOREIGN KEY (obj_formal_definition_id) - REFERENCES obj_formal_definition (obj_formal_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (fp_spec_id) - REFERENCES formal_parmspec (fp_spec_id) - ON DELETE CASCADE, - FOREIGN KEY (ac_id) - REFERENCES ari_collection (ac_id) - ON DELETE CASCADE, - UNIQUE (fp_spec_id) -); - -CREATE TABLE report_template_actual_definition ( - obj_actual_definition_id INT NOT NULL, - ap_spec_id INT , - ts TIMESTAMP NULL, - - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (ap_spec_id) - REFERENCES actual_parmspec (ap_spec_id) - ON DELETE CASCADE, - UNIQUE (ap_spec_id) -); -COMMENT ON COLUMN report_template_actual_definition.ts IS 'TS value embedded in raw report. This field may be NULL if embedded in a set of reports with a common timestamp (per specification). Calling application is responsible for converting AMP Timestamp specification into a SQL-compatible format.'; - --- TODO: need to look at this *** --- CREATE TABLE report_instance ( --- obj_actual_definition_id INT NOT NULL, --- generation_time TIME NOT NULL, --- tnvc_id INT NOT NULL, --- PRIMARY KEY (obj_actual_definition_id), --- FOREIGN KEY (obj_actual_definition_id) --- REFERENCES obj_actual_definition (obj_actual_definition_id) --- ON DELETE CASCADE, --- FOREIGN KEY (tnvc_id) --- REFERENCES type_name_value_collection (tnvc_id) --- ); - -CREATE TABLE sbr_actual_definition ( - obj_actual_definition_id INT NOT NULL, - expression_id INT NOT NULL, - run_count BIGINT NOT NULL, - start_time TIME NOT NULL, - ac_id INT NOT NULL, - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (expression_id) - REFERENCES expression (expression_id) - ON DELETE CASCADE, - FOREIGN KEY (ac_id) - REFERENCES ari_collection (ac_id) - ON DELETE CASCADE, - UNIQUE (expression_id , run_count , start_time , ac_id) -); - - -CREATE TABLE tbr_actual_definition ( - obj_actual_definition_id INT NOT NULL, - wait_period TIME NOT NULL, - run_count BIGINT NOT NULL, - start_time TIME NOT NULL, - ac_id INT NOT NULL, - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (ac_id) - REFERENCES ari_collection (ac_id) - ON DELETE CASCADE, - UNIQUE (wait_period , run_count , start_time , ac_id) -); - -CREATE TABLE table_template_actual_definition ( - obj_actual_definition_id INT NOT NULL, - tnvc_id INT NOT NULL, - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (tnvc_id) - REFERENCES type_name_value_collection (tnvc_id) - ON DELETE CASCADE, - UNIQUE (tnvc_id) -); - --- need to work on storing rows --- CREATE TABLE table_instance ( --- obj_actual_definition_id INT NOT NULL, --- time_stamp TIME NOT NULL, --- num_rows INT NOT NULL DEFAULT 0, --- tnvc_id INT , --- PRIMARY KEY (obj_actual_definition_id), --- FOREIGN KEY (obj_actual_definition_id) --- REFERENCES obj_actual_definition (obj_actual_definition_id) --- ON DELETE CASCADE, --- FOREIGN KEY (tnvc_id) --- REFERENCES type_name_value_collection (tnvc_id) --- ON DELETE CASCADE --- ); - -CREATE TABLE variable_actual_definition ( - obj_actual_definition_id INT NOT NULL, - data_type_id INT NOT NULL, - expression_id INT NOT NULL, - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, - FOREIGN KEY (expression_id) - REFERENCES expression (expression_id) - ON DELETE CASCADE, - UNIQUE (data_type_id , expression_id) -); - - - --- Ensure MySQL allows explicit INSERT of 0-values for initializing lookup tables --- (Note: Other DB systems, such as PostgreSQL require different syntax for declaring auto-increment fields to begin with). --- SET sql_mode = NO_AUTO_VALUE_ON_ZERO; - -DROP TABLE IF EXISTS message_group_agents; -DROP TABLE IF EXISTS message_perform_control; -DROP TABLE IF EXISTS message_agents; -DROP TABLE IF EXISTS message_report_set_entry; -DROP TABLE IF EXISTS report_definition; -DROP TABLE IF EXISTS message_group_entry; -DROP TABLE IF EXISTS message_group; -DROP TABLE IF EXISTS enum_message_group_states; -DROP TABLE IF EXISTS enum_message_group_types; - -DROP TABLE IF EXISTS nm_mgr_log; - -CREATE TABLE enum_message_group_states ( - state_id INT NOT NULL , - name VARCHAR(45) NULL UNIQUE, - description varchar NULL, - PRIMARY KEY (state_id) - ); - COMMENT ON TABLE enum_message_group_states is 'Enumeration of state_id values in message_group' - ; -INSERT INTO enum_message_group_states (state_id, name, description) VALUES -(0, 'initializing', 'Default value, but generally used solely by UI when creating new outgoing messages.'), -(1, 'ready', 'Indicates message is ready for processing, either for the manager to transmit (outgoing) or user to analyze (incoming)'), -(2, 'sent', 'For outgoing sets only, this indicates that the manager has parsed and sent this message group.'), -(3, 'error', 'Indicates that the manager failed to parse or transmit this group successfully.'), -(4, 'aborted', 'Indicates this outgoing message set has been aborted by the user before transmission.'); - - -CREATE TABLE enum_message_group_types ( - type_id INT NOT NULL , - name VARCHAR(45) NULL UNIQUE, - PRIMARY KEY (type_id) - ); - COMMENT ON TABLE enum_message_group_types is 'Enumeration of Message group opcode/type values' - ; -INSERT INTO enum_message_group_types (type_id, name) VALUES -(0, 'REG_AGENT'), -(1, 'RPT_SET'), -(2, 'PERF_CTRL'), -(3, 'TBL_SET'); - - -CREATE TABLE message_group ( - group_id INT NOT NULL , - created_ts TIMESTAMP NOT NULL DEFAULT NOW(), - modified_ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - ts INT NULL, - is_outgoing BOOL, - state_id INT NOT NULL DEFAULT 0, - PRIMARY KEY (group_id), - CONSTRAINT message_group_state_id FOREIGN KEY (state_id) REFERENCES enum_message_group_states (state_id) ON DELETE RESTRICT - ); -COMMENT on TABLE message_group IS 'Incoming and outgoing message sets'; -COMMENT on COLUMN message_group.modified_ts is 'If NULL, this is an outgoing message. Otherwise this is the raw AMP timestamp value of the received message group. The function amp_ts_to_datetime() can convert this into a MySQL TIMESTAMP format.'; - CREATE TRIGGER update_mg_changetimestamp BEFORE UPDATE - ON message_group FOR EACH ROW EXECUTE PROCEDURE - update_changetimestamp_column(); - -CREATE TABLE message_group_agents ( - group_id INT NOT NULL, - agent_id INT NOT NULL, - PRIMARY KEY (group_id), - CONSTRAINT message_group_agents_group_id FOREIGN KEY (group_id) REFERENCES message_group (group_id) ON DELETE CASCADE, - CONSTRAINT message_group_agents_agent_id FOREIGN KEY (agent_id) REFERENCES registered_agents (registered_agents_id) ON DELETE CASCADE - ); - COMMENT ON TABLE message_group_agents IS 'For received groups, the agent that transmitted the group (singular entry). For outgoing groups, a set of one or more destination agents for this message'; - -CREATE TABLE message_group_entry ( - group_id INT NOT NULL, - message_id INT NOT NULL , - ack BOOL NOT NULL, - nak BOOL NOT NULL, - acl BOOL NOT NULL, - order_num INT NOT NULL, - type_id INT NOT NULL , - PRIMARY KEY (message_id), - UNIQUE (group_id, message_id, order_num), - CONSTRAINT message_group_entry_group_id FOREIGN KEY (group_id) REFERENCES message_group (group_id) ON DELETE CASCADE, - CONSTRAINT message_group_entry_opcode FOREIGN KEY (type_id) REFERENCES enum_message_group_types (type_id) ON DELETE CASCADE - ); - COMMENT ON TABLE message_group_entry is 'For received groups, the agent that transmitted the group (singular entry). For outgoing groups, a set of one or more destination agents for this message'; -COMMENT ON COLUMN message_group_entry.type_id IS 'Conforms to AMP Message Header Opcode value'; - - -CREATE TABLE message_perform_control ( - message_id INT NOT NULL, - tv INT NULL, - ac_id INT NOT NULL, - PRIMARY KEY (message_id), - CONSTRAINT message_perform_control_mid FOREIGN KEY (message_id) REFERENCES message_group_entry (message_id) ON DELETE CASCADE - ); - COMMENT ON TABLE message_perform_control IS 'Control(s) to be sent to agent'; - -CREATE TABLE message_agents ( - message_id INT NOT NULL, - agent_id INT NULL, - PRIMARY KEY (message_id), - CONSTRAINT message_agents_mid FOREIGN KEY (message_id) REFERENCES message_group_entry (message_id) ON DELETE CASCADE, - CONSTRAINT message_agents_eid FOREIGN KEY (agent_id) REFERENCES registered_agents (registered_agents_id) ON DELETE CASCADE - ); - COMMENT ON TABLE message_agents IS 'For register_Agent messages, there will always be a single entry in this table. For Table and Msg sets this is the [optional] list of RX names for the set'; - --- TODO TABLE message_table_set_entry - -CREATE TABLE report_definition ( - report_id INT NOT NULL , - ari_id INT NOT NULL, - ts INT NULL , - tnvc_id INT NULL, - PRIMARY KEY (report_id), - CONSTRAINT report_definition_ari FOREIGN KEY (ari_id) REFERENCES obj_actual_definition (obj_actual_definition_id) ON DELETE CASCADE, - CONSTRAINT report_definition_tnvc FOREIGN KEY (tnvc_id) REFERENCES type_name_value_collection (tnvc_id) ON DELETE CASCADE - ); - COMMENT ON TABLE report_definition IS 'An instance of a receipt message report' ; -COMMENT ON COLUMN report_definition.ts IS 'Optional AMP Timestamp as received'; - -CREATE TABLE message_report_set_entry ( - message_id INT NOT NULL, - report_id INT NULL, - order_num smallint , - UNIQUE (message_id, order_num), - CONSTRAINT message_report_entry_mid FOREIGN KEY (message_id) REFERENCES message_group_entry (message_id) ON DELETE CASCADE, - CONSTRAINT message_report_entry_rid FOREIGN KEY (report_id) REFERENCES report_definition (report_id) ON DELETE CASCADE - ); - COMMENT ON TABLE message_report_set_entry is 'A set of received reports' - ; - -CREATE TABLE nm_mgr_log ( - id SERIAL NOT NULL , - time TIMESTAMP NOT NULL DEFAULT NOW(), - msg varchar NOT NULL, - details TEXT NULL, - level INT NULL, - source VARCHAR(32) NULL, - file VARCHAR(64) NULL, - line INT NULL, - PRIMARY KEY (id) - ); - COMMENT ON TABLE nm_mgr_log is 'AMP_DEBUG logging table for ION NM Manager Application. Primarily intended for debug purposes.' -; - - diff --git a/amp-sql/postgres/Database_Scripts/Views/obj_view.sql b/amp-sql/postgres/Database_Scripts/Views/01-obj_view.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Views/obj_view.sql rename to amp-sql/postgres/Database_Scripts/Views/01-obj_view.sql diff --git a/amp-sql/postgres/Database_Scripts/Views/ctrl_view.sql b/amp-sql/postgres/Database_Scripts/Views/04-ctrl_view.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Views/ctrl_view.sql rename to amp-sql/postgres/Database_Scripts/Views/04-ctrl_view.sql diff --git a/amp-sql/postgres/Database_Scripts/Views/edd_view.sql b/amp-sql/postgres/Database_Scripts/Views/05-edd_view.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Views/edd_view.sql rename to amp-sql/postgres/Database_Scripts/Views/05-edd_view.sql diff --git a/amp-sql/postgres/Database_Scripts/Views/mac_view.sql b/amp-sql/postgres/Database_Scripts/Views/06-mac_view.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Views/mac_view.sql rename to amp-sql/postgres/Database_Scripts/Views/06-mac_view.sql diff --git a/amp-sql/postgres/Database_Scripts/Views/oper_view.sql b/amp-sql/postgres/Database_Scripts/Views/07-oper_view.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Views/oper_view.sql rename to amp-sql/postgres/Database_Scripts/Views/07-oper_view.sql diff --git a/amp-sql/postgres/Database_Scripts/Views/message_view.sql b/amp-sql/postgres/Database_Scripts/Views/08-message_view.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Views/message_view.sql rename to amp-sql/postgres/Database_Scripts/Views/08-message_view.sql diff --git a/amp-sql/postgres/Database_Scripts/Views/sbr_view.sql b/amp-sql/postgres/Database_Scripts/Views/09-sbr_view.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Views/sbr_view.sql rename to amp-sql/postgres/Database_Scripts/Views/09-sbr_view.sql diff --git a/amp-sql/postgres/Database_Scripts/Views/tbr_view.sql b/amp-sql/postgres/Database_Scripts/Views/10-tbr_view.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Views/tbr_view.sql rename to amp-sql/postgres/Database_Scripts/Views/10-tbr_view.sql diff --git a/amp-sql/postgres/Database_Scripts/Views/tblt_view.sql b/amp-sql/postgres/Database_Scripts/Views/11-tblt_view.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Views/tblt_view.sql rename to amp-sql/postgres/Database_Scripts/Views/11-tblt_view.sql diff --git a/amp-sql/postgres/Database_Scripts/Views/tnvc_view.sql b/amp-sql/postgres/Database_Scripts/Views/12-tnvc_view.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Views/tnvc_view.sql rename to amp-sql/postgres/Database_Scripts/Views/12-tnvc_view.sql diff --git a/amp-sql/postgres/Database_Scripts/Views/namespace_view.sql b/amp-sql/postgres/Database_Scripts/Views/13-namespace_view.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Views/namespace_view.sql rename to amp-sql/postgres/Database_Scripts/Views/13-namespace_view.sql diff --git a/amp-sql/postgres/Database_Scripts/Views/parm_view.sql b/amp-sql/postgres/Database_Scripts/Views/13-parm_view.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Views/parm_view.sql rename to amp-sql/postgres/Database_Scripts/Views/13-parm_view.sql diff --git a/amp-sql/postgres/Database_Scripts/Views/rpt_view.sql b/amp-sql/postgres/Database_Scripts/Views/13-rpt_view.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Views/rpt_view.sql rename to amp-sql/postgres/Database_Scripts/Views/13-rpt_view.sql diff --git a/amp-sql/postgres/Database_Scripts/Views/var_view.sql b/amp-sql/postgres/Database_Scripts/Views/13-var_view.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Views/var_view.sql rename to amp-sql/postgres/Database_Scripts/Views/13-var_view.sql diff --git a/amp-sql/postgres/Database_Scripts/Views/ari_view.sql b/amp-sql/postgres/Database_Scripts/Views/14-ari_view.sql similarity index 100% rename from amp-sql/postgres/Database_Scripts/Views/ari_view.sql rename to amp-sql/postgres/Database_Scripts/Views/14-ari_view.sql diff --git a/amp-sql/postgres/Dockerfile b/amp-sql/postgres/Dockerfile deleted file mode 100644 index 3a0cf99..0000000 --- a/amp-sql/postgres/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -## -## Copyright (c) 2023 The Johns Hopkins University Applied Physics -## Laboratory LLC. -## -## This file is part of the Asynchronous Network Management System (ANMS). -## -## 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. -## -## This work was performed for the Jet Propulsion Laboratory, California -## Institute of Technology, sponsored by the United States Government under -## the prime contract 80NM0018D0004 between the Caltech and NASA under -## subcontract 1658085. -## -FROM postgres -ENV POSTGRES_PASSWORD postgres -ENV POSTGRES_DB testdb -COPY init.sql /docker-entrypoint-initdb.d/ \ No newline at end of file diff --git a/amp-sql/postgres/docker-compose.yml b/amp-sql/postgres/docker-compose.yml deleted file mode 100644 index f9ed6e4..0000000 --- a/amp-sql/postgres/docker-compose.yml +++ /dev/null @@ -1,76 +0,0 @@ -## -## Copyright (c) 2023 The Johns Hopkins University Applied Physics -## Laboratory LLC. -## -## This file is part of the Asynchronous Network Management System (ANMS). -## -## 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. -## -## This work was performed for the Jet Propulsion Laboratory, California -## Institute of Technology, sponsored by the United States Government under -## the prime contract 80NM0018D0004 between the Caltech and NASA under -## subcontract 1658085. -## -version: '3.8' - -services: - db: - container_name: postgres - image: postgres - volumes: - - ${PWD}:/shared - - ${PWD}/Database_Scripts/Tables/amp_core_create_database.sql:/docker-entrypoint-initdb.d/00-amp_core_create_database.sql - - ${PWD}/Database_Scripts/Tables/transcoder.sql:/docker-entrypoint-initdb.d/00-transcoder.sql - - ${PWD}/Database_Scripts/Views/obj_view.sql:/docker-entrypoint-initdb.d/01-obj_view.sql - - ${PWD}/Database_Scripts/Views/ari_view.sql:/docker-entrypoint-initdb.d/14-ari_view.sql - - ${PWD}/Database_Scripts/Views/ctrl_view.sql:/docker-entrypoint-initdb.d/04-ctrl_view.sql - - ${PWD}/Database_Scripts/Views/edd_view.sql:/docker-entrypoint-initdb.d/05-edd_view.sql - - ${PWD}/Database_Scripts/Views/mac_view.sql:/docker-entrypoint-initdb.d/06-mac_view.sql - - ${PWD}/Database_Scripts/Views/oper_view.sql:/docker-entrypoint-initdb.d/07-oper_view.sql - - ${PWD}/Database_Scripts/Views/message_view.sql:/docker-entrypoint-initdb.d/08-message_view.sql - - ${PWD}/Database_Scripts/Views/rpt_view.sql:/docker-entrypoint-initdb.d/13-rpt_view.sql - - ${PWD}/Database_Scripts/Views/sbr_view.sql:/docker-entrypoint-initdb.d/09-sbr_view.sql - - ${PWD}/Database_Scripts/Views/tbr_view.sql:/docker-entrypoint-initdb.d/10-tbr_view.sql - - ${PWD}/Database_Scripts/Views/tblt_view.sql:/docker-entrypoint-initdb.d/11-tblt_view.sql - - ${PWD}/Database_Scripts/Views/tnvc_view.sql:/docker-entrypoint-initdb.d/12-tnvc_view.sql - - ${PWD}/Database_Scripts/Views/parm_view.sql:/docker-entrypoint-initdb.d/13-parm_view.sql - - ${PWD}/Database_Scripts/Views/var_view.sql:/docker-entrypoint-initdb.d/13-var_view.sql - - ${PWD}/Database_Scripts/Routines/all_routines.sql:/docker-entrypoint-initdb.d/16-all_routines.sql - - ${PWD}/Agent_Scripts/adm_amp_agent.sql:/docker-entrypoint-initdb.d/30-adm_amp_agent.sql - - ${PWD}/Agent_Scripts/adm_bp_agent.sql:/docker-entrypoint-initdb.d/30-adm_bp_agent.sql - - ${PWD}/Agent_Scripts/adm_ltp_agent.sql:/docker-entrypoint-initdb.d/30-adm_ltp_agent.sql - - ${PWD}/Agent_Scripts/adm_ionsec_admin.sql:/docker-entrypoint-initdb.d/30-adm_ionsec_admin.sql - - ${PWD}/Agent_Scripts/adm_ion_ltp_admin.sql:/docker-entrypoint-initdb.d/30-adm_ion_ltp_admin.sql - - ${PWD}/Agent_Scripts/adm_ion_ipn_admin.sql:/docker-entrypoint-initdb.d/30-adm_ion_ipn_admin.sql - - ${PWD}/Agent_Scripts/adm_ion_bp_admin.sql:/docker-entrypoint-initdb.d/30-adm_ion_bp_admin.sql - - ${PWD}/Agent_Scripts/adm_ion_admin.sql:/docker-entrypoint-initdb.d/30-adm_ion_admin.sql - - ${PWD}/Agent_Scripts/adm_sbsp.sql:/docker-entrypoint-initdb.d/30-adm_sbsp.sql - - ${PWD}/Database_Scripts/Tables/healthcheck_roles.sql:/docker-entrypoint-initdb.d/17-healthcheck_roles.sql - - ${PWD}/Database_Scripts/amp_core_functions.sql:/docker-entrypoint-initdb.d/17-amp_core_functions.sql - restart: always - environment: - POSTGRES_USER: root - POSTGRES_PASSWORD: root - POSTGRES_DB: amp_core - ports: - - "5432:5432" - pgadmin: - container_name: pgadmin4_container - image: dpage/pgadmin4 - restart: always - environment: - PGADMIN_DEFAULT_EMAIL: admin@admin.com - PGADMIN_DEFAULT_PASSWORD: admin - ports: - - "5050:80" - volumes: - - ./servers.json:/pgadmin4/servers.json # preconfigured servers/connections - - ./pgpass.conf:/pgpass # passwords for the connections in this file diff --git a/amp-sql/postgres/init.sql b/amp-sql/postgres/init.sql deleted file mode 100644 index a39653f..0000000 --- a/amp-sql/postgres/init.sql +++ /dev/null @@ -1,859 +0,0 @@ --- --- Copyright (c) 2023 The Johns Hopkins University Applied Physics --- Laboratory LLC. --- --- This file is part of the Asynchronous Network Management System (ANMS). --- --- 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. --- --- This work was performed for the Jet Propulsion Laboratory, California --- Institute of Technology, sponsored by the United States Government under --- the prime contract 80NM0018D0004 between the Caltech and NASA under --- subcontract 1658085. --- - --- A DB for storing and using the ADMs and ADM objects --- --- Version 1.0 of the amp database --- Changes: --- All sp_ are changed to SP__ to follow good sql practices. --- --- Updated the constraints of Constants included derived types. --- --- Reworking SBR and TBR instance and definitons. All the base info will be in definition and Instances will be used for holding parameter info --- and when to run. --- can store what the previous events and every so often remove old instances or move them to long term storage. --- --- Updated obj_defintion to cascade on delete --- --- updated some naming conventions, making sure fk agree with pk, and pk follow table name. obj_identifer to obj_metadata. --- - - --- SET GLOBAL sql_mode='NO_AUTO_VALUE_ON_ZERO'; --- SET SESSION sql_mode='NO_AUTO_VALUE_ON_ZERO'; --- SELECT @@GLOBAL .sql_mode; --- SELECT @@SESSION .sql_mode; - --- CREATE DATABASE /*!32312 IF NOT EXISTS*/ /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; - - -CREATE OR REPLACE FUNCTION update_changetimestamp_column() -RETURNS TRIGGER AS $$ -BEGIN - NEW.changetimestamp = now(); - RETURN NEW; -END; -$$ language 'plpgsql'; - -CREATE SEQUENCE data_type_id_seq minvalue 0; -CREATE TABLE data_type ( - data_type_id integer NOT NULL DEFAULT nextval('data_type_id_seq'), - type_name VARCHAR(50) NOT NULL UNIQUE, - use_desc varchar NOT NULL, - PRIMARY KEY (data_type_id) -); -ALTER SEQUENCE data_type_id_seq OWNED BY data_type.data_type_id; -ALTER SEQUENCE data_type_id_seq RESTART WITH 0; --- AMM Object Types -INSERT INTO data_type(type_name, use_desc) VALUES('CONST','Constant'); -- to start Auto increment at 0 -INSERT INTO data_type(type_name, use_desc) VALUES('CTRL','Control'); -INSERT INTO data_type(type_name, use_desc) VALUES('EDD','Externally Defined Data'); -INSERT INTO data_type(type_name, use_desc) VALUES('LIT','Literal'); -INSERT INTO data_type(type_name, use_desc) VALUES('MAC','Macro'); -INSERT INTO data_type(type_name, use_desc) VALUES('OPER','Operator'); -INSERT INTO data_type(type_name, use_desc) VALUES('RPT','Report'); -INSERT INTO data_type(type_name, use_desc) VALUES('RPTT','Report Template'); -INSERT INTO data_type(type_name, use_desc) VALUES('SBR','State Based Rules'); -INSERT INTO data_type(type_name, use_desc) VALUES('TBL','Table'); -INSERT INTO data_type(type_name, use_desc) VALUES('TBLT','Table Template'); -INSERT INTO data_type(type_name, use_desc) VALUES('TBR','Time Based Rules'); -INSERT INTO data_type(type_name, use_desc) VALUES('VAR','Variable'); -INSERT INTO data_type(type_name, use_desc) VALUES('MDAT','Metadata'); - -ALTER SEQUENCE data_type_id_seq RESTART WITH 16; --- Primative Types -INSERT INTO data_type(type_name, use_desc) VALUES('BOOL','Boolean'); -- to start Auto increment at 16 -INSERT INTO data_type(type_name, use_desc) VALUES('BYTE','8 bits, Standard Byte'); -INSERT INTO data_type(type_name, use_desc) VALUES('STR','Character String'); -INSERT INTO data_type(type_name, use_desc) VALUES('INT','Signed 32 bit Integer'); -INSERT INTO data_type(type_name, use_desc) VALUES('UINT',' 32 bit Integer'); -INSERT INTO data_type(type_name, use_desc) VALUES('VAST','Signed 64 bit Integer'); -INSERT INTO data_type(type_name, use_desc) VALUES('UVAST',' 64 bit Integer'); -INSERT INTO data_type(type_name, use_desc) VALUES('REAL32','Single precision Floating Point'); -INSERT INTO data_type(type_name, use_desc) VALUES('REAL64','double precision precision Floating Point'); - -ALTER SEQUENCE data_type_id_seq RESTART WITH 32; --- Compound/Derived Types -INSERT INTO data_type(type_name, use_desc) VALUES('TV','Time Value'); -- to start Auto increment at 32 -INSERT INTO data_type(type_name, use_desc) VALUES('TS','Timestamp'); -INSERT INTO data_type(type_name, use_desc) VALUES('TNV','Type-Name-Value'); -INSERT INTO data_type(type_name, use_desc) VALUES('TNVC','Type-Name-Value Collection'); -INSERT INTO data_type(type_name, use_desc) VALUES('ARI','AMM Resource Identifier'); -INSERT INTO data_type(type_name, use_desc) VALUES('AC','ARI Collection'); -INSERT INTO data_type(type_name, use_desc) VALUES('EXPR','Expression'); -INSERT INTO data_type(type_name, use_desc) VALUES('BYTESTR','Bytestring'); -INSERT INTO data_type(type_name, use_desc) VALUES ('PARMNAME','parameter name'); -INSERT INTO data_type(type_name, use_desc) VALUES('FP','formal parameter'); -INSERT INTO data_type(type_name, use_desc) VALUES ('APV','actual parameter-by-value'); -INSERT INTO data_type(type_name, use_desc) VALUES('APN', 'actual parameter-by-name'); - - -CREATE TABLE IF NOT EXISTS ADM_Type_Enumeration ( - data_type_id INT NOT NULL, - Enumeration INT NOT NULL, - PRIMARY KEY (data_type_id), - CONSTRAINT fk1 FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE ON UPDATE NO ACTION -); - --- Table 1: ADM Type Enumerations -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (0, 0); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (1, 1); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (2, 2); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (3, 3); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (5, 4); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (7, 5); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (8, 6); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (10, 7); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (11, 8); -INSERT INTO ADM_Type_Enumeration (data_type_id, Enumeration) VALUES (12, 9); - - - -CREATE TABLE registered_agents ( - registered_agents_id INT NOT NULL , - agent_id_string VARCHAR(128) NOT NULL DEFAULT 'ipn:0.0', - first_registered TIMESTAMP NOT NULL DEFAULT NOW(), - last_registered TIMESTAMP NOT NULL DEFAULT NOW(), - PRIMARY KEY (registered_agents_id), - UNIQUE (agent_id_string) -); - -CREATE TABLE namespace ( - namespace_id INT NOT NULL , - namespace_type varchar NOT NULL, - issuing_org varchar NOT NULL, - name_string varchar NOT NULL, - version_name varchar NOT NULL DEFAULT '0.0.0', - PRIMARY KEY (namespace_id) - -- Below UNIQUE key not valid. Explicit check in SP instead instead. TODO: Add appropriate indexes - -- UNIQUE (namespace_type, issuing_org , name_string , version_name) -); - - -CREATE TABLE adm ( - namespace_id INT NOT NULL, - adm_name varchar, - adm_enum INT , - adm_enum_label varchar, - use_desc varchar DEFAULT NULL, - PRIMARY KEY (namespace_id), - FOREIGN KEY (namespace_id) - REFERENCES namespace (namespace_id), - UNIQUE (adm_enum) -); - -CREATE TABLE network_config ( - namespace_id INT NOT NULL, - issuer_binary_string varchar NOT NULL, - tag varchar DEFAULT NULL, - PRIMARY KEY (namespace_id), - FOREIGN KEY (namespace_id) - REFERENCES namespace (namespace_id) -); - - -CREATE TABLE obj_metadata ( - obj_metadata_id INT NOT NULL , - data_type_id INT NOT NULL, - obj_name varchar NOT NULL, - namespace_id INT , - PRIMARY KEY (obj_metadata_id), - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, - FOREIGN KEY (namespace_id) - REFERENCES namespace (namespace_id) - ON DELETE CASCADE, - UNIQUE (data_type_id , obj_name , namespace_id) -); - - -CREATE TABLE obj_formal_definition ( - obj_formal_definition_id INT NOT NULL , - obj_metadata_id INT NOT NULL, - obj_enum INT DEFAULT NULL, -- Nominally obj_enum, data_type_id, and adm_enum would make a UNIQUE KEY, but tables are too normalized to enforce this - use_desc varchar DEFAULT NULL, - PRIMARY KEY (obj_formal_definition_id), - FOREIGN KEY (obj_metadata_id) - REFERENCES obj_metadata (obj_metadata_id) - ON DELETE CASCADE -); - -CREATE TABLE obj_actual_definition ( - obj_actual_definition_id INT NOT NULL , - obj_metadata_id INT NOT NULL, - use_desc varchar DEFAULT ' ', - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_metadata_id) - REFERENCES obj_metadata (obj_metadata_id) - ON DELETE CASCADE -); - -CREATE TABLE formal_parmspec ( - fp_spec_id INT NOT NULL , - num_parms INT NOT NULL, - use_desc varchar DEFAULT NULL, - PRIMARY KEY (fp_spec_id) -); - - -CREATE TABLE IF NOT EXISTS formal_parm ( - fp_id INT NOT NULL , - fp_spec_id INT NOT NULL, - order_num INT NOT NULL, - parm_name varchar DEFAULT NULL, - data_type_id INT NOT NULL, - obj_actual_definition_id INT NULL DEFAULT NULL, - PRIMARY KEY (fp_id), - FOREIGN KEY (fp_spec_id) - REFERENCES formal_parmspec (fp_spec_id) - ON DELETE CASCADE ON UPDATE NO ACTION, - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE SET NULL, - UNIQUE (fp_id , order_num) -); - -CREATE TABLE ari_collection ( - ac_id INT NOT NULL , - num_entries INT NOT NULL DEFAULT 0, - use_desc varchar, - PRIMARY KEY (ac_id) -); - - -CREATE TABLE type_name_value_collection ( - tnvc_id INT NOT NULL , - use_desc varchar DEFAULT NULL, - PRIMARY KEY (tnvc_id) -); - -CREATE TABLE type_name_value_entry ( - tnv_id INT NOT NULL , - tnvc_id INT NOT NULL, - order_num INT DEFAULT 0, - data_type_id INT , - data_name varchar DEFAULT NULL, - fp_id INT DEFAULT NULL, - PRIMARY KEY (tnv_id), - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, - FOREIGN KEY (tnvc_id) - REFERENCES type_name_value_collection (tnvc_id) - ON DELETE CASCADE, - FOREIGN KEY (fp_id) REFERENCES formal_parm (fp_id), -UNIQUE (tnvc_id , order_num) -); - -CREATE TABLE type_name_value_obj_entry ( -tnv_id INT NOT NULL, -obj_actual_definition_id INT DEFAULT NULL, -FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE SET NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE type_name_value_int_entry ( -tnv_id INT NOT NULL, -entry_value INT DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE type_name_value_ac_entry ( -tnv_id INT NOT NULL, -ac_id INT DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE, -FOREIGN KEY (ac_id) - REFERENCES ari_collection (ac_id) -); - -CREATE TABLE type_name_value_tnvc_entry ( -tnv_id INT NOT NULL, -tnvc_id INT DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE, -FOREIGN KEY (tnvc_id) - REFERENCES type_name_value_collection (tnvc_id) -); - - -CREATE TABLE type_name_value_uint_entry ( -tnv_id INT NOT NULL, -entry_value INT DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE type_name_value_vast_entry ( -tnv_id INT NOT NULL, -entry_value BIGINT DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE type_name_value_uvast_entry ( -tnv_id INT NOT NULL, -entry_value BIGINT DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE type_name_value_real32_entry ( -tnv_id INT NOT NULL, -entry_value FLOAT DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - - -CREATE TABLE type_name_value_real64_entry ( -tnv_id INT NOT NULL, -entry_value double precision DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE type_name_value_string_entry ( -tnv_id INT NOT NULL, -entry_value varchar DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE type_name_value_bool_entry ( -tnv_id INT NOT NULL, -entry_value BOOL DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE type_name_value_byte_entry ( -tnv_id INT NOT NULL, -entry_value smallint DEFAULT NULL, -FOREIGN KEY (tnv_id) - REFERENCES type_name_value_entry (tnv_id) - ON DELETE CASCADE -); - -CREATE TABLE ari_collection_entry ( - ac_entry_id INT NOT NULL , - ac_id INT NOT NULL, - order_num INT NOT NULL, - PRIMARY KEY (ac_entry_id), - FOREIGN KEY (ac_id) - REFERENCES ari_collection (ac_id) - ON DELETE CASCADE, - UNIQUE (ac_id , order_num) -); - -CREATE TABLE ari_collection_formal_entry ( - ac_entry_id INT NOT NULL, - obj_formal_definition_id INT NOT NULL, - PRIMARY KEY (ac_entry_id), - FOREIGN KEY (ac_entry_id) - REFERENCES ari_collection_entry (ac_entry_id) - ON DELETE CASCADE, - FOREIGN KEY (obj_formal_definition_id) - REFERENCES obj_formal_definition (obj_formal_definition_id) - ON DELETE CASCADE -); - - -CREATE TABLE ari_collection_actual_entry ( - ac_entry_id INT NOT NULL , - obj_actual_definition_id INT NOT NULL, - PRIMARY KEY (ac_entry_id), - FOREIGN KEY (ac_entry_id) - REFERENCES ari_collection_entry (ac_entry_id) - ON DELETE CASCADE, - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE -); - - - - -CREATE TABLE actual_parmspec ( - ap_spec_id INT NOT NULL , - fp_spec_id INT NOT NULL, - tnvc_id INT NOT NULL, - use_desc varchar DEFAULT NULL, - PRIMARY KEY (ap_spec_id), - FOREIGN KEY (fp_spec_id) - REFERENCES formal_parmspec (fp_spec_id) - ON DELETE CASCADE, - FOREIGN KEY (tnvc_id) - REFERENCES type_name_value_collection (tnvc_id) - ON DELETE CASCADE - -); - - - -CREATE TABLE edd_formal_definition ( - obj_formal_definition_id INT NOT NULL, - fp_spec_id INT , - data_type_id INT NOT NULL, - PRIMARY KEY (obj_formal_definition_id), - FOREIGN KEY (obj_formal_definition_id) - REFERENCES obj_formal_definition (obj_formal_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (fp_spec_id) - REFERENCES formal_parmspec (fp_spec_id) - ON DELETE CASCADE, - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, - UNIQUE (fp_spec_id) -); - -CREATE TABLE edd_actual_definition ( - obj_actual_definition_id INT NOT NULL, - ap_spec_id INT , - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (ap_spec_id) - REFERENCES actual_parmspec (ap_spec_id) - ON DELETE CASCADE, - UNIQUE (ap_spec_id) -); - - -CREATE TABLE const_actual_definition ( - obj_actual_definition_id INT NOT NULL, - data_type_id INT NOT NULL, - data_value varchar NOT NULL, - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, --- UNIQUE (data_type_id , data_value), -- TODO: Update SP to auto-select existing, joining on metadata_id to enforce constraint. The columns in this table alone are insufficient - CHECK (data_type_id > 15 AND data_type_id < 40) -); - -CREATE TABLE control_formal_definition ( - obj_formal_definition_id INT NOT NULL, - fp_spec_id INT , - PRIMARY KEY (obj_formal_definition_id), - FOREIGN KEY (obj_formal_definition_id) - REFERENCES obj_formal_definition (obj_formal_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (fp_spec_id) - REFERENCES formal_parmspec (fp_spec_id) - ON DELETE CASCADE, - UNIQUE (fp_spec_id) -); - -CREATE TABLE control_actual_definition ( - obj_actual_definition_id INT NOT NULL, - ap_spec_id INT , - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (ap_spec_id) - REFERENCES actual_parmspec (ap_spec_id) - ON DELETE CASCADE, - UNIQUE (ap_spec_id) -); - -CREATE TABLE macro_formal_definition ( - obj_formal_definition_id INT NOT NULL, - fp_spec_id INT , - ac_id INT NOT NULL, - max_call_depth INT DEFAULT 4, - PRIMARY KEY (obj_formal_definition_id), - FOREIGN KEY (obj_formal_definition_id) - REFERENCES obj_formal_definition (obj_formal_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (fp_spec_id) - REFERENCES formal_parmspec (fp_spec_id) - ON DELETE CASCADE, - FOREIGN KEY (ac_id) - REFERENCES ari_collection (ac_id) - ON DELETE CASCADE, - UNIQUE (fp_spec_id) -); - - -CREATE TABLE macro_actual_definition ( - obj_actual_definition_id INT NOT NULL, - ap_spec_id INT , - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (ap_spec_id) - REFERENCES actual_parmspec (ap_spec_id) - ON DELETE CASCADE, - UNIQUE (ap_spec_id) -); - -CREATE TABLE operator_actual_definition ( - obj_actual_definition_id INT NOT NULL, - data_type_id INT NOT NULL, - num_operands INT NOT NULL, - tnvc_id INT NOT NULL, - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, - FOREIGN KEY (tnvc_id) - REFERENCES type_name_value_collection (tnvc_id) - ON DELETE CASCADE -); - -CREATE TABLE literal_actual_definition ( - obj_actual_definition_id INT NOT NULL, - data_type_id INT NOT NULL, - data_value varchar NOT NULL, - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, - CHECK (data_type_id > 16) - -- UNIQUE (data_value) -- TODO: Unique constraint must include metadata_id, so we will have to enforce via SP later -); - - -CREATE TABLE expression ( - expression_id INT NOT NULL , - data_type_id INT NOT NULL, - ac_id INT NOT NULL, - PRIMARY KEY (expression_id), - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, - FOREIGN KEY (ac_id) - REFERENCES ari_collection (ac_id) - ON DELETE CASCADE, - UNIQUE (data_type_id , ac_id) -); - -CREATE TABLE report_template_formal_definition ( - obj_formal_definition_id INT NOT NULL, - fp_spec_id INT , - ac_id INT NOT NULL, - PRIMARY KEY (obj_formal_definition_id), - FOREIGN KEY (obj_formal_definition_id) - REFERENCES obj_formal_definition (obj_formal_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (fp_spec_id) - REFERENCES formal_parmspec (fp_spec_id) - ON DELETE CASCADE, - FOREIGN KEY (ac_id) - REFERENCES ari_collection (ac_id) - ON DELETE CASCADE, - UNIQUE (fp_spec_id) -); - -CREATE TABLE report_template_actual_definition ( - obj_actual_definition_id INT NOT NULL, - ap_spec_id INT , - ts TIMESTAMP NULL, - - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (ap_spec_id) - REFERENCES actual_parmspec (ap_spec_id) - ON DELETE CASCADE, - UNIQUE (ap_spec_id) -); -COMMENT ON COLUMN report_template_actual_definition.ts IS 'TS value embedded in raw report. This field may be NULL if embedded in a set of reports with a common timestamp (per specification). Calling application is responsible for converting AMP Timestamp specification into a SQL-compatible format.'; - --- TODO: need to look at this *** --- CREATE TABLE report_instance ( --- obj_actual_definition_id INT NOT NULL, --- generation_time TIME NOT NULL, --- tnvc_id INT NOT NULL, --- PRIMARY KEY (obj_actual_definition_id), --- FOREIGN KEY (obj_actual_definition_id) --- REFERENCES obj_actual_definition (obj_actual_definition_id) --- ON DELETE CASCADE, --- FOREIGN KEY (tnvc_id) --- REFERENCES type_name_value_collection (tnvc_id) --- ); - -CREATE TABLE sbr_actual_definition ( - obj_actual_definition_id INT NOT NULL, - expression_id INT NOT NULL, - run_count BIGINT NOT NULL, - start_time TIME NOT NULL, - ac_id INT NOT NULL, - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (expression_id) - REFERENCES expression (expression_id) - ON DELETE CASCADE, - FOREIGN KEY (ac_id) - REFERENCES ari_collection (ac_id) - ON DELETE CASCADE, - UNIQUE (expression_id , run_count , start_time , ac_id) -); - - -CREATE TABLE tbr_actual_definition ( - obj_actual_definition_id INT NOT NULL, - wait_period TIME NOT NULL, - run_count BIGINT NOT NULL, - start_time TIME NOT NULL, - ac_id INT NOT NULL, - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (ac_id) - REFERENCES ari_collection (ac_id) - ON DELETE CASCADE, - UNIQUE (wait_period , run_count , start_time , ac_id) -); - -CREATE TABLE table_template_actual_definition ( - obj_actual_definition_id INT NOT NULL, - tnvc_id INT NOT NULL, - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (tnvc_id) - REFERENCES type_name_value_collection (tnvc_id) - ON DELETE CASCADE, - UNIQUE (tnvc_id) -); - --- need to work on storing rows --- CREATE TABLE table_instance ( --- obj_actual_definition_id INT NOT NULL, --- time_stamp TIME NOT NULL, --- num_rows INT NOT NULL DEFAULT 0, --- tnvc_id INT , --- PRIMARY KEY (obj_actual_definition_id), --- FOREIGN KEY (obj_actual_definition_id) --- REFERENCES obj_actual_definition (obj_actual_definition_id) --- ON DELETE CASCADE, --- FOREIGN KEY (tnvc_id) --- REFERENCES type_name_value_collection (tnvc_id) --- ON DELETE CASCADE --- ); - -CREATE TABLE variable_actual_definition ( - obj_actual_definition_id INT NOT NULL, - data_type_id INT NOT NULL, - expression_id INT NOT NULL, - PRIMARY KEY (obj_actual_definition_id), - FOREIGN KEY (obj_actual_definition_id) - REFERENCES obj_actual_definition (obj_actual_definition_id) - ON DELETE CASCADE, - FOREIGN KEY (data_type_id) - REFERENCES data_type (data_type_id) - ON DELETE CASCADE, - FOREIGN KEY (expression_id) - REFERENCES expression (expression_id) - ON DELETE CASCADE, - UNIQUE (data_type_id , expression_id) -); - - - --- Ensure MySQL allows explicit INSERT of 0-values for initializing lookup tables --- (Note: Other DB systems, such as PostgreSQL require different syntax for declaring auto-increment fields to begin with). --- SET sql_mode = NO_AUTO_VALUE_ON_ZERO; - -DROP TABLE IF EXISTS message_group_agents; -DROP TABLE IF EXISTS message_perform_control; -DROP TABLE IF EXISTS message_agents; -DROP TABLE IF EXISTS message_report_set_entry; -DROP TABLE IF EXISTS report_definition; -DROP TABLE IF EXISTS message_group_entry; -DROP TABLE IF EXISTS message_group; -DROP TABLE IF EXISTS enum_message_group_states; -DROP TABLE IF EXISTS enum_message_group_types; - -DROP TABLE IF EXISTS nm_mgr_log; - -CREATE TABLE enum_message_group_states ( - state_id INT NOT NULL , - name VARCHAR(45) NULL UNIQUE, - description varchar NULL, - PRIMARY KEY (state_id) - ); - COMMENT ON TABLE enum_message_group_states is 'Enumeration of state_id values in message_group' - ; -INSERT INTO enum_message_group_states (state_id, name, description) VALUES -(0, 'initializing', 'Default value, but generally used solely by UI when creating new outgoing messages.'), -(1, 'ready', 'Indicates message is ready for processing, either for the manager to transmit (outgoing) or user to analyze (incoming)'), -(2, 'sent', 'For outgoing sets only, this indicates that the manager has parsed and sent this message group.'), -(3, 'error', 'Indicates that the manager failed to parse or transmit this group successfully.'), -(4, 'aborted', 'Indicates this outgoing message set has been aborted by the user before transmission.'); - - -CREATE TABLE enum_message_group_types ( - type_id INT NOT NULL , - name VARCHAR(45) NULL UNIQUE, - PRIMARY KEY (type_id) - ); - COMMENT ON TABLE enum_message_group_types is 'Enumeration of Message group opcode/type values' - ; -INSERT INTO enum_message_group_types (type_id, name) VALUES -(0, 'REG_AGENT'), -(1, 'RPT_SET'), -(2, 'PERF_CTRL'), -(3, 'TBL_SET'); - - -CREATE TABLE message_group ( - group_id INT NOT NULL , - created_ts TIMESTAMP NOT NULL DEFAULT NOW(), - modified_ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - ts INT NULL, - is_outgoing BOOL, - state_id INT NOT NULL DEFAULT 0, - PRIMARY KEY (group_id), - CONSTRAINT message_group_state_id FOREIGN KEY (state_id) REFERENCES enum_message_group_states (state_id) ON DELETE RESTRICT - ); -COMMENT on TABLE message_group IS 'Incoming and outgoing message sets'; -COMMENT on COLUMN message_group.modified_ts is 'If NULL, this is an outgoing message. Otherwise this is the raw AMP timestamp value of the received message group. The function amp_ts_to_datetime() can convert this into a MySQL TIMESTAMP format.'; - CREATE TRIGGER update_mg_changetimestamp BEFORE UPDATE - ON message_group FOR EACH ROW EXECUTE PROCEDURE - update_changetimestamp_column(); - -CREATE TABLE message_group_agents ( - group_id INT NOT NULL, - agent_id INT NOT NULL, - PRIMARY KEY (group_id), - CONSTRAINT message_group_agents_group_id FOREIGN KEY (group_id) REFERENCES message_group (group_id) ON DELETE CASCADE, - CONSTRAINT message_group_agents_agent_id FOREIGN KEY (agent_id) REFERENCES registered_agents (registered_agents_id) ON DELETE CASCADE - ); - COMMENT ON TABLE message_group_agents IS 'For received groups, the agent that transmitted the group (singular entry). For outgoing groups, a set of one or more destination agents for this message'; - -CREATE TABLE message_group_entry ( - group_id INT NOT NULL, - message_id INT NOT NULL , - ack BOOL NOT NULL, - nak BOOL NOT NULL, - acl BOOL NOT NULL, - order_num INT NOT NULL, - type_id INT NOT NULL , - PRIMARY KEY (message_id), - UNIQUE (group_id, message_id, order_num), - CONSTRAINT message_group_entry_group_id FOREIGN KEY (group_id) REFERENCES message_group (group_id) ON DELETE CASCADE, - CONSTRAINT message_group_entry_opcode FOREIGN KEY (type_id) REFERENCES enum_message_group_types (type_id) ON DELETE CASCADE - ); - COMMENT ON TABLE message_group_entry is 'For received groups, the agent that transmitted the group (singular entry). For outgoing groups, a set of one or more destination agents for this message'; -COMMENT ON COLUMN message_group_entry.type_id IS 'Conforms to AMP Message Header Opcode value'; - - -CREATE TABLE message_perform_control ( - message_id INT NOT NULL, - tv INT NULL, - ac_id INT NOT NULL, - PRIMARY KEY (message_id), - CONSTRAINT message_perform_control_mid FOREIGN KEY (message_id) REFERENCES message_group_entry (message_id) ON DELETE CASCADE - ); - COMMENT ON TABLE message_perform_control IS 'Control(s) to be sent to agent'; - -CREATE TABLE message_agents ( - message_id INT NOT NULL, - agent_id INT NULL, - PRIMARY KEY (message_id), - CONSTRAINT message_agents_mid FOREIGN KEY (message_id) REFERENCES message_group_entry (message_id) ON DELETE CASCADE, - CONSTRAINT message_agents_eid FOREIGN KEY (agent_id) REFERENCES registered_agents (registered_agents_id) ON DELETE CASCADE - ); - COMMENT ON TABLE message_agents IS 'For register_Agent messages, there will always be a single entry in this table. For Table and Msg sets this is the [optional] list of RX names for the set'; - --- TODO TABLE message_table_set_entry - -CREATE TABLE report_definition ( - report_id INT NOT NULL , - ari_id INT NOT NULL, - ts INT NULL , - tnvc_id INT NULL, - PRIMARY KEY (report_id), - CONSTRAINT report_definition_ari FOREIGN KEY (ari_id) REFERENCES obj_actual_definition (obj_actual_definition_id) ON DELETE CASCADE, - CONSTRAINT report_definition_tnvc FOREIGN KEY (tnvc_id) REFERENCES type_name_value_collection (tnvc_id) ON DELETE CASCADE - ); - COMMENT ON TABLE report_definition IS 'An instance of a receipt message report' ; -COMMENT ON COLUMN report_definition.ts IS 'Optional AMP Timestamp as received'; - -CREATE TABLE message_report_set_entry ( - message_id INT NOT NULL, - report_id INT NULL, - order_num smallint , - UNIQUE (message_id, order_num), - CONSTRAINT message_report_entry_mid FOREIGN KEY (message_id) REFERENCES message_group_entry (message_id) ON DELETE CASCADE, - CONSTRAINT message_report_entry_rid FOREIGN KEY (report_id) REFERENCES report_definition (report_id) ON DELETE CASCADE - ); - COMMENT ON TABLE message_report_set_entry is 'A set of received reports' - ; - -CREATE TABLE nm_mgr_log ( - id INT NOT NULL , - time TIMESTAMP NOT NULL DEFAULT NOW(), - msg varchar NOT NULL, - details TEXT NULL, - level INT NULL, - source VARCHAR(32) NULL, - file VARCHAR(64) NULL, - line INT NULL, - PRIMARY KEY (id) - ); - COMMENT ON TABLE nm_mgr_log is 'AMP_DEBUG logging table for ION NM Manager Application. Primarily intended for debug purposes.' -; - -