Skip to content
Snippets Groups Projects

Add Linux support to venv-manager

Merged Ghost User requested to merge venv-manager/add-linux-support into develop
All threads resolved!
Files
11
@@ -23,12 +23,33 @@ 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
// Works if linux and our gnmi target is used.
softwareVersion := n.YangData.System.State.SoftwareVersion
+1
if softwareVersion != nil {
// Checks if software version is in compatible format.
result, _ := regexp.MatchString(`^([A-Za-z0-9\.\/])*:([A-Za-z0-9\.])*`, *softwareVersion)
if result {
n.Kind = "linux"
n.Image = containerRegistryURL + *softwareVersion
return
}
// specific to arista
n.Kind = "couldn't detect kind"
n.Image = "couldn't detect image"
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"
return
}
n.Kind = "ceos"
n.Image = containerRegistryURL + n.Kind + ":" + dockerTag
}
Loading