summaryrefslogtreecommitdiffstats
path: root/src/k8splugin
diff options
context:
space:
mode:
authorRitu Sood <Ritu.Sood@intel.com>2020-01-10 19:45:22 +0000
committerGerrit Code Review <gerrit@onap.org>2020-01-10 19:45:22 +0000
commit053d8702e02a5acddc06ead4aeefcaac664a184c (patch)
tree5413470a19fd73433b54606bacc537c3db69640f /src/k8splugin
parent731f6cc1a411276ef348804184416acf11f9477b (diff)
parent4f411bacefec35c9a51e078175668aa97a398477 (diff)
Merge "Instantiate infra_workload based on vf-module-*-ids"
Diffstat (limited to 'src/k8splugin')
-rw-r--r--src/k8splugin/api/brokerhandler.go14
-rw-r--r--src/k8splugin/api/brokerhandler_test.go49
2 files changed, 21 insertions, 42 deletions
diff --git a/src/k8splugin/api/brokerhandler.go b/src/k8splugin/api/brokerhandler.go
index b377baf1..7671db44 100644
--- a/src/k8splugin/api/brokerhandler.go
+++ b/src/k8splugin/api/brokerhandler.go
@@ -134,15 +134,13 @@ func (b brokerInstanceHandler) createHandler(w http.ResponseWriter, r *http.Requ
return
}
- rbName := req.getAttributeValue(req.SDNCDirectives, "k8s-rb-definition-name")
- if rbName == "" {
- http.Error(w, "k8s-rb-definition-name is missing from sdnc-directives", http.StatusBadRequest)
+ if req.VFModuleModelInvariantID == "" {
+ http.Error(w, "vf-module-model-invariant-id is empty", http.StatusBadRequest)
return
}
- rbVersion := req.getAttributeValue(req.SDNCDirectives, "k8s-rb-definition-version")
- if rbVersion == "" {
- http.Error(w, "k8s-rb-definition-version is missing from sdnc-directives", http.StatusBadRequest)
+ if req.VFModuleModelVersionID == "" {
+ http.Error(w, "vf-module-model-version-id is empty", http.StatusBadRequest)
return
}
@@ -160,8 +158,8 @@ func (b brokerInstanceHandler) createHandler(w http.ResponseWriter, r *http.Requ
// Setup the resource parameters for making the request
var instReq app.InstanceRequest
- instReq.RBName = rbName
- instReq.RBVersion = rbVersion
+ instReq.RBName = req.VFModuleModelInvariantID
+ instReq.RBVersion = req.VFModuleModelVersionID
instReq.ProfileName = profileName
instReq.CloudRegion = cloudRegion
instReq.Labels = map[string]string{
diff --git a/src/k8splugin/api/brokerhandler_test.go b/src/k8splugin/api/brokerhandler_test.go
index 00ca3b7b..83ff588b 100644
--- a/src/k8splugin/api/brokerhandler_test.go
+++ b/src/k8splugin/api/brokerhandler_test.go
@@ -48,18 +48,19 @@ func TestBrokerCreateHandler(t *testing.T) {
expectedCode: http.StatusUnprocessableEntity,
},
{
- label: "Missing parameter failure",
+ label: "Missing vf-module-*-id parameter",
input: bytes.NewBuffer([]byte(`{
"vf-module-model-customization-id": "84sdfkio938",
- "user_directives": {
+ "vf-module-model-invariant-id": "123456qwerty",
+ "sdnc_directives": {
"attributes": [
{
- "attribute_name": "k8s-rb-definition-name",
- "attribute_value": "test-rbdef"
+ "attribute_name": "vf_module_name",
+ "attribute_value": "test-vf-module-name"
},
{
- "attribute_name": "k8s-rb-definition-version",
- "attribute_value": "v1"
+ "attribute_name": "k8s-rb-profile-name",
+ "attribute_value": "profile1"
}
]
}
@@ -67,9 +68,11 @@ func TestBrokerCreateHandler(t *testing.T) {
expectedCode: http.StatusBadRequest,
},
{
- label: "Deprecated parameters passed (user_directives)",
+ label: "Missing parameter from sdnc_directives",
input: bytes.NewBuffer([]byte(`{
- "vf-module-model-customization-id": "97sdfkio168",
+ "vf-module-model-customization-id": "84sdfkio938",
+ "vf-module-model-invariant-id": "123456qwerty",
+ "vf-module-model-version-id": "123qweasdzxc",
"sdnc_directives": {
"attributes": [
{
@@ -77,22 +80,6 @@ func TestBrokerCreateHandler(t *testing.T) {
"attribute_value": "test-vf-module-name"
}
]
- },
- "user_directives": {
- "attributes": [
- {
- "attribute_name": "rb-definition-name",
- "attribute_value": "test-rbdef"
- },
- {
- "attribute_name": "rb-definition-version",
- "attribute_value": "v1"
- },
- {
- "attribute_name": "rb-profile-name",
- "attribute_value": "profile1"
- }
- ]
}
}`)),
expectedCode: http.StatusBadRequest,
@@ -101,6 +88,8 @@ func TestBrokerCreateHandler(t *testing.T) {
label: "Succesfully create an Instance",
input: bytes.NewBuffer([]byte(`{
"vf-module-model-customization-id": "84sdfkio938",
+ "vf-module-model-invariant-id": "123456qwerty",
+ "vf-module-model-version-id": "123qweasdzxc",
"sdnc_directives": {
"attributes": [
{
@@ -108,14 +97,6 @@ func TestBrokerCreateHandler(t *testing.T) {
"attribute_value": "test-vf-module-name"
},
{
- "attribute_name": "k8s-rb-definition-name",
- "attribute_value": "test-rbdef"
- },
- {
- "attribute_name": "k8s-rb-definition-version",
- "attribute_value": "v1"
- },
- {
"attribute_name": "k8s-rb-profile-name",
"attribute_value": "profile1"
}
@@ -149,8 +130,8 @@ func TestBrokerCreateHandler(t *testing.T) {
{
ID: "HaKpys8e",
Request: app.InstanceRequest{
- RBName: "test-rbdef",
- RBVersion: "v1",
+ RBName: "123456qwerty",
+ RBVersion: "123qweasdzxc",
ProfileName: "profile1",
CloudRegion: "region1",
},