-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[minor_change] Add model and client files for PIM external (pimExtP),…
… PIM (pimIfP and pimIfPol), PIM IPv6 (pimIPV6IfP) and IGMP interface (igmpIfPol and igmpIfP) profiles, add relation to l3extLIfP and fix issue with re-creation of cloudtemplateRegionDetail
- Loading branch information
Showing
14 changed files
with
1,201 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package client | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/ciscoecosystem/aci-go-client/v2/container" | ||
"github.com/ciscoecosystem/aci-go-client/v2/models" | ||
) | ||
|
||
func (sm *ServiceManager) CreateIGMPInterfaceProfile(parentDn string, description string, igmpIfPAttr models.IGMPInterfaceProfileAttributes) (*models.IGMPInterfaceProfile, error) { | ||
|
||
igmpIfP := models.NewIGMPInterfaceProfile(parentDn, description, igmpIfPAttr) | ||
|
||
err := sm.Save(igmpIfP) | ||
return igmpIfP, err | ||
} | ||
|
||
func (sm *ServiceManager) ReadIGMPInterfaceProfile(parentDn string) (*models.InterfaceProfile, error) { | ||
|
||
dn := fmt.Sprintf("%s/%s", parentDn, models.RnIgmpIfP) | ||
|
||
cont, err := sm.Get(dn) | ||
if err != nil { | ||
return nil, err | ||
} | ||
igmpIfP := models.InterfaceProfileFromContainer(cont) | ||
return igmpIfP, nil | ||
} | ||
|
||
func (sm *ServiceManager) DeleteIGMPInterfaceProfile(parentDn string) error { | ||
|
||
dn := fmt.Sprintf("%s/%s", parentDn, models.RnIgmpIfP) | ||
|
||
return sm.DeleteByDn(dn, models.IgmpIfPClassName) | ||
} | ||
|
||
func (sm *ServiceManager) UpdateIGMPInterfaceProfile(parentDn string, description string, igmpIfPAttr models.IGMPInterfaceProfileAttributes) (*models.IGMPInterfaceProfile, error) { | ||
|
||
igmpIfP := models.NewIGMPInterfaceProfile(parentDn, description, igmpIfPAttr) | ||
|
||
igmpIfP.Status = "modified" | ||
err := sm.Save(igmpIfP) | ||
return igmpIfP, err | ||
} | ||
|
||
func (sm *ServiceManager) ListIGMPInterfaceProfile(parentDn string) ([]*models.InterfaceProfile, error) { | ||
|
||
dnUrl := fmt.Sprintf("%s/%s/%s.json", models.BaseurlStr, parentDn, models.IgmpIfPClassName) | ||
|
||
cont, err := sm.GetViaURL(dnUrl) | ||
list := models.InterfaceProfileListFromContainer(cont) | ||
return list, err | ||
} | ||
|
||
func (sm *ServiceManager) CreateRelationIGMPRsIfPol(parentDn, annotation, tDn string) error { | ||
dn := fmt.Sprintf("%s/rsIfPol", parentDn) | ||
containerJSON := []byte(fmt.Sprintf(`{ | ||
"%s": { | ||
"attributes": { | ||
"dn": "%s", | ||
"annotation": "%s", | ||
"tDn": "%s" | ||
} | ||
} | ||
}`, "igmpRsIfPol", dn, annotation, 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 | ||
} | ||
cont, _, err := sm.client.Do(req) | ||
if err != nil { | ||
return err | ||
} | ||
fmt.Printf("%+v", cont) | ||
return nil | ||
} | ||
|
||
func (sm *ServiceManager) DeleteRelationIGMPRsIfPol(parentDn string) error { | ||
dn := fmt.Sprintf("%s/rsIfPol", parentDn) | ||
return sm.DeleteByDn(dn, "igmpRsIfPol") | ||
} | ||
|
||
func (sm *ServiceManager) ReadRelationIGMPRsIfPol(parentDn string) (interface{}, error) { | ||
dnUrl := fmt.Sprintf("%s/%s/%s.json", models.BaseurlStr, parentDn, "igmpRsIfPol") | ||
cont, err := sm.GetViaURL(dnUrl) | ||
contList := models.ListFromContainer(cont, "igmpRsIfPol") | ||
|
||
if len(contList) > 0 { | ||
dat := models.G(contList[0], "tDn") | ||
return dat, err | ||
} else { | ||
return nil, err | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package client | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/ciscoecosystem/aci-go-client/v2/models" | ||
) | ||
|
||
func (sm *ServiceManager) CreateIGMPInterfacePolicy(name string, tenant string, description string, igmpIfPolAttr models.IGMPInterfacePolicyAttributes) (*models.IGMPInterfacePolicy, error) { | ||
|
||
rn := fmt.Sprintf(models.RnIgmpIfPol, name) | ||
|
||
parentDn := fmt.Sprintf(models.ParentDnIgmpIfPol, tenant) | ||
igmpIfPol := models.NewIGMPInterfacePolicy(rn, parentDn, description, igmpIfPolAttr) | ||
|
||
err := sm.Save(igmpIfPol) | ||
return igmpIfPol, err | ||
} | ||
|
||
func (sm *ServiceManager) ReadIGMPInterfacePolicy(name string, tenant string) (*models.IGMPInterfacePolicy, error) { | ||
|
||
rn := fmt.Sprintf(models.RnIgmpIfPol, name) | ||
|
||
parentDn := fmt.Sprintf(models.ParentDnIgmpIfPol, tenant) | ||
dn := fmt.Sprintf("%s/%s", parentDn, rn) | ||
|
||
cont, err := sm.Get(dn) | ||
if err != nil { | ||
return nil, err | ||
} | ||
igmpIfPol := models.IGMPInterfacePolicyFromContainer(cont) | ||
return igmpIfPol, nil | ||
} | ||
|
||
func (sm *ServiceManager) DeleteIGMPInterfacePolicy(name string, tenant string) error { | ||
|
||
rn := fmt.Sprintf(models.RnIgmpIfPol, name) | ||
|
||
parentDn := fmt.Sprintf(models.ParentDnIgmpIfPol, tenant) | ||
dn := fmt.Sprintf("%s/%s", parentDn, rn) | ||
|
||
return sm.DeleteByDn(dn, models.IgmpIfPolClassName) | ||
} | ||
|
||
func (sm *ServiceManager) UpdateIGMPInterfacePolicy(name string, tenant string, description string, igmpIfPolAttr models.IGMPInterfacePolicyAttributes) (*models.IGMPInterfacePolicy, error) { | ||
|
||
rn := fmt.Sprintf(models.RnIgmpIfPol, name) | ||
|
||
parentDn := fmt.Sprintf(models.ParentDnIgmpIfPol, tenant) | ||
igmpIfPol := models.NewIGMPInterfacePolicy(rn, parentDn, description, igmpIfPolAttr) | ||
|
||
igmpIfPol.Status = "modified" | ||
err := sm.Save(igmpIfPol) | ||
return igmpIfPol, err | ||
} | ||
|
||
func (sm *ServiceManager) ListIGMPInterfacePolicy(tenant string) ([]*models.IGMPInterfacePolicy, error) { | ||
|
||
parentDn := fmt.Sprintf(models.ParentDnIgmpIfPol, tenant) | ||
dnUrl := fmt.Sprintf("%s/%s/%s.json", models.BaseurlStr, parentDn, models.IgmpIfPolClassName) | ||
|
||
cont, err := sm.GetViaURL(dnUrl) | ||
list := models.IGMPInterfacePolicyListFromContainer(cont) | ||
return list, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package client | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/ciscoecosystem/aci-go-client/v2/models" | ||
) | ||
|
||
func (sm *ServiceManager) CreatePIMExternalProfile(l3_outside string, tenant string, description string, pimExtPAttr models.PIMExternalProfileAttributes) (*models.PIMExternalProfile, error) { | ||
|
||
parentDn := fmt.Sprintf(models.ParentDnPimExtP, tenant, l3_outside) | ||
pimExtP := models.NewPIMExternalProfile(parentDn, description, pimExtPAttr) | ||
|
||
err := sm.Save(pimExtP) | ||
return pimExtP, err | ||
} | ||
|
||
func (sm *ServiceManager) ReadPIMExternalProfile(l3_outside string, tenant string) (*models.PIMExternalProfile, error) { | ||
|
||
parentDn := fmt.Sprintf(models.ParentDnPimExtP, tenant, l3_outside) | ||
dn := fmt.Sprintf("%s/%s", parentDn, models.RnPimExtP) | ||
|
||
cont, err := sm.Get(dn) | ||
if err != nil { | ||
return nil, err | ||
} | ||
pimExtP := models.PIMExternalProfileFromContainer(cont) | ||
return pimExtP, nil | ||
} | ||
|
||
func (sm *ServiceManager) DeletePIMExternalProfile(l3_outside string, tenant string) error { | ||
|
||
parentDn := fmt.Sprintf(models.ParentDnPimExtP, tenant, l3_outside) | ||
dn := fmt.Sprintf("%s/%s", parentDn, models.RnPimExtP) | ||
|
||
return sm.DeleteByDn(dn, models.PimExtPClassName) | ||
} | ||
|
||
func (sm *ServiceManager) UpdatePIMExternalProfile(l3_outside string, tenant string, description string, pimExtPAttr models.PIMExternalProfileAttributes) (*models.PIMExternalProfile, error) { | ||
|
||
parentDn := fmt.Sprintf(models.ParentDnPimExtP, tenant, l3_outside) | ||
pimExtP := models.NewPIMExternalProfile(parentDn, description, pimExtPAttr) | ||
|
||
pimExtP.Status = "modified" | ||
err := sm.Save(pimExtP) | ||
return pimExtP, err | ||
} | ||
|
||
func (sm *ServiceManager) ListPIMExternalProfile(l3_outside string, tenant string) ([]*models.PIMExternalProfile, error) { | ||
|
||
parentDn := fmt.Sprintf(models.ParentDnPimExtP, tenant, l3_outside) | ||
dnUrl := fmt.Sprintf("%s/%s/%s.json", models.BaseurlStr, parentDn, models.PimExtPClassName) | ||
|
||
cont, err := sm.GetViaURL(dnUrl) | ||
list := models.PIMExternalProfileListFromContainer(cont) | ||
return list, err | ||
} |
Oops, something went wrong.