summaryrefslogtreecommitdiffstats
path: root/src/orchestrator/pkg
diff options
context:
space:
mode:
authorEric Multanen <eric.w.multanen@intel.com>2020-04-23 12:55:38 -0700
committerEric Multanen <eric.w.multanen@intel.com>2020-06-03 17:17:21 -0700
commite80f462ab1621090dd9cf7a2c648eb168aaafa5e (patch)
treea94b336dcb30929756077e80dd8ed581b1455088 /src/orchestrator/pkg
parent8e7a20777f2100324526a34b4b6c943b512df0fb (diff)
Add grpc contextupdate client call to orchestrator
Adds a contextupdate client function that can be invoked for any action or placement controller to process intents for that controller. Adds the corresponding server side handling for the ovnaction controller. Issue-ID: MULTICLOUD-1019 Signed-off-by: Eric Multanen <eric.w.multanen@intel.com> Change-Id: Ifdfc99e522288a530735bc4c1402d45449f6d057
Diffstat (limited to 'src/orchestrator/pkg')
-rw-r--r--src/orchestrator/pkg/grpc/contextupdate/contextupdate.pb.go295
-rw-r--r--src/orchestrator/pkg/grpc/contextupdate/contextupdate.proto1
-rw-r--r--src/orchestrator/pkg/grpc/contextupdateclient/client.go62
-rw-r--r--[-rwxr-xr-x]src/orchestrator/pkg/infra/rpc/rpc.go0
-rw-r--r--src/orchestrator/pkg/module/deployment_intent_groups.go3
5 files changed, 275 insertions, 86 deletions
diff --git a/src/orchestrator/pkg/grpc/contextupdate/contextupdate.pb.go b/src/orchestrator/pkg/grpc/contextupdate/contextupdate.pb.go
index 72226224..24a405ca 100644
--- a/src/orchestrator/pkg/grpc/contextupdate/contextupdate.pb.go
+++ b/src/orchestrator/pkg/grpc/contextupdate/contextupdate.pb.go
@@ -1,137 +1,262 @@
+//
+// Copyright 2020 Intel Corporation, Inc
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.24.0
+// protoc v3.11.4
// source: contextupdate.proto
package contextupdate
import (
context "context"
- fmt "fmt"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
- math "math"
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
)
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
+// This is a compile-time assertion that a sufficiently up-to-date version
+// of the legacy proto package is being used.
+const _ = proto.ProtoPackageIsVersion4
type ContextUpdateRequest struct {
- AppContext string `protobuf:"bytes,1,opt,name=app_context,json=appContext,proto3" json:"app_context,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
-func (m *ContextUpdateRequest) Reset() { *m = ContextUpdateRequest{} }
-func (m *ContextUpdateRequest) String() string { return proto.CompactTextString(m) }
-func (*ContextUpdateRequest) ProtoMessage() {}
-func (*ContextUpdateRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_8ebb57f5310873be, []int{0}
+ AppContext string `protobuf:"bytes,1,opt,name=app_context,json=appContext,proto3" json:"app_context,omitempty"`
+ IntentName string `protobuf:"bytes,2,opt,name=intent_name,json=intentName,proto3" json:"intent_name,omitempty"`
}
-func (m *ContextUpdateRequest) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_ContextUpdateRequest.Unmarshal(m, b)
-}
-func (m *ContextUpdateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_ContextUpdateRequest.Marshal(b, m, deterministic)
+func (x *ContextUpdateRequest) Reset() {
+ *x = ContextUpdateRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_contextupdate_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
}
-func (m *ContextUpdateRequest) XXX_Merge(src proto.Message) {
- xxx_messageInfo_ContextUpdateRequest.Merge(m, src)
+
+func (x *ContextUpdateRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
}
-func (m *ContextUpdateRequest) XXX_Size() int {
- return xxx_messageInfo_ContextUpdateRequest.Size(m)
+
+func (*ContextUpdateRequest) ProtoMessage() {}
+
+func (x *ContextUpdateRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_contextupdate_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
}
-func (m *ContextUpdateRequest) XXX_DiscardUnknown() {
- xxx_messageInfo_ContextUpdateRequest.DiscardUnknown(m)
+
+// Deprecated: Use ContextUpdateRequest.ProtoReflect.Descriptor instead.
+func (*ContextUpdateRequest) Descriptor() ([]byte, []int) {
+ return file_contextupdate_proto_rawDescGZIP(), []int{0}
}
-var xxx_messageInfo_ContextUpdateRequest proto.InternalMessageInfo
+func (x *ContextUpdateRequest) GetAppContext() string {
+ if x != nil {
+ return x.AppContext
+ }
+ return ""
+}
-func (m *ContextUpdateRequest) GetAppContext() string {
- if m != nil {
- return m.AppContext
+func (x *ContextUpdateRequest) GetIntentName() string {
+ if x != nil {
+ return x.IntentName
}
return ""
}
type ContextUpdateResponse struct {
- AppContextUpdated bool `protobuf:"varint,1,opt,name=app_context_updated,json=appContextUpdated,proto3" json:"app_context_updated,omitempty"`
- AppContextUpdateMessage string `protobuf:"bytes,2,opt,name=app_context_update_message,json=appContextUpdateMessage,proto3" json:"app_context_update_message,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
-func (m *ContextUpdateResponse) Reset() { *m = ContextUpdateResponse{} }
-func (m *ContextUpdateResponse) String() string { return proto.CompactTextString(m) }
-func (*ContextUpdateResponse) ProtoMessage() {}
-func (*ContextUpdateResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_8ebb57f5310873be, []int{1}
+ AppContextUpdated bool `protobuf:"varint,1,opt,name=app_context_updated,json=appContextUpdated,proto3" json:"app_context_updated,omitempty"`
+ AppContextUpdateMessage string `protobuf:"bytes,2,opt,name=app_context_update_message,json=appContextUpdateMessage,proto3" json:"app_context_update_message,omitempty"`
}
-func (m *ContextUpdateResponse) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_ContextUpdateResponse.Unmarshal(m, b)
-}
-func (m *ContextUpdateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_ContextUpdateResponse.Marshal(b, m, deterministic)
-}
-func (m *ContextUpdateResponse) XXX_Merge(src proto.Message) {
- xxx_messageInfo_ContextUpdateResponse.Merge(m, src)
+func (x *ContextUpdateResponse) Reset() {
+ *x = ContextUpdateResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_contextupdate_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
}
-func (m *ContextUpdateResponse) XXX_Size() int {
- return xxx_messageInfo_ContextUpdateResponse.Size(m)
+
+func (x *ContextUpdateResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
}
-func (m *ContextUpdateResponse) XXX_DiscardUnknown() {
- xxx_messageInfo_ContextUpdateResponse.DiscardUnknown(m)
+
+func (*ContextUpdateResponse) ProtoMessage() {}
+
+func (x *ContextUpdateResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_contextupdate_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
}
-var xxx_messageInfo_ContextUpdateResponse proto.InternalMessageInfo
+// Deprecated: Use ContextUpdateResponse.ProtoReflect.Descriptor instead.
+func (*ContextUpdateResponse) Descriptor() ([]byte, []int) {
+ return file_contextupdate_proto_rawDescGZIP(), []int{1}
+}
-func (m *ContextUpdateResponse) GetAppContextUpdated() bool {
- if m != nil {
- return m.AppContextUpdated
+func (x *ContextUpdateResponse) GetAppContextUpdated() bool {
+ if x != nil {
+ return x.AppContextUpdated
}
return false
}
-func (m *ContextUpdateResponse) GetAppContextUpdateMessage() string {
- if m != nil {
- return m.AppContextUpdateMessage
+func (x *ContextUpdateResponse) GetAppContextUpdateMessage() string {
+ if x != nil {
+ return x.AppContextUpdateMessage
}
return ""
}
-func init() {
- proto.RegisterType((*ContextUpdateRequest)(nil), "ContextUpdateRequest")
- proto.RegisterType((*ContextUpdateResponse)(nil), "ContextUpdateResponse")
+var File_contextupdate_proto protoreflect.FileDescriptor
+
+var file_contextupdate_proto_rawDesc = []byte{
+ 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x2e,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x58, 0x0a, 0x14, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74,
+ 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a,
+ 0x0b, 0x61, 0x70, 0x70, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x1f,
+ 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22,
+ 0x84, 0x01, 0x0a, 0x15, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74,
+ 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x61, 0x70, 0x70,
+ 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x61, 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x65,
+ 0x78, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x3b, 0x0a, 0x1a, 0x61, 0x70, 0x70,
+ 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f,
+ 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x17, 0x61,
+ 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d,
+ 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x54, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78,
+ 0x74, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x43, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74,
+ 0x65, 0x41, 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x15, 0x2e, 0x43, 0x6f,
+ 0x6e, 0x74, 0x65, 0x78, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x55, 0x70, 0x64, 0x61,
+ 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x62, 0x06, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_contextupdate_proto_rawDescOnce sync.Once
+ file_contextupdate_proto_rawDescData = file_contextupdate_proto_rawDesc
+)
+
+func file_contextupdate_proto_rawDescGZIP() []byte {
+ file_contextupdate_proto_rawDescOnce.Do(func() {
+ file_contextupdate_proto_rawDescData = protoimpl.X.CompressGZIP(file_contextupdate_proto_rawDescData)
+ })
+ return file_contextupdate_proto_rawDescData
}
-func init() {
- proto.RegisterFile("contextupdate.proto", fileDescriptor_8ebb57f5310873be)
+var file_contextupdate_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
+var file_contextupdate_proto_goTypes = []interface{}{
+ (*ContextUpdateRequest)(nil), // 0: ContextUpdateRequest
+ (*ContextUpdateResponse)(nil), // 1: ContextUpdateResponse
+}
+var file_contextupdate_proto_depIdxs = []int32{
+ 0, // 0: contextupdate.UpdateAppContext:input_type -> ContextUpdateRequest
+ 1, // 1: contextupdate.UpdateAppContext:output_type -> ContextUpdateResponse
+ 1, // [1:2] is the sub-list for method output_type
+ 0, // [0:1] is the sub-list for method input_type
+ 0, // [0:0] is the sub-list for extension type_name
+ 0, // [0:0] is the sub-list for extension extendee
+ 0, // [0:0] is the sub-list for field type_name
}
-var fileDescriptor_8ebb57f5310873be = []byte{
- // 176 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4e, 0xce, 0xcf, 0x2b,
- 0x49, 0xad, 0x28, 0x29, 0x2d, 0x48, 0x49, 0x2c, 0x49, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x57,
- 0x32, 0xe7, 0x12, 0x71, 0x86, 0x08, 0x87, 0x82, 0x85, 0x83, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b,
- 0x84, 0xe4, 0xb9, 0xb8, 0x13, 0x0b, 0x0a, 0xe2, 0xa1, 0x5a, 0x24, 0x18, 0x15, 0x18, 0x35, 0x38,
- 0x83, 0xb8, 0x12, 0x0b, 0x0a, 0xa0, 0xaa, 0x95, 0x5a, 0x18, 0xb9, 0x44, 0xd1, 0x74, 0x16, 0x17,
- 0xe4, 0xe7, 0x15, 0xa7, 0x0a, 0xe9, 0x71, 0x09, 0x23, 0x69, 0x8d, 0x87, 0x58, 0x97, 0x02, 0x36,
- 0x82, 0x23, 0x48, 0x10, 0x61, 0x04, 0x44, 0x5b, 0x8a, 0x90, 0x35, 0x97, 0x14, 0xa6, 0xfa, 0xf8,
- 0xdc, 0xd4, 0xe2, 0xe2, 0xc4, 0xf4, 0x54, 0x09, 0x26, 0xb0, 0xcd, 0xe2, 0xe8, 0xda, 0x7c, 0x21,
- 0xd2, 0x46, 0x21, 0x5c, 0xbc, 0x28, 0xde, 0x12, 0x72, 0xe6, 0x12, 0x80, 0xa8, 0x70, 0x84, 0xeb,
- 0x10, 0x12, 0xd5, 0xc3, 0xe6, 0x47, 0x29, 0x31, 0x3d, 0xac, 0x1e, 0x50, 0x62, 0x48, 0x62, 0x03,
- 0x07, 0x8e, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x75, 0x78, 0xc0, 0x4d, 0x33, 0x01, 0x00, 0x00,
+func init() { file_contextupdate_proto_init() }
+func file_contextupdate_proto_init() {
+ if File_contextupdate_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_contextupdate_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ContextUpdateRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_contextupdate_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ContextUpdateResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_contextupdate_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 2,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_contextupdate_proto_goTypes,
+ DependencyIndexes: file_contextupdate_proto_depIdxs,
+ MessageInfos: file_contextupdate_proto_msgTypes,
+ }.Build()
+ File_contextupdate_proto = out.File
+ file_contextupdate_proto_rawDesc = nil
+ file_contextupdate_proto_goTypes = nil
+ file_contextupdate_proto_depIdxs = nil
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -177,7 +302,7 @@ type ContextupdateServer interface {
type UnimplementedContextupdateServer struct {
}
-func (*UnimplementedContextupdateServer) UpdateAppContext(ctx context.Context, req *ContextUpdateRequest) (*ContextUpdateResponse, error) {
+func (*UnimplementedContextupdateServer) UpdateAppContext(context.Context, *ContextUpdateRequest) (*ContextUpdateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateAppContext not implemented")
}
diff --git a/src/orchestrator/pkg/grpc/contextupdate/contextupdate.proto b/src/orchestrator/pkg/grpc/contextupdate/contextupdate.proto
index ac305ba6..de8c4b16 100644
--- a/src/orchestrator/pkg/grpc/contextupdate/contextupdate.proto
+++ b/src/orchestrator/pkg/grpc/contextupdate/contextupdate.proto
@@ -24,6 +24,7 @@ service contextupdate {
message ContextUpdateRequest {
string app_context = 1;
+ string intent_name = 2;
}
message ContextUpdateResponse {
diff --git a/src/orchestrator/pkg/grpc/contextupdateclient/client.go b/src/orchestrator/pkg/grpc/contextupdateclient/client.go
new file mode 100644
index 00000000..d89a1bca
--- /dev/null
+++ b/src/orchestrator/pkg/grpc/contextupdateclient/client.go
@@ -0,0 +1,62 @@
+/*
+Copyright 2020 Intel Corporation.
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package contextupdateclient
+
+import (
+ "context"
+ "time"
+
+ contextpb "github.com/onap/multicloud-k8s/src/orchestrator/pkg/grpc/contextupdate"
+ log "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/logutils"
+ "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/rpc"
+ pkgerrors "github.com/pkg/errors"
+)
+
+// InvokeContextUpdate will make the grpc call to the specified controller
+// The controller will take the specified intentName and update the AppContext
+// appropriatly based on its operation as a placement or action controller.
+func InvokeContextUpdate(controllerName, intentName, appContextId string) error {
+ var err error
+ var rpcClient contextpb.ContextupdateClient
+ var updateRes *contextpb.ContextUpdateResponse
+ ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
+ defer cancel()
+
+ conn := rpc.GetRpcConn(controllerName)
+
+ if conn != nil {
+ rpcClient = contextpb.NewContextupdateClient(conn)
+ updateReq := new(contextpb.ContextUpdateRequest)
+ updateReq.AppContext = appContextId
+ updateReq.IntentName = intentName
+ updateRes, err = rpcClient.UpdateAppContext(ctx, updateReq)
+ } else {
+ return pkgerrors.Errorf("ContextUpdate Failed - Could not get ContextupdateClient: %v", controllerName)
+ }
+
+ if err == nil {
+ if updateRes.AppContextUpdated {
+ log.Info("ContextUpdate Passed", log.Fields{
+ "Controller": controllerName,
+ "Intent": intentName,
+ "AppContext": appContextId,
+ "Message": updateRes.AppContextUpdateMessage,
+ })
+ return nil
+ } else {
+ return pkgerrors.Errorf("ContextUpdate Failed: %v", updateRes.AppContextUpdateMessage)
+ }
+ }
+ return err
+}
diff --git a/src/orchestrator/pkg/infra/rpc/rpc.go b/src/orchestrator/pkg/infra/rpc/rpc.go
index a9c97bff..a9c97bff 100755..100644
--- a/src/orchestrator/pkg/infra/rpc/rpc.go
+++ b/src/orchestrator/pkg/infra/rpc/rpc.go
diff --git a/src/orchestrator/pkg/module/deployment_intent_groups.go b/src/orchestrator/pkg/module/deployment_intent_groups.go
index cfbf53e2..16a14c7b 100644
--- a/src/orchestrator/pkg/module/deployment_intent_groups.go
+++ b/src/orchestrator/pkg/module/deployment_intent_groups.go
@@ -18,9 +18,10 @@ package module
import (
"encoding/json"
- "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/db"
"reflect"
+ "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/db"
+
pkgerrors "github.com/pkg/errors"
)