Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions netconf/message/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ type CreateSubscription struct {
type CreateSubscriptionData struct {
XMLNS string `xml:"xmlns,attr"`
Stream string `xml:"stream,omitempty"` // default is NETCONF
Filter string `xml:",innerxml"`
StartTime string `xml:"startTime,omitempty"`
StopTime string `xml:"stopTime,omitempty"`
}
Expand All @@ -82,18 +83,18 @@ type CreateSubscriptionData struct {
func NewCreateSubscriptionDefault() *CreateSubscription {
var rpc CreateSubscription
var sub = &CreateSubscriptionData{
NetconfNotificationXmlns, "", "", "",
NetconfNotificationXmlns, "", "", "", "",
}
rpc.Subscription = *sub
rpc.MessageID = uuid()
return &rpc
}

// NewCreateSubscription can be used to create a `create-subscription` message.
func NewCreateSubscription(stopTime string, startTime string, stream string) *CreateSubscription {
func NewCreateSubscription(stopTime string, startTime string, stream string, filter string) *CreateSubscription {
var rpc CreateSubscription
var sub = &CreateSubscriptionData{
NetconfNotificationXmlns, stream, startTime, stopTime,
NetconfNotificationXmlns, stream, filter, startTime, stopTime,
}
rpc.Subscription = *sub
rpc.MessageID = uuid()
Expand Down
4 changes: 2 additions & 2 deletions netconf/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
// TODO limitation - for now, we can only register one stream per session, because when a notification is received
// there is no way to attribute it to a specific stream
func (session *Session) CreateNotificationStream(
timeout int32, stopTime string, startTime string, stream string, callback Callback,
timeout int32, stopTime string, startTime string, filter string, stream string, callback Callback,
) error {
if session.IsNotificationStreamCreated {
return fmt.Errorf(
Expand All @@ -38,7 +38,7 @@ func (session *Session) CreateNotificationStream(
)
}
session.Listener.Register(message.NetconfNotificationStreamHandler, callback)
sub := message.NewCreateSubscription(stopTime, startTime, stream)
sub := message.NewCreateSubscription(stopTime, startTime, stream, filter)
rpc, err := session.SyncRPC(sub, timeout)
if err != nil {
errMsg := "fail to create notification stream"
Expand Down