Skip to content
Snippets Groups Projects
Commit 02228812 authored by Fabian Seidl's avatar Fabian Seidl
Browse files

add missing option to retrieve pndID from MNE

parent 96314cee
No related branches found
No related tags found
1 merge request!416Resolve "Refactor how PNDs are implemented in the code"
Pipeline #130929 failed
......@@ -25,6 +25,7 @@ type NetworkElement interface {
GetModelAsString() (string, error)
TransportAddress() string
GetMetadata() conflict.Metadata
PndID() uuid.UUID
}
// Details contains details of a network element used by the cSBI mechanism.
......
......@@ -66,6 +66,7 @@ func NewNetworkElement(
name: name,
transportOptions: opt,
Metadata: metadata,
pndID: pndID,
},
}, nil
}
......@@ -77,7 +78,7 @@ func NewNetworkElement(
transport: t,
name: name,
transportOptions: opt,
PndID: pndID,
pndID: pndID,
Metadata: metadata,
}, nil
}
......@@ -104,7 +105,7 @@ type CommonNetworkElement struct {
Metadata conflict.Metadata
// ID of the PND this network element is associated with.
PndID uuid.UUID
pndID uuid.UUID
}
// ID returns the UUID of the Network Element.
......@@ -176,6 +177,11 @@ func (n *CommonNetworkElement) GetMetadata() conflict.Metadata {
return n.Metadata
}
// PndID returns the ID of the associated PND.
func (n *CommonNetworkElement) PndID() uuid.UUID {
return n.pndID
}
// CsbiNetworkElement is used for the cSBI functionality.
type CsbiNetworkElement struct {
CommonNetworkElement
......@@ -216,6 +222,11 @@ func (n *CsbiNetworkElement) GetMetadata() conflict.Metadata {
return n.Metadata
}
// PndID returns the ID of the associated PND.
func (n *CsbiNetworkElement) PndID() uuid.UUID {
return n.pndID
}
// ProcessResponse processes a response for the Network Element.
func (n *CsbiNetworkElement) ProcessResponse(resp proto.Message) error {
// TODO: callback to send response to caller
......@@ -284,10 +295,10 @@ func (n *CommonNetworkElement) MarshalJSON() ([]byte, error) {
var pndUUID uuid.UUID
if n.PndID == uuid.Nil {
if n.pndID == uuid.Nil {
pndUUID = uuid.UUID{}
} else {
pndUUID = n.PndID
pndUUID = n.pndID
}
modelAsString, err := ygot.EmitJSON(n.Model, n.getYgotEmitJSONConfig())
......@@ -371,7 +382,7 @@ func (n *CommonNetworkElement) MarshalBSON() ([]byte, error) {
TransportOptionType: transportOptionType,
SBI: n.sbi.ID().String(),
Model: modelAsString,
PndID: n.PndID.String(),
PndID: n.pndID.String(),
})
}
......
......@@ -19,7 +19,7 @@ func getMockNetworkElement(mneID uuid.UUID, sbi southbound.SouthboundInterface)
Model: sbi.Schema().Root,
sbi: sbi,
transport: &mocks.Transport{},
PndID: uuid.New(),
pndID: uuid.New(),
}
}
......
......@@ -91,8 +91,7 @@ func (n *NetworkElementWatcher) callSubscribe(stopContext context.Context, mne n
// SubscriptionInformation contains pnd ID, network element ID and name to be used in the internal subscribe to check
// from which network element a response was sent
if err := mne.Transport().ControlPlaneSubscribe(gNMIOptionsCtx, n.handleSubscribeResponse, &transport.SubscriptionInformation{
//TODO(PND): add pndID here, when adding pndID as reference to MNE!
//PndID: pndID,
PndID: mne.PndID().String(),
NetworkElementID: mne.ID().String(),
NetworkElementName: mne.Name(),
StopContext: stopContext,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment