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"))
-	        }
+		}
 	}
 }
