# Test Set: Standard Reports.
#
# Assume nm_mgr is on ipn:1.1
# Assume nm_agent is on ipn:1.2
# Assume ipn:1.0 is available

###################################################
# Test Case 1 Generate Reports.
###################################################

#------------------------------------------------------------------------------
# Step 1.1: Generate Agent ADM Full Report.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_rpts([ari:/IANA:amp.agent/Rptt.full_report()],[])
#
#------------------------------------------------------------------------------
c11541050502252381871819410000
WAIT 1

#------------------------------------------------------------------------------
# Step 1.2: Verify ADM report received and correct.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 1.3 Generate the BP Full Report.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_rpts([ari:/IANA:bp.agent/Rptt.full_report()],[])
#
#------------------------------------------------------------------------------
c1154105050225238127456167656e744449414e4100
WAIT 1

#------------------------------------------------------------------------------
# Step 1.4: Verify BP Report received and correct.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 1.5: Generate ADM Report and BP Report Concurrently.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_rpts(
#         [ari:/IANA:amp.agent/Rptt.full_report(),
#          ari:/IANA:bp.agent/Rptt.full_report()],[])
#
#------------------------------------------------------------------------------
c11541050502252382871819410027456167656e744449414e4100
WAIT 1

#------------------------------------------------------------------------------
# Step 1.6: Verify both reports received and correct.
#------------------------------------------------------------------------------

###################################################
# Test Case 2: Generate parameterized reports
###################################################

#------------------------------------------------------------------------------
# Step 2.1: Generate Endpoint report for endpoint ipn:1.1
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_rpts(
#       [ari:/IANA:dtn.bp_agent/Rptt.endpoint_report(ipn:1.1)],[])
#
#------------------------------------------------------------------------------
c11541050502252381c7182d41010501126769706e3a312e3100
WAIT 5


#------------------------------------------------------------------------------
# Step 2.2: Verify endpoint report received for selected endpoint
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 2.3 Generate Endpoint report for 3 endpoints:
#              ipn:1.0,
#              ipn:1.1,
#              ipn:1.2
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_rpts(
#         [ari:/IANA:dtn.bp_agent/Rptt.endpoint_report(ipn:1.0),
#          ari:/IANA:dtn.bp_agent/Rptt.endpoint_report(ipn:1.1),
#          ari:/IANA:dtn.bp_agent/Rptt.endpoint_report(ipn:1.2)], [])
#
#------------------------------------------------------------------------------
c11541050502252383c7182d41010501126769706e3a312e30c7182d41010501126769706e3a312e31c7182d41010501126769706e3a312e3200
WAIT 5

#------------------------------------------------------------------------------
# Step 2.4: Verify endpoint reports received for the three endpoints:
#           ipn:1.0
#           ipn:1.1
#           ipn:1.2
#------------------------------------------------------------------------------


###################################################
# Test Case 3: Report on basic elements
###################################################

#------------------------------------------------------------------------------
# Step 3.1: Generate Report that has specified EDD in it.
#           EDD selected is NUM_TBL_TPLS defined by the AMP Agent ADM
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_rpts([ari:/IANA:amp.agent/Edd.num_tbl_tpls],[])
#
#------------------------------------------------------------------------------
c115410505022523818216410100
WAIT 1

#------------------------------------------------------------------------------
# Step 3.2: Verify report received and correct.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 3.3: Generate Report that has specified VAR in it.
#           VAR selected is NUM_RULES defined by the AMP Agent ADM
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_rpts([ari:/IANA:amp.agent/Var.num_rules],[])
#
#------------------------------------------------------------------------------
c115410505022523818c181d410000
WAIT 1

#------------------------------------------------------------------------------
# Step 3.4: Verify report received and correct.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 3.5 Generate two report at once: with EDD and VAR in it.
#          EDD selected is NUM_TBL_TPLS defined by the AMP Agent ADM
#          VAR selected is NUM_RULES defined by the AMP Agent ADM
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_rpts(
#         [ari:/IANA:amp.agent/Edd.num_tbl_tpls,
#          ari:/IANA:amp.agent/Var.num_rules], [])
#
#------------------------------------------------------------------------------
c11541050502252382821641018c181d410000
WAIT 1

#------------------------------------------------------------------------------
# Step 3.6: Verify report received and correct
#------------------------------------------------------------------------------


###################################################
# Test Case 4: Report templates
###################################################

#------------------------------------------------------------------------------
# Step 4.1: Add a report template (R1) that provides the number of table
#           templates (num_tbl_tpls) and number of report templates
#           (num_rpt_tpls) known to the Agent.
#
#------------------------------------------------------------------------------
#
# Type: Report Template (rptt)
# Nickname (NN): 1
# Issuer (ISS): 1
# Name: R1
# RPTT ARI: ari:/1:1/Rptt.R1
# CBOR RPTT ARI: 0x3742523141314131
#
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.add_rptt(ari:/1:1/Rptt.R1,
#        [ari:/IANA:amp.agent/Edd.num_tbl_tpls,
#         ari:/IANA:amp.agent/Edd.num_rpt_tpls])
#
#------------------------------------------------------------------------------
c1154102050224253742523141314131828216410182164100
WAIT 1

#------------------------------------------------------------------------------
# Step 4.2: Describe the Report Template (rptt) R1
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.desc_rptt([ari:/1:1/Rptt.R1])
#
#------------------------------------------------------------------------------
c1154104050125813742523141314131
WAIT 1

#------------------------------------------------------------------------------
# Step 4.3: Reboot Manager and verify report loads from SDR.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 4.4: Generate a table of all known report templates.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.rptts], [])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410200
WAIT 1

#------------------------------------------------------------------------------
# Step 4.5: Request Report R1.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_rpts([ari:/1:1/Rptt.R1], [])
#
#------------------------------------------------------------------------------
c11541050502252381374252314131413100
WAIT 1

#------------------------------------------------------------------------------
# Step 4.6: Reboot Agent and make sure R1 is read back from SDR.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 4.7: Generate a table of all known report templates and make sure
#           R1 still exists.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.rptts], [])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410200
WAIT 1

#------------------------------------------------------------------------------
# Step 4.8: Delete R1
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.del_rptt([ari:/1:1/Rptt.R1])
#
#------------------------------------------------------------------------------
c1154103050125813742523141314131
WAIT 1

#------------------------------------------------------------------------------
# Step 4.9: Generate a table of all known report templates and make sure
#            R1 has been deleted (is not represented in the table).
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.rptts], [])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410200
WAIT 1

#------------------------------------------------------------------------------
# Step 4.10: Reboot Agent and make sure R1 does not come back.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 4.11: Generate a table of all known report templates and make sure
#            R1 is not represented in the table.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.rptts], [])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410200
WAIT 1

###################################################
# Test Case 5: Describe Report
###################################################

#------------------------------------------------------------------------------
# Step 5.1: Describe the AMP Agent FUll report.
#------------------------------------------------------------------------------
#
# ari:/IANA:amp.agent/Ctrl.desc_rptt(ari:/IANA:amp.agent/Rptt.full_report())
#
#------------------------------------------------------------------------------
c1154104050125818718194100
WAIT 1



# Test Set 2: Variables
#
# Assume nm_mgr is on ipn:1.1
# Assume nm_agent is on ipn:1.2

###############################################################################
# TC 1 Test Basic Variable Operations
###############################################################################
# Generate basic variables in the AMP.
#
###############################################################################

#------------------------------------------------------------------------------
# Step 1.1: Define UINT V1 as "2 + 2"
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:Amp.Agent/Ctrl.add_var(ari://var.v1, (UINT) 2 2 +, UINT)
#
#------------------------------------------------------------------------------
#
# V1 ARI: ari://var.v1
# V1 encoding: 0x0c427631
#
# CBOR breakout:
#
# CONTROL  TNVC    PARM TYPES       PARM1    PARM2                     PARM3
#          TYPE
# add_var   TV    (ARI,EXPR,BYTE)   (V1)     (UINT) 2, 2, +            UINT
# c1154100  05     03 24 26 11     0c427631 148343024302c51818410100   14
#------------------------------------------------------------------------------
c115410005032426110c427631148343024302c5181841010014
WAIT 1



#------------------------------------------------------------------------------
# Step 1.2: List VARs on the agent and confirm that V1 is listed.
#------------------------------------------------------------------------------
#
# V1 ARI: ari://var.v1
# V1 encoding: 0x0c427631
#
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.variables()],[])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410100
WAIT 1


#------------------------------------------------------------------------------
# Step 1.3: Generate a report for V1 and confirm it has value UINT 4
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_rpts([ari://var.v1],[])
#
#------------------------------------------------------------------------------
c115410505022523810c42763100
WAIT 1



#------------------------------------------------------------------------------
# Step 1.4: Restart the Agent.
#------------------------------------------------------------------------------


#------------------------------------------------------------------------------
# Step 1.5: List VARs on the agent and confirm that V1 is still listed.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.variables()],[])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410100
WAIT 1


#------------------------------------------------------------------------------
# Step 1.6: Generate a report for V1 and confirm it still has value UINT 4
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_rpts([ari://var.v1],[])
#
#------------------------------------------------------------------------------
c115410505022523810c42763100
WAIT 1


#------------------------------------------------------------------------------
# Step 1.7 Delete V1
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.del_var([ari://var.v1])
#
#------------------------------------------------------------------------------
c1154101050125810c427631
WAIT 1


#------------------------------------------------------------------------------
# Step 1.8: List VARs on the agent and confirm that V1 is NOT listed.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.variables()],[])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410100
WAIT 1



#------------------------------------------------------------------------------
# Step 1.9: Generate a report for V1 and confirm it is not reported.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_rpts([ari://var.v1],[])
#
#------------------------------------------------------------------------------
c115410505022523810c42763100
WAIT 1



#------------------------------------------------------------------------------
# Step 1.10: Restart the Agent.
#------------------------------------------------------------------------------


#------------------------------------------------------------------------------
# Step 1.11: List VARs on the agent and confirm that V1 is NOT listed.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.variables()],[])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410100
WAIT 1



#------------------------------------------------------------------------------
# Step 1.12: Generate a report for V1 and confirm it is not reported.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_rpts([ari://var.v1],[])
#
#------------------------------------------------------------------------------
c115410505022523810c42763100
WAIT 1




###############################################################################
# Test Case 2.2: Complex Variables
###############################################################################
# uint V2 = 4;         // Test that V2 = 4.
# expr V3 = V2 + 1;
# uint V4 = eval(V3);  // Test that V4 = 5.
# V2 = V4;             // Test that V2 = 5.
# V4 = eval(V3);       // Test that V4 = 6.
#
# V2 ARI = 0x0c427632
# V3 ARI = 0x0c427633
# V4 ARI = 0x0c427634
###############################################################################

#------------------------------------------------------------------------------
# Step 2.2.1: Define UINT V2 as "4"
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:Amp.Agent/Ctrl.add_var(ari://var.v2, (UINT) 4, UINT)
#
#------------------------------------------------------------------------------
c115410005032426110c4276321481430414
WAIT 1


#------------------------------------------------------------------------------
# Step 2.2.2: Define EXPR V3 as "V2 + 1"
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:Amp.Agent/Ctrl.add_var(ari://var.v3, (UINT) ari://var.v2 1 +, EXPR)
#
#------------------------------------------------------------------------------
#
# CBOR breakout:
#
# CONTROL  TNVC    PARM TYPES       PARM1    PARM2                        PARM3
#          TYPE
# add_var   TV    (ARI,EXPR,BYTE)   (V3)     (UINT) v2, 1, +              EXPR
# c1154100  05     03 24 26 11    0c427633  14830c4276324301c51818410100   26
#------------------------------------------------------------------------------
c115410005032426110c42763314830c4276324301c5181841010026
WAIT 1


#------------------------------------------------------------------------------
# Step 2.2.3: Define UINT V4 as having an initializing expression of {V3}
#------------------------------------------------------------------------------
#
# ARI:  ari:/IANA:Amp.Agent/Ctrl.add_var(ari://var.v4, UINT ari://var.v3, UINT)
#
#------------------------------------------------------------------------------
c115410005032426110c42763414810c42763314
WAIT 1

#------------------------------------------------------------------------------
# Step 2.2.4: Define custom report R1 = {V2, V3, V4}
#------------------------------------------------------------------------------
#
# R1 ARI = 0x07427231
#
# ARI: ari:/IANA:Amp.Agent/Ctrl.add_rptt(ari://rptt.r1, [ari://var.v2, ari://var.v3, ari://var.v4])
#
#------------------------------------------------------------------------------
c11541020502242507427231830c4276320c4276330c427634
WAIT 1


#------------------------------------------------------------------------------
# Step 2.2.5: Generate Report R1 and verify values are {4,EXPR,5}
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_rpts([ari://rptt.r1],[])
#
#------------------------------------------------------------------------------
c115410505022523810742723100
WAIT 1


#------------------------------------------------------------------------------
# Step 2.2.6: STORE(V2, V4)  - V2 = V4
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.store_var(ari://var.v2, (UINT) ari://var.v4)
#
#------------------------------------------------------------------------------
c115410e050224260c42763214810c427634
WAIT 1


#------------------------------------------------------------------------------
# Step 2.2.7: STORE(V4, V3) - V4 = expr_eval(V3)
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.store_var(ari://var.v4, ari://var.v3)
#
#------------------------------------------------------------------------------
c115410e050224260c42763414810c427633
WAIT 1


#------------------------------------------------------------------------------
# Step 2.2.8: Generate Report R1 and verify values are {5,EXPR,6}
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_rpts([ari://rptt.r1],[])
#
#------------------------------------------------------------------------------
c115410505022523810742723100
WAIT 1


# Test Set: Macros
#
# Assume nm_mgr is on ipn:1.1
# Assume nm_agent is on ipn:1.2

###############################################################################
# Test Case 1 Test Basic Macro Operations
###############################################################################
# Generate basic macros in the AMP.
#
###############################################################################

#------------------------------------------------------------------------------
# Step 1.1: Create a Macro that
#   1) Generates a BP Agent Full Report
#   2) Issues a reset all counts command to reset the counters in the BP Agent
#      full report
#   3) Generates a new BP Agent Full Report
#
#------------------------------------------------------------------------------
#
# Type: Macro (mac)
# Nickname (NN): 1
# Issuer (ISS): 1
# Name: test_full_rpt
# Macro ARI: ari:/1:1/Mac.test_full_rpt
# CBOR Macro ARI: 0x344d746573745f66756c6c5f72707441314131
#
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.add_macro("test_full_rpt", ari:/1:1/Mac.test_full_rpt,
#       [ari:/IANA:amp.agent/Ctrl.gen_rpts([ari:/IANA:dtn.bp_agent/Rptt.full_report()], []),
#        ari:/IANA:dtn.bp_agent/Ctrl.reset_all_counts(),
#        ari:/IANA:amp.agent/Ctrl.gen_rpts([ari:/IANA:dtn.bp_agent/Rptt.full_report()], [])])
#
#------------------------------------------------------------------------------
c115410705031224256d746573745f66756c6c5f727074344d746573745f66756c6c5f7270744131413183c1154105050225238187182d4100008118294100c1154105050225238187182d410000
WAIT 1

#------------------------------------------------------------------------------
# Step 1.2: Describe Macro test_full_rpt.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.desc_macro([ari:/1:1/Mac.test_full_rpt])
#
#------------------------------------------------------------------------------
c115410905012581344d746573745f66756c6c5f72707441314131
WAIT 1

#------------------------------------------------------------------------------
# Step 1.3: Reboot manager and see if macro is restored.
#------------------------------------------------------------------------------


#------------------------------------------------------------------------------
# Step 1.4: Request table of known macros.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.macros()],[])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410300
WAIT 1

#------------------------------------------------------------------------------
# Step 1.5: Reboot manager and see if macro is restored.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 1.6: Request table of known macros. Make sure the macro is still present.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.macros()],[])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410300
WAIT 1


#------------------------------------------------------------------------------
# Step 1.7: Delete macro test_full_rptt.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.del_macro([ari:/1:1/Mac.test_full_rpt])
#
#------------------------------------------------------------------------------
c115410805012581344d746573745f66756c6c5f72707441314131
WAIT 1

#------------------------------------------------------------------------------
# Step 1.8: Request table of known macros. Make sure the macro is no longer
#           listed.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.macros()],[])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410300
WAIT 1


#------------------------------------------------------------------------------
# Step 1.9: Reboot agent and make sure macro doesn't come back.
#------------------------------------------------------------------------------


#------------------------------------------------------------------------------
# Step 1.10: Request table of known macros. Make sure the macro is no longer
#           listed.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.macros()],[])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410300
WAIT 1













# Test Set 4: Time-Based Rule Production.
#
# Assume nm_mgr is on ipn:1.1
# Assume nm_agent is on ipn:1.2

###############################################################################
# TC 4.1 Generate Reports to a schedule.
###############################################################################
# This test will cause an AGENT FULL report to be generated
# 5 times at intervals of 5 seconds each.
#
###############################################################################


#------------------------------------------------------------------------------
# Step 4.1.1: Build the TBR to report on the AGENT Full Report.
#------------------------------------------------------------------------------
#
# NOTE: The TBR will be identified as "ari://Tbr.1" which is 0x0b4131
# START: 0
# PERIOD: 5
# COUNT: 5
# Action: {GEN_RPT({FULL_REPORT}, 0)}
# Description: TBR1
#
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:AMP.AGENT/CTRL.ADD_TBR(ari://Tbr.1, 0, 5, 5, [ari:/IANA:amp.agent/Ctrl.gen_rpts([ari:/IANA:amp.agent/Rptt.full_report()],[])], ‘TBR1’)
#
#------------------------------------------------------------------------------
c115410a05062420201625120b413100050581c11541050502252381871819410000682018544252312019
WAIT 1

#------------------------------------------------------------------------------
# Step 4.1.2: Verify that 5 reports are received approximately
# 5 seconds apart (variance up to 1 second between individual reports
# are within tolerance due to the 1Hz rate of the agent autonomy
# engine.
#------------------------------------------------------------------------------

WAIT 30


###############################################################################
# TC 4.2: Manipulate TBRs.
###############################################################################
# Interrupt a running TBR
###############################################################################

#------------------------------------------------------------------------------
# Step 4.2.1: Define a TBR  (TBR 2) that will generate an AGENT FULL REPORT
# every 30 seconds 100 times.
#------------------------------------------------------------------------------
#
# NOTE: The TBR will be identified as "ari://Tbr.2" which is 0x0b4132
# START: 0
# PERIOD: 30
# COUNT: 100
# Action: {GEN_RPT({FULL_REPORT}, 0)}
# Description: TBR2
#
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:AMP.AGENT/CTRL.ADD_TBR(ari://Tbr.2, 0, 30, 100,
#         [ari:/IANA:amp.agent/Ctrl.gen_rpts([ari:/IANA:amp.agent/Rptt.full_report()],[])], ‘TBR2’)
#
#------------------------------------------------------------------------------
c115410a05062420201625120b413200181e186481c11541050502252381871819410000682018544252322019
WAIT 1


#------------------------------------------------------------------------------
# Step 4.2.2: List TBRs on the agent.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.rules()],[])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410400
WAIT 1


#------------------------------------------------------------------------------
# Step 4.2.3: Verify TBR 2 is listed in the reported rules.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 4.2.4: Describe TBR 2.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.desc_rule([ari://Tbr.2])
#
#------------------------------------------------------------------------------
c115410d050125810b4132
WAIT 1

#------------------------------------------------------------------------------
# Step 4.2.5: Verify the description matches the definition.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 4.2.6: Delete TBR 2.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.del_rule([ari://TBR.2])
#
#------------------------------------------------------------------------------
c115410c050125810b4132
WAIT 1


#------------------------------------------------------------------------------
# Step 4.2.7: Verify no reports received after TRL deleted.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 4.2.8: List TBRs on the agent.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.rules()],[])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410400
WAIT 1

#------------------------------------------------------------------------------
# Step 4.2.9: Verify TBR2 not shown in list.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 4.2.10: Describe TBR 2 from the agent.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.desc_rule([ari://TBR.2])
#
#------------------------------------------------------------------------------
c115410d050125810b4132
WAIT 1

#------------------------------------------------------------------------------
# Step 4.2.11: Verify TBR not there to be described.
#------------------------------------------------------------------------------

###############################################################################
# TC 4.3: Run macro by TBR
###############################################################################
#
###############################################################################

#------------------------------------------------------------------------------
# Step 4.3.1: Create a Macro that generates a BP full report.
#
# Type: Macro (mac)
# Name: bp_full_rpt_macro
# Macro ARI: ari://Mac.bp_full_rpt_macro
# CBOR Macro ARI: 0x045162705f66756c6c5f7270745f6d6163726f
#
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.add_macro("bp_full_rpt_macro",
#        ari://Mac.bp_full_rpt_macro, [ari:/IANA:amp.agent/Ctrl.gen_rpts(
#         [ari:/IANA:dtn.bp_agent/Rptt.full_report()], [])])
#
#------------------------------------------------------------------------------
c11541070503122425732262705f66756c6c5f7270745f6d6163726f22045162705f66756c6c5f7270745f6d6163726f81c1154105050225238187182d410000
WAIT 1


#------------------------------------------------------------------------------
# Step 4.3.2: Define TBR T7 to run Agent Macro bp_full_rpt_macro 1 time with
#             period 5.
#------------------------------------------------------------------------------
#
# NOTE: The TBR will be identified as "ari://Tbr.7" which is 0x0b4137
# START: 0
# PERIOD: 5
# COUNT: 1
# Action: {bp_full_rpt_macro}
# Description: TBR7
#
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:AMP.AGENT/CTRL.ADD_TBR(ari://Tbr.7, 0, 5, 1,
#        [ari://Mac.bp_full_rpt_macro], ‘TBR7’)
#
#------------------------------------------------------------------------------
c115410a05062420201625120b413700050181045162705f66756c6c5f7270745f6d6163726f682018544252372019
WAIT 1

#------------------------------------------------------------------------------
# Step 4.3.2: Read the returned report and make sure parms were correct.
#------------------------------------------------------------------------------


# Test Set 5: State-Based Rule Production.
#
# Assumes nm_mgr is on ipn:1.1
# Assumes nm_agent is on ipn:1.2
#

###############################################################################
# TC 1 Generate Reports based on a variable.
###############################################################################
# This test will cause an Agent FULL REPORT to be generated
# up to 5 times whenever Variable V5 == 1.
###############################################################################


#------------------------------------------------------------------------------
# Step 1.1: Define UINT V5 = 0.
#------------------------------------------------------------------------------
#
# V5 ARI = 0x0c427635
#
# ari:/IANA:Amp.Agent/Ctrl.add_var(ari://var.v5, (UINT) 0, UINT)
#
#
# CBOR breakout:
#
# CONTROL  TNVC    PARM TYPES       PARM1    PARM2         PARM3
#          TYPE
# add_var   TV    (ARI,EXPR,BYTE)   (V1)     (UINT) 0      UINT
# c1154100  05     03 24 26 11     0c427635 14814300        14
#
#------------------------------------------------------------------------------
c115410005032426110c4276351481430014
WAIT 1


#------------------------------------------------------------------------------
# Step 1.2: Retrieve value of V5 in a report.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_rpts([ari://var.v5],[])
#
#------------------------------------------------------------------------------
c115410505022523810c42763500
WAIT 1


#------------------------------------------------------------------------------
# Step 1.3: Confirm value of V5 is 0.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 1.4: Define Macro M1 generate an agent FULL_REPORT and reset V5 = 0
#------------------------------------------------------------------------------
#
# Macro M1 ARI: 0x04424d31
#
# ARI: ari:/IANA:amp.agent/Ctrl.add_macro("m1", ari://Mac.M1,
#      [ari:/IANA:amp.agent/Ctrl.gen_rpts([ari:/IANA:amp.agent/Rptt.full_report()],[]),
#       ari:/IANA:amp.agent/Ctrl.store_var(ari://var.v5, (UINT)0)])
#
#------------------------------------------------------------------------------
c11541070503122425626d3104424d3182c11541050502252381871819410000c115410e050224260c42763514814300
WAIT 1

#------------------------------------------------------------------------------
# Step 1.5: List Macros
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.macros()],[])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410300
WAIT 1

#------------------------------------------------------------------------------
# Step 1.6: Review returned report and make sure MACRO M1 is listed.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 1.7: Describe Macro M1
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.desc_macro([ari://Mac.M1])
#
#------------------------------------------------------------------------------
c11541090501258104424d31
WAIT 1

#------------------------------------------------------------------------------
# Step 1.8: Make sure M1 was described correctly.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 1.9: Define SRL S1 to run every time V5 >= 2 up to 3 times.
#------------------------------------------------------------------------------
#
# S1 ARI = 0x08425331
# Start = 0
# Expr = [V5, 2, >=]
# MaxEval = 1000
# Count = 3
# Action = [M1]
#
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.add_sbr(ari://Sbr.S1, 0,
#       (UINT) ari://Var.v5 2 >=, 1000, 3, [ari://Mac.M1], "S1")
#
#------------------------------------------------------------------------------
c115410b050724162616162512084253310014830c4276354302c5181842182f001903e8038104424d31625331
WAIT 1

#------------------------------------------------------------------------------
# Step 1.10: List known rules
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.rules()],[])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410400
WAIT 1

#------------------------------------------------------------------------------
# Step 1.11: Ensure that S1 is there.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 1.12: Describe SRL1
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.desc_rule([ari://Sbr.S1])
#
#------------------------------------------------------------------------------
c115410d0501258108425331
WAIT 1

#------------------------------------------------------------------------------
# Step 1.13: Ensure that S1 matches description
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 1.14: Set TBR T1 to run every 20 seconds 6 times that will
# run the command: V5 = V5 + 1 which is: STOR(V5, {(UINT), V5 1 +})
#------------------------------------------------------------------------------
#
# T1 ARI = 0x0b425431
# T1 Start = 0
# T1 Period = 20
# T1 Count = 6
# T1 Action: ari:/IANA:amp.agent/Ctrl.store_var(ari://var.v5, (UINT) ari://var.v5 1 +)
#
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.add_tbr(ari://tbr.T1, 0, 20, 6,
#      [ari:/IANA:amp.agent/Ctrl.store_var(ari://var.v5, (UINT) ari://var.v5 1 +)], "T1")
#
#------------------------------------------------------------------------------
c115410a05062416161625120b42543100140681c115410e050224260c42763514830c4276354301c51818410100625431
WAIT 1

#------------------------------------------------------------------------------
# Step 1.15: Describe T1 and make sure it is correct.
#------------------------------------------------------------------------------
#
# ARI ari:/IANA:amp.agent/Ctrl.desc_rule([ari://Tbr.T1])
#
#------------------------------------------------------------------------------
c115410d050125810b425431
WAIT 1

#------------------------------------------------------------------------------
# Step 1.16: Verify S1 runs 3 times, approximately every 40 seconds.
#------------------------------------------------------------------------------

WAIT 170

#------------------------------------------------------------------------------
# Step 1.17: Inspect ADM reports for correct # TBR and SBR counts.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 1.18: List known rules and verify S1 and T1 are no longer listed.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.rules()],[])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410400
WAIT 1


#------------------------------------------------------------------------------
# Step 1.19: Delete S1. i.e. show no issue with deleting a deleted SBR.
#            Expect to see the following in Agent output:
#            "[nm/agent/adm_amp_agent_impl.c:1946]
#            w DEL_RULE Cannot find RULE to be deleted."
#
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.del_rule([ari://Sbr.S1])
#
#------------------------------------------------------------------------------
c115410c0501258108425331
WAIT 1


#------------------------------------------------------------------------------
# Step 1.20: Restart Agent and verify only 1 Var and 1 Macro restore.
#------------------------------------------------------------------------------

# Test Set 6: Standard Tables.
#
# Assume nm_mgr is on ipn:1.1
# Assume nm_agent is on ipn:1.2
# Assume ipn:1.0 is available

###################################################
# Test Case 1 Generate Tables.
###################################################

#------------------------------------------------------------------------------
# Step 1.1: Generate a table that lists all the adms that are supported by
#           the agent using the AMP Agent adm table template.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.adms()],[])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410000
WAIT 1

#------------------------------------------------------------------------------
# Step 1.2: Verify ADM table received and correct. Must include the AMP Agent ADM
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 1.3: Generate a table that lists all the table templates that are defined
#           by the agent using the AMP Agent tblts table template.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls([ari:/IANA:amp.agent/Tblt.tblts()],[])
#
#------------------------------------------------------------------------------
c115410605022523818a181b410500
WAIT 1

#------------------------------------------------------------------------------
# Step 1.4: Verify TBLT table received and correct.
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Step 1.5: Generate tables concurrently: variables and rules.
#------------------------------------------------------------------------------
#
# ARI: ari:/IANA:amp.agent/Ctrl.gen_tbls(
#         [ari:/IANA:amp.agent/Tblt.variables(),
#          ari:/IANA:amp.agent/Tblt.rules()],[])
#
#------------------------------------------------------------------------------
c115410605022523828a181b41018a181b410400
WAIT 1

#------------------------------------------------------------------------------
# Step 1.6: Verify both tables received and correct.
#------------------------------------------------------------------------------
