diff --git a/features/cm/ne.go b/features/cm/ne.go index 329ac9df..fd480da8 100644 --- a/features/cm/ne.go +++ b/features/cm/ne.go @@ -423,7 +423,13 @@ func ExportCmFromNF(w http.ResponseWriter, r *http.Request) { var scpCmd string ipType := global.ParseIPAddr(neInfo.Ip) - if neTypeLower != "omc" { + omcNetypeLower := strings.ToLower(config.GetYamlConfig().OMC.NeType) + etcListIMS := "{*.yaml,mmtel,vars.cfg}" + if config.GetYamlConfig().NE.EtcListIMS != "" { + etcListIMS = config.GetYamlConfig().NE.EtcListIMS + } + switch neTypeLower { + case omcNetypeLower: if ipType == global.IsIPv4 { scpCmd = fmt.Sprintf("scp -r %s@%s:%s/%s/*.yaml %s/etc/%s", config.GetYamlConfig().NE.User, neInfo.Ip, config.GetYamlConfig().NE.EtcDir, @@ -433,7 +439,17 @@ func ExportCmFromNF(w http.ResponseWriter, r *http.Request) { neInfo.Ip, config.GetYamlConfig().NE.EtcDir, neTypeLower, config.GetYamlConfig().OMC.Backup, neTypeLower) } - } else { + case "ims": + if ipType == global.IsIPv4 { + scpCmd = fmt.Sprintf("scp -r %s@%s:%s/%s/%s %s/etc/%s", config.GetYamlConfig().NE.User, + neInfo.Ip, config.GetYamlConfig().NE.EtcDir, neTypeLower, + etcListIMS, config.GetYamlConfig().OMC.Backup, neTypeLower) + } else { + scpCmd = fmt.Sprintf("scp -r %s@[%s]:%s/%s/%s %s/etc/%s", config.GetYamlConfig().NE.User, + neInfo.Ip, config.GetYamlConfig().NE.EtcDir, neTypeLower, + etcListIMS, config.GetYamlConfig().OMC.Backup, neTypeLower) + } + default: if ipType == global.IsIPv4 { scpCmd = fmt.Sprintf("scp -r %s@%s:%s/etc/*.yaml %s/etc/%s", config.GetYamlConfig().NE.User, neInfo.Ip, config.GetYamlConfig().NE.OmcDir, config.GetYamlConfig().OMC.Backup, neTypeLower) diff --git a/features/cm/software.go b/features/cm/software.go index d264b9cd..535a0fe9 100644 --- a/features/cm/software.go +++ b/features/cm/software.go @@ -698,7 +698,7 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) { return } } else if fileType == 2 { - dpkgCmd := fmt.Sprintf("sudo dpkg -i '%s'", filePath) + dpkgCmd := fmt.Sprintf("sudo dpkg -i --force-all '%s'", filePath) cmd := exec.Command("ssh", sshHost, dpkgCmd) out, err := cmd.CombinedOutput() log.Debugf("Exec output: %v", string(out)) @@ -744,7 +744,6 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) { services.ResponseInternalServerError500ProcessError(w, err) return } - } } @@ -839,7 +838,7 @@ func RollBackSoftwareToNF(w http.ResponseWriter, r *http.Request) { return } } else if fileType == 2 { - dpkgCmd := fmt.Sprintf("sudo dpkg -i '%s'", filePath) + dpkgCmd := fmt.Sprintf("sudo dpkg -i --force-all '%s'", filePath) cmd := exec.Command("ssh", sshHost, dpkgCmd) out, err := cmd.CombinedOutput() log.Debugf("Exec output: %v", string(out)) diff --git a/restagent/config/config.go b/restagent/config/config.go index 29aba635..2e5fd60b 100644 --- a/restagent/config/config.go +++ b/restagent/config/config.go @@ -114,6 +114,7 @@ type YamlConfig struct { OmcDir string `yaml:"omcdir"` ScpDir string `yaml:"scpdir"` LicenseDir string `yaml:"licensedir"` + EtcListIMS string `yaml:"etcListIMS"` } `yaml:"ne"` Auth struct { diff --git a/restagent/etc/restconf.yaml b/restagent/etc/restconf.yaml index 96413f38..fd6f8b19 100644 --- a/restagent/etc/restconf.yaml +++ b/restagent/etc/restconf.yaml @@ -69,6 +69,7 @@ mml: mmlHome: ./mmlhome upload: /home/agtuser +# NE config ne: user: root etcdir: /usr/local/etc @@ -76,6 +77,8 @@ ne: omcdir: /usr/local/omc scpdir: /tmp licensedir: /usr/local/etc/{neType}/license + # backup etc list of IMS + etcListIMS: '{*.yaml,mmtel,vars.cfg}' # chk2ne: true/false, if put OmcNeConfig parameters to NE omc: