[SEBA-854] Add new API and modify existing

Change-Id: Iea9fd003d122f58a4d45c79d806a2011087d1740
diff --git a/demo_test/Makefile b/demo_test/Makefile
index d2d3ced..533ef3a 100644
--- a/demo_test/Makefile
+++ b/demo_test/Makefile
@@ -24,6 +24,7 @@
 
 
 proto/importer.pb.go: ../proto/importer.proto
+	mkdir -p proto
 	protoc --proto_path=../proto \
 	-I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
 	--go_out=plugins=grpc:proto/ \
diff --git a/demo_test/cmd_client/Note b/demo_test/cmd_client/Note
index 74b6916..ca0c094 100644
--- a/demo_test/cmd_client/Note
+++ b/demo_test/cmd_client/Note
@@ -52,44 +52,48 @@
 									attach:192.168.4.27:8888:edgecore:180
 									attach:192.168.3.34:8888:edgecore:180
 --------------------------------------------------------------------------------------
-UnSubscribe all events(ResourceAdded/ResourceRemoved/Alert)		unsub:add:rm:alert
+UnSubscribe all events(ResourceAdded/ResourceRemoved/Alert)		unsub:192.168.4.27:8888:add:rm:alert
 --------------------------------------------------------------------------------------
-Subscribe all events(ResourceAdded/ResourceRemoved/Alert) 		sub:add:rm:alert
+Subscribe all events(ResourceAdded/ResourceRemoved/Alert) 		sub:192.168.4.27:8888:add:rm:alert
 --------------------------------------------------------------------------------------
 Subscribe and unsubscribe an event					Example:	
 
-Subscribe ResourceAdded event 						sub:add
-Subscribe ResourceRemoved event						sub:rm
-Subscribe Alert event							sub:alert
-Unsubscribe ResourceAdded event						unsub:add
-Unsubscribe ResourceRemoved event					unsub:rm
-Unsubscribe Alert event							unsub:alert
+Subscribe ResourceAdded event 						sub:192.168.4.27:8888:add
+Subscribe ResourceRemoved event						sub:192.168.4.27:8888:rm
+Subscribe Alert event							sub:192.168.4.27:8888:alert
+Unsubscribe ResourceAdded event						unsub:192.168.4.27:8888:add
+Unsubscribe ResourceRemoved event					unsub:192.168.4.27:8888:rm
+Unsubscribe Alert event							unsub:192.168.4.27:8888:alert
 --------------------------------------------------------------------------------------
 Subscribe and unsubscribe multiple events, out of order			Use the above commands to do test.
 --------------------------------------------------------------------------------------
-Subscribe an unsupported event						sub:update
+Subscribe an unsupported event						sub:192.168.4.27:8888:update
 --------------------------------------------------------------------------------------
 Subscribe to an already subscribed event				Example:
 
-									sub:add
-									sub:add
+									sub:192.168.4.27:8888:add
+									sub:192.168.4.27:8888:add
 --------------------------------------------------------------------------------------
-Unsubscribe  an unsupported event					unsub:update
+Unsubscribe  an unsupported event					unsub:192.168.4.27:8888:update
 --------------------------------------------------------------------------------------
 Unsubscribe a supported but not-subscribed event			Example:
 
-									unsub:add:rm:alert
-									unsub:add
-									unsub:rm
-									unsub:alert
+									unsub:192.168.4.27:8888:add:rm:alert
+									unsub:192.168.4.27:8888:add
+									unsub:192.168.4.27:8888:rm
+									unsub:192.168.4.27:8888:alert
 --------------------------------------------------------------------------------------
 Change polling interval 						Example: 
 
 Set frequecny to 30 seconds
-									period:30
+									period:192.168.4.27:8888:30
 --------------------------------------------------------------------------------------
-Show support event list							showeventlist	
---------------------------------------------------------------------------------------
+Show support event list vendor						showeventlist:edgecore
+-----------------------------------------------------------------------------------------------
+Show current events subscribed by device                               showdeviceeventlist:192.168.4.27:8888
+------------------------------------------------------------------------------------------------------------ 
+Clear all current events subscribed by device                          cleardeviceeventlist:192.168.4.27:8888
+-------------------------------------------------------------------------------------------------------------
 * During and after each test, verify the list of events subscribed	wget --no-check-certificate  \
 									-qO- https://192.168.4.27:8888/redfish/v1/EventService/Subscriptions/ \
 									| python -m json.tool
diff --git a/demo_test/proto/importer.pb.go b/demo_test/proto/importer.pb.go
deleted file mode 100644
index 0e2fe6a..0000000
--- a/demo_test/proto/importer.pb.go
+++ /dev/null
@@ -1,432 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// source: importer.proto
-
-package importer
-
-import (
-	context "context"
-	fmt "fmt"
-	proto "github.com/golang/protobuf/proto"
-	empty "github.com/golang/protobuf/ptypes/empty"
-	grpc "google.golang.org/grpc"
-	codes "google.golang.org/grpc/codes"
-	status "google.golang.org/grpc/status"
-	math "math"
-)
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// 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
-
-type DeviceInfo struct {
-	IpAddress            string   `protobuf:"bytes,1,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"`
-	Frequency            uint32   `protobuf:"varint,2,opt,name=frequency,proto3" json:"frequency,omitempty"`
-	Vendor               string   `protobuf:"bytes,3,opt,name=vendor,proto3" json:"vendor,omitempty"`
-	Protocol             string   `protobuf:"bytes,4,opt,name=protocol,proto3" json:"protocol,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *DeviceInfo) Reset()         { *m = DeviceInfo{} }
-func (m *DeviceInfo) String() string { return proto.CompactTextString(m) }
-func (*DeviceInfo) ProtoMessage()    {}
-func (*DeviceInfo) Descriptor() ([]byte, []int) {
-	return fileDescriptor_394990ff89e0d02b, []int{0}
-}
-
-func (m *DeviceInfo) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_DeviceInfo.Unmarshal(m, b)
-}
-func (m *DeviceInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_DeviceInfo.Marshal(b, m, deterministic)
-}
-func (m *DeviceInfo) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_DeviceInfo.Merge(m, src)
-}
-func (m *DeviceInfo) XXX_Size() int {
-	return xxx_messageInfo_DeviceInfo.Size(m)
-}
-func (m *DeviceInfo) XXX_DiscardUnknown() {
-	xxx_messageInfo_DeviceInfo.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_DeviceInfo proto.InternalMessageInfo
-
-func (m *DeviceInfo) GetIpAddress() string {
-	if m != nil {
-		return m.IpAddress
-	}
-	return ""
-}
-
-func (m *DeviceInfo) GetFrequency() uint32 {
-	if m != nil {
-		return m.Frequency
-	}
-	return 0
-}
-
-func (m *DeviceInfo) GetVendor() string {
-	if m != nil {
-		return m.Vendor
-	}
-	return ""
-}
-
-func (m *DeviceInfo) GetProtocol() string {
-	if m != nil {
-		return m.Protocol
-	}
-	return ""
-}
-
-type EventList struct {
-	EventIpAddress       string   `protobuf:"bytes,1,opt,name=event_ip_address,json=eventIpAddress,proto3" json:"event_ip_address,omitempty"`
-	Events               []string `protobuf:"bytes,2,rep,name=events,proto3" json:"events,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *EventList) Reset()         { *m = EventList{} }
-func (m *EventList) String() string { return proto.CompactTextString(m) }
-func (*EventList) ProtoMessage()    {}
-func (*EventList) Descriptor() ([]byte, []int) {
-	return fileDescriptor_394990ff89e0d02b, []int{1}
-}
-
-func (m *EventList) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_EventList.Unmarshal(m, b)
-}
-func (m *EventList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_EventList.Marshal(b, m, deterministic)
-}
-func (m *EventList) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_EventList.Merge(m, src)
-}
-func (m *EventList) XXX_Size() int {
-	return xxx_messageInfo_EventList.Size(m)
-}
-func (m *EventList) XXX_DiscardUnknown() {
-	xxx_messageInfo_EventList.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_EventList proto.InternalMessageInfo
-
-func (m *EventList) GetEventIpAddress() string {
-	if m != nil {
-		return m.EventIpAddress
-	}
-	return ""
-}
-
-func (m *EventList) GetEvents() []string {
-	if m != nil {
-		return m.Events
-	}
-	return nil
-}
-
-type SupportedEventList struct {
-	Events               []string `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"`
-	XXX_NoUnkeyedLiteral struct{} `json:"-"`
-	XXX_unrecognized     []byte   `json:"-"`
-	XXX_sizecache        int32    `json:"-"`
-}
-
-func (m *SupportedEventList) Reset()         { *m = SupportedEventList{} }
-func (m *SupportedEventList) String() string { return proto.CompactTextString(m) }
-func (*SupportedEventList) ProtoMessage()    {}
-func (*SupportedEventList) Descriptor() ([]byte, []int) {
-	return fileDescriptor_394990ff89e0d02b, []int{2}
-}
-
-func (m *SupportedEventList) XXX_Unmarshal(b []byte) error {
-	return xxx_messageInfo_SupportedEventList.Unmarshal(m, b)
-}
-func (m *SupportedEventList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
-	return xxx_messageInfo_SupportedEventList.Marshal(b, m, deterministic)
-}
-func (m *SupportedEventList) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_SupportedEventList.Merge(m, src)
-}
-func (m *SupportedEventList) XXX_Size() int {
-	return xxx_messageInfo_SupportedEventList.Size(m)
-}
-func (m *SupportedEventList) XXX_DiscardUnknown() {
-	xxx_messageInfo_SupportedEventList.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_SupportedEventList proto.InternalMessageInfo
-
-func (m *SupportedEventList) GetEvents() []string {
-	if m != nil {
-		return m.Events
-	}
-	return nil
-}
-
-func init() {
-	proto.RegisterType((*DeviceInfo)(nil), "importer.DeviceInfo")
-	proto.RegisterType((*EventList)(nil), "importer.EventList")
-	proto.RegisterType((*SupportedEventList)(nil), "importer.SupportedEventList")
-}
-
-func init() { proto.RegisterFile("importer.proto", fileDescriptor_394990ff89e0d02b) }
-
-var fileDescriptor_394990ff89e0d02b = []byte{
-	// 329 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x90, 0xcf, 0x4a, 0xf3, 0x40,
-	0x14, 0xc5, 0x9b, 0xf6, 0xa3, 0x34, 0x97, 0x7e, 0x45, 0x47, 0xad, 0xa1, 0x56, 0x28, 0x59, 0x75,
-	0x21, 0x29, 0xe8, 0x5e, 0x14, 0xfa, 0xc7, 0x82, 0x6e, 0x1a, 0x5c, 0x97, 0x26, 0xb9, 0x2d, 0x03,
-	0xcd, 0xcc, 0x38, 0x33, 0x09, 0x74, 0xe1, 0x23, 0xfb, 0x0e, 0x92, 0x89, 0xcd, 0x14, 0x2a, 0x82,
-	0xe0, 0xf2, 0xfc, 0xe6, 0x9e, 0xb9, 0xe7, 0x1e, 0xe8, 0xd0, 0x54, 0x70, 0xa9, 0x51, 0x06, 0x42,
-	0x72, 0xcd, 0x49, 0x6b, 0xaf, 0x7b, 0x57, 0x1b, 0xce, 0x37, 0x5b, 0x1c, 0x19, 0x1e, 0x65, 0xeb,
-	0x11, 0xa6, 0x42, 0xef, 0xca, 0x31, 0xff, 0x1d, 0x60, 0x8c, 0x39, 0x8d, 0x71, 0xce, 0xd6, 0x9c,
-	0x5c, 0x03, 0x50, 0xb1, 0x5c, 0x25, 0x89, 0x44, 0xa5, 0x3c, 0x67, 0xe0, 0x0c, 0xdd, 0x85, 0x4b,
-	0xc5, 0x63, 0x09, 0x48, 0x1f, 0xdc, 0xb5, 0xc4, 0xb7, 0x0c, 0x59, 0xbc, 0xf3, 0xea, 0x03, 0x67,
-	0xf8, 0x7f, 0x61, 0x01, 0xe9, 0x42, 0x33, 0x47, 0x96, 0x70, 0xe9, 0x35, 0x8c, 0xf1, 0x4b, 0x91,
-	0x1e, 0xb4, 0xcc, 0xae, 0x98, 0x6f, 0xbd, 0x7f, 0xe6, 0xa5, 0xd2, 0xfe, 0x0b, 0xb8, 0x93, 0x1c,
-	0x99, 0x7e, 0xa6, 0x4a, 0x93, 0x21, 0x9c, 0x60, 0x21, 0x96, 0x47, 0x19, 0x3a, 0x86, 0xcf, 0xab,
-	0x20, 0x5d, 0x68, 0x1a, 0xa2, 0xbc, 0xfa, 0xa0, 0x51, 0xac, 0x2a, 0x95, 0x7f, 0x03, 0x24, 0xcc,
-	0x84, 0xb9, 0x3b, 0xb1, 0xff, 0xda, 0x69, 0xe7, 0x70, 0xfa, 0xf6, 0xa3, 0x0e, 0xa7, 0x89, 0x39,
-	0x7e, 0x99, 0xae, 0xd8, 0x6a, 0x83, 0x29, 0x32, 0x4d, 0x1e, 0xa0, 0x13, 0x22, 0x4b, 0x0e, 0x5a,
-	0x39, 0x0f, 0xaa, 0x6e, 0x2d, 0xed, 0x75, 0x83, 0xb2, 0xd7, 0x60, 0xdf, 0x6b, 0x30, 0x29, 0x7a,
-	0xf5, 0x6b, 0xe4, 0x1e, 0xda, 0x21, 0xea, 0x69, 0x55, 0xcc, 0x6f, 0xfd, 0x63, 0x68, 0xcf, 0x50,
-	0xdb, 0xfc, 0xdf, 0xfb, 0xfb, 0x96, 0x1e, 0xdf, 0xec, 0xd7, 0xc8, 0x14, 0x2e, 0xc2, 0x2c, 0x52,
-	0x32, 0x96, 0x34, 0xc2, 0x19, 0xcd, 0x91, 0x99, 0x57, 0x45, 0xce, 0xac, 0xb1, 0x9a, 0xff, 0x21,
-	0xcd, 0x13, 0x5c, 0xbe, 0xb2, 0xbf, 0xf8, 0x29, 0x6a, 0x1a, 0x72, 0xf7, 0x19, 0x00, 0x00, 0xff,
-	0xff, 0x79, 0x23, 0x4a, 0xc2, 0xab, 0x02, 0x00, 0x00,
-}
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ context.Context
-var _ grpc.ClientConn
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-const _ = grpc.SupportPackageIsVersion4
-
-// DeviceManagementClient is the client API for DeviceManagement service.
-//
-// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
-type DeviceManagementClient interface {
-	SendDeviceInfo(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*empty.Empty, error)
-	SetFrequency(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*empty.Empty, error)
-	GetEventList(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*SupportedEventList, error)
-	SubsrcribeGivenEvents(ctx context.Context, in *EventList, opts ...grpc.CallOption) (*empty.Empty, error)
-	UnSubsrcribeGivenEvents(ctx context.Context, in *EventList, opts ...grpc.CallOption) (*empty.Empty, error)
-}
-
-type deviceManagementClient struct {
-	cc *grpc.ClientConn
-}
-
-func NewDeviceManagementClient(cc *grpc.ClientConn) DeviceManagementClient {
-	return &deviceManagementClient{cc}
-}
-
-func (c *deviceManagementClient) SendDeviceInfo(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*empty.Empty, error) {
-	out := new(empty.Empty)
-	err := c.cc.Invoke(ctx, "/importer.device_management/SendDeviceInfo", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *deviceManagementClient) SetFrequency(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*empty.Empty, error) {
-	out := new(empty.Empty)
-	err := c.cc.Invoke(ctx, "/importer.device_management/SetFrequency", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *deviceManagementClient) GetEventList(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*SupportedEventList, error) {
-	out := new(SupportedEventList)
-	err := c.cc.Invoke(ctx, "/importer.device_management/GetEventList", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *deviceManagementClient) SubsrcribeGivenEvents(ctx context.Context, in *EventList, opts ...grpc.CallOption) (*empty.Empty, error) {
-	out := new(empty.Empty)
-	err := c.cc.Invoke(ctx, "/importer.device_management/SubsrcribeGivenEvents", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *deviceManagementClient) UnSubsrcribeGivenEvents(ctx context.Context, in *EventList, opts ...grpc.CallOption) (*empty.Empty, error) {
-	out := new(empty.Empty)
-	err := c.cc.Invoke(ctx, "/importer.device_management/UnSubsrcribeGivenEvents", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-// DeviceManagementServer is the server API for DeviceManagement service.
-type DeviceManagementServer interface {
-	SendDeviceInfo(context.Context, *DeviceInfo) (*empty.Empty, error)
-	SetFrequency(context.Context, *DeviceInfo) (*empty.Empty, error)
-	GetEventList(context.Context, *DeviceInfo) (*SupportedEventList, error)
-	SubsrcribeGivenEvents(context.Context, *EventList) (*empty.Empty, error)
-	UnSubsrcribeGivenEvents(context.Context, *EventList) (*empty.Empty, error)
-}
-
-// UnimplementedDeviceManagementServer can be embedded to have forward compatible implementations.
-type UnimplementedDeviceManagementServer struct {
-}
-
-func (*UnimplementedDeviceManagementServer) SendDeviceInfo(ctx context.Context, req *DeviceInfo) (*empty.Empty, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method SendDeviceInfo not implemented")
-}
-func (*UnimplementedDeviceManagementServer) SetFrequency(ctx context.Context, req *DeviceInfo) (*empty.Empty, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method SetFrequency not implemented")
-}
-func (*UnimplementedDeviceManagementServer) GetEventList(ctx context.Context, req *DeviceInfo) (*SupportedEventList, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method GetEventList not implemented")
-}
-func (*UnimplementedDeviceManagementServer) SubsrcribeGivenEvents(ctx context.Context, req *EventList) (*empty.Empty, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method SubsrcribeGivenEvents not implemented")
-}
-func (*UnimplementedDeviceManagementServer) UnSubsrcribeGivenEvents(ctx context.Context, req *EventList) (*empty.Empty, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method UnSubsrcribeGivenEvents not implemented")
-}
-
-func RegisterDeviceManagementServer(s *grpc.Server, srv DeviceManagementServer) {
-	s.RegisterService(&_DeviceManagement_serviceDesc, srv)
-}
-
-func _DeviceManagement_SendDeviceInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(DeviceInfo)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(DeviceManagementServer).SendDeviceInfo(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/importer.device_management/SendDeviceInfo",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(DeviceManagementServer).SendDeviceInfo(ctx, req.(*DeviceInfo))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _DeviceManagement_SetFrequency_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(DeviceInfo)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(DeviceManagementServer).SetFrequency(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/importer.device_management/SetFrequency",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(DeviceManagementServer).SetFrequency(ctx, req.(*DeviceInfo))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _DeviceManagement_GetEventList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(DeviceInfo)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(DeviceManagementServer).GetEventList(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/importer.device_management/GetEventList",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(DeviceManagementServer).GetEventList(ctx, req.(*DeviceInfo))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _DeviceManagement_SubsrcribeGivenEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(EventList)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(DeviceManagementServer).SubsrcribeGivenEvents(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/importer.device_management/SubsrcribeGivenEvents",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(DeviceManagementServer).SubsrcribeGivenEvents(ctx, req.(*EventList))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _DeviceManagement_UnSubsrcribeGivenEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(EventList)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(DeviceManagementServer).UnSubsrcribeGivenEvents(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/importer.device_management/UnSubsrcribeGivenEvents",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(DeviceManagementServer).UnSubsrcribeGivenEvents(ctx, req.(*EventList))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-var _DeviceManagement_serviceDesc = grpc.ServiceDesc{
-	ServiceName: "importer.device_management",
-	HandlerType: (*DeviceManagementServer)(nil),
-	Methods: []grpc.MethodDesc{
-		{
-			MethodName: "SendDeviceInfo",
-			Handler:    _DeviceManagement_SendDeviceInfo_Handler,
-		},
-		{
-			MethodName: "SetFrequency",
-			Handler:    _DeviceManagement_SetFrequency_Handler,
-		},
-		{
-			MethodName: "GetEventList",
-			Handler:    _DeviceManagement_GetEventList_Handler,
-		},
-		{
-			MethodName: "SubsrcribeGivenEvents",
-			Handler:    _DeviceManagement_SubsrcribeGivenEvents_Handler,
-		},
-		{
-			MethodName: "UnSubsrcribeGivenEvents",
-			Handler:    _DeviceManagement_UnSubsrcribeGivenEvents_Handler,
-		},
-	},
-	Streams:  []grpc.StreamDesc{},
-	Metadata: "importer.proto",
-}
diff --git a/demo_test/test.go b/demo_test/test.go
index 70c2df6..05582ad 100644
--- a/demo_test/test.go
+++ b/demo_test/test.go
@@ -15,73 +15,61 @@
 package main
 
 import (
-        "fmt"
-        "net"
-        "bufio"
-        "os"
-        "os/signal"
-        "os/exec"
-        "github.com/Shopify/sarama"
-        "google.golang.org/grpc"
-        "golang.org/x/net/context"
-        importer "./proto"
-        log "github.com/Sirupsen/logrus"
+	importer "./proto"
+	"bufio"
 	"bytes"
+	"crypto/tls"
+	"fmt"
+	"github.com/Shopify/sarama"
+	log "github.com/Sirupsen/logrus"
+	"golang.org/x/net/context"
+	"google.golang.org/grpc"
+	"google.golang.org/grpc/status"
+	"net"
+	"net/http"
+	"os"
+	"os/exec"
+	"os/signal"
+	"strconv"
 	"strings"
-        "net/http"
-        "crypto/tls"
-        "strconv"
 )
 
-var REDFISH_ROOT		= "/redfish/v1"
-var CONTENT_TYPE		= "application/json"
+var REDFISH_ROOT = "/redfish/v1"
+var CONTENT_TYPE = "application/json"
 var EVENTS_MAP = map[string]string{
-"add":"ResourceAdded",
-"rm":"ResourceRemoved",
-"alert":"Alert",
-"update":"Update"}
+	"add":    "ResourceAdded",
+	"rm":     "ResourceRemoved",
+	"alert":  "Alert",
+	"update": "Update"}
 
-var default_address string	= "localhost:31085"
-var default_port    string	= "8888"
-var default_vendor  string	= "edgecore"
-var default_freq    uint64	= 180
-var attach_device_ip string	= ""
-var importerTopic		= "importer"
+var default_address string = "localhost:31085"
+var default_port string = "8888"
+var default_vendor string = "edgecore"
+var default_freq uint64 = 180
+var attach_device_ip string = ""
+var importerTopic = "importer"
 var DataConsumer sarama.Consumer
 
-var cc	   importer.DeviceManagementClient
-var ctx	   context.Context
-var conn   * grpc.ClientConn
-
-type Device struct {
-	deviceinfo * importer.DeviceInfo
-	eventlist  * importer.EventList
-}
-
-var devicemap map[string]* Device
+var cc importer.DeviceManagementClient
+var ctx context.Context
+var conn *grpc.ClientConn
 
 /*///////////////////////////////////////////////////////////////////////*/
 // Allows user to register the device for data collection and frequency.
 //
 //
 /*///////////////////////////////////////////////////////////////////////*/
-func (s * Device) Attach(aip string, avendor string, afreq uint32) (error, string) {
-        fmt.Println("Received Attach\n")
-	var default_protocol string	= "https"
+func Attach(aip string, avendor string, afreq uint32) error {
+	fmt.Println("Received Attach\n")
+	var default_protocol string = "https"
+	deviceinfo := new(importer.DeviceInfo)
+	deviceinfo.IpAddress = aip
+	deviceinfo.Vendor = avendor
+	deviceinfo.Frequency = afreq
+	deviceinfo.Protocol = default_protocol
+	_, err := cc.SendDeviceInfo(ctx, deviceinfo)
 
-	s.deviceinfo = new(importer.DeviceInfo)
-	s.eventlist  = new(importer.EventList)
-	s.deviceinfo.IpAddress  = aip
-	s.deviceinfo.Vendor     = avendor
-	s.deviceinfo.Frequency  = afreq
-	s.deviceinfo.Protocol   = default_protocol
-	_, err := cc.SendDeviceInfo(ctx, s.deviceinfo)
-
-	if err != nil {
-		return err ,"attach error!!"
-	}else{
-		return nil,""
-	}
+	return err
 }
 
 /*///////////////////////////////////////////////////////////////////////*/
@@ -89,16 +77,14 @@
 //
 //
 /*///////////////////////////////////////////////////////////////////////*/
-func (s * Device) UpdateFreq(wd uint32)(error, string) {
-        fmt.Println("Received Period\n")
-	s.deviceinfo.Frequency  = wd
-	_, err := cc.SetFrequency(ctx, s.deviceinfo)
+func UpdateFreq(ip_address string, wd uint32) error {
+	fmt.Println("Received Period\n")
+	freqinfo := new(importer.FreqInfo)
+	freqinfo.Frequency = wd
+	freqinfo.IpAddress = ip_address
+	_, err := cc.SetFrequency(ctx, freqinfo)
 
-	if err != nil {
-		return err, "period error!!"
-	}else{
-		return nil,""
-	}
+	return err
 }
 
 /*///////////////////////////////////////////////////////////////////////*/
@@ -106,17 +92,14 @@
 //
 //
 /*///////////////////////////////////////////////////////////////////////*/
-func (s * Device) Subscribe(eventlist []string) (error, string) {
-        fmt.Println("Received Subscribe\n")
-	s.eventlist.Events = eventlist
-	s.eventlist.EventIpAddress = s.deviceinfo.IpAddress
-	_, err := cc.SubsrcribeGivenEvents(ctx, s.eventlist)
+func Subscribe(ip_address string, Giveneventlist []string) error {
+	fmt.Println("Received Subscribe\n")
+	giveneventlist := new(importer.GivenEventList)
+	giveneventlist.Events = Giveneventlist
+	giveneventlist.EventIpAddress = ip_address
+	_, err := cc.SubsrcribeGivenEvents(ctx, giveneventlist)
 
-	if err != nil {
-		return err, "sub error!!"
-	}else{
-		return nil,""
-	}
+	return err
 }
 
 /*///////////////////////////////////////////////////////////////////////*/
@@ -124,17 +107,14 @@
 //
 //
 /*///////////////////////////////////////////////////////////////////////*/
-func (s * Device) UnSubscribe(eventlist []string) (error, string) {
-        fmt.Println("Received UnSubscribe\n")
-	s.eventlist.Events = eventlist
-	s.eventlist.EventIpAddress = s.deviceinfo.IpAddress
-	_, err := cc.UnSubsrcribeGivenEvents(ctx, s.eventlist)
+func UnSubscribe(ip_address string, Giveneventlist []string) error {
+	fmt.Println("Received UnSubscribe\n")
+	giveneventlist := new(importer.GivenEventList)
+	giveneventlist.Events = Giveneventlist
+	giveneventlist.EventIpAddress = ip_address
+	_, err := cc.UnSubsrcribeGivenEvents(ctx, giveneventlist)
 
-	if err != nil {
-		return err, "unsub error!!"
-	}else{
-		return nil,""
-	}
+	return err
 }
 
 /*///////////////////////////////////////////////////////////////////////*/
@@ -142,23 +122,50 @@
 //
 //
 /*///////////////////////////////////////////////////////////////////////*/
-func (s * Device) GetEventSupportList() (error, []string) {
-        fmt.Println("Received GetEventSupportList\n")
-	var ret_msg * importer.SupportedEventList
-	ret_msg, err :=cc.GetEventList(ctx, devicemap[s.deviceinfo.IpAddress].deviceinfo);
-	if err != nil {
-		return err,ret_msg.Events
-	}else{
-		fmt.Println("show all event subs:", ret_msg)
-		return nil , ret_msg.Events
-	}
+func GetEventSupportList(vendor string) (error, []string) {
+	fmt.Println("Received GetEventSupportList\n")
+	vendorinfo := new(importer.VendorInfo)
+	vendorinfo.Vendor = vendor
+	var ret_msg *importer.EventList
+	ret_msg, err := cc.GetEventList(ctx, vendorinfo)
+
+	return err, ret_msg.Events
+}
+
+/*///////////////////////////////////////////////////////////////////////*/
+// Allows user to get the current events subscribed by device
+//
+//
+/*///////////////////////////////////////////////////////////////////////*/
+func GetEventCurrentDeviceList(ip_address string) (error, []string) {
+	fmt.Println("Received GetEventCurrentDeviceList\n")
+	currentdeviceinfo := new(importer.Device)
+	currentdeviceinfo.IpAddress = ip_address
+	var ret_msg *importer.EventList
+	ret_msg, err := cc.GetCurrentEventList(ctx, currentdeviceinfo)
+
+	return err, ret_msg.Events
+}
+
+/*///////////////////////////////////////////////////////////////////////*/
+// Allows user to get the current events subscribed by device
+//
+//
+/*///////////////////////////////////////////////////////////////////////*/
+func ClearCurrentDeviceEventList(ip_address string) error {
+	fmt.Println("Received ClearCurrentDeviceEventList\n")
+	currentdeviceinfo := new(importer.Device)
+	currentdeviceinfo.IpAddress = ip_address
+	_, err := cc.ClearCurrentEventList(ctx, currentdeviceinfo)
+
+	return err
 }
 
 func init() {
-        Formatter := new(log.TextFormatter)
-        Formatter.TimestampFormat = "02-01-2006 15:04:05"
-        Formatter.FullTimestamp = true
-        log.SetFormatter(Formatter)
+	Formatter := new(log.TextFormatter)
+	Formatter.TimestampFormat = "02-01-2006 15:04:05"
+	Formatter.FullTimestamp = true
+	log.SetFormatter(Formatter)
 }
 
 func topicListener(topic *string, master sarama.Consumer) {
@@ -180,7 +187,7 @@
 				log.Info("Got message on topic=[%s]: %s", *topic, string(msg.Value))
 			case <-signals:
 				log.Warn("Interrupt is detected")
-		                os.Exit(1)
+				os.Exit(1)
 			}
 		}
 	}()
@@ -188,7 +195,7 @@
 }
 
 func kafkainit() {
-	cmd := exec.Command("/bin/sh","kafka_ip.sh")
+	cmd := exec.Command("/bin/sh", "kafka_ip.sh")
 	var kafkaIP string
 	var out bytes.Buffer
 	cmd.Stdout = &out
@@ -200,8 +207,8 @@
 
 	kafkaIP = out.String()
 	kafkaIP = strings.TrimSuffix(kafkaIP, "\n")
-	kafkaIP = kafkaIP +":9092"
-	fmt.Println("IP address of kafka-cord-0:",kafkaIP)
+	kafkaIP = kafkaIP + ":9092"
+	fmt.Println("IP address of kafka-cord-0:", kafkaIP)
 	config := sarama.NewConfig()
 	config.Consumer.Return.Errors = true
 	master, err := sarama.NewConsumer([]string{kafkaIP}, config)
@@ -219,21 +226,21 @@
 	kafkainit()
 
 	ln, err := net.Listen("tcp", ":9999")
-        if err != nil {
-                fmt.Println("could not listen")
-                log.Fatal("did not listen: %v", err)
-        }
+	if err != nil {
+		fmt.Println("could not listen")
+		log.Fatal("did not listen: %v", err)
+	}
 	defer ln.Close()
 
 	connS, err := ln.Accept()
 	if err != nil {
-                fmt.Println("Accept error")
-                log.Fatal("Accept error: %v", err)
-	}else{
+		fmt.Println("Accept error")
+		log.Fatal("Accept error: %v", err)
+	} else {
 
 		conn, err = grpc.Dial(default_address, grpc.WithInsecure())
 		if err != nil {
-		        fmt.Println("could not connect")
+			fmt.Println("could not connect")
 			log.Fatal("did not connect: %v", err)
 		}
 		defer conn.Close()
@@ -241,7 +248,6 @@
 		cc = importer.NewDeviceManagementClient(conn)
 		ctx = context.Background()
 
-		devicemap = make(map[string] *Device)
 		loop := true
 
 		for loop == true {
@@ -254,153 +260,193 @@
 
 			switch string(cmd) {
 
-			case "attach" :
+			case "attach":
 				cmd_size := len(s)
-				var err	error
-				var aport   string = default_port
-				var avendor string = default_vendor
-				var uafreq  uint64 = default_freq
+				var err error
+				var uafreq uint64
+				if cmd_size == 5 {
+					aip := s[1]
+					aport := s[2]
+					avendor := s[3]
+					afreq := s[4]
+					uafreq, err = strconv.ParseUint(afreq, 10, 64)
 
-				if (cmd_size == 2 || cmd_size == 5){
-					aip    := s[1]
-					if(cmd_size == 5){
-						aport	= s[2]
-						avendor	= s[3]
-						afreq	:= s[4]
-						uafreq, err = strconv.ParseUint(afreq, 10, 64)
-
-						if err != nil {
-							fmt.Print("ParseUint error!!")
-						}
-
-						attach_device_ip = aip + ":" + aport
-					}else{
-						attach_device_ip = aip + ":" + default_port
+					if err != nil {
+						fmt.Print("ParseUint error!!\n")
 					}
 
-					if (devicemap[attach_device_ip] == nil){
-						dev := new (Device)
-						err, newmessage = dev.Attach(attach_device_ip, avendor, uint32(uafreq))
-						if err != nil {
-							fmt.Print("attach error!!")
-						}else{
-							fmt.Print("attatch IP:", attach_device_ip)
-							newmessage = attach_device_ip
-							devicemap[attach_device_ip] = dev
-						}
-					}else{
-						fmt.Print("Change attach IP to %v", attach_device_ip)
+					attach_device_ip = aip + ":" + aport
+
+					err = Attach(attach_device_ip, avendor, uint32(uafreq))
+					if err != nil {
+						errStatus, _ := status.FromError(err)
+						fmt.Println(errStatus.Message())
+						fmt.Println(errStatus.Code())
+						fmt.Print("attach error!!\n")
+						newmessage = errStatus.Message()
+
+					} else {
+						fmt.Print("attatch IP:\n", attach_device_ip)
 						newmessage = attach_device_ip
 					}
-				}else{
-					fmt.Print("Need IP address !!")
+				} else {
+					fmt.Print("Need IP addres,port,vendor,freqs !!\n")
 					newmessage = "Need IP address !!"
 
 				}
-			break
 
-			case "period" :
+			case "period":
 				cmd_size := len(s)
-				if (cmd_size == 2 ){
-					if (devicemap[attach_device_ip] != nil){
-						pv  := s[1]
-						fmt.Print("pv:", pv)
-						u, err := strconv.ParseUint(pv, 10, 64)
+				fmt.Print("cmd_size period %d", cmd_size)
+				if cmd_size == 4 {
+					fip := s[1]
+					fport := s[2]
+					pv := s[3]
+					fmt.Print("pv:", pv)
+					u, err := strconv.ParseUint(pv, 10, 64)
+
+					if err != nil {
+						fmt.Print("ParseUint error!!\n")
+					} else {
+						wd := uint32(u)
+						ip_address := fip + ":" + fport
+						err = UpdateFreq(ip_address, wd)
 
 						if err != nil {
-							fmt.Print("ParseUint error!!")
-						}else{
-							wd := uint32(u)
-							dev := devicemap[attach_device_ip]
-							err, newmessage =  dev.UpdateFreq(wd)
-
-							if err != nil {
-								fmt.Print("period error!!")
-							}else{
-								newmessage = strings.ToUpper(cmd)
-							}
+							errStatus, _ := status.FromError(err)
+							fmt.Println(errStatus.Message())
+							fmt.Println(errStatus.Code())
+							newmessage = errStatus.Message()
+							fmt.Print("period error!!\n")
+						} else {
+							newmessage = strings.ToUpper(cmd)
 						}
-					}else{
-						fmt.Print("need attach first!!")
-						newmessage = "need attach first!!"
 					}
-				}else{
-					fmt.Print("Need period value !!")
+				} else {
+					fmt.Print("Need period value !!\n")
 					newmessage = "Need period value !!"
 				}
 
-			break
-
-			case "sub","unsub" :
+			case "sub", "unsub":
 				cmd_size := len(s)
-				fmt.Print("cmd is :", cmd)
-				if(cmd_size > 4 || cmd_size <0){
+				fmt.Print("cmd is :", cmd, cmd_size)
+				if cmd_size > 6 || cmd_size < 0 {
 					fmt.Print("error event !!")
 					newmessage = "error event !!"
-				}else{
+				} else {
+					ip := s[1]
+					port := s[2]
+					ip_address := ip + ":" + port
 					var events_list []string
-					for i := 1; i < cmd_size; i++ {
+					for i := 3; i < cmd_size; i++ {
 						if value, ok := EVENTS_MAP[s[i]]; ok {
-							events_list = append(events_list,value)
+							events_list = append(events_list, value)
 						} else {
 							fmt.Println("key not found")
 						}
 					}
 
-					if (devicemap[attach_device_ip] != nil){
-						dev := devicemap[attach_device_ip]
-						if(string(cmd) == "sub"){
-							err, newmessage =  dev.Subscribe(events_list)
-							if err != nil {
-								fmt.Print("sub error!!")
-								newmessage = "sub error!!"
-							}else{
-								newmessage = strings.ToUpper(cmd)
-							}
-						}else{
-							err, newmessage =  dev.UnSubscribe(events_list)
-							if err != nil {
-								fmt.Print("unsub error!!")
-								newmessage = "unsub error!!"
-							}else{
-								newmessage = strings.ToUpper(cmd)
-							}
+					if string(cmd) == "sub" {
+						err = Subscribe(ip_address, events_list)
+						if err != nil {
+							errStatus, _ := status.FromError(err)
+							fmt.Println(errStatus.Message())
+							fmt.Println(errStatus.Code())
+							newmessage = errStatus.Message()
+							fmt.Print("sub error!!")
+						} else {
+							newmessage = strings.ToUpper(cmd)
 						}
-					}else{
-						fmt.Print("need attach first !!")
-						newmessage = "need attach first !!"
+					} else {
+						err = UnSubscribe(ip_address, events_list)
+						if err != nil {
+							errStatus, _ := status.FromError(err)
+							fmt.Println(errStatus.Message())
+							fmt.Println(errStatus.Code())
+							newmessage = errStatus.Message()
+							fmt.Print("unsub error!!")
+						} else {
+							newmessage = strings.ToUpper(cmd)
+						}
 					}
 				}
-			break
 
-			case "showeventlist" :
-				if (devicemap[attach_device_ip] != nil){
-					dev := devicemap[attach_device_ip]
-					err, supportlist :=  dev.GetEventSupportList()
+			case "showeventlist":
+				cmd_size := len(s)
+				fmt.Print("cmd is :", cmd, cmd_size)
+				if cmd_size > 3 || cmd_size < 0 {
+					fmt.Print("error event !!")
+					newmessage = "error event !!"
+				} else {
+					vendor := s[1]
+					err, supportlist := GetEventSupportList(vendor)
 
 					if err != nil {
+						errStatus, _ := status.FromError(err)
+						fmt.Println(errStatus.Message())
+						fmt.Println(errStatus.Code())
+						newmessage = errStatus.Message()
 						fmt.Print("showeventlist error!!")
-					}else{
+					} else {
 						fmt.Print("showeventlist ", supportlist)
-						newmessage = strings.Join(supportlist[:],",")
+						newmessage = strings.Join(supportlist[:], ",")
 					}
-				}else{
-					fmt.Print("need attach first !!")
-					newmessage = "need attach first !!"
 				}
 
-			break
+			case "showdeviceeventlist":
+				cmd_size := len(s)
+				fmt.Print("cmd is :", cmd, cmd_size)
+				if cmd_size > 4 || cmd_size < 0 {
+					fmt.Print("error event !!")
+					newmessage = "error event !!"
+				} else {
+					eip := s[1]
+					eport := s[2]
+					ip_address := eip + ":" + eport
+					err, currentlist := GetEventCurrentDeviceList(ip_address)
 
-			case "QUIT" :
+					if err != nil {
+						errStatus, _ := status.FromError(err)
+						fmt.Println(errStatus.Message())
+						fmt.Println(errStatus.Code())
+						newmessage = errStatus.Message()
+						fmt.Print("showdeviceeventlist error!!")
+					} else {
+						fmt.Print("showeventlist ", currentlist)
+						newmessage = strings.Join(currentlist[:], ",")
+					}
+				}
+
+			case "cleardeviceeventlist":
+				cmd_size := len(s)
+				fmt.Print("cmd is :", cmd, cmd_size)
+				if cmd_size > 4 || cmd_size < 0 {
+					fmt.Print("error event !!")
+					newmessage = "error event !!"
+				} else {
+					clip := s[1]
+					clport := s[2]
+					ip_address := clip + ":" + clport
+					err = ClearCurrentDeviceEventList(ip_address)
+					if err != nil {
+						errStatus, _ := status.FromError(err)
+						fmt.Println(errStatus.Message())
+						fmt.Println(errStatus.Code())
+						newmessage = errStatus.Message()
+						fmt.Print("cleardeviceeventlist  error!!")
+					} else {
+						newmessage = strings.ToUpper(cmd)
+					}
+				}
+
+			case "QUIT":
 				loop = false
-	                        newmessage="QUIT"
-			break
+				newmessage = "QUIT"
 
-			default :
-			break
+			default:
 			}
 			// send string back to client
 			connS.Write([]byte(newmessage + "\n"))
-	        }
+		}
 	}
 }