Added UUID to policy ids and new policy types 32/4032/1
authorBjornMagnussonXA <bjorn.magnusson@est.tech>
Mon, 8 Jun 2020 13:54:11 +0000 (15:54 +0200)
committerBjornMagnussonXA <bjorn.magnusson@est.tech>
Mon, 8 Jun 2020 20:09:37 +0000 (22:09 +0200)
Change-Id: I0b0f600b4c5f4f10e36a84c76d1b104fcf3d712d
Issue-ID: NONRTRIC-154
Signed-off-by: BjornMagnussonXA <bjorn.magnusson@est.tech>
47 files changed:
test/auto-test/FTC1.sh
test/auto-test/FTC10.sh
test/auto-test/FTC100.sh
test/auto-test/FTC110.sh
test/auto-test/FTC150.sh
test/auto-test/FTC300.sh
test/auto-test/FTC310.sh
test/auto-test/FTC350.sh
test/auto-test/FTC800.sh
test/auto-test/FTC810.sh
test/auto-test/FTC850.sh
test/auto-test/FTC900.sh
test/auto-test/testdata/OSC/1-agent-modified.json
test/auto-test/testdata/OSC/1.json
test/auto-test/testdata/OSC/3-agent-modified.json
test/auto-test/testdata/OSC/3.json
test/auto-test/testdata/OSC/4-agent-modified.json
test/auto-test/testdata/OSC/4.json
test/auto-test/testdata/OSC/5-agent-modified.json
test/auto-test/testdata/OSC/5.json
test/auto-test/testdata/OSC/hw-agent-modified.json
test/auto-test/testdata/OSC/hw.json
test/auto-test/testdata/OSC/pi1_template.json
test/auto-test/testdata/OSC/pi3_template.json
test/auto-test/testdata/OSC/pi4_template.json
test/auto-test/testdata/OSC/pi5_template.json
test/auto-test/testdata/OSC/piqos_template.json [new file with mode: 0644]
test/auto-test/testdata/OSC/qos-agent-modified.json [new file with mode: 0644]
test/auto-test/testdata/OSC/qos.json [new file with mode: 0644]
test/auto-test/testdata/OSC/sim_1.json
test/auto-test/testdata/OSC/sim_3.json
test/auto-test/testdata/OSC/sim_4.json
test/auto-test/testdata/OSC/sim_5.json
test/auto-test/testdata/OSC/sim_hw.json
test/auto-test/testdata/OSC/sim_qos.json [new file with mode: 0644]
test/auto-test/testdata/OSC/sim_tsa.json
test/auto-test/testdata/OSC/tsa-agent-modified.json
test/auto-test/testdata/OSC/tsa.json
test/auto-test/testdata/STD/pi1_template.json
test/common/README.md
test/common/agent_api_functions.sh
test/common/controller_api_functions.sh
test/common/create_policies_process.py
test/common/delete_policies_process.py
test/common/test_env.sh
test/common/testcase_common.sh
test/simulator-group/sim-monitor.js

index 877a209..d9a88b1 100755 (executable)
@@ -35,6 +35,8 @@ EXCLUDED_IMAGES="SDNC_ONAP"
 # Path to callback receiver
 CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
 
+generate_uuid
+
 # Tested variants of REST/DMAAP/SDNC config
 TESTED_VARIANTS="REST   DMAAP   REST+SDNC   DMAAP+SDNC"
 #Test agent and simulator protocol versions (others are http only)
index 771ee55..eaa6de2 100755 (executable)
@@ -28,6 +28,8 @@ EXCLUDED_IMAGES="SDNC SDNC_ONAP"
 
 #### TEST BEGIN ####
 
+generate_uuid
+
 #Local vars in test script
 ##########################
 # Path to callback receiver
index 8ee7e37..6f90437 100755 (executable)
@@ -29,6 +29,8 @@ EXCLUDED_IMAGES="SDNC_ONAP"
 
 #### TEST BEGIN ####
 
+generate_uuid
+
 #Local vars in test script
 ##########################
 
index 1efce99..8427ad1 100755 (executable)
@@ -27,6 +27,7 @@ EXCLUDED_IMAGES="SDMC SDNC_ONAP"
 . ../common/agent_api_functions.sh
 . ../common/ricsimulator_api_functions.sh
 
+generate_uuid
 
 #Local vars in test script
 ##########################
index 9320302..1cd2a33 100755 (executable)
@@ -29,6 +29,8 @@ EXCLUDED_IMAGES="PA CP SDNC_ONAP"
 
 #### TEST BEGIN ####
 
+generate_uuid
+
 #Test agent and simulator protocol versions (others are http only)
 TESTED_PROTOCOLS="HTTP HTTPS"
 
index 9320606..2ab4385 100755 (executable)
@@ -28,6 +28,8 @@ EXCLUDED_IMAGES="SDNC_ONAP"
 
 #### TEST BEGIN ####
 
+generate_uuid
+
 #Local vars in test script
 ##########################
 # Path to callback receiver
index 18d6816..7eb3c19 100755 (executable)
@@ -30,6 +30,7 @@ EXCLUDED_IMAGES="SDNC_ONAP"
 
 #### TEST BEGIN ####
 
+generate_uuid
 
 # Clean container and start all needed containers #
 clean_containers
index 0fe253f..416a77d 100755 (executable)
@@ -28,6 +28,8 @@ EXCLUDED_IMAGES="SDNC_ONAP"
 
 #### TEST BEGIN ####
 
+generate_uuid
+
 #Local vars in test script
 ##########################
 # Path to callback receiver
index 6bab06b..e97f3ff 100755 (executable)
@@ -28,6 +28,8 @@ EXCLUDED_IMAGES="SDNC_ONAP"
 
 #### TEST BEGIN ####
 
+generate_uuid
+
 #Local vars in test script
 ##########################
 # Path to callback receiver
index 2dae7e7..e9f19f8 100755 (executable)
@@ -28,6 +28,8 @@ EXCLUDED_IMAGES="SDNC_ONAP"
 
 #### TEST BEGIN ####
 
+generate_uuid
+
 #Local vars in test script
 ##########################
 # Path to callback receiver
index f45246d..32e450f 100755 (executable)
@@ -42,6 +42,8 @@ TESTED_PROTOCOLS="HTTP HTTPS"
 NUM_RICS=20
 NUM_POLICIES_PER_RIC=500
 
+generate_uuid
+
 for __httpx in $TESTED_PROTOCOLS ; do
     for interface in $TESTED_VARIANTS ; do
 
@@ -80,6 +82,8 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         start_mr # Not used, but removes error messages from the agent log
 
+        start_control_panel
+
         start_policy_agent
 
         set_agent_debug
index 5a71916..05b6ff6 100755 (executable)
@@ -17,7 +17,7 @@
 #  ============LICENSE_END=================================================
 #
 
-TC_ONELINE_DESCR="Testing of the Control Panel and the Health Check app - populating with types and instances"
+TC_ONELINE_DESCR="Preparation for test of the Control Panel and the Health Check app - populating a number of ric simulators with types and instances"
 
 #App names to exclude checking pulling images for, space separated list
 EXCLUDED_IMAGES="SDNC SDNC_ONAP"
@@ -38,9 +38,9 @@ clean_containers
 OSC_NUM_RICS=6
 STD_NUM_RICS=5
 
-start_ric_simulators  ricsim_g1 $OSC_NUM_RICS OSC_2.1.0
+start_ric_simulators  $RIC_SIM_PREFIX"_g1" $OSC_NUM_RICS OSC_2.1.0
 
-start_ric_simulators  ricsim_g2 $STD_NUM_RICS STD_1.1.3
+start_ric_simulators  $RIC_SIM_PREFIX"_g2" $STD_NUM_RICS STD_1.1.3
 
 start_mr #Just to prevent errors in the agent log...
 
@@ -60,37 +60,39 @@ api_get_status 200
 # Print the A1 version for OSC
 for ((i=1; i<=$OSC_NUM_RICS; i++))
 do
-    sim_print ricsim_g1_$i interface
+    sim_print $RIC_SIM_PREFIX"_g1_"$i interface
 done
 
 
 # Print the A1 version for STD
 for ((i=1; i<=$STD_NUM_RICS; i++))
 do
-    sim_print ricsim_g2_$i interface
+    sim_print $RIC_SIM_PREFIX"_g2_"$i interface
 done
 
 
 # Load the polictypes in osc
 for ((i=1; i<=$OSC_NUM_RICS; i++))
 do
-    sim_put_policy_type 201 ricsim_g1_$i 2 testdata/OSC/sim_hw.json
-    sim_put_policy_type 201 ricsim_g1_$i 20008 testdata/OSC/sim_tsa.json
+    sim_put_policy_type 201 $RIC_SIM_PREFIX"_g1_"$i 2 testdata/OSC/sim_hw.json
+    sim_put_policy_type 201 $RIC_SIM_PREFIX"_g1_"$i 100 testdata/OSC/sim_qos.json
+    sim_put_policy_type 201 $RIC_SIM_PREFIX"_g1_"$i 20008 testdata/OSC/sim_tsa.json
 done
 
 
 #Check the number of schemas and the individual schemas in OSC
-api_equal json:policy_types 3 120
+api_equal json:policy_types 4 120
 
 for ((i=1; i<=$OSC_NUM_RICS; i++))
 do
-    api_equal json:policy_types?ric=ricsim_g1_$i 2 120
+    api_equal json:policy_types?ric=$RIC_SIM_PREFIX"_g1_"$i 3 120
 done
 
 # Check the schemas in OSC
 for ((i=1; i<=$OSC_NUM_RICS; i++))
 do
     api_get_policy_schema 200 2 testdata/OSC/hw-agent-modified.json
+    api_get_policy_schema 200 100 testdata/OSC/qos-agent-modified.json
     api_get_policy_schema 200 20008 testdata/OSC/tsa-agent-modified.json
 done
 
@@ -98,34 +100,39 @@ done
 # Create policies
 use_agent_rest_http
 
-api_put_service 201 "rapp1" 0 "$CR_PATH/1"
+api_put_service 201 "Emergency-response-app" 0 "$CR_PATH/1"
 
 # Create policies in OSC
 for ((i=1; i<=$OSC_NUM_RICS; i++))
 do
-    api_put_policy 201 "rapp1" ricsim_g1_$i 2 $((2000+$i)) NOTRANSIENT testdata/OSC/pihw_template.json 1
-    api_put_policy 201 "rapp1" ricsim_g1_$i 20008 $((2050+$i*10)) NOTRANSIENT testdata/OSC/pitsa_template.json 1
+    generate_uuid
+    api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 2 $((2000+$i)) NOTRANSIENT testdata/OSC/pihw_template.json 1
+    generate_uuid
+    api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 100 $((3000+$i)) NOTRANSIENT testdata/OSC/piqos_template.json 1
+    generate_uuid
+    api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 20008 $((4000+$i)) NOTRANSIENT testdata/OSC/pitsa_template.json 1
 done
 
 
 # Check the number of policies in OSC
 for ((i=1; i<=$OSC_NUM_RICS; i++))
 do
-    sim_equal ricsim_g1_$i num_instances 2
+    sim_equal $RIC_SIM_PREFIX"_g1_"$i num_instances 3
 done
 
 
 # Create policies in STD
 for ((i=1; i<=$STD_NUM_RICS; i++))
 do
-    api_put_policy 201 "rapp1" ricsim_g2_$i NOTYPE $((2100+$i)) NOTRANSIENT testdata/STD/pi1_template.json 1
+    generate_uuid
+    api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g2_"$i NOTYPE $((2100+$i)) NOTRANSIENT testdata/STD/pi1_template.json 1
 done
 
 
 # Check the number of policies in STD
 for ((i=1; i<=$STD_NUM_RICS; i++))
 do
-    sim_equal ricsim_g2_$i num_instances 1
+    sim_equal $RIC_SIM_PREFIX"_g2_"$i num_instances 1
 done
 
 check_policy_agent_logs
index 3b37214..a40aa88 100644 (file)
@@ -20,7 +20,7 @@
           "qosId"
         ]
       },
-      "qosObjective": {
+      "qosObjectives": {
         "type": "object",
         "properties": {
           "priorityLevel": {
@@ -35,6 +35,6 @@
     },
     "additionalProperties": false,
     "required": [
-      "scope", "qosObjective"
+      "scope", "qosObjectives"
     ]
   }
index 5fe68ce..c865bac 100644 (file)
@@ -20,7 +20,7 @@
         "qosId"
       ]
     },
-    "qosObjective": {
+    "qosObjectives": {
       "type": "object",
       "properties": {
         "priorityLevel": {
@@ -35,6 +35,6 @@
   },
   "additionalProperties": false,
   "required": [
-    "scope", "qosObjective"
+    "scope", "qosObjectives"
   ]
 }
index 303b36b..3bf9a47 100644 (file)
@@ -16,7 +16,7 @@
           "groupId"
         ]
       },
-      "qosObjective": {
+      "qosObjectives": {
         "type": "object",
         "properties": {
           "priorityLevel": {
@@ -31,6 +31,6 @@
     },
     "additionalProperties": false,
     "required": [
-      "scope", "qosObjective"
+      "scope", "qosObjectives"
     ]
   }
index ab0204d..4966dea 100644 (file)
@@ -16,7 +16,7 @@
         "groupId"
       ]
     },
-    "qosObjective": {
+    "qosObjectives": {
       "type": "object",
       "properties": {
         "priorityLevel": {
@@ -31,6 +31,6 @@
   },
   "additionalProperties": false,
   "required": [
-    "scope", "qosObjective"
+    "scope", "qosObjectives"
   ]
 }
index 868ceea..7fb71a6 100644 (file)
@@ -16,7 +16,7 @@
           "cellId"
         ]
       },
-      "qosObjective": {
+      "qosObjectives": {
         "type": "object",
         "properties": {
           "priorityLevel": {
@@ -31,6 +31,6 @@
     },
     "additionalProperties": false,
     "required": [
-      "scope", "qosObjective"
+      "scope", "qosObjectives"
     ]
   }
index c5e785c..3891b76 100644 (file)
@@ -16,7 +16,7 @@
         "cellId"
       ]
     },
-    "qosObjective": {
+    "qosObjectives": {
       "type": "object",
       "properties": {
         "priorityLevel": {
@@ -31,6 +31,6 @@
   },
   "additionalProperties": false,
   "required": [
-    "scope", "qosObjective"
+    "scope", "qosObjectives"
   ]
 }
index b5fd5bc..1b1c508 100644 (file)
@@ -20,7 +20,7 @@
           "cellId"
         ]
       },
-      "qosObjective": {
+      "qosObjectives": {
         "type": "object",
         "properties": {
           "priorityLevel": {
@@ -35,6 +35,6 @@
     },
     "additionalProperties": false,
     "required": [
-      "scope", "qosObjective"
+      "scope", "qosObjectives"
     ]
   }
index dee440a..1708a1e 100644 (file)
@@ -20,7 +20,7 @@
         "cellId"
       ]
     },
-    "qosObjective": {
+    "qosObjectives": {
       "type": "object",
       "properties": {
         "priorityLevel": {
@@ -35,6 +35,6 @@
   },
   "additionalProperties": false,
   "required": [
-    "scope", "qosObjective"
+    "scope", "qosObjectives"
   ]
 }
index c48736e..5ea5802 100644 (file)
@@ -1,7 +1,7 @@
 {
     "$schema": "http://json-schema.org/draft-07/schema#",
     "title": "2",
-    "description": "HW policy type",
+    "description": "Hello World policy type",
     "type": "object",
     "properties": {
       "threshold": {
index 684f80d..b15b93e 100644 (file)
@@ -1,7 +1,7 @@
 {
     "$schema": "http://json-schema.org/draft-07/schema#",
-    "title": "HW Policy",
-    "description": "HW policy type",
+    "title": "Hello World Policy",
+    "description": "Hello World policy type",
     "type": "object",
     "properties": {
       "threshold": {
index 7795808..da25554 100644 (file)
@@ -3,7 +3,7 @@
       "ueId": "ueXXX",
       "qosId": "qosXXX"
     },
-    "qosObjective": {
+    "qosObjectives": {
       "priorityLevel": XXX
     }
   }
\ No newline at end of file
index a916fad..02d33bc 100644 (file)
@@ -2,7 +2,7 @@
     "scope": {
       "groupId": "groupXXX"
     },
-    "qosObjective": {
+    "qosObjectives": {
       "priorityLevel": XXX
     }
   }
\ No newline at end of file
index 0673dec..dff4b6b 100644 (file)
@@ -2,7 +2,7 @@
     "scope": {
       "cellId": "cellXXX"
     },
-    "qosObjective": {
+    "qosObjectives": {
       "priorityLevel": XXX
     }
   }
\ No newline at end of file
index e362c9e..af6be9d 100644 (file)
@@ -3,7 +3,7 @@
       "sliceId": "sliceXXX",
       "cellId": "cellXXX"
     },
-    "qosObjective": {
+    "qosObjectives": {
       "priorityLevel": XXX
     }
   }
\ No newline at end of file
diff --git a/test/auto-test/testdata/OSC/piqos_template.json b/test/auto-test/testdata/OSC/piqos_template.json
new file mode 100644 (file)
index 0000000..da25554
--- /dev/null
@@ -0,0 +1,9 @@
+{
+    "scope": {
+      "ueId": "ueXXX",
+      "qosId": "qosXXX"
+    },
+    "qosObjectives": {
+      "priorityLevel": XXX
+    }
+  }
\ No newline at end of file
diff --git a/test/auto-test/testdata/OSC/qos-agent-modified.json b/test/auto-test/testdata/OSC/qos-agent-modified.json
new file mode 100644 (file)
index 0000000..3a012cd
--- /dev/null
@@ -0,0 +1,40 @@
+{
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "100",
+    "description": "Quality of Service policy type",
+    "type": "object",
+    "properties": {
+      "scope": {
+        "type": "object",
+        "properties": {
+          "ueId": {
+            "type": "string"
+          },
+          "qosId": {
+            "type": "string"
+          }
+        },
+        "additionalProperties": false,
+        "required": [
+          "ueId",
+          "qosId"
+        ]
+      },
+      "qosObjectives": {
+        "type": "object",
+        "properties": {
+          "priorityLevel": {
+            "type": "number"
+          }
+        },
+        "additionalProperties": false,
+        "required": [
+          "priorityLevel"
+        ]
+      }
+    },
+    "additionalProperties": false,
+    "required": [
+      "scope", "qosObjectives"
+    ]
+  }
diff --git a/test/auto-test/testdata/OSC/qos.json b/test/auto-test/testdata/OSC/qos.json
new file mode 100644 (file)
index 0000000..070ebe4
--- /dev/null
@@ -0,0 +1,40 @@
+{
+  "$schema": "http://json-schema.org/draft-07/schema#",
+  "title": "OSC_Type1_1.0.0",
+  "description": "Quality of Service policy type",
+  "type": "object",
+  "properties": {
+    "scope": {
+      "type": "object",
+      "properties": {
+        "ueId": {
+          "type": "string"
+        },
+        "qosId": {
+          "type": "string"
+        }
+      },
+      "additionalProperties": false,
+      "required": [
+        "ueId",
+        "qosId"
+      ]
+    },
+    "qosObjectives": {
+      "type": "object",
+      "properties": {
+        "priorityLevel": {
+          "type": "number"
+        }
+      },
+      "additionalProperties": false,
+      "required": [
+        "priorityLevel"
+      ]
+    }
+  },
+  "additionalProperties": false,
+  "required": [
+    "scope", "qosObjectives"
+  ]
+}
index 537d86f..aeea773 100644 (file)
@@ -24,7 +24,7 @@
           "qosId"
         ]
       },
-      "qosObjective": {
+      "qosObjectives": {
         "type": "object",
         "properties": {
           "priorityLevel": {
@@ -39,7 +39,7 @@
     },
     "additionalProperties": false,
     "required": [
-      "scope", "qosObjective"
+      "scope", "qosObjectives"
     ]
   }
 }
index 1b97047..d21a9a9 100644 (file)
@@ -20,7 +20,7 @@
           "groupId"
         ]
       },
-      "qosObjective": {
+      "qosObjectives": {
         "type": "object",
         "properties": {
           "priorityLevel": {
@@ -35,7 +35,7 @@
     },
     "additionalProperties": false,
     "required": [
-      "scope", "qosObjective"
+      "scope", "qosObjectives"
     ]
   }
 }
index ac1fa2b..a55b34e 100644 (file)
@@ -20,7 +20,7 @@
           "cellId"
         ]
       },
-      "qosObjective": {
+      "qosObjectives": {
         "type": "object",
         "properties": {
           "priorityLevel": {
@@ -35,7 +35,7 @@
     },
     "additionalProperties": false,
     "required": [
-      "scope", "qosObjective"
+      "scope", "qosObjectives"
     ]
   }
 }
index 4d8f3c9..fd5290f 100644 (file)
@@ -24,7 +24,7 @@
           "cellId"
         ]
       },
-      "qosObjective": {
+      "qosObjectives": {
         "type": "object",
         "properties": {
           "priorityLevel": {
@@ -39,7 +39,7 @@
     },
     "additionalProperties": false,
     "required": [
-      "scope", "qosObjective"
+      "scope", "qosObjectives"
     ]
   }
 }
index 65085c5..47e0ae0 100644 (file)
@@ -5,7 +5,7 @@
     "create_schema": {
       "$schema": "http://json-schema.org/draft-07/schema#",
       "title": "HW Policy",
-      "description": "HW policy type",
+      "description": "Hello World policy type",
       "type": "object",
       "properties": {
         "threshold": {
diff --git a/test/auto-test/testdata/OSC/sim_qos.json b/test/auto-test/testdata/OSC/sim_qos.json
new file mode 100644 (file)
index 0000000..92eaa6f
--- /dev/null
@@ -0,0 +1,45 @@
+{
+  "name": "pt1",
+  "description": "pt1 policy type",
+  "policy_type_id": 100,
+  "create_schema": {
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "OSC_Type1_1.0.0",
+    "description": "Quality of Service policy type",
+    "type": "object",
+    "properties": {
+      "scope": {
+        "type": "object",
+        "properties": {
+          "ueId": {
+            "type": "string"
+          },
+          "qosId": {
+            "type": "string"
+          }
+        },
+        "additionalProperties": false,
+        "required": [
+          "ueId",
+          "qosId"
+        ]
+      },
+      "qosObjectives": {
+        "type": "object",
+        "properties": {
+          "priorityLevel": {
+            "type": "number"
+          }
+        },
+        "additionalProperties": false,
+        "required": [
+          "priorityLevel"
+        ]
+      }
+    },
+    "additionalProperties": false,
+    "required": [
+      "scope", "qosObjectives"
+    ]
+  }
+}
index 4520cfa..9227b5e 100644 (file)
@@ -5,7 +5,7 @@
   "create_schema": {
     "$schema": "http://json-schema.org/draft-07/schema#",
     "title": "TS Policy",
-    "description": "TS policy type",
+    "description": "Traffic Steering - High prio traffic - policy type",
     "type": "object",
     "properties": {
       "threshold": {
index 7d48ff9..d9426c7 100644 (file)
@@ -1,7 +1,7 @@
 {
     "$schema": "http://json-schema.org/draft-07/schema#",
     "title": "20008",
-    "description": "TS policy type",
+    "description": "Traffic Steering - High prio traffic - policy type",
     "type": "object",
     "properties": {
       "threshold": {
index b1d443b..5f4d20d 100644 (file)
@@ -1,7 +1,7 @@
 {
     "$schema": "http://json-schema.org/draft-07/schema#",
     "title": "TS Policy",
-    "description": "TS policy type",
+    "description": "Traffic Steering - High prio traffic - policy type",
     "type": "object",
     "properties": {
       "threshold": {
index 2a87513..e06b031 100644 (file)
@@ -3,7 +3,7 @@
     "ueId": "ueXXX",
     "qosId": "qosXXX"
   },
-  "qosObjective": {
+  "qosObjectives": {
     "priorityLevel": XXX
   }
 }
\ No newline at end of file
index 62ee842..a048c64 100644 (file)
@@ -63,7 +63,8 @@ The script can be started with these arguments
 | `remote-remove` | same as remote but all images are removed first so that fresh images are pulled when running |
 | `auto-clean` | all containers will be automatically stopped and removed when the test case is complete. Requires the function 'auto_clean_containers' to be included last in the applicable auto-test script |
 | `--stop-at-error` | intended for debugging and make the script stop at first 'FAIL' and save all logs with a prefix 'STOP_AT_ERROR' |
-| `--use-local-image` | Only applicable when running as 'remote' or 'remote-remove'. Mainly for debugging when a locally built image shall be used together with other remote images from nexus.Accepts a space separated list of PA, CP, RICSIM, SDNC for Policy Agent, Control Panel, A1-controller and the Ric simulator |
+| `--use-local-image <app-nam> [<app-name>]*` | nnly applicable when running as 'remote' or 'remote-remove'. Mainly for debugging when a locally built image shall be used together with other remote images from nexus.Accepts a space separated list of PA, CP, RICSIM, SDNC for Policy Agent, Control Panel, A1-controller and the Ric simulator |
+| `--ricsim-prefix <prefix>` | use another prefix for the ric simulator container name than the standard 'ricsim'. Note that the testscript has to read and use the env var `$RIC_SIM_PREFIX` instead of a hardcoded name of the ric(s). |
 
 #### Function: print_result ####
 Print a test report of an auto-test script.
@@ -130,7 +131,12 @@ Make the script sleep for a number of seconds.
 | `<sleep-time-in-sec> ` | Number of seconds to sleep |
 | `<any-text-in-quotes-to-be-printed>` | Optional. The text will be printed, if present |
 
-
+#### Function: generate_uuid ####
+Geneate a UUID prefix to use along with the policy instance number when creating/deleting policies. Sets the env var UUID.
+UUID is then automatically added to the policy id in GET/PUT/DELETE.
+| arg list |
+|--|
+| None |
 
 #### Function: consul_config_app ####
 Function to load a json config from a file into consul for the Policy Agent
index b2d6a24..550ace0 100644 (file)
@@ -251,7 +251,7 @@ api_get_policies() {
        fi
 
     if [ $paramError -ne 0 ]; then
-        __print_err "<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-ype-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <template-file>]*]" $@
+        __print_err "<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <template-file>]*]" $@
         return 1
     fi
        queryparams=""
@@ -297,7 +297,7 @@ api_get_policies() {
                                if [ "$targetJson" != "[" ]; then
                                        targetJson=$targetJson","
                                fi
-                               targetJson=$targetJson"{\"id\":\"${arr[$i]}\",\"lastModified\":\"????\",\"ric\":\"${arr[$i+1]}\",\"service\":\"${arr[$i+2]}\",\"type\":"
+                               targetJson=$targetJson"{\"id\":\"$UUID${arr[$i]}\",\"lastModified\":\"????\",\"ric\":\"${arr[$i+1]}\",\"service\":\"${arr[$i+2]}\",\"type\":"
                                if [ "${arr[$i+3]}" == "EMPTY" ]; then
                                        targetJson=$targetJson"\"\","
                                else
@@ -341,7 +341,7 @@ api_get_policy() {
         return 1
     fi
 
-       query="/policy?id=$2"
+       query="/policy?id=$UUID$2"
        res="$(__do_curl_to_agent GET $query)"
        status=${res:${#res}-3}
 
@@ -398,7 +398,7 @@ api_put_policy() {
        file=$7
 
        while [ $count -lt $max ]; do
-               query="/policy?id=$pid&ric=$ric&service=$2"
+               query="/policy?id=$UUID$pid&ric=$ric&service=$2"
 
                if [ $4 != "NOTYPE" ]; then
                        query=$query"&type=$4"
@@ -414,7 +414,6 @@ api_put_policy() {
        status=${res:${#res}-3}
                echo -ne " Creating "$count"("$max")${SAMELINE}"
                if [ $status -ne $1 ]; then
-                       let pid=$pid+1
                        echo " Created "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                        ((RES_FAIL++))
@@ -458,7 +457,7 @@ api_put_policy_batch() {
        file=$7
        ARR=""
        while [ $count -lt $max ]; do
-               query="/policy?id=$pid&ric=$ric&service=$2"
+               query="/policy?id=$UUID$pid&ric=$ric&service=$2"
 
                if [ $4 != "NOTYPE" ]; then
                        query=$query"&type=$4"
@@ -475,7 +474,6 @@ api_put_policy_batch() {
                echo -ne " Requested(batch) "$count"("$max")${SAMELINE}"
 
                if [ $status -ne 200 ]; then
-                       let pid=$pid+1
                        echo " Requested(batch) "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status 200 (in request), got "$status $ERED
                        ((RES_FAIL++))
@@ -498,7 +496,6 @@ api_put_policy_batch() {
                echo -ne " Created(batch) "$count"("$max")${SAMELINE}"
 
                if [ $status -ne $1 ]; then
-                       let pid=$pid+1
                        echo " Created(batch) "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                        ((RES_FAIL++))
@@ -562,8 +559,12 @@ api_put_policy_parallel() {
 
        for ((i=1; i<=$pids; i++))
        do
+               uuid=$UUID
+               if [ -z "$uuid" ]; then
+                       uuid="NOUUID"
+               fi
                echo "" > ".pid${i}.res.txt"
-               echo $resp_code $urlbase $ric_base $num_rics $start_id $template $count $pids $i > ".pid${i}.txt"
+               echo $resp_code $urlbase $ric_base $num_rics $uuid $start_id $template $count $pids $i > ".pid${i}.txt"
                echo $i
        done  | xargs -n 1 -I{} -P $pids bash -c '{
                arg=$(echo {})
@@ -625,7 +626,7 @@ api_delete_policy() {
        pid=$2
 
        while [ $count -lt $max ]; do
-               query="/policy?id="$pid
+               query="/policy?id="$UUID$pid
                res="$(__do_curl_to_agent DELETE $query)"
                status=${res:${#res}-3}
                echo -ne " Deleting "$count"("$max")${SAMELINE}"
@@ -671,13 +672,12 @@ api_delete_policy_batch() {
        pid=$2
        ARR=""
        while [ $count -lt $max ]; do
-               query="/policy?id="$pid
+               query="/policy?id="$UUID$pid
                res="$(__do_curl_to_agent DELETE_BATCH $query)"
                status=${res:${#res}-3}
                echo -ne " Requested(batch) "$count"("$max")${SAMELINE}"
 
                if [ $status -ne 200 ]; then
-                       let pid=$pid+1
                        echo " Requested(batch) "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status 200 (in request), got "$status $ERED
                        ((RES_FAIL++))
@@ -701,7 +701,6 @@ api_delete_policy_batch() {
                echo -ne " Deleted(batch) "$count"("$max")${SAMELINE}"
 
                if [ $status -ne $1 ]; then
-                       let pid=$pid+1
                        echo " Deleted(batch) "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                        ((RES_FAIL++))
@@ -747,8 +746,12 @@ api_delete_policy_parallel() {
 
        for ((i=1; i<=$pids; i++))
        do
+               uuid=$UUID
+               if [ -z "$uuid" ]; then
+                       uuid="NOUUID"
+               fi
                echo "" > ".pid${i}.del.res.txt"
-               echo $resp_code $urlbase $num_rics $start_id $count $pids $i > ".pid${i}.del.txt"
+               echo $resp_code $urlbase $num_rics $uuid $start_id $count $pids $i > ".pid${i}.del.txt"
                echo $i
        done  | xargs -n 1 -I{} -P $pids bash -c '{
                arg=$(echo {})
@@ -841,7 +844,7 @@ api_get_policy_ids() {
                                targetJson=$targetJson","
                        fi
                        if [ $pid != "NOID" ]; then
-                               targetJson=$targetJson"\"$pid\""
+                               targetJson=$targetJson"\"$UUID$pid\""
                        fi
                done
 
@@ -998,7 +1001,7 @@ api_get_policy_status() {
                return 1
        fi
 
-       query="/policy_status?id="$2
+       query="/policy_status?id="$UUID$2
 
        res="$(__do_curl_to_agent GET $query)"
     status=${res:${#res}-3}
index daab47c..e33c619 100644 (file)
@@ -119,7 +119,7 @@ controller_api_get_A1_policy_ids() {
         if [ "$targetJson" != "[" ]; then
             targetJson=$targetJson","
         fi
-        targetJson=$targetJson"\"$pid\""
+        targetJson=$targetJson"\"$UUID$pid\""
     done
     targetJson=$targetJson"]"
 
@@ -209,10 +209,10 @@ controller_api_delete_A1_policy() {
 
     paramError=1
     if [ $# -eq 5 ] && [ $2 == "OSC" ]; then
-        url="http://$3:$RIC_SIM_INTERNAL_PORT/a1-p/policytypes/$4/policies/$5"
+        url="http://$3:$RIC_SIM_INTERNAL_PORT/a1-p/policytypes/$4/policies/$UUID$5"
                paramError=0
     elif [ $# -eq 4 ] && [ $2 == "STD" ]; then
-        url="http://$3:$RIC_SIM_INTERNAL_PORT/A1-P/v1/policies/$4"
+        url="http://$3:$RIC_SIM_INTERNAL_PORT/A1-P/v1/policies/$UUID$4"
         paramError=0
        fi
 
@@ -254,12 +254,12 @@ controller_api_put_A1_policy() {
 
     paramError=1
     if [ $# -eq 6 ] && [ $2 == "OSC" ]; then
-        url="http://$3:$RIC_SIM_INTERNAL_PORT/a1-p/policytypes/$4/policies/$5"
+        url="http://$3:$RIC_SIM_INTERNAL_PORT/a1-p/policytypes/$4/policies/$UUID$5"
         body=$(sed 's/XXX/'${5}'/g' $6)
 
                paramError=0
     elif [ $# -eq 5 ] && [ $2 == "STD" ]; then
-        url="http://$3:$RIC_SIM_INTERNAL_PORT/A1-P/v1/policies/$4"
+        url="http://$3:$RIC_SIM_INTERNAL_PORT/A1-P/v1/policies/$UUID$4"
         body=$(sed 's/XXX/'${4}'/g' $5)
         paramError=0
        fi
@@ -304,7 +304,7 @@ controller_api_get_A1_policy_status() {
     targetJson=""
     paramError=1
     if [ $# -ge 5 ] && [ $2 == "OSC" ]; then
-        url="http://$3:$RIC_SIM_INTERNAL_PORT/a1-p/policytypes/$4/policies/$5/status"
+        url="http://$3:$RIC_SIM_INTERNAL_PORT/a1-p/policytypes/$4/policies/$UUID$5/status"
         if [ $# -gt 5 ]; then
             targetJson="{\"instance_status\":\"$6\""
             targetJson=$targetJson",\"has_been_deleted\":\"$7\""
@@ -312,7 +312,7 @@ controller_api_get_A1_policy_status() {
         fi
                paramError=0
     elif [ $# -ge 4 ] && [ $2 == "STD" ]; then
-        url="http://$3:$RIC_SIM_INTERNAL_PORT/A1-P/v1/policies/$4/status"
+        url="http://$3:$RIC_SIM_INTERNAL_PORT/A1-P/v1/policies/$UUID$4/status"
         if [ $# -gt 4 ]; then
             targetJson="{\"enforceStatus\":\"$5\""
             if [ $# -eq 6 ]; then
index 19a77ba..8d37678 100644 (file)
@@ -30,21 +30,25 @@ from requests.packages import urllib3
 
 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
 
-#arg responsecode baseurl ric_base num_rics startid templatepath count pids pid_id
+#arg responsecode baseurl ric_base num_rics uuid startid templatepath count pids pid_id
 try:
-    if len(sys.argv) != 10:
-        print("1Expected 9 args, got "+str(len(sys.argv)-1)+ ". Args: responsecode baseurl ric_base num_rics startid templatepath count pids pid_id")
+    if len(sys.argv) != 11:
+        print("1Expected 10 args, got "+str(len(sys.argv)-1)+ ". Args: responsecode baseurl ric_base num_rics uuid startid templatepath count pids pid_id")
         sys.exit()
 
     responsecode=int(sys.argv[1])
     baseurl=sys.argv[2]
     ric_base=sys.argv[3]
     num_rics=int(sys.argv[4])
-    start=int(sys.argv[5])
-    templatepath=sys.argv[6]
-    count=int(sys.argv[7])
-    pids=int(sys.argv[8])
-    pid_id=int(sys.argv[9])
+    uuid=sys.argv[5]
+    start=int(sys.argv[6])
+    templatepath=sys.argv[7]
+    count=int(sys.argv[8])
+    pids=int(sys.argv[9])
+    pid_id=int(sys.argv[10])
+
+    if uuid == "NOUUID":
+        uuid=""
 
     with open(templatepath, 'r') as file:
         template = file.read()
@@ -57,18 +61,18 @@ try:
                 payload=template.replace("XXX",str(i))
                 ric_id=(i%num_rics)+1
                 ric=ric_base+str(ric_id)
-                url=baseurl+"&id="+str(i)+"&ric="+str(ric)
+                url=baseurl+"&id="+uuid+str(i)+"&ric="+str(ric)
                 try:
                     headers = {'Content-type': 'application/json'}
                     resp=requests.put(url, json.dumps(json.loads(payload)), headers=headers, verify=False, timeout=90)
                 except Exception as e1:
-                    print("1Put failed for id:"+str(i)+ ", "+str(e1) + " "+traceback.format_exc())
+                    print("1Put failed for id:"+uuid+str(i)+ ", "+str(e1) + " "+traceback.format_exc())
                     sys.exit()
                 if (resp.status_code == None):
-                    print("1Put failed for id:"+str(i)+ ", expected response code: "+responsecode+", got: None")
+                    print("1Put failed for id:"+uuid+str(i)+ ", expected response code: "+responsecode+", got: None")
                     sys.exit()
                 if (resp.status_code != responsecode):
-                    print("1Put failed for id:"+str(i)+ ", expected response code: "+responsecode+", got: "+str(resp.status_code))
+                    print("1Put failed for id:"+uuid+str(i)+ ", expected response code: "+responsecode+", got: "+str(resp.status_code))
                     sys.exit()
 
     print("0")
index fe87919..e647118 100644 (file)
@@ -30,35 +30,39 @@ from requests.packages import urllib3
 
 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
 
-#arg responsecode baseurl num_rics startid count pids pid_id
+#arg responsecode baseurl num_rics uuid startid count pids pid_id
 
 try:
-    if len(sys.argv) != 8:
-        print("1Expected 7 args, got "+str(len(sys.argv)-1)+ ". Args: responsecode baseurl num_rics startid count pids pid_id")
+    if len(sys.argv) != 9:
+        print("1Expected 8 args, got "+str(len(sys.argv)-1)+ ". Args: responsecode baseurl num_rics uuid startid count pids pid_id")
         sys.exit()
 
     responsecode=int(sys.argv[1])
     baseurl=sys.argv[2]
     num_rics=int(sys.argv[3])
-    start=int(sys.argv[4])
-    count=int(sys.argv[5])
-    pids=int(sys.argv[6])
-    pid_id=int(sys.argv[7])
+    uuid=sys.argv[4]
+    start=int(sys.argv[5])
+    count=int(sys.argv[6])
+    pids=int(sys.argv[7])
+    pid_id=int(sys.argv[8])
+
+    if uuid == "NOUUID":
+        uuid=""
 
     stop=count*num_rics+start
     for i in range(start,stop):
         if (i%pids == (pid_id-1)):
-            url=str(baseurl+"?id="+str(i))
+            url=str(baseurl+"?id="+uuid+str(i))
             try:
                 resp=requests.delete(url, verify=False, timeout=90)
             except Exception as e1:
-                print("1Delete failed for id:"+str(i)+ ", "+str(e1) + " "+traceback.format_exc())
+                print("1Delete failed for id:"+uuid+str(i)+ ", "+str(e1) + " "+traceback.format_exc())
                 sys.exit()
             if (resp.status_code == None):
-                print("1Delete failed for id:"+str(i)+ ", expected response code: "+responsecode+", got: None")
+                print("1Delete failed for id:"+uuid+str(i)+ ", expected response code: "+responsecode+", got: None")
                 sys.exit()
             if (resp.status_code != responsecode):
-                print("1Delete failed for id:"+str(i)+ ", expected response code: "+responsecode+", got: "+str(resp.status_code))
+                print("1Delete failed for id:"+uuid+str(i)+ ", expected response code: "+responsecode+", got: "+str(resp.status_code))
                 sys.exit()
 
     print("0")
index 55a4957..11c3b6d 100755 (executable)
@@ -132,6 +132,7 @@ export CONFIG_BINDING_SERVICE="config-binding-service"          # Host name of C
 export RIC_SIM_BASE="g"                                         # Base name of the RIC Simulator container, shall be the group code
                                                                 # Note, a prefix is added to each container name by the .env file in the 'ric' dir
 RIC_SIM_PREFIX="ricsim"                                         # Prefix added to ric container name, added in the .env file in the 'ric' dir
+                                                                # This prefix can be changed from the command line
 export RIC_SIM_INTERNAL_PORT=8085                               # RIC Simulator container internal port (container -> container).
                                                                 # (external ports allocated by docker)
 export RIC_SIM_INTERNAL_SECURE_PORT=8185                        # RIC Simulator container internal secure port (container -> container).
@@ -167,6 +168,9 @@ export CONTROL_PANEL_EXTERNAL_PORT=8080                         # Control Panel
 export CONTROL_PANEL_INTERNAL_PORT=8080                         # Control Panel container external port (host -> container)
 CONTROL_PANEL_LOGPATH="/logs/nonrtric-controlpanel.log"         # Path the application log in the Control Panel container
 
+UUID=""                                                         # UUID used as prefix to the policy id to simulate a real UUID
+                                                                # Testscript need to set the UUID to use other this empty prefix is used
+
 RESTBASE="http://localhost:"$POLICY_AGENT_EXTERNAL_PORT         # Base url to the Agent NB REST interface
 RESTBASE_SECURE="https://localhost:"$POLICY_AGENT_EXTERNAL_SECURE_PORT # Base url to the secure Agent NB REST interface
 DMAAPBASE="http://localhost:"$MR_EXTERNAL_PORT                  # Base url to the Dmaap adapter
index 4d89d0c..d694ef1 100755 (executable)
@@ -18,7 +18,7 @@
 #
 
 # This is a script that contains all the functions needed for auto test
-# Arg: local|remote|remote-remove [auto-clean]
+# Arg: local|remote|remote-remove [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [--use-local-image <app-nam> [<app-name>]*]
 
 
 #Formatting for 'echo' cmd
@@ -94,6 +94,9 @@ AUTO_CLEAN=""
 # Var to hold the app names to use local image for when running 'remote' or 'remote-remove'
 USE_LOCAL_IMAGES=""
 
+# List of available apps to override with local image
+AVAILABLE_LOCAL_IMAGES_OVERRIDE="PA CP SDNC RICSIM"
+
 # Use this var (STOP_AT_ERROR=1 in the test script) for debugging/trouble shooting to take all logs and exit at first FAIL test case
 STOP_AT_ERROR=0
 
@@ -180,33 +183,67 @@ if [ $paramerror -eq 0 ]; then
                shift;
        fi
 fi
-if [ $paramerror -eq 0 ]; then
-       if [ "$1" == "auto-clean" ]; then
-               AUTO_CLEAN="auto"
-               shift;
+foundparm=0
+while [ $paramerror -eq 0 ] && [ $foundparm -eq 0 ]; do
+       foundparm=1
+       if [ $paramerror -eq 0 ]; then
+               if [ "$1" == "auto-clean" ]; then
+                       AUTO_CLEAN="auto"
+                       echo "Option set - Auto clean at end of test script"
+                       shift;
+                       foundparm=0
+               fi
        fi
-fi
-if [ $paramerror -eq 0 ]; then
-       if [ "$1" == "--stop-at-error" ]; then
-               STOP_AT_ERROR=1
-               shift;
+       if [ $paramerror -eq 0 ]; then
+               if [ "$1" == "--stop-at-error" ]; then
+                       STOP_AT_ERROR=1
+                       echo "Option set - Stop at first error"
+                       shift;
+                       foundparm=0
+               fi
        fi
-fi
-if [ $paramerror -eq 0 ]; then
-       if [ "$1" == "--use-local-image" ]; then
-               USE_LOCAL_IMAGES=${@:2}
-               while [ $# -gt 0 ]; do
+       if [ $paramerror -eq 0 ]; then
+               if [ "$1" == "--ricsim-prefix" ]; then
                        shift;
-               done
+                       RIC_SIM_PREFIX=$1
+                       if [ -z "$1" ]; then
+                               paramerror=1
+                       else
+                               echo "Option set - Overriding RIC_SIM_PREFIX with: "$1
+                               shift;
+                               foundparm=0
+                       fi
+               fi
        fi
-fi
+       if [ $paramerror -eq 0 ]; then
+               if [ "$1" == "--use-local-image" ]; then
+                       USE_LOCAL_IMAGES=""
+                       shift
+                       while [ $# -gt 0 ] && [[ "$1" != "--"* ]]; do
+                               USE_LOCAL_IMAGES=$USE_LOCAL_IMAGES" "$1
+                               if [[ "$AVAILABLE_LOCAL_IMAGES_OVERRIDE" != *"$1"* ]]; then
+                                       paramerror=1
+                               fi
+                               shift;
+                       done
+                       foundparm=0
+                       if [ -z "$USE_LOCAL_IMAGES" ]; then
+                               paramerror=1
+                       else
+                               echo "Option set - Override remote images for app(s):"$USE_LOCAL_IMAGES
+                       fi
+               fi
+       fi
+done
+echo ""
 
+#Still params left?
 if [ $paramerror -eq 0 ] && [ $# -gt 0 ]; then
        paramerror=1
 fi
 
 if [ $paramerror -eq 1 ]; then
-       echo -e $RED"Expected arg: local|remote|remote-remove [auto-clean] [--stop-at-error] [--use-local-image <app-nam> [<app-name>]*]"$ERED
+       echo -e $RED"Expected arg: local|remote|remote-remove [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [--use-local-image <app-nam> [<app-name>]*]"$ERED
        exit 1
 fi
 
@@ -829,6 +866,14 @@ clean_containers() {
        echo -e $BOLD" Removing all dangling/untagged docker images"$EBOLD
     docker rmi --force $(docker images -q -f dangling=true) &> /dev/null
        echo ""
+
+       CONTRS=$(docker ps | awk '$1 != "CONTAINER" { n++ }; END { print n+0 }')
+       if [ $? -eq 0 ]; then
+               if [ $CONTRS -ne 0 ]; then
+                       echo -e $RED"Containers running, may cause distubance to the test case"$ERED
+                       docker ps -a
+               fi
+       fi
 }
 
 # Function stop and remove all container in the end of the test script, if the arg 'auto-clean' is given at test script start
@@ -1048,6 +1093,13 @@ __start_container() {
        return 0
 }
 
+# Generate a UUID to use as prefix for policy ids
+generate_uuid() {
+       UUID=$(python3 -c 'import sys,uuid; sys.stdout.write(uuid.uuid4().hex)')
+       #Reduce length to make space for serial id, us 'a' as marker where the serial id is added
+       UUID=${UUID:0:${#UUID}-4}"a"
+}
+
 ####################
 ### Consul functions
 ####################
@@ -1182,7 +1234,7 @@ prepare_consul_config() {
 
        config_json=$config_json"\n   \"ric\": ["
 
-       rics=$(docker ps | grep ricsim | awk '{print $NF}')
+       rics=$(docker ps | grep $RIC_SIM_PREFIX | awk '{print $NF}')
 
        if [ $? -ne 0 ] || [ -z "$rics" ]; then
                echo -e $RED" FAIL - the names of the running RIC Simulator cannot be retrieved." $ERED
@@ -1257,31 +1309,36 @@ use_simulator_https() {
 }
 
 # Start one group (ricsim_g1, ricsim_g2 or ricsim_g3) with a number of RIC Simulators using a given A interface
+# 'ricsim' may be set on command line to other prefix
 # args:  ricsim_g1|ricsim_g2|ricsim_g3 <count> <interface-id>
 # (Function for test scripts)
 start_ric_simulators() {
 
        echo -e $BOLD"Starting RIC Simulators"$EBOLD
 
+       RIC1=$RIC_SIM_PREFIX"_g1"
+       RIC2=$RIC_SIM_PREFIX"_g2"
+       RIC3=$RIC_SIM_PREFIX"_g3"
+
        if [ $# != 3 ]; then
                ((RES_CONF_FAIL++))
-       __print_err "need three args,  ricsim_g1|ricsim_g2|ricsim_g3 <count> <interface-id>" $@
+       __print_err "need three args,  $RIC1|$RIC2|$RIC3 <count> <interface-id>" $@
                exit 1
        fi
        echo " $2 simulators using basename: $1 on interface: $3"
        #Set env var for simulator count and A1 interface vesion for the given group
-       if [ $1 == "ricsim_g1" ]; then
+       if [ $1 == "$RIC1" ]; then
                G1_COUNT=$2
                G1_A1_VERSION=$3
-       elif [ $1 == "ricsim_g2" ]; then
+       elif [ $1 == "$RIC2" ]; then
                G2_COUNT=$2
                G2_A1_VERSION=$3
-       elif [ $1 == "ricsim_g3" ]; then
+       elif [ $1 == "$RIC3" ]; then
                G3_COUNT=$2
                G3_A1_VERSION=$3
        else
                ((RES_CONF_FAIL++))
-       __print_err "need three args, gricsim_g1|ricsim_g2|ricsim_g3 <count> <interface-id>" $@
+       __print_err "need three args, $RIC1|$RIC2|$RIC3 <count> <interface-id>" $@
                exit 1
        fi
 
index d56ad7f..17d3205 100644 (file)
@@ -41,7 +41,7 @@ app.get("/",function(req, res){
 function getSimCtr(url, index, cb) {
     var data = '';
 
-    console.log("URL: "+ url + " - ")
+    //console.log("URL: "+ url + " - ")
     try {
         http.get(url, (resp) => {
             // A chunk of data has been recieved.
@@ -185,6 +185,8 @@ var getCtr=0
 
 var refreshInterval=4000
 
+var ricbasename="ricsim"
+
 function fetchAllMetrics() {
     setTimeout(() => {
 
@@ -195,7 +197,7 @@ function fetchAllMetrics() {
         if (getCtr%3 == 0) {
             //Extract the port numbers from the running simulators, for every 3 calls
             const { exec } = require('child_process');
-            exec('docker ps --filter "name=ricsim" --format "{{.Names}} {{.Ports}}" | sed s/0.0.0.0:// | cut -d \'>\' -f1 | sed \'s/[[-]]*$//\'', (err, stdout, stderr) => {
+            exec('docker ps --filter "name='+ricbasename+'" --format "{{.Names}} {{.Ports}}" | sed s/0.0.0.0:// | cut -d \'>\' -f1 | sed \'s/[[-]]*$//\'', (err, stdout, stderr) => {
 
                 var simulators = ""
                 simulators=`${stdout}`.replace(/(\r\n|\n|\r)/gm," ");
@@ -377,6 +379,14 @@ setInterval(() => {
 
 app.get("/mon",function(req, res){
 
+    var bn=req.query.basename
+
+    if (bn == undefined) {
+        getCtr=0
+        return res.redirect('/mon?basename=ricsim');
+    } else {
+        ricbasename=bn
+    }
 
     refreshInterval=2000
 
@@ -388,6 +398,9 @@ app.get("/mon",function(req, res){
             "<title>Policy Agent and simulator monitor</title>"+
             "</head>" +
             "<body>" +
+            "<font size=\"-3\" face=\"monospace\">" +
+            "<p>Change basename in url if other ric sim prefix is used</p>" +
+            "</font>" +
             "<h3>Policy agent</h3>" +
             "<font face=\"monospace\">" +
             "Status:..............................." + formatDataRow(ag1) + "<br>" +