Skip to content
Snippets Groups Projects

Enable export and import of SDN configuration

Merged Ghost User requested to merge export-import-sdn-config into develop
3 files
+ 24
5
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -23,14 +23,19 @@ func (n Node) GetID() string {
@@ -23,14 +23,19 @@ func (n Node) GetID() string {
// FillAllFields fills all remaining fields of object with data from YangData.
// FillAllFields fills all remaining fields of object with data from YangData.
func (n *Node) FillAllFields(containerRegistryURL string) {
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
// err = *&n.YangData.System.State.
if softwareVersion != nil {
 
n.Kind = "linux"
 
n.Image = containerRegistryURL + *softwareVersion
 
return
 
}
// specific to arista
// specific to arista
regex := regexp.MustCompile(`[0-9]+\.[0-9]+\.[0-9][A-Z]`)
regex := regexp.MustCompile(`[0-9]+\.[0-9]+\.[0-9][A-Z]`)
dockerTag := string(regex.FindAll([]byte(*n.YangData.Lldp.Config.SystemDescription), 1)[0])
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 {
if len(dockerTag) == 0 {
n.Kind = "couldn't detect kind"
n.Kind = "couldn't detect kind"
n.Image = "couldn't detect image"
n.Image = "couldn't detect image"
@@ -39,5 +44,4 @@ func (n *Node) FillAllFields(containerRegistryURL string) {
@@ -39,5 +44,4 @@ func (n *Node) FillAllFields(containerRegistryURL string) {
n.Kind = "ceos"
n.Kind = "ceos"
n.Image = containerRegistryURL + n.Kind + ":" + dockerTag
n.Image = containerRegistryURL + n.Kind + ":" + dockerTag
}
}
Loading