From b2b175eae0f4e8b5b0cb9ccbeeca1e98065feeb5 Mon Sep 17 00:00:00 2001 From: Kiran Kamineni Date: Fri, 15 Mar 2019 15:18:12 -0700 Subject: Update definition and profile to latest spec Bringing all the definition and profile code upto the latest spec. Integrated the end to end instance code changes that were made. P9: Added updated plugin.sh with updated uri paths based on spec Issue-ID: MULTICLOUD-291 Change-Id: Id6e3c6bc2cd02cfb7005e203ccf03e0793b97e95 Signed-off-by: Kiran Kamineni --- src/k8splugin/api/handler.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/k8splugin/api/handler.go') diff --git a/src/k8splugin/api/handler.go b/src/k8splugin/api/handler.go index b1cc6709..31ffad90 100644 --- a/src/k8splugin/api/handler.go +++ b/src/k8splugin/api/handler.go @@ -63,8 +63,12 @@ func validateBody(body interface{}) error { werr := pkgerrors.Wrap(errors.New("Invalid/Missing CsarID in POST request"), "CreateVnfRequest bad request") return werr } - if b.RBProfileID == "" { - werr := pkgerrors.Wrap(errors.New("Invalid/Missing RB ProfileID in POST request"), "CreateVnfRequest bad request") + if b.RBName == "" || b.RBVersion == "" { + werr := pkgerrors.Wrap(errors.New("Invalid/Missing resource bundle parameters in POST request"), "CreateVnfRequest bad request") + return werr + } + if b.ProfileName == "" { + werr := pkgerrors.Wrap(errors.New("Invalid/Missing profile name in POST request"), "CreateVnfRequest bad request") return werr } if strings.Contains(b.CloudRegionID, "|") { @@ -117,16 +121,20 @@ func CreateHandler(w http.ResponseWriter, r *http.Request) { }, nil */ + profile, err := rb.NewProfileClient().Get(resource.RBName, resource.RBVersion, resource.ProfileName) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } externalVNFID, resourceNameMap, err := helper.CreateVNF(resource.CsarID, resource.CloudRegionID, - resource.RBProfileID, &kubeclient) + profile, &kubeclient) if err != nil { werr := pkgerrors.Wrap(err, "Read Kubernetes Data information error") http.Error(w, werr.Error(), http.StatusInternalServerError) return } - rbProfile, _ := rb.NewProfileClient().Get(resource.RBProfileID) - namespace := rbProfile.Namespace + namespace := profile.Namespace // cloud1-default-uuid internalVNFID := resource.CloudRegionID + "-" + namespace + "-" + externalVNFID -- cgit 1.2.3-korg