diff --git a/cmd/addDevice.go b/cmd/addDevice.go deleted file mode 100644 index 2304e22141967ed8947833b6999818f521f97a70..0000000000000000000000000000000000000000 --- 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 d61a454a9a347e8ebc05657d031afc785cb2517d..0000000000000000000000000000000000000000 --- 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 437f6f25f83b62616fd72c918bd78ee45ad82fbb..0000000000000000000000000000000000000000 --- 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 fc10bdb4fb746317c2450b4548cfae680115769f..0000000000000000000000000000000000000000 --- 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 fbb0c71ddbdb98f69d05d55932e44a55d48fd257..0000000000000000000000000000000000000000 --- 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 3b5cdcc1d8127037e3bf3e5736781527d789f8f2..0000000000000000000000000000000000000000 --- 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 56b93cb16e2a0d583ac76a2d2587c8e714bcce24..0000000000000000000000000000000000000000 --- 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 ef7320893641740fe0d465a13e3b7218ae6c2260..0000000000000000000000000000000000000000 --- 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 43cd98b7d379f61811c762bd4622acb1a9d9e2ee..0000000000000000000000000000000000000000 --- 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 2f394f86e45efa91deaff069bf4bbabe4aa75153..0000000000000000000000000000000000000000 --- 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 b302f872a9bfd809a962348e16bbd539a110ee39..0000000000000000000000000000000000000000 --- 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 e426d051678a51eb31183361c26716f0f8079726..0000000000000000000000000000000000000000 --- 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 c45a03b217358be731977c4ad44ec094b2623c0b..0000000000000000000000000000000000000000 --- 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 ea0a8c13f4e1c1959ba024e486ae22866e83d0c5..0000000000000000000000000000000000000000 --- 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 a17c4d2896fe4bf1a75057c1730859747d70a5ee..0000000000000000000000000000000000000000 --- 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 953b01bfeeef4ab175a3328294c97c9546d4750a..0000000000000000000000000000000000000000 --- 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 f70586dc7063f38f9b1a6c2f1b5f7348995e7dfd..0000000000000000000000000000000000000000 --- 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 2fb8dbb1fa6b263fb746b7307a85439e977b8cfa..0000000000000000000000000000000000000000 --- 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 63e7a9ac5c131d862253d34f7ba46e62cd5b2374..0000000000000000000000000000000000000000 --- 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 97224d87268e43bf3edadfa9368e141efe3148d0..0000000000000000000000000000000000000000 --- 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 e7443de720c7753a89ecc45beacef3a5a63a58a9..0000000000000000000000000000000000000000 --- 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 3ea5ddd50a2706cee1931690323d4e06b9a3d17c..0000000000000000000000000000000000000000 --- 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 81ee206ba74db83bbc6e2550b6cde8fe928a9965..0000000000000000000000000000000000000000 --- 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 2822dde484ee837498712dffd35a507c909c945a..f00c205ddc15db40bc315bd1d1935a69c6e32b61 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 fbaf8d2673f3a12dba8183eaa7d8ccfdf98ad892..74dfc0175dd4ab8ef2afc908b4936cd85b46f5e1 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 248b6e376e39ba6dbc5c63ec2b7c286398cc7ab9..97eda04e8cb0175fd76d3301bb42d5ec91bf8c73 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 dd24e37caa1144b200e1aa47b9bc6f97ae77c298..ae3d20904a6d3dba424e4c5a4d47b24ba3c92243 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 }