Skip to content
Snippets Groups Projects
Commit a38ffd7f authored by Malte Bauch's avatar Malte Bauch
Browse files

clean up comments

parent 688d4801
No related branches found
No related tags found
1 merge request!401Change the current gosdn plugin implementation from Go's internal plugin system to hashicorp's go-plugins
...@@ -96,12 +96,14 @@ var mneName string ...@@ -96,12 +96,14 @@ var mneName string
var opcode string var opcode string
var pluginID string var pluginID string
var pluginIDFlagName = "plugin-id"
func init() { func init() {
networkElementCmd.AddCommand(networkElementCreateCmd) networkElementCmd.AddCommand(networkElementCreateCmd)
networkElementCreateCmd.Flags().StringVar(&mneName, "name", "", "add a network element name (optional)") networkElementCreateCmd.Flags().StringVar(&mneName, "name", "", "add a network element name (optional)")
networkElementCreateCmd.Flags().StringVar(&opcode, "type", "", "generation target (csbi or plugin)") networkElementCreateCmd.Flags().StringVar(&opcode, "type", "", "generation target (csbi or plugin)")
networkElementCreateCmd.Flags().StringVar(&pluginID, "plugin-id", "", "the plugin ID of the plugin to be used") networkElementCreateCmd.Flags().StringVar(&pluginID, pluginIDFlagName, "", "the plugin ID of the plugin to be used")
networkElementCreateCmd.Flags().StringVarP(&address, "address", "a", "", "address of a gnmi target, e.g. 192.168.1.1:6030") networkElementCreateCmd.Flags().StringVarP(&address, "address", "a", "", "address of a gnmi target, e.g. 192.168.1.1:6030")
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")
......
...@@ -220,10 +220,9 @@ func completionBasedOnCmd(c *PromptCompleter, cmd *cobra.Command, inputSplit []s ...@@ -220,10 +220,9 @@ func completionBasedOnCmd(c *PromptCompleter, cmd *cobra.Command, inputSplit []s
} }
case networkElementCreateCmd: case networkElementCreateCmd:
if len(inputFlags) != 0 { if len(inputFlags) != 0 {
// TODO: remove hardcoded `plugin-id` if inputFlags[len(inputFlags)-1] == pluginIDFlagName &&
if inputFlags[len(inputFlags)-1] == "--plugin-id" && ((inputSplit[len(inputSplit)-1] == pluginIDFlagName && d.GetWordBeforeCursor() == "") ||
((inputSplit[len(inputSplit)-1] == "--plugin-id" && d.GetWordBeforeCursor() == "") || (inputSplit[len(inputSplit)-2] == pluginIDFlagName && d.GetWordBeforeCursor() != "")) {
(inputSplit[len(inputSplit)-2] == "--plugin-id" && d.GetWordBeforeCursor() != "")) {
return c.updateSuggestionsThroughFunc(d, getAvailablePlugins) return c.updateSuggestionsThroughFunc(d, getAvailablePlugins)
} else { } else {
return cobraCommandCompletion(cmd, d, inputFlags, []prompt.Suggest{}) return cobraCommandCompletion(cmd, d, inputFlags, []prompt.Suggest{})
......
...@@ -14,7 +14,6 @@ import ( ...@@ -14,7 +14,6 @@ import (
type Transport interface { type Transport interface {
Get(ctx context.Context, params ...string) (any, error) Get(ctx context.Context, params ...string) (any, error)
Set(ctx context.Context, payload change.Payload, path string, plugin plugin.Plugin) error Set(ctx context.Context, payload change.Payload, path string, plugin plugin.Plugin) error
// TODO: add delete
CustomSet(ctx context.Context, req *gpb.SetRequest) (*gpb.SetResponse, error) CustomSet(ctx context.Context, req *gpb.SetRequest) (*gpb.SetResponse, error)
Subscribe(ctx context.Context, params ...string) error Subscribe(ctx context.Context, params ...string) error
ControlPlaneSubscribe(ctx context.Context, subscribeCallbackFunc HandleSubscribeResponse, ControlPlaneSubscribe(ctx context.Context, subscribeCallbackFunc HandleSubscribeResponse,
......
...@@ -13,8 +13,6 @@ import ( ...@@ -13,8 +13,6 @@ import (
transport "code.fbi.h-da.de/danet/gosdn/controller/interfaces/transport" transport "code.fbi.h-da.de/danet/gosdn/controller/interfaces/transport"
uuid "github.com/google/uuid" uuid "github.com/google/uuid"
ygot "github.com/openconfig/ygot/ygot"
) )
// NetworkElement is an autogenerated mock type for the NetworkElement type // NetworkElement is an autogenerated mock type for the NetworkElement type
...@@ -186,11 +184,6 @@ func (_m *NetworkElement) ProcessResponse(_a0 protoreflect.ProtoMessage) error { ...@@ -186,11 +184,6 @@ func (_m *NetworkElement) ProcessResponse(_a0 protoreflect.ProtoMessage) error {
return r0 return r0
} }
// SetModel provides a mock function with given fields: _a0
func (_m *NetworkElement) SetModel(_a0 ygot.GoStruct) {
_m.Called(_a0)
}
// Transport provides a mock function with given fields: // Transport provides a mock function with given fields:
func (_m *NetworkElement) Transport() transport.Transport { func (_m *NetworkElement) Transport() transport.Transport {
ret := _m.Called() ret := _m.Called()
......
...@@ -179,6 +179,32 @@ func (_m *Plugin) Ping() error { ...@@ -179,6 +179,32 @@ func (_m *Plugin) Ping() error {
return r0 return r0
} }
// PruneConfigFalse provides a mock function with given fields: value
func (_m *Plugin) PruneConfigFalse(value []byte) ([]byte, error) {
ret := _m.Called(value)
var r0 []byte
var r1 error
if rf, ok := ret.Get(0).(func([]byte) ([]byte, error)); ok {
return rf(value)
}
if rf, ok := ret.Get(0).(func([]byte) []byte); ok {
r0 = rf(value)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
if rf, ok := ret.Get(1).(func([]byte) error); ok {
r1 = rf(value)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Restart provides a mock function with given fields: // Restart provides a mock function with given fields:
func (_m *Plugin) Restart() error { func (_m *Plugin) Restart() error {
ret := _m.Called() ret := _m.Called()
......
...@@ -80,15 +80,6 @@ func (c ConfigurationManagementServer) ExportSDNConfig(ctx context.Context, requ ...@@ -80,15 +80,6 @@ func (c ConfigurationManagementServer) ExportSDNConfig(ctx context.Context, requ
networkElements := pnd.NetworkElements() networkElements := pnd.NetworkElements()
// TODO: check if this is really necessary
//for _, networkElement := range networkElements {
// model, err := networkElement.GetModelAsFilteredCopy()
// if err != nil {
// return nil, err
// }
// //networkElement.SetModel(model)
//}
sdnConfig.NetworkElements = networkElements sdnConfig.NetworkElements = networkElements
sdnConfig.Nodes, err = c.nodeService.GetAll() sdnConfig.Nodes, err = c.nodeService.GetAll()
...@@ -323,7 +314,8 @@ func (c ConfigurationManagementServer) createNetworkElements(sdnConfig *loadedSD ...@@ -323,7 +314,8 @@ func (c ConfigurationManagementServer) createNetworkElements(sdnConfig *loadedSD
TransportOption: &tpb.TransportOption_GnmiTransportOption{ TransportOption: &tpb.TransportOption_GnmiTransportOption{
GnmiTransportOption: &tpb.GnmiTransportOption{}, GnmiTransportOption: &tpb.GnmiTransportOption{},
}, },
// TODO: change TransportOption - type is not needed // TODO: change TransportOption - type is not needed; this should
// be removed as soon as we remove the csbi device type
Type: spb.Type_TYPE_OPENCONFIG, Type: spb.Type_TYPE_OPENCONFIG,
} }
_, err := pnd.AddNetworkElement( _, err := pnd.AddNetworkElement(
......
...@@ -164,7 +164,6 @@ func (p *Plugin) Ping() error { ...@@ -164,7 +164,6 @@ func (p *Plugin) Ping() error {
// UpdatePlugin updates a given Plugin. Therefore the version of the // UpdatePlugin updates a given Plugin. Therefore the version of the
// `plugin.yml` manifest file is compared to the version in use. If a new // `plugin.yml` manifest file is compared to the version in use. If a new
// version is within the plugin folder, the new version of the plugin is built. // version is within the plugin folder, the new version of the plugin is built.
// NOTE:This should only be used with caution.
func UpdatePlugin(p plugin.Plugin) (updated bool, err error) { func UpdatePlugin(p plugin.Plugin) (updated bool, err error) {
return false, fmt.Errorf("not implemented yet") return false, fmt.Errorf("not implemented yet")
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment