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