summaryrefslogtreecommitdiffstats
path: root/mock-sdc
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-12-12 16:49:00 +0100
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-12-12 16:49:00 +0100
commit3a57d8c9297d3c587cf5d76418ca60bb9937ce60 (patch)
tree818d7f0291541428cfaa6dbe1118d6dcef669ac4 /mock-sdc
parent63b9911d7018e5bb7b5f0d70abb72aa995ad01a4 (diff)
Fix mock sdc docker buildHEADmaster
- adjust UUID function since the version is not pinned and it changed upstream Issue-ID: SDC-4705 Change-Id: Id949a87ca30e7550cb849d50122272db8d172fa6 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'mock-sdc')
-rw-r--r--mock-sdc/go.mod22
-rw-r--r--mock-sdc/go.sum42
-rw-r--r--mock-sdc/resource_handlers.go33
-rw-r--r--mock-sdc/vendor_handlers.go4
-rw-r--r--mock-sdc/vsp_handlers.go4
5 files changed, 84 insertions, 21 deletions
diff --git a/mock-sdc/go.mod b/mock-sdc/go.mod
new file mode 100644
index 0000000..a10cfa4
--- /dev/null
+++ b/mock-sdc/go.mod
@@ -0,0 +1,22 @@
+module onap/mock-sdc
+
+go 1.22.1
+
+require (
+ github.com/labstack/echo v3.3.10+incompatible
+ github.com/labstack/gommon v0.4.2
+ github.com/satori/go.uuid v1.2.0
+)
+
+require (
+ github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
+ github.com/mattn/go-colorable v0.1.13 // indirect
+ github.com/mattn/go-isatty v0.0.20 // indirect
+ github.com/valyala/bytebufferpool v1.0.0 // indirect
+ github.com/valyala/fasttemplate v1.2.2 // indirect
+ golang.org/x/crypto v0.31.0 // indirect
+ golang.org/x/net v0.21.0 // indirect
+ golang.org/x/sys v0.28.0 // indirect
+ golang.org/x/text v0.21.0 // indirect
+ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
+)
diff --git a/mock-sdc/go.sum b/mock-sdc/go.sum
new file mode 100644
index 0000000..67ea3f5
--- /dev/null
+++ b/mock-sdc/go.sum
@@ -0,0 +1,42 @@
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
+github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
+github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
+github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/labstack/echo v3.3.10+incompatible h1:pGRcYk231ExFAyoAjAfD85kQzRJCRI8bbnE7CX5OEgg=
+github.com/labstack/echo v3.3.10+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s=
+github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
+github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
+github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
+github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
+github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
+github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
+github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
+github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
+github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
+github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
+github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
+github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
+github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
+github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
+golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
+golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
+golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
+golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
+golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
+golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
+golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
+gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
+gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
diff --git a/mock-sdc/resource_handlers.go b/mock-sdc/resource_handlers.go
index 53aa98f..66256eb 100644
--- a/mock-sdc/resource_handlers.go
+++ b/mock-sdc/resource_handlers.go
@@ -17,9 +17,9 @@ package main
import (
"container/list"
"encoding/json"
- "net/http"
"errors"
"io/ioutil"
+ "net/http"
"github.com/labstack/echo"
uuid "github.com/satori/go.uuid"
@@ -66,7 +66,7 @@ type Category struct {
Version string `json:"version"`
}
-//ArtifactAdd Describes ressource component Instances artifacts in SDC
+// ArtifactAdd Describes ressource component Instances artifacts in SDC
type ArtifactAdd struct {
ArtifactName string `json:"artifactName"`
ArtifactLabel string `json:"artifactLabel"`
@@ -74,7 +74,7 @@ type ArtifactAdd struct {
Description string `json:"description"`
}
-//ComponentInstance Describes ressource component Instances in SDC
+// ComponentInstance Describes ressource component Instances in SDC
type ComponentInstance struct {
UniqueID string `json:"uniqueId"`
Name string `json:"name"`
@@ -157,7 +157,7 @@ type DistributionIDList struct {
DistributionStatusOfServiceList []DistributionIDResult `json:"distributionStatusOfServiceList"`
}
-//DistributionStatus format
+// DistributionStatus format
type DistributionStatus struct {
OmfComponentID string `json:"omfComponentID"`
Timestamp string `json:"timestamp"`
@@ -178,7 +178,7 @@ type NewUploadResult struct {
ArtifactName string `json:"artifactName"`
}
-//Property format
+// Property format
type Property struct {
Name string `json:"name"`
Value string `json:"value"`
@@ -187,7 +187,7 @@ type Property struct {
ParentUniqueID string `json:"parentUniqueId"`
}
-//Input format
+// Input format
type Input struct {
Name string `json:"name"`
Value string `json:"value"`
@@ -324,9 +324,9 @@ func postResources(c echo.Context) error {
Status: "Exists"})
}
}
- resource.ID = uuid.Must(uuid.NewV4()).String()
- resource.InvariantID = uuid.Must(uuid.NewV4()).String()
- resource.UniqueID = uuid.Must(uuid.NewV4()).String()
+ resource.ID = uuid.NewV4().String()
+ resource.InvariantID = uuid.NewV4().String()
+ resource.UniqueID = uuid.NewV4().String()
resource.Version = "0.1"
resource.LifecycleState = "NOT_CERTIFIED_CHECKOUT"
resource.DistributionStatus = "DISTRIBUTION_NOT_APPROVED"
@@ -395,7 +395,7 @@ func postAddResourceToService(c echo.Context) error {
rr.ResourceType == resourceAdd.OriginType {
if rr.ResourceType == "VF" {
ci := ComponentInstance{
- UniqueID: uuid.Must(uuid.NewV4()).String(),
+ UniqueID: uuid.NewV4().String(),
Name: resourceAdd.Name,
ComponentName: resourceAdd.Name,
OriginType: "VF",
@@ -428,7 +428,7 @@ func getDistribution(c echo.Context) error {
distributionIDResult := new(DistributionIDResult)
if r.DistributionStatus == "DISTRIBUTED" {
if len(r.DistributionID) < 1 {
- resourceList[i].DistributionID = uuid.Must(uuid.NewV4()).String()
+ resourceList[i].DistributionID = uuid.NewV4().String()
}
distributionIDResult.DeployementStatus = "Distributed"
distributionIDResult.UserID = "Oper P(op0001)"
@@ -1358,8 +1358,8 @@ func getArtifactTypes(c echo.Context) error {
func registerForDistribution(c echo.Context) error {
distributionRegistration := map[string]string{
- "distrNotificationTopicName":"testName",
- "distrStatusTopicName":"testTopic",
+ "distrNotificationTopicName": "testName",
+ "distrStatusTopicName": "testTopic",
}
return c.JSON(http.StatusOK, distributionRegistration)
}
@@ -1370,10 +1370,9 @@ func unRegisterForDistribution(c echo.Context) error {
func distributionKafkaData(c echo.Context) error {
kafkaData := map[string]string{
- "kafkaBootStrapServer":"localhost:43219",
- "distrNotificationTopicName":"SDC-DIST-NOTIF-TOPIC",
- "distrStatusTopicName":"SDC-DIST-STATUS-TOPIC",
+ "kafkaBootStrapServer": "localhost:43219",
+ "distrNotificationTopicName": "SDC-DIST-NOTIF-TOPIC",
+ "distrStatusTopicName": "SDC-DIST-STATUS-TOPIC",
}
return c.JSON(http.StatusOK, kafkaData)
}
-
diff --git a/mock-sdc/vendor_handlers.go b/mock-sdc/vendor_handlers.go
index 2bdde87..ad55071 100644
--- a/mock-sdc/vendor_handlers.go
+++ b/mock-sdc/vendor_handlers.go
@@ -113,7 +113,7 @@ func postVendorServiceModels(c echo.Context) error {
return err
}
- u1 := uuid.Must(uuid.NewV4()).String()
+ u1 := uuid.NewV4().String()
version := Version{
ID: u1,
Name: "1.0",
@@ -135,7 +135,7 @@ func postVendorServiceModels(c echo.Context) error {
Dirty: false,
},
}
- u2 := uuid.Must(uuid.NewV4()).String()
+ u2 := uuid.NewV4().String()
var empty struct{}
vendorList = append(vendorList, Vendor{
ID: u2,
diff --git a/mock-sdc/vsp_handlers.go b/mock-sdc/vsp_handlers.go
index 6b45774..02dcd95 100644
--- a/mock-sdc/vsp_handlers.go
+++ b/mock-sdc/vsp_handlers.go
@@ -188,7 +188,7 @@ func postVendorSoftwareProducts(c echo.Context) error {
return err
}
- u1 := uuid.Must(uuid.NewV4()).String()
+ u1 := uuid.NewV4().String()
version := Version{
ID: u1,
Name: "1.0",
@@ -210,7 +210,7 @@ func postVendorSoftwareProducts(c echo.Context) error {
Dirty: false,
},
}
- u2 := uuid.Must(uuid.NewV4()).String()
+ u2 := uuid.NewV4().String()
vspList = append(vspList, Vsp{
ID: u2,
OnboardingMethod: "NetworkPackage",