Skip to content
Snippets Groups Projects
Commit d34c744a authored by Neil-Jocelyn Schark's avatar Neil-Jocelyn Schark
Browse files

add linux support

parent c12d43c4
Branches
No related tags found
3 merge requests!406Draft: Add backup script,!404Enable export and import of SDN configuration,!377Add Linux support to venv-manager
Pipeline #116044 failed
This commit is part of merge request !404. Comments created here will be created in the context of that merge request.
......@@ -4,6 +4,7 @@ import (
"flag"
"fmt"
"os"
"strings"
venvmanager "code.fbi.h-da.de/danet/gosdn/applications/venv-manager/venv-manager"
"google.golang.org/grpc"
......@@ -30,6 +31,8 @@ func main() {
}
flag.Parse()
customContainerRegistryURL = ensureLastCharIsSlash(customContainerRegistryURL)
fmt.Println("I will try to connect to goSDN located at", dialConnectionURL)
venvManager := venvmanager.NewVenvManager(dialConnectionURL, dialOption, yamlFilepath, customContainerRegistryURL)
......@@ -50,3 +53,15 @@ func main() {
}
os.Exit(0)
}
func ensureLastCharIsSlash(inputString string) string {
if len(inputString) == 0 {
return inputString
}
if strings.HasSuffix(inputString, "/") {
return inputString
}
return inputString + "/"
}
......@@ -23,14 +23,19 @@ func (n Node) GetID() string {
// FillAllFields fills all remaining fields of object with data from YangData.
func (n *Node) FillAllFields(containerRegistryURL string) {
// make switch case here to differentialte between linux, arista, etc
// err = *&n.YangData.System.State.
// Works if linux and our gnmi target is used.
softwareVersion := n.YangData.System.State.SoftwareVersion
if softwareVersion != nil {
n.Kind = "linux"
n.Image = containerRegistryURL + *softwareVersion
return
}
// specific to arista
regex := regexp.MustCompile(`[0-9]+\.[0-9]+\.[0-9][A-Z]`)
dockerTag := string(regex.FindAll([]byte(*n.YangData.Lldp.Config.SystemDescription), 1)[0])
// If it's not linux with our gnmi target and not arista, we don't support it.
if len(dockerTag) == 0 {
n.Kind = "couldn't detect kind"
n.Image = "couldn't detect image"
......@@ -39,5 +44,4 @@ func (n *Node) FillAllFields(containerRegistryURL string) {
n.Kind = "ceos"
n.Image = containerRegistryURL + n.Kind + ":" + dockerTag
}
......@@ -215,7 +215,7 @@ func (v *VenvManager) getAndAddMoreData(topologyData *topology.GoSdnTopology) (*
// Create 'root' path to be able to load the whole model from the store.
path, err := ygot.StringToPath("/", ygot.StructuredPath)
if err != nil {
panic(err)
return nil, err
}
// just to load model data into goSDN to have newest data available for get request
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment