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

add getAllMne and getAllPnd

parent 5922b50e
No related branches found
No related tags found
1 merge request!790Resolve "Update gRPC abstraction API with missing calls and refactoring"
This commit is part of merge request !790. Comments created here will be created in the context of that merge request.
......@@ -50,6 +50,23 @@ func AddNetworkElement(ctx context.Context, addr, mneName, mneUUID string, opt *
return client.AddList(ctx, req)
}
// AddNetworkElementList adds all the network elements to the controller. The name of each network element is optional.
// If no name is provided a name will be generated upon network element creation.
func AddNetworkElementList(ctx context.Context, addr, pid string, mneList []*mnepb.SetMne) (*mnepb.AddListResponse, error) {
client, err := nbi.NetworkElementClient(addr, dialOptions...)
if err != nil {
return nil, err
}
req := &mnepb.AddListRequest{
Timestamp: time.Now().UnixNano(),
Mne: mneList,
Pid: pid,
}
return client.AddList(ctx, req)
}
// GetNetworkElement requests one network element belonging to a given
// PrincipalNetworkDomain from the controller. If no network element identifier
// is provided, an error is thrown.
......@@ -72,6 +89,21 @@ func GetNetworkElement(ctx context.Context, addr, pid string, mneid string) (*mn
return client.Get(ctx, req)
}
// GetNetworkElements requests all available network elements related to one PND.
func GetNetworkElements(ctx context.Context, addr, pid string) (*mnepb.GetAllResponse, error) {
client, err := nbi.NetworkElementClient(addr, dialOptions...)
if err != nil {
return nil, err
}
req := &mnepb.GetAllRequest{
Timestamp: time.Now().UnixNano(),
Pid: pid,
}
return client.GetAll(ctx, req)
}
// GetPluginSchemaTree gets the schema tree for a plugin.
func GetPluginSchemaTree(ctx context.Context, addr string, pluginID uuid.UUID) (map[string]*yang.Entry, error) {
pluginClient, err := nbi.PluginClient(addr, dialOptions...)
......
......@@ -30,6 +30,21 @@ func CreatePnd(ctx context.Context, addr, name, description string) (*ppb.Create
return pndClient.CreatePndList(ctx, req)
}
// CreatePndList uses the provided creation properties to add all the PNDs to the controller.
func CreatePndList(ctx context.Context, addr string, pnds []*ppb.PndCreateProperties) (*ppb.CreatePndListResponse, error) {
pndClient, err := nbi.PndClient(addr, dialOptions...)
if err != nil {
return nil, err
}
req := &ppb.CreatePndListRequest{
Timestamp: time.Now().UnixNano(),
Pnd: pnds,
}
return pndClient.CreatePndList(ctx, req)
}
// GetPnd requests one PrincipalNetworkDomain from the
// controller.
func GetPnd(ctx context.Context, addr string, args string) (*ppb.GetPndResponse, error) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment