assert.Equal(t, "App2ExampleCounterOneObjectInstance", appMetrics["App2ExampleCounterOne"].ObjectInstance)
assert.Equal(t, "App2ExampleCounterTwoObject", appMetrics["App2ExampleCounterTwo"].ObjectName)
assert.Equal(t, "App2ExampleCounterTwoObjectInstance", appMetrics["App2ExampleCounterTwo"].ObjectInstance)
+
+ bytes, err = ioutil.ReadFile("../../test/noConfig_xApp_config_test_output.json")
+ assert.Nil(t, err)
+ appMetrics = vespaMgr.ParseMetricsFromDescriptor(bytes, appMetrics)
+
+ bytes, err = ioutil.ReadFile("../../test/noMeasurements_xApp_config_test_output.json")
+ assert.Nil(t, err)
+ appMetrics = vespaMgr.ParseMetricsFromDescriptor(bytes, appMetrics)
+
+ bytes, err = ioutil.ReadFile("../../test/inValidMeasurements_xApp_config_test_output.json")
+ assert.Nil(t, err)
+ appMetrics = vespaMgr.ParseMetricsFromDescriptor(bytes, appMetrics)
+
}
func TestParseXAppDescriptorWithNoConfig(t *testing.T) {
func TestVespaMgrTestSuite(t *testing.T) {
suite.Run(t, new(VespaMgrTestSuite))
}
+
+func (suite *VespaMgrTestSuite) TestCreateConf() {
+ suite.vespaMgr.CreateConf("/unknown/text.txt", []byte{})
+}
+
+func (suite *VespaMgrTestSuite) TestHandleMeasurements() {
+ data, err := ioutil.ReadFile("../../test/xApp_config_test_output.json")
+ suite.Nil(err)
+
+ pbodyEn, _ := json.Marshal(data)
+ req, _ := http.NewRequest("POST", "/ric/v1/measurements", bytes.NewBuffer(pbodyEn))
+ handleFunc := http.HandlerFunc(suite.vespaMgr.HandleMeasurements)
+ response := executeRequest(req, handleFunc)
+ suite.Equal(http.StatusOK, response.Code)
+}
--- /dev/null
+[
+ {
+ "metadata": { },
+ "descriptor": { },
+ "config": {
+ "local": {
+ "host": ":8080"
+ },
+ "logger": {
+ "level": 5
+ },
+ "measurements": [
+ {
+ "moId_1": "SEP-12/XAPP-1",
+ "measType_1": "X2",
+ "measId_1": "9001",
+ "measInterval_1": "60",
+ "metrics_1": [
+ {
+ "name": "App1ExampleCounterOne",
+ "objectName": "App1ExampleCounterOneObject",
+ "objectInstance": "App1ExampleCounterOneObjectInstance",
+ "counterId": "0011",
+ "type": "counter",
+ "description": "Example counter 1"
+ },
+ {
+ "name": "App1ExampleCounterTwo",
+ "objectName": "App1ExampleCounterTwoObject",
+ "objectInstance": "App1ExampleCounterTwoObjectInstance",
+ "counterId": "0012",
+ "type": "counter",
+ "description": "Example counter 2"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "metadata": {},
+ "descriptor": {},
+ "config": {
+ "local": {
+ "host": ":8080"
+ },
+ "logger": {
+ "level": 3
+ },
+ "measurements": [
+ {
+ "moId": "SEP-12/XAPP-2",
+ "measType": "X2",
+ "measId": "9002",
+ "measInterval": "60",
+ "metrics": [
+ {
+ "name": "App2ExampleCounterOne",
+ "objectName": "App2ExampleCounterOneObject",
+ "objectInstance": "App2ExampleCounterOneObjectInstance",
+ "counterId": "0021",
+ "type": "counter",
+ "description": "Example counter 1"
+ },
+ {
+ "name": "App2ExampleCounterTwo",
+ "objectName": "App2ExampleCounterTwoObject",
+ "objectInstance": "App2ExampleCounterTwoObjectInstance",
+ "counterId": "0022",
+ "type": "counter",
+ "description": "Example counter 2"
+ }
+ ]
+ }
+ ]
+ }
+ }
+]
--- /dev/null
+[
+ {
+ "metadata": { },
+ "descriptor": { },
+ "config_1": {
+ "local": {
+ "host": ":8080"
+ },
+ "logger": {
+ "level": 5
+ },
+ "measurements": [
+ {
+ "moId": "SEP-12/XAPP-1",
+ "measType": "X2",
+ "measId": "9001",
+ "measInterval": "60",
+ "metrics": [
+ {
+ "name": "App1ExampleCounterOne",
+ "objectName": "App1ExampleCounterOneObject",
+ "objectInstance": "App1ExampleCounterOneObjectInstance",
+ "counterId": "0011",
+ "type": "counter",
+ "description": "Example counter 1"
+ },
+ {
+ "name": "App1ExampleCounterTwo",
+ "objectName": "App1ExampleCounterTwoObject",
+ "objectInstance": "App1ExampleCounterTwoObjectInstance",
+ "counterId": "0012",
+ "type": "counter",
+ "description": "Example counter 2"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "metadata": {},
+ "descriptor": {},
+ "config": {
+ "local": {
+ "host": ":8080"
+ },
+ "logger": {
+ "level": 3
+ },
+ "measurements": [
+ {
+ "moId": "SEP-12/XAPP-2",
+ "measType": "X2",
+ "measId": "9002",
+ "measInterval": "60",
+ "metrics": [
+ {
+ "name": "App2ExampleCounterOne",
+ "objectName": "App2ExampleCounterOneObject",
+ "objectInstance": "App2ExampleCounterOneObjectInstance",
+ "counterId": "0021",
+ "type": "counter",
+ "description": "Example counter 1"
+ },
+ {
+ "name": "App2ExampleCounterTwo",
+ "objectName": "App2ExampleCounterTwoObject",
+ "objectInstance": "App2ExampleCounterTwoObjectInstance",
+ "counterId": "0022",
+ "type": "counter",
+ "description": "Example counter 2"
+ }
+ ]
+ }
+ ]
+ }
+ }
+]
--- /dev/null
+[
+ {
+ "metadata": { },
+ "descriptor": { },
+ "config": {
+ "local": {
+ "host": ":8080"
+ },
+ "logger": {
+ "level": 5
+ },
+ "measurements_1": [
+ {
+ "moId": "SEP-12/XAPP-1",
+ "measType": "X2",
+ "measId": "9001",
+ "measInterval": "60",
+ "metrics": [
+ {
+ "name": "App1ExampleCounterOne",
+ "objectName": "App1ExampleCounterOneObject",
+ "objectInstance": "App1ExampleCounterOneObjectInstance",
+ "counterId": "0011",
+ "type": "counter",
+ "description": "Example counter 1"
+ },
+ {
+ "name": "App1ExampleCounterTwo",
+ "objectName": "App1ExampleCounterTwoObject",
+ "objectInstance": "App1ExampleCounterTwoObjectInstance",
+ "counterId": "0012",
+ "type": "counter",
+ "description": "Example counter 2"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "metadata": {},
+ "descriptor": {},
+ "config": {
+ "local": {
+ "host": ":8080"
+ },
+ "logger": {
+ "level": 3
+ },
+ "measurements": [
+ {
+ "moId": "SEP-12/XAPP-2",
+ "measType": "X2",
+ "measId": "9002",
+ "measInterval": "60",
+ "metrics": [
+ {
+ "name": "App2ExampleCounterOne",
+ "objectName": "App2ExampleCounterOneObject",
+ "objectInstance": "App2ExampleCounterOneObjectInstance",
+ "counterId": "0021",
+ "type": "counter",
+ "description": "Example counter 1"
+ },
+ {
+ "name": "App2ExampleCounterTwo",
+ "objectName": "App2ExampleCounterTwoObject",
+ "objectInstance": "App2ExampleCounterTwoObjectInstance",
+ "counterId": "0022",
+ "type": "counter",
+ "description": "Example counter 2"
+ }
+ ]
+ }
+ ]
+ }
+ }
+]