summaryrefslogtreecommitdiffstats
path: root/src/orchestrator/pkg/appcontext/appcontext.go
diff options
context:
space:
mode:
authorRajamohan Raj <rajamohan.raj@intel.com>2020-04-30 23:07:15 +0000
committerRajamohan Raj <rajamohan.raj@intel.com>2020-05-12 19:47:41 +0000
commit8fd7fd2ba9db1fb2dbe22c0cf89edb80454cff6d (patch)
tree867d42e86073a5b3ca3917096e8f99f8f791d448 /src/orchestrator/pkg/appcontext/appcontext.go
parent8e0c00c4c59add2fa03a67081d74cd46934d034e (diff)
Create appContext and save to etcd
In this patch, following tasks are accomplished 1. Creation of appContext and storing the appcontexts for each app in the compositeApp into etcd as part of the instantiation process 2. Added a util method to extract parameters from k8s manifest files. 3. Added a new testing script to auto create NCM artifacts through the NCM APIs 4. Modified the existing plugin_collection_v2.sh to better test the orchestrator APIs. 5. Added logging to appcontext lib 6. Bug fix in the helm charts. Issue-ID: MULTICLOUD-1064 Signed-off-by: Rajamohan Raj <rajamohan.raj@intel.com> Change-Id: I1b0e4d1351ad3a083be529239748015ea5db2a41
Diffstat (limited to 'src/orchestrator/pkg/appcontext/appcontext.go')
-rw-r--r--src/orchestrator/pkg/appcontext/appcontext.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/orchestrator/pkg/appcontext/appcontext.go b/src/orchestrator/pkg/appcontext/appcontext.go
index d92b1d11..8f7841ac 100644
--- a/src/orchestrator/pkg/appcontext/appcontext.go
+++ b/src/orchestrator/pkg/appcontext/appcontext.go
@@ -22,6 +22,8 @@ import (
"github.com/onap/multicloud-k8s/src/orchestrator/pkg/rtcontext"
pkgerrors "github.com/pkg/errors"
+ //"log"
+ log "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/logutils"
)
type AppContext struct {
@@ -81,6 +83,7 @@ func (ac *AppContext) AddApp(handle interface{}, appname string) (interface{}, e
if err != nil {
return nil, err
}
+ log.Info(":: Added app handle ::", log.Fields{"AppHandle":h})
return h, nil
}
@@ -93,7 +96,7 @@ func (ac *AppContext) DeleteApp(handle interface{}) error {
return nil
}
-//Returns the hanlde for a given app
+//Returns the handle for a given app
func (ac *AppContext) GetAppHandle(appname string) (interface{}, error) {
if appname == "" {
return nil, pkgerrors.Errorf("Not a valid run time context app name")
@@ -123,6 +126,7 @@ func (ac *AppContext) AddCluster(handle interface{}, clustername string) (interf
if err != nil {
return nil, err
}
+ log.Info(":: Added cluster handle ::", log.Fields{"ClusterHandler":h})
return h, nil
}
@@ -193,11 +197,13 @@ func (ac *AppContext) GetClusterNames(appname string) ([]string, error) {
}
//Add resource under app and cluster
-func (ac *AppContext) AddResource(handle interface{}, resname string, value interface{}) (interface{}, error) {
+func (ac *AppContext) AddResource(handle interface{}, resname string, value []byte) (interface{}, error) {
h, err := ac.rtc.RtcAddResource(handle, resname, value)
if err != nil {
return nil, err
}
+ log.Info(":: Added resource handle ::", log.Fields{"ResourceHandler":h})
+
return h, nil
}
@@ -238,7 +244,7 @@ func (ac *AppContext) GetResourceHandle(appname string, clustername string, resn
}
//Update the resource value usign the given handle
-func (ac *AppContext) UpdateResourceValue(handle interface{}, value interface{}) error {
+func (ac *AppContext) UpdateResourceValue(handle interface{}, value []byte) error {
return ac.rtc.RtcUpdateValue(handle, value)
}
@@ -254,6 +260,7 @@ func (ac *AppContext) AddInstruction(handle interface{}, level string, insttype
if err != nil {
return nil, err
}
+ log.Info(":: Added instruction handle ::", log.Fields{"InstructionHandler":h})
return h, nil
}