Skip to content

Commit

Permalink
[minor_changes] added functions for fvRsNodeAtt
Browse files Browse the repository at this point in the history
  • Loading branch information
abrahammughal authored and lhercot committed Jul 26, 2023
1 parent ac4d6e8 commit cd2aa76
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion client/fvAEPg_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func (sm *ServiceManager) ListApplicationEPG(application_profile string, tenant

baseurlStr := "/api/node/class"
dnUrl := fmt.Sprintf("%s/uni/tn-%s/ap-%s/fvAEPg.json", baseurlStr, tenant, application_profile)

cont, err := sm.GetViaURL(dnUrl)
list := models.ApplicationEPGListFromContainer(cont)

Expand Down Expand Up @@ -465,6 +464,40 @@ func (sm *ServiceManager) CreateRelationfvRsNodeAttFromApplicationEPG(parentDn,
return nil
}

func (sm *ServiceManager) CreateRelationfvRsNodeAtt(parentDn, encap, mode, description, deploymentImmediacy, tDn string) error {
dn := fmt.Sprintf("%s/rsnodeAtt-[%s]", parentDn, tDn)
containerJSON := []byte(fmt.Sprintf(`{
"%s": {
"attributes": {
"dn": "%s",
"encap": "%s",
"mode": "%s",
"descr": "%s",
"instrImedcy": "%s",
"tDn": "%s",
"annotation":"orchestrator:terraform"
}
}
}`, "fvRsNodeAtt", dn, encap, mode, description, deploymentImmediacy, tDn))

jsonPayload, err := container.ParseJSON(containerJSON)
if err != nil {
return err
}

req, err := sm.client.MakeRestRequest("POST", fmt.Sprintf("%s.json", sm.MOURL), jsonPayload, true)
if err != nil {
return err
}

_, _, err = sm.client.Do(req)
if err != nil {
return err
}

return nil
}

func (sm *ServiceManager) DeleteRelationfvRsNodeAttFromApplicationEPG(parentDn, tDn string) error {
dn := fmt.Sprintf("%s/rsnodeAtt-[%s]", parentDn, tDn)
return sm.DeleteByDn(dn, "fvRsNodeAtt")
Expand All @@ -486,6 +519,25 @@ func (sm *ServiceManager) ReadRelationfvRsNodeAttFromApplicationEPG(parentDn str
}
return st, err

}
func (sm *ServiceManager) ReadRelationfvRsNodeAtt(parentDn string) (interface{}, error) {
baseurlStr := "/api/node/class"
dnUrl := fmt.Sprintf("%s/%s/%s.json", baseurlStr, parentDn, "fvRsNodeAtt")
cont, err := sm.GetViaURL(dnUrl)

contList := models.ListFromContainer(cont, "fvRsNodeAtt")

st := make([]map[string]string, 0, 1)
for _, contItem := range contList {
paramMap := make(map[string]string)
paramMap["encap"] = models.G(contItem, "encap")
paramMap["instrImedcy"] = models.G(contItem, "instrImedcy")
paramMap["mode"] = models.G(contItem, "mode")
paramMap["descr"] = models.G(contItem, "descr")
st = append(st, paramMap)
}
return st, err

}
func (sm *ServiceManager) CreateRelationfvRsDppPolFromApplicationEPG(parentDn, tnQosDppPolName string) error {
dn := fmt.Sprintf("%s/rsdppPol", parentDn)
Expand Down

0 comments on commit cd2aa76

Please sign in to comment.