Update apex-pdp CSIT tests to include metrics 07/128407/1
authorRashmi Pujar <rashmi.pujar1@bell.ca>
Fri, 8 Apr 2022 19:45:32 +0000 (15:45 -0400)
committerRashmi Pujar <rashmi.pujar1@bell.ca>
Fri, 8 Apr 2022 19:45:57 +0000 (15:45 -0400)
Validate metrics as documented in
https://wiki.onap.org/display/DW/Policy+Framework%3A+Key+metrics+to+monitor

Issue-ID: POLICY-3766
Signed-off-by: Rashmi Pujar <rashmi.pujar1@bell.ca>
Change-Id: Iac1c0298c8e9a35c5ef25aec15e3b9bcbabebf7e

csit/apex-pdp/tests/apex-pdp-test.robot
csit/apex-pdp/tests/data/onap.pnf.metadataSet.Test.json
csit/apex-pdp/tests/data/onap.policies.apex.pnf.Test.json
csit/apex-pdp/tests/data/onap.policies.apex.vnf.Test.json

index ffa501d..b0e4c72 100644 (file)
@@ -16,12 +16,6 @@ Healthcheck
      Should Be Equal As Strings    ${resp.json()['code']}    200
      Set Suite Variable    ${pdpName}    ${resp.json()['name']}
 
-Metrics
-     [Documentation]  Verify policy-apex-pdp is exporting prometheus metrics
-     ${hcauth}=  HealthCheckAuth
-     ${resp}=  PerformGetRequest  ${APEX_IP}  /metrics  200  null  ${hcauth}
-     Should Contain  ${resp.text}  jvm_threads_current
-
 ExecuteApexSampleDomainPolicy
      Set Test Variable    ${policyName}    onap.policies.native.apex.Sampledomain
      ${postjson}=  Get file  ${CURDIR}/data/${policyName}.json
@@ -65,6 +59,26 @@ ExecuteApexTestPnfPolicyWithMetadataSet
       Should Be Equal As Integers    ${result.rc}    0
       Wait Until Keyword Succeeds    2 min    5 sec    TriggerAndVerifyTestPnfPolicy
 
+Metrics
+     [Documentation]  Verify policy-apex-pdp is exporting prometheus metrics
+     ${auth}=  HealthCheckAuth
+     ${resp}=  PerformGetRequest  ${APEX_IP}  /metrics  200  null  ${auth}
+     Should Contain  ${resp.text}  pdpa_policy_deployments_total{operation="deploy",status="TOTAL",} 4.0
+     Should Contain  ${resp.text}  pdpa_policy_deployments_total{operation="deploy",status="SUCCESS",} 4.0
+     Should Contain  ${resp.text}  pdpa_policy_executions_total{status="SUCCESS",} 3.0
+     Should Contain  ${resp.text}  pdpa_policy_executions_total{status="TOTAL",} 3.0
+     Should Match  ${resp.text}  *pdpa_engine_event_executions{engine_instance_id="NSOApexEngine-*:0.0.1",}*
+     Should Match  ${resp.text}  *pdpa_engine_event_executions{engine_instance_id="MyApexEngine-*:0.0.1",}*
+     Should Match  ${resp.text}  *pdpa_engine_state{engine_instance_id=*,} 2.0*
+     Should Contain  ${resp.text}  pdpa_engine_event_executions
+     Should Contain  ${resp.text}  pdpa_engine_average_execution_time_seconds
+     Should Contain  ${resp.text}  pdpa_engine_last_execution_time_bucket
+     Should Contain  ${resp.text}  pdpa_engine_last_execution_time_count
+     Should Contain  ${resp.text}  pdpa_engine_last_execution_time_sum
+     Should Match  ${resp.text}  *pdpa_engine_last_start_timestamp_epoch{engine_instance_id="NSOApexEngine-*:0.0.1",}*E12*
+     Should Match  ${resp.text}  *pdpa_engine_last_start_timestamp_epoch{engine_instance_id="MyApexEngine-*:0.0.1",}*E12*
+     Should Contain  ${resp.text}  jvm_threads_current
+
 *** Keywords ***
 
 DeployPolicy
index c59f695..b59efc0 100644 (file)
                               }
                             }
                           ]
-                        }
+                        },
+                        "toscaPolicyState": "EXIT_FAILURE"
                       },
                       "outputEvents": {
                         "entry": [
                                     }
                                   }
                                 ]
-                              }
+                              },
+                              "toscaPolicyState": ""
                             }
                           }
                         ]
                               }
                             }
                           ]
-                        }
+                        },
+                        "toscaPolicyState": "EXIT_SUCCESS"
                       },
                       "outputEvents": {
                         "entry": [
                                     }
                                   }
                                 ]
-                              }
+                              },
+                              "toscaPolicyState": ""
                             }
                           }
                         ]
                               }
                             }
                           ]
-                        }
+                        },
+                        "toscaPolicyState": "EXIT_FAILURE"
                       },
                       "outputEvents": {
                         "entry": [
                                     }
                                   }
                                 ]
-                              }
+                              },
+                              "toscaPolicyState": ""
                             }
                           }
                         ]
                               }
                             }
                           ]
-                        }
+                        },
+                        "toscaPolicyState": ""
                       },
                       "outputEvents": {
                         "entry": [
                                     }
                                   }
                                 ]
-                              }
+                              },
+                              "toscaPolicyState": ""
                             }
                           },
                           {
                                     }
                                   }
                                 ]
-                              }
+                              },
+                              "toscaPolicyState": ""
                             }
                           }
                         ]
                               }
                             }
                           ]
-                        }
+                        },
+                        "toscaPolicyState": "ENTRY"
                       },
                       "outputEvents": {
                         "entry": [
                                     }
                                   }
                                 ]
-                              }
+                              },
+                              "toscaPolicyState": ""
                             }
                           },
                           {
                                     }
                                   }
                                 ]
-                              }
+                              },
+                              "toscaPolicyState": ""
                             }
                           }
                         ]
                           }
                         ]
                       }
-                    }
+                    },
+                    "toscaPolicyState": "EXIT_FAILURE"
                   },
                   {
                     "key": {
                             }
                           }
                         ]
-                      }
+                      },
+                      "toscaPolicyState": ""
                     }
                   },
                   {
                             }
                           }
                         ]
-                      }
+                      },
+                      "toscaPolicyState": ""
                     }
                   },
                   {
                             }
                           }
                         ]
-                      }
+                      },
+                      "toscaPolicyState": "EXIT_FAILURE"
                     }
                   },
                   {
                             }
                           }
                         ]
-                      }
+                      },
+                      "toscaPolicyState": ""
                     }
                   },
                   {
                             }
                           }
                         ]
-                      }
+                      },
+                      "toscaPolicyState": "EXIT_SUCCESS"
                     }
                   },
                   {
                             }
                           }
                         ]
-                      }
+                      },
+                      "toscaPolicyState": ""
                     }
                   },
                   {
                             }
                           }
                         ]
-                      }
+                      },
+                      "toscaPolicyState": "ENTRY"
                     }
                   }
                 ]
       }
     }
   }
-}
\ No newline at end of file
+}
index e64e0c9..5d9cbf9 100644 (file)
                                     }
                                   }
                                 ]
-                              }
+                              },
+                              "toscaPolicyState": "EXIT_FAILURE"
                             },
                             "outputEvents": {
                               "entry": [
                                           }
                                         }
                                       ]
-                                    }
+                                    },
+                                    "toscaPolicyState": ""
                                   }
                                 }
                               ]
                                     }
                                   }
                                 ]
-                              }
+                              },
+                              "toscaPolicyState": "EXIT_SUCCESS"
                             },
                             "outputEvents": {
                               "entry": [
                                           }
                                         }
                                       ]
-                                    }
+                                    },
+                                    "toscaPolicyState": ""
                                   }
                                 }
                               ]
                                     }
                                   }
                                 ]
-                              }
+                              },
+                              "toscaPolicyState": "EXIT_FAILURE"
                             },
                             "outputEvents": {
                               "entry": [
                                           }
                                         }
                                       ]
-                                    }
+                                    },
+                                    "toscaPolicyState": ""
                                   }
                                 }
                               ]
                                     }
                                   }
                                 ]
-                              }
+                              },
+                              "toscaPolicyState": ""
                             },
                             "outputEvents": {
                               "entry": [
                                           }
                                         }
                                       ]
-                                    }
+                                    },
+                                    "toscaPolicyState": ""
                                   }
                                 },
                                 {
                                           }
                                         }
                                       ]
-                                    }
+                                    },
+                                    "toscaPolicyState": ""
                                   }
                                 }
                               ]
                                     }
                                   }
                                 ]
-                              }
+                              },
+                              "toscaPolicyState": "ENTRY"
                             },
                             "outputEvents": {
                               "entry": [
                                           }
                                         }
                                       ]
-                                    }
+                                    },
+                                    "toscaPolicyState": ""
                                   }
                                 },
                                 {
                                           }
                                         }
                                       ]
-                                    }
+                                    },
+                                    "toscaPolicyState": ""
                                   }
                                 }
                               ]
                                 }
                               ]
                             }
-                          }
+                          },
+                          "toscaPolicyState": "EXIT_FAILURE"
                         },
                         {
                           "key": {
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": ""
                           }
                         },
                         {
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": ""
                           }
                         },
                         {
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": "EXIT_FAILURE"
                           }
                         },
                         {
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": ""
                           }
                         },
                         {
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": "EXIT_SUCCESS"
                           }
                         },
                         {
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": ""
                           }
                         },
                         {
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": "ENTRY"
                           }
                         }
                       ]
index 90684c4..d000de7 100644 (file)
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": "EXIT_FAILURE"
                           }
                         },
                         {
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": ""
                           }
                         },
                         {
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": ""
                           }
                         },
                         {
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": "EXIT_FAILURE"
                           }
                         },
                         {
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": ""
                           }
                         },
                         {
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": ""
                           }
                         },
                         {
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": "EXIT_FAILURE"
                           }
                         },
                         {
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": ""
                           }
                         },
                         {
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": "EXIT_SUCCESS"
                           }
                         },
                         {
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": ""
                           }
                         },
                         {
                                   }
                                 }
                               ]
-                            }
+                            },
+                            "toscaPolicyState": "ENTRY"
                           }
                         }
                       ]