diff --git a/controller/api/managedNetworkElement.go b/controller/api/managedNetworkElement.go index b07ad58e0d8156ff079401f0a57813926b061d92..f9b5eb57a3e4705f36e9303b09a3ca04c813fd36 100644 --- a/controller/api/managedNetworkElement.go +++ b/controller/api/managedNetworkElement.go @@ -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...) diff --git a/controller/api/pnd.go b/controller/api/pnd.go index d547807ba4612522ff1430f821c420378a3fb8d9..b8ab4d66bb32705e31b604e07a219ab111dc5a35 100644 --- a/controller/api/pnd.go +++ b/controller/api/pnd.go @@ -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) {