VOL-2180 context changes in voltha-go

Passed context up as far as possible.
Where context reached the gRPC api, the context is passed through directly.
Where context reached the kafka api, context.TODO() was used (as this NBI does not support context or request cancelation)
Anywhere a new thread is started, and the creating thread makes no attempt to wait, context.Background() was used.
Anywhere a new thread is started, and the creating thread waits for completion, the ctx is passed through from the creating thread.
Cancelation of gRPC NBI requests should recursively cancel all the way through to the KV.

Change-Id: I7a65b49ae4e8c1d5263c27d2627e0ffe4d1eb71b
diff --git a/vendor/github.com/opencord/voltha-protos/v3/go/voltha/adapter.pb.go b/vendor/github.com/opencord/voltha-protos/v3/go/voltha/adapter.pb.go
index 93bf21b..1f24221 100644
--- a/vendor/github.com/opencord/voltha-protos/v3/go/voltha/adapter.pb.go
+++ b/vendor/github.com/opencord/voltha-protos/v3/go/voltha/adapter.pb.go
@@ -7,6 +7,7 @@
 	fmt "fmt"
 	proto "github.com/golang/protobuf/proto"
 	any "github.com/golang/protobuf/ptypes/any"
+	timestamp "github.com/golang/protobuf/ptypes/timestamp"
 	common "github.com/opencord/voltha-protos/v3/go/common"
 	math "math"
 )
@@ -83,9 +84,11 @@
 	// Custom descriptors and custom configuration
 	AdditionalDescription *any.Any `protobuf:"bytes,64,opt,name=additional_description,json=additionalDescription,proto3" json:"additional_description,omitempty"`
 	LogicalDeviceIds      []string `protobuf:"bytes,4,rep,name=logical_device_ids,json=logicalDeviceIds,proto3" json:"logical_device_ids,omitempty"`
-	XXX_NoUnkeyedLiteral  struct{} `json:"-"`
-	XXX_unrecognized      []byte   `json:"-"`
-	XXX_sizecache         int32    `json:"-"`
+	// timestamp when the adapter last sent a message to the core
+	LastCommunication    *timestamp.Timestamp `protobuf:"bytes,5,opt,name=last_communication,json=lastCommunication,proto3" json:"last_communication,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}             `json:"-"`
+	XXX_unrecognized     []byte               `json:"-"`
+	XXX_sizecache        int32                `json:"-"`
 }
 
 func (m *Adapter) Reset()         { *m = Adapter{} }
@@ -155,6 +158,13 @@
 	return nil
 }
 
+func (m *Adapter) GetLastCommunication() *timestamp.Timestamp {
+	if m != nil {
+		return m.LastCommunication
+	}
+	return nil
+}
+
 type Adapters struct {
 	Items                []*Adapter `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
 	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
@@ -203,30 +213,33 @@
 func init() { proto.RegisterFile("voltha_protos/adapter.proto", fileDescriptor_7e998ce153307274) }
 
 var fileDescriptor_7e998ce153307274 = []byte{
-	// 397 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x41, 0x8e, 0xda, 0x30,
-	0x14, 0x86, 0x95, 0xd0, 0xc9, 0x0c, 0x1e, 0x4d, 0x4b, 0xdd, 0x82, 0x52, 0x2a, 0xd4, 0x08, 0xa9,
-	0x52, 0x16, 0xc5, 0x51, 0xe1, 0x02, 0x85, 0xb2, 0xa9, 0xc4, 0x2a, 0x42, 0x5d, 0x74, 0x13, 0x85,
-	0xd8, 0x18, 0x4b, 0x8e, 0x5f, 0x14, 0x87, 0x48, 0x9c, 0xa0, 0xeb, 0x1e, 0xac, 0xf7, 0xe8, 0x09,
-	0xba, 0xae, 0xb0, 0x1d, 0x01, 0x5d, 0xcc, 0x2a, 0x7a, 0xff, 0xf7, 0xbf, 0xf7, 0x7e, 0x3b, 0x46,
-	0xef, 0x5b, 0x90, 0xcd, 0x21, 0xcf, 0xaa, 0x1a, 0x1a, 0xd0, 0x49, 0x4e, 0xf3, 0xaa, 0x61, 0x35,
-	0x31, 0x25, 0x0e, 0x2c, 0x1c, 0xbf, 0xe3, 0x00, 0x5c, 0xb2, 0xc4, 0xa8, 0xbb, 0xe3, 0x3e, 0xc9,
-	0xd5, 0xc9, 0x5a, 0xc6, 0xe3, 0xdb, 0xfe, 0x02, 0xca, 0x12, 0x94, 0x63, 0xe1, 0x2d, 0x2b, 0x59,
-	0x93, 0x5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0xb5, 0x01, 0xdf, 0xa8, 0x9e, 0x7e, 0x46, 0x0f, 0x2e,
-	0x9a, 0xc6, 0x1f, 0xd1, 0x9d, 0x68, 0x58, 0xa9, 0x43, 0x2f, 0xea, 0xc5, 0x8f, 0xf3, 0x57, 0xff,
-	0x65, 0x4f, 0x2d, 0x5d, 0x6d, 0xd1, 0x1b, 0xa8, 0x39, 0x81, 0x8a, 0xa9, 0x02, 0x6a, 0xea, 0x5c,
-	0xab, 0xa7, 0xef, 0xe6, 0xeb, 0xcc, 0x3f, 0x08, 0x17, 0xcd, 0xe1, 0xb8, 0x3b, 0xff, 0xd7, 0xa4,
-	0xb3, 0x26, 0xd6, 0x3a, 0x73, 0x8f, 0xa4, 0x5d, 0x24, 0x1c, 0x9c, 0xb6, 0x0b, 0x8c, 0xb8, 0xf8,
-	0x17, 0x00, 0x00, 0xff, 0xff, 0x41, 0x59, 0x44, 0x43, 0xa5, 0x02, 0x00, 0x00,
+	// 439 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xdd, 0x6a, 0xdb, 0x30,
+	0x14, 0xc6, 0xc9, 0x92, 0x36, 0x2a, 0xdd, 0x52, 0x6d, 0x29, 0x5e, 0x46, 0x69, 0x08, 0x0c, 0x72,
+	0xb1, 0xca, 0x2c, 0x79, 0x81, 0x25, 0xed, 0x4d, 0xa1, 0x57, 0x26, 0xec, 0x62, 0x37, 0x46, 0xb1,
+	0x54, 0x55, 0x20, 0xeb, 0x18, 0x4b, 0x31, 0xe4, 0x09, 0xf6, 0x74, 0x7b, 0x83, 0x3d, 0xc0, 0x9e,
+	0x60, 0xd7, 0xc3, 0x92, 0x4c, 0x7e, 0x06, 0xbd, 0x32, 0xe7, 0xfb, 0xbe, 0x73, 0xbe, 0xef, 0x1c,
+	0x0b, 0x7d, 0xaa, 0x41, 0xd9, 0x17, 0x9a, 0x95, 0x15, 0x58, 0x30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