From 36bd331d5772b07c58f21392b9bcb0f6e2f4ff43 Mon Sep 17 00:00:00 2001 From: Manuel Kieweg <manuel.kieweg@h-da.de> Date: Thu, 10 Jun 2021 12:05:10 +0200 Subject: [PATCH] remove cli, moved to gosdnc --- cmd/addDevice.go | 73 ------------------------- cmd/addPnd.go | 70 ------------------------ cmd/capabilities.go | 52 ------------------ cmd/change.go | 49 ----------------- cmd/cli.go | 60 -------------------- cmd/cliSet.go | 69 ----------------------- cmd/commit.go | 57 ------------------- cmd/confirm.go | 57 ------------------- cmd/delete.go | 69 ----------------------- cmd/getDevice.go | 65 ---------------------- cmd/getIds.go | 65 ---------------------- cmd/getPnd.go | 67 ----------------------- cmd/init.go | 63 --------------------- cmd/list.go | 63 --------------------- cmd/pnd.go | 67 ----------------------- cmd/replace.go | 60 -------------------- cmd/request.go | 62 --------------------- cmd/requestAll.go | 65 ---------------------- cmd/subscribe.go | 59 -------------------- cmd/target.go | 56 ------------------- cmd/update.go | 60 -------------------- cmd/util.go | 52 ------------------ cmd/ygot.go | 52 ------------------ go.mod | 5 +- go.sum | 6 +- test/integration/cliIntegration_test.go | 4 +- test/integration/cmdIntegration_test.go | 16 +++--- 27 files changed, 17 insertions(+), 1426 deletions(-) delete mode 100644 cmd/addDevice.go delete mode 100644 cmd/addPnd.go delete mode 100644 cmd/capabilities.go delete mode 100644 cmd/change.go delete mode 100644 cmd/cli.go delete mode 100644 cmd/cliSet.go delete mode 100644 cmd/commit.go delete mode 100644 cmd/confirm.go delete mode 100644 cmd/delete.go delete mode 100644 cmd/getDevice.go delete mode 100644 cmd/getIds.go delete mode 100644 cmd/getPnd.go delete mode 100644 cmd/init.go delete mode 100644 cmd/list.go delete mode 100644 cmd/pnd.go delete mode 100644 cmd/replace.go delete mode 100644 cmd/request.go delete mode 100644 cmd/requestAll.go delete mode 100644 cmd/subscribe.go delete mode 100644 cmd/target.go delete mode 100644 cmd/update.go delete mode 100644 cmd/util.go delete mode 100644 cmd/ygot.go diff --git a/cmd/addDevice.go b/cmd/addDevice.go deleted file mode 100644 index 2304e2214..000000000 --- a/cmd/addDevice.go +++ /dev/null @@ -1,73 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - "github.com/spf13/cobra" - - log "github.com/sirupsen/logrus" -) - -// addDeviceCmd represents the addDevice command -var addDeviceCmd = &cobra.Command{ - Use: "add-device", - Short: "adds a device to the controller", - Long: `Adds a device to the controller. - -Device address and user credentials need to be provided -if they diverge from the default credentials.`, - RunE: func(cmd *cobra.Command, args []string) error { - resp, err := cli.AddDevice( - apiEndpoint, - username, - password, - cliSbi, - cliPnd, - address, - deviceName, - ) - if err != nil { - return err - } - log.Info(resp) - return nil - }, -} - -var deviceName string - -func init() { - cliCmd.AddCommand(addDeviceCmd) - - addDeviceCmd.Flags().StringVar(&deviceName, "name", "", "add a device name (optional)") -} diff --git a/cmd/addPnd.go b/cmd/addPnd.go deleted file mode 100644 index d61a454a9..000000000 --- a/cmd/addPnd.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - "github.com/spf13/cobra" - - log "github.com/sirupsen/logrus" -) - -// addCmd represents the add command -var addCmd = &cobra.Command{ - Use: "add", - Short: "adds a new principal network domain to the controller", - Long: `A principal network domain is a main networking entity. This can be a -campus building or site. - -A description must be passed as positional argument. A name and default SBI can be -passed using flags`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - resp, err := cli.AddPnd(apiEndpoint, pndName, args[0], pndDefaultSbi) - if err != nil { - return err - } - log.Info(resp) - return nil - }, -} - -var pndName string -var pndDefaultSbi string - -func init() { - pndCmd.AddCommand(addCmd) - - addCmd.Flags().StringVar(&pndName, "name", "", "the name of the pnd") - addCmd.Flags().StringVar(&pndDefaultSbi, "sbi", "openconfig", "the default SBI of the pnd") - -} diff --git a/cmd/capabilities.go b/cmd/capabilities.go deleted file mode 100644 index 437f6f25f..000000000 --- a/cmd/capabilities.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - "github.com/spf13/cobra" -) - -// capabilitiesCmd represents the capabilities command -var capabilitiesCmd = &cobra.Command{ - Use: "capabilities", - Short: "capabilities request", - Long: `Sends a gNMI Capabilities request to the specified target -and prints the supported models to stdout.`, - RunE: func(cmd *cobra.Command, args []string) error { - return cli.Capabilities(username, password, address) - }, -} - -func init() { - rootCmd.AddCommand(capabilitiesCmd) -} diff --git a/cmd/change.go b/cmd/change.go deleted file mode 100644 index fc10bdb4f..000000000 --- a/cmd/change.go +++ /dev/null @@ -1,49 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "github.com/spf13/cobra" -) - -// changeCmd represents the change command -var changeCmd = &cobra.Command{ - Use: "change", - Short: "manage changes of the specified pnd", - Long: `use "change list" or "change list-pending" to list changes - -use "change commit" or "change confirm" respectively`, -} - -func init() { - cliCmd.AddCommand(changeCmd) -} diff --git a/cmd/cli.go b/cmd/cli.go deleted file mode 100644 index fbb0c71dd..000000000 --- a/cmd/cli.go +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - "github.com/spf13/cobra" -) - -var uuid string -var apiEndpoint string - -// cliCmd represents the cli command -var cliCmd = &cobra.Command{ - Use: "cli", - Short: "initialises the cli", - Long: `Initialises the CLI. The first PND UUID and SBI UUID -are written to the config file for subsequent requests.`, - RunE: func(cmd *cobra.Command, args []string) error { - return cli.Init(apiEndpoint) - }, -} - -var verbose bool - -func init() { - rootCmd.AddCommand(cliCmd) - - cliCmd.PersistentFlags().StringVar(&apiEndpoint, "controller", "http://gosdn-develop.apps.ocp.fbi.h-da.de/api", "address of the controller") - pndCmd.PersistentFlags().BoolVar(&verbose, "verbose", false, "show ond and sbi info") -} diff --git a/cmd/cliSet.go b/cmd/cliSet.go deleted file mode 100644 index 3b5cdcc1d..000000000 --- a/cmd/cliSet.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" -) - -// cliSetCmd represents the cliSet command -var cliSetCmd = &cobra.Command{ - Use: "set", - Args: cobra.ExactArgs(2), - Short: "set a value on a device", - Long: `Update a path value for a given device. Only one path and -only one value supported for now. - -Use "set replace" or "set delete" respectively`, - RunE: func(cmd *cobra.Command, args []string) error { - resp, err := cli.Update( - apiEndpoint, - uuid, - cliPnd, - args[0], - args[1], - ) - if err != nil { - return err - } - log.Info(resp) - return nil - }, -} - -func init() { - cliCmd.AddCommand(cliSetCmd) - - cliSetCmd.PersistentFlags().StringVar(&uuid, "uuid", "", "uuid of the target device") -} diff --git a/cmd/commit.go b/cmd/commit.go deleted file mode 100644 index 56b93cb16..000000000 --- a/cmd/commit.go +++ /dev/null @@ -1,57 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" -) - -// commitCmd represents the commit command -var commitCmd = &cobra.Command{ - Use: "commit", - Args: cobra.ExactArgs(1), - Short: "Commit the given change for the active PND", - Long: ``, - Run: func(cmd *cobra.Command, args []string) { - log.Info(cli.Commit( - apiEndpoint, - cliPnd, - args[0], - )) - }, -} - -func init() { - changeCmd.AddCommand(commitCmd) -} diff --git a/cmd/confirm.go b/cmd/confirm.go deleted file mode 100644 index ef7320893..000000000 --- a/cmd/confirm.go +++ /dev/null @@ -1,57 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" -) - -// confirmCmd represents the confirm command -var confirmCmd = &cobra.Command{ - Use: "confirm", - Args: cobra.ExactArgs(1), - Short: "Confirms the given change for the active PND", - Long: ``, - Run: func(cmd *cobra.Command, args []string) { - log.Info(cli.Confirm( - apiEndpoint, - cliPnd, - args[0], - )) - }, -} - -func init() { - changeCmd.AddCommand(confirmCmd) -} diff --git a/cmd/delete.go b/cmd/delete.go deleted file mode 100644 index 43cd98b7d..000000000 --- a/cmd/delete.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" -) - -// deleteCmd represents the delete command -var deleteCmd = &cobra.Command{ - Use: "delete", - Args: cobra.ExactArgs(1), - Short: "set a value on a device", - Long: `Set a path value for a given device. Only one path and -only one value supported for now`, - Run: func(cmd *cobra.Command, args []string) { - log.Info(cli.Delete( - apiEndpoint, - uuid, - cliPnd, - args[0], - )) - }, -} - -func init() { - cliSetCmd.AddCommand(deleteCmd) - - // Here you will define your flags and configuration settings. - - // Cobra supports Persistent Flags which will work for this command - // and all subcommands, e.g.: - // deleteCmd.PersistentFlags().String("foo", "", "A help for foo") - - // Cobra supports local flags which will only run when this command - // is called directly, e.g.: - // deleteCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") -} diff --git a/cmd/getDevice.go b/cmd/getDevice.go deleted file mode 100644 index 2f394f86e..000000000 --- a/cmd/getDevice.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" -) - -// getDeviceCmd represents the getDevice command -var getDeviceCmd = &cobra.Command{ - Use: "get-device", - Args: cobra.ExactArgs(1), - Short: "gets device information from the controller", - Long: `Gets device information from the controller. - -Device UUID or name needs to be specified as positional argument.`, - RunE: func(cmd *cobra.Command, args []string) error { - resp, err := cli.GetDevice( - apiEndpoint, - cliPnd, - cliSbi, - args[0], - ) - if err != nil { - return err - } - log.Info(resp) - return nil - }, -} - -func init() { - cliCmd.AddCommand(getDeviceCmd) -} diff --git a/cmd/getIds.go b/cmd/getIds.go deleted file mode 100644 index b302f872a..000000000 --- a/cmd/getIds.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" -) - -// getIdsCmd represents the getIds command -var getIdsCmd = &cobra.Command{ - Use: "get-ids", - Short: "gets device IDs from the controller", - Long: `Gets device IDs from the controller and lists them.`, - RunE: func(cmd *cobra.Command, args []string) error { - resp, err := cli.GetIds(apiEndpoint) - if err != nil { - return err - } - for i, pnd := range resp { - log.Infof("PND %v: %v\n\tuuid: %v", i+1, pnd.Name, pnd.Id) - for j, ond := range pnd.Ond { - log.Infof("\tSBI %v: %v\n\tuuid: %v", j+1, ond.Name, ond.Id) - } - for k, sbi := range pnd.Sbi { - log.Infof("\tSBI %v: %v", k+1, sbi.Id) - } - } - return nil - }, -} - -func init() { - cliCmd.AddCommand(getIdsCmd) -} diff --git a/cmd/getPnd.go b/cmd/getPnd.go deleted file mode 100644 index e426d0516..000000000 --- a/cmd/getPnd.go +++ /dev/null @@ -1,67 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" -) - -// getCmd represents the get command -var getCmd = &cobra.Command{ - Use: "get", - Short: "get one or multiple pnds by uuid or name and print them to stdout", - Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { - resp, err := cli.GetPnd(apiEndpoint, args...) - if err != nil { - return err - } - for i, pnd := range resp.Pnd { - log.Infof("PND %v: %v\n\tuuid: %v", i+1, pnd.Name, pnd.Id) - if verbose { - for j, ond := range pnd.Ond { - log.Infof("\tSBI %v: %v\n\tuuid: %v", j+1, ond.Name, ond.Id) - } - for k, sbi := range pnd.Sbi { - log.Infof("\tSBI %v: %v", k+1, sbi.Id) - } - } - } - return nil - }, -} - -func init() { - pndCmd.AddCommand(getCmd) -} diff --git a/cmd/init.go b/cmd/init.go deleted file mode 100644 index c45a03b21..000000000 --- a/cmd/init.go +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - "github.com/spf13/cobra" -) - -// initCmd represents the init command -var initCmd = &cobra.Command{ - Use: "init", - Short: "initialise SBI and PND", - Long: `Initialise SBI and PND and saves values to config file. - -Same as invoking "gosdn cli" without any arguments`, - RunE: func(cmd *cobra.Command, args []string) error { - return cli.Init(apiEndpoint) - }, -} - -func init() { - cliCmd.AddCommand(initCmd) - - // Here you will define your flags and configuration settings. - - // Cobra supports Persistent Flags which will work for this command - // and all subcommands, e.g.: - // initCmd.PersistentFlags().String("foo", "", "A help for foo") - - // Cobra supports local flags which will only run when this command - // is called directly, e.g.: - // initCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") -} diff --git a/cmd/list.go b/cmd/list.go deleted file mode 100644 index ea0a8c13f..000000000 --- a/cmd/list.go +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" -) - -// listCmd represents the list command -var listCmd = &cobra.Command{ - Use: "list", - Short: "Lists all committed changes", - Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { - resp, err := cli.GetChanges(apiEndpoint, cliPnd) - if err != nil { - return err - } - for _, change := range resp.Change { - log.WithFields(log.Fields{ - "uuid": change.Id, - "age": change.Age, - "state": change.State, - }).Infof("") - } - return nil - }, -} - -func init() { - changeCmd.AddCommand(listCmd) -} diff --git a/cmd/pnd.go b/cmd/pnd.go deleted file mode 100644 index a17c4d289..000000000 --- a/cmd/pnd.go +++ /dev/null @@ -1,67 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -// pndCmd represents the pnd command -var pndCmd = &cobra.Command{ - Use: "pnd", - Short: "A brief description of your command", - Long: `A longer description that spans multiple lines and likely contains examples -and usage of using your command. For example: - -Cobra is a CLI library for Go that empowers applications. -This application is a tool to generate the needed files -to quickly create a Cobra application.`, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("pnd called") - }, -} - -func init() { - cliCmd.AddCommand(pndCmd) - - // Here you will define your flags and configuration settings. - - // Cobra supports Persistent Flags which will work for this command - // and all subcommands, e.g.: - // pndCmd.PersistentFlags().String("foo", "", "A help for foo") - - // Cobra supports local flags which will only run when this command - // is called directly, e.g.: - // pndCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") -} diff --git a/cmd/replace.go b/cmd/replace.go deleted file mode 100644 index 953b01bfe..000000000 --- a/cmd/replace.go +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" -) - -// replaceCmd represents the replace command -var replaceCmd = &cobra.Command{ - Use: "replace", - Args: cobra.ExactArgs(2), - Short: "set a value on a device", - Long: `Set a path value for a given device. Only one path and -only one value supported for now`, - Run: func(cmd *cobra.Command, args []string) { - log.Info(cli.Replace( - apiEndpoint, - uuid, - cliPnd, - args[0], - args[1], - )) - }, -} - -func init() { - cliSetCmd.AddCommand(replaceCmd) -} diff --git a/cmd/request.go b/cmd/request.go deleted file mode 100644 index f70586dc7..000000000 --- a/cmd/request.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" -) - -// requestCmd represents the request command -var requestCmd = &cobra.Command{ - Use: "request", - Args: cobra.ExactArgs(1), - Short: "requests a path from a specified device on the controller", - Long: `Requests a path from a specified device on the controller. - -The request path is passed as positional argument.`, - Run: func(cmd *cobra.Command, args []string) { - log.Info(cli.GetDevice( - apiEndpoint, - cliPnd, - args[0], - uuid, - )) - }, -} - -func init() { - cliCmd.AddCommand(requestCmd) - - requestCmd.Flags().StringVar(&uuid, "uuid", "", "uuid of the requested device") -} diff --git a/cmd/requestAll.go b/cmd/requestAll.go deleted file mode 100644 index 2fb8dbb1f..000000000 --- a/cmd/requestAll.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" -) - -// requestAllCmd represents the requestAll command -var requestAllCmd = &cobra.Command{ - Use: "request-all", - Args: cobra.ExactArgs(1), - Short: "requests specified path from all devices on the controller", - Long: `Requests a path from all devices on the controller known by -the controller. - -The request path is passed as positional argument.`, - RunE: func(cmd *cobra.Command, args []string) error { - resp, err := cli.GetDevice( - apiEndpoint, - cliPnd, - args[0], - ) - if err != nil { - return err - } - log.Info(resp) - return nil - }, -} - -func init() { - cliCmd.AddCommand(requestAllCmd) -} diff --git a/cmd/subscribe.go b/cmd/subscribe.go deleted file mode 100644 index 63e7a9ac5..000000000 --- a/cmd/subscribe.go +++ /dev/null @@ -1,59 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - "github.com/spf13/cobra" -) - -var sampleInterval int64 -var heartbeatInterval int64 - -// subscribeCmd represents the subscribe command -var subscribeCmd = &cobra.Command{ - Use: "subscribe", - Short: "subscribe to target", - Long: `Starts a gNMI subscriber requesting the specified paths on the target and logs the response to stdout. - -Only 'stream' mode with 'sample' operation supported.`, - RunE: func(cmd *cobra.Command, args []string) error { - return cli.Subscribe(address, username, password, "", sampleInterval, heartbeatInterval, args...) - }, -} - -func init() { - rootCmd.AddCommand(subscribeCmd) - - subscribeCmd.Flags().Int64Var(&sampleInterval, "sample-rate", 5, "Sample rate per second.") - subscribeCmd.Flags().Int64Var(&heartbeatInterval, "heartbeat-rate", 1, "Heartbeat rate per second.") -} diff --git a/cmd/target.go b/cmd/target.go deleted file mode 100644 index 97224d872..000000000 --- a/cmd/target.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - - "github.com/spf13/cobra" -) - -var bindAddr string - -// targetCmd represents the target command -var targetCmd = &cobra.Command{ - Use: "target", - Short: "start gnmi target", - Long: `Starts a gNMI target listening on the specified port.`, - RunE: func(cmd *cobra.Command, args []string) error { - return cli.Target(bindAddr) - }, -} - -func init() { - rootCmd.AddCommand(targetCmd) - - targetCmd.Flags().StringVar(&bindAddr, "bind-address", ":9339", "listen address of the target: [address]:port") -} diff --git a/cmd/update.go b/cmd/update.go deleted file mode 100644 index e7443de72..000000000 --- a/cmd/update.go +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "code.fbi.h-da.de/cocsn/gosdn/cli" - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" -) - -// updateCmd represents the update command -var updateCmd = &cobra.Command{ - Use: "update", - Args: cobra.ExactArgs(2), - Short: "update a value on a device", - Long: `Update a path value for a given device. Only one path and -only one value supported for now`, - Run: func(cmd *cobra.Command, args []string) { - log.Info(cli.Update( - apiEndpoint, - uuid, - cliPnd, - args[0], - args[1], - )) - }, -} - -func init() { - cliSetCmd.AddCommand(updateCmd) -} diff --git a/cmd/util.go b/cmd/util.go deleted file mode 100644 index 3ea5ddd50..000000000 --- a/cmd/util.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "errors" - - "github.com/spf13/cobra" -) - -// utilCmd represents the util command -var utilCmd = &cobra.Command{ - Use: "util", - Short: "multiple ygot utils - not yet implemented", - Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { - return errors.New("not implemented") - }, -} - -func init() { - ygotCmd.AddCommand(utilCmd) -} diff --git a/cmd/ygot.go b/cmd/ygot.go deleted file mode 100644 index 81ee206ba..000000000 --- a/cmd/ygot.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright © 2021 da/net research group <danet.fbi.h-da.de> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -package cmd - -import ( - "errors" - - "github.com/spf13/cobra" -) - -// ygotCmd represents the ygot command -var ygotCmd = &cobra.Command{ - Use: "ygot", - Short: "multiple ygot utils - not yet implemented", - Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { - return errors.New("not implemented") - }, -} - -func init() { - rootCmd.AddCommand(ygotCmd) -} diff --git a/go.mod b/go.mod index 2822dde48..f00c205dd 100644 --- a/go.mod +++ b/go.mod @@ -3,16 +3,15 @@ module code.fbi.h-da.de/cocsn/gosdn go 1.16 require ( - code.fbi.h-da.de/cocsn/api/go v0.0.0-20210609120033-1ef56612bd26 + code.fbi.h-da.de/cocsn/api/go v0.0.0-20210609143151-4dabee5ab99a + code.fbi.h-da.de/cocsn/gosdn/api v0.0.0-20210610093733-cbc69d7e537d code.fbi.h-da.de/cocsn/yang-models v0.0.7 github.com/aristanetworks/goarista v0.0.0-20201120222254-94a892eb0c6a github.com/docker/docker v20.10.6+incompatible github.com/golang/protobuf v1.5.2 github.com/google/gnxi v0.0.0-20210423111716-4b504ef806a7 github.com/google/uuid v1.2.0 - github.com/imdario/mergo v0.3.11 // indirect github.com/neo4j/neo4j-go-driver v1.8.3 - github.com/onsi/gomega v1.10.3 // indirect github.com/openconfig/gnmi v0.0.0-20210527163611-d3a3e30199da github.com/openconfig/goyang v0.2.4 github.com/openconfig/ygot v0.10.11 diff --git a/go.sum b/go.sum index fbaf8d267..74dfc0175 100644 --- a/go.sum +++ b/go.sum @@ -21,8 +21,12 @@ cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIA cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -code.fbi.h-da.de/cocsn/api/go v0.0.0-20210609120033-1ef56612bd26 h1:Uqo/Gfh/pwmkHZFiTtcJGCZbHh+ZDcD2W1zOdABerbI= code.fbi.h-da.de/cocsn/api/go v0.0.0-20210609120033-1ef56612bd26/go.mod h1:2+rnE92IyXLbiy3/92EM7JrtsY5tXPAKX90QmsT2+m0= +code.fbi.h-da.de/cocsn/api/go v0.0.0-20210609143151-4dabee5ab99a h1:C2tdh2A4RckZJXUymtF2ec8hE8mTkhn7EQJShv+i/Jk= +code.fbi.h-da.de/cocsn/api/go v0.0.0-20210609143151-4dabee5ab99a/go.mod h1:2+rnE92IyXLbiy3/92EM7JrtsY5tXPAKX90QmsT2+m0= +code.fbi.h-da.de/cocsn/gosdn v0.0.3-0.20210609130706-9cca50b3d195/go.mod h1:EK0GUnwNB+qMMjSJxGzLpfDw+KsUHS2LZkdzshldm4Q= +code.fbi.h-da.de/cocsn/gosdn/api v0.0.0-20210610093733-cbc69d7e537d h1:olcB+ojVhToetF73X1waLRaTG7oZpdFvZ2yUIAKiiI8= +code.fbi.h-da.de/cocsn/gosdn/api v0.0.0-20210610093733-cbc69d7e537d/go.mod h1:rn/FEXBauGQyFOIS2NhGd0EzF29Ibds0xt34Oo5wTgk= code.fbi.h-da.de/cocsn/yang-models v0.0.7 h1:3TOo8J+EdAJKeq4o3aaNWZRhjSwguIS8wciW1U9PkSk= code.fbi.h-da.de/cocsn/yang-models v0.0.7/go.mod h1:M+2HinfhTT8nA8qvn2cpWNlOtuiizTNDWA3yfy72K/g= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= diff --git a/test/integration/cliIntegration_test.go b/test/integration/cliIntegration_test.go index 248b6e376..97eda04e8 100644 --- a/test/integration/cliIntegration_test.go +++ b/test/integration/cliIntegration_test.go @@ -3,7 +3,7 @@ package integration import ( "testing" - "code.fbi.h-da.de/cocsn/gosdn/cli" + "code.fbi.h-da.de/cocsn/gosdn/api" ) func TestCapabilities(t *testing.T) { @@ -41,7 +41,7 @@ func TestCapabilities(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - if err := cli.Capabilities(tt.args.a, tt.args.u, tt.args.p); (err != nil) != tt.wantErr { + if err := api.Capabilities(tt.args.a, tt.args.u, tt.args.p); (err != nil) != tt.wantErr { t.Errorf("Capabilities() error = %v, wantErr %v", err, tt.wantErr) } }) diff --git a/test/integration/cmdIntegration_test.go b/test/integration/cmdIntegration_test.go index dd24e37ca..ae3d20904 100644 --- a/test/integration/cmdIntegration_test.go +++ b/test/integration/cmdIntegration_test.go @@ -6,7 +6,7 @@ import ( tpb "code.fbi.h-da.de/cocsn/api/go/gosdn/transport" - "code.fbi.h-da.de/cocsn/gosdn/cli" + "code.fbi.h-da.de/cocsn/gosdn/api" "code.fbi.h-da.de/cocsn/gosdn/nucleus/util/proto" guuid "github.com/google/uuid" gpb "github.com/openconfig/gnmi/proto/gnmi" @@ -98,7 +98,7 @@ func TestCmdIntegration(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { defer viper.Reset() - if err := cli.Init(testAPIEndpoint); (err != nil) != tt.wantErr { + if err := api.Init(testAPIEndpoint); (err != nil) != tt.wantErr { switch err.(type) { case viper.ConfigFileNotFoundError: default: @@ -109,7 +109,7 @@ func TestCmdIntegration(t *testing.T) { cliPnd := viper.GetString("CLI_PND") cliSbi := viper.GetString("CLI_SBI") - if _, err := cli.AddDevice( + if _, err := api.AddDevice( testAPIEndpoint, testUsername, testPassword, @@ -123,7 +123,7 @@ func TestCmdIntegration(t *testing.T) { } did := viper.GetString("LAST_DEVICE_UUID") - _, err := cli.GetDevice( + _, err := api.GetDevice( testAPIEndpoint, cliPnd, testPath, @@ -134,7 +134,7 @@ func TestCmdIntegration(t *testing.T) { return } - _, err = cli.GetDevice( + _, err = api.GetDevice( testAPIEndpoint, cliPnd, "", @@ -146,7 +146,7 @@ func TestCmdIntegration(t *testing.T) { } hostname := guuid.New().String() - _, err = cli.Update( + _, err = api.Update( testAPIEndpoint, did, cliPnd, @@ -158,10 +158,10 @@ func TestCmdIntegration(t *testing.T) { return } - resp, err := cli.GetDevice(testAddress, testUsername, testPassword, testPath) + resp, err := api.GetDevice(testAddress, testUsername, testPassword, testPath) if err != nil { if !tt.wantErr { - t.Errorf("cli.Get() error = %v, wantErr %v", err, tt.wantErr) + t.Errorf("api.Get() error = %v, wantErr %v", err, tt.wantErr) } return } -- GitLab