Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • danet/gosdn
1 result
Select Git revision
Show changes
Commits on Source (2)
...@@ -47,8 +47,8 @@ func (p *PndAdapter) RemoveSbi(uuid.UUID) error { ...@@ -47,8 +47,8 @@ func (p *PndAdapter) RemoveSbi(uuid.UUID) error {
// AddNetworkElement adds a new device to the controller. The device name is optional. // AddNetworkElement adds a new device to the controller. The device name is optional.
// If no name is provided a name will be generated upon device creation. // If no name is provided a name will be generated upon device creation.
func (p *PndAdapter) AddNetworkElement(ctx context.Context, name string, opts *tpb.TransportOption, pluginId uuid.UUID, gNMISubscribePaths []string) (*mnepb.AddListResponse, error) { func (p *PndAdapter) AddNetworkElement(ctx context.Context, name, mneUUID string, opts *tpb.TransportOption, pluginId uuid.UUID, gNMISubscribePaths []string) (*mnepb.AddListResponse, error) {
return api.AddNetworkElement(ctx, p.endpoint, name, opts, pluginId, p.ID(), gNMISubscribePaths) return api.AddNetworkElement(ctx, p.endpoint, name, mneUUID, opts, pluginId, p.ID(), gNMISubscribePaths)
} }
// GetPluginSchemaTree requests a plugin schema tree. // GetPluginSchemaTree requests a plugin schema tree.
......
...@@ -75,9 +75,10 @@ func TestPndAdapter_AddNetworkElement(t *testing.T) { ...@@ -75,9 +75,10 @@ func TestPndAdapter_AddNetworkElement(t *testing.T) {
endpoint string endpoint string
} }
type args struct { type args struct {
name string name string
opts *tpb.TransportOption opts *tpb.TransportOption
sid uuid.UUID sid uuid.UUID
mneUUID string
} }
tests := []struct { tests := []struct {
name string name string
...@@ -93,7 +94,7 @@ func TestPndAdapter_AddNetworkElement(t *testing.T) { ...@@ -93,7 +94,7 @@ func TestPndAdapter_AddNetworkElement(t *testing.T) {
id: tt.fields.id, id: tt.fields.id,
endpoint: tt.fields.endpoint, endpoint: tt.fields.endpoint,
} }
if _, err := p.AddNetworkElement(context.TODO(), tt.args.name, tt.args.opts, tt.args.sid, []string{}); (err != nil) != tt.wantErr { if _, err := p.AddNetworkElement(context.TODO(), tt.args.name, tt.args.mneUUID, tt.args.opts, tt.args.sid, []string{}); (err != nil) != tt.wantErr {
t.Errorf("PndAdapter.AddNetworkElement() error = %v, wantErr %v", err, tt.wantErr) t.Errorf("PndAdapter.AddNetworkElement() error = %v, wantErr %v", err, tt.wantErr)
} }
}) })
......
...@@ -71,7 +71,7 @@ if they diverge from the default credentials (user:'admin' and pw:'arista').`, ...@@ -71,7 +71,7 @@ if they diverge from the default credentials (user:'admin' and pw:'arista').`,
return return
} }
resp, err := pndAdapter.AddNetworkElement(createContextWithAuthorization(), mneName, opt, pluginUUID, []string{"system/config/hostname", "system/config/domain-name"}) resp, err := pndAdapter.AddNetworkElement(createContextWithAuthorization(), mneName, mneUUID, opt, pluginUUID, []string{"system/config/hostname", "system/config/domain-name"})
if err != nil { if err != nil {
spinner.Fail(err) spinner.Fail(err)
return return
...@@ -85,12 +85,13 @@ if they diverge from the default credentials (user:'admin' and pw:'arista').`, ...@@ -85,12 +85,13 @@ if they diverge from the default credentials (user:'admin' and pw:'arista').`,
// Necessary for prompt mode. The flag variables have to be resetted, // Necessary for prompt mode. The flag variables have to be resetted,
// since in prompt mode the program keeps running. // since in prompt mode the program keeps running.
mneName, pluginID, address, username, password = "", "", "", "", "" mneName, mneUUID, pluginID, address, username, password = "", "", "", "", "", ""
tls = false tls = false
}, },
} }
var mneName string var mneName string
var mneUUID string
var pluginID string var pluginID string
var tls bool var tls bool
...@@ -103,4 +104,5 @@ func init() { ...@@ -103,4 +104,5 @@ func init() {
networkElementCreateCmd.Flags().StringVarP(&username, "username", "u", "", "username for a gnmi resource") networkElementCreateCmd.Flags().StringVarP(&username, "username", "u", "", "username for a gnmi resource")
networkElementCreateCmd.Flags().StringVarP(&password, "password", "p", "", "password for a gnmi resource") networkElementCreateCmd.Flags().StringVarP(&password, "password", "p", "", "password for a gnmi resource")
networkElementCreateCmd.Flags().BoolVarP(&tls, "tls", "t", false, "use flag to enable the controller to send requests to network elements using tls") networkElementCreateCmd.Flags().BoolVarP(&tls, "tls", "t", false, "use flag to enable the controller to send requests to network elements using tls")
networkElementCreateCmd.Flags().StringVar(&mneUUID, "uuid", "", "add a network element UUID (optional)")
} }
...@@ -20,7 +20,7 @@ import ( ...@@ -20,7 +20,7 @@ import (
// AddNetworkElement adds a new network element to the controller. The network element name is optional. // AddNetworkElement adds a new network element to the controller. The network element name is optional.
// If no name is provided a name will be generated upon network element creation. // If no name is provided a name will be generated upon network element creation.
func AddNetworkElement(ctx context.Context, addr, mneName string, opt *tpb.TransportOption, pluginID, pid uuid.UUID, gNMISubscribePaths []string) (*mnepb.AddListResponse, error) { func AddNetworkElement(ctx context.Context, addr, mneName, mneUUID string, opt *tpb.TransportOption, pluginID, pid uuid.UUID, gNMISubscribePaths []string) (*mnepb.AddListResponse, error) {
client, err := nbi.NetworkElementClient(addr, dialOptions...) client, err := nbi.NetworkElementClient(addr, dialOptions...)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -36,6 +36,7 @@ func AddNetworkElement(ctx context.Context, addr, mneName string, opt *tpb.Trans ...@@ -36,6 +36,7 @@ func AddNetworkElement(ctx context.Context, addr, mneName string, opt *tpb.Trans
Pid: pid.String(), Pid: pid.String(),
TransportOption: opt, TransportOption: opt,
GnmiSubscribePaths: gNMISubscribePaths, GnmiSubscribePaths: gNMISubscribePaths,
MneId: mneUUID,
}, },
}, },
Pid: pid.String(), Pid: pid.String(),
......