Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions api/apiserver/api_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
package apiserver

import (
"encoding/json"
"net/http"

"github.com/gin-gonic/gin"
"github.com/omec-project/metricfunc/cmd/controller"
"github.com/omec-project/metricfunc/internal/metricdata"
"github.com/omec-project/metricfunc/logger"
"github.com/omec-project/openapi"
Expand Down Expand Up @@ -113,3 +115,16 @@ func GetNfServiceStatsDetail(c *gin.Context) {
//Gives summary of all services
func GetNfServiceStatsAll(c *gin.Context) {
}

func PushTestIPs(c *gin.Context) {
requestBody, err := c.GetRawData()
if err != nil {
logger.ApiSrvLog.Errorf("get requestbody error %s", err.Error())
return
}
var rogueIPs controller.RogueIPs
json.Unmarshal(requestBody, &rogueIPs)

logger.ApiSrvLog.Infoln("Test RogueIPs: ", rogueIPs)
controller.RogueChannel <- rogueIPs
}
7 changes: 7 additions & 0 deletions api/apiserver/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ var routes = Routes{
"/nfServiceStats/all",
GetNfServiceStatsAll,
},

{
"TestIPs",
strings.ToUpper("Post"),
"/testIPs",
PushTestIPs,
},
}

/* APIs
Expand Down
38 changes: 38 additions & 0 deletions cmd/controller/config/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// SPDX-FileCopyrightText: 2022-present Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0

package Config

type Config struct {
Info *Info `yaml:"info"`
Logger *Logger `yaml:"logger"`
Configuration *Configuration `yaml:"configuration"`
}

type Info struct {
Version string `yaml:"version,omitempty"`
Description string `yaml:"description,omitempty"`
HttpVersion int `yaml:"http-version,omitempty"`
}

type Logger struct {
LogLevel string `yaml:"level,omitempty"`
}

type Configuration struct {
OnosApiServer ServerAddr `yaml:"onosApiServer,omitempty"`
RocEndPoint ServerAddr `yaml:"rocEndPoint,omitempty"`
MetricFuncEndPoint ServerAddr `yaml:"metricFuncEndPoint,omitempty"`
}

type ServerAddr struct {
Addr string `yaml:"addr,omitempty"` // IP used to run the server in the node.
Port int `yaml:"port,omitempty"`
PollInterval int `yaml:"pollInterval,omitempty"`
}

type Urls struct {
Uri string `yaml:"uri,omitempty"`
Port int `yaml:"port,omitempty"`
}
22 changes: 22 additions & 0 deletions cmd/controller/config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# SPDX-FileCopyrightText: 2022-present Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0

info:
version: 1.0.0
description: Controller Pod initial local configuration

logger:
level: debug

configuration:
onosApiServer:
addr: "onosapp"
port: 9301
rocEndPoint:
addr: "aether-roc-umbrella-aether-roc-gui-v2-1-external.aether-roc.svc"
port: 31194
metricFuncEndPoint:
addr: "metricfunc.omec.svc"
port: 5001

Loading