diff --git a/client/igmpIfP_service.go b/client/igmpIfP_service.go new file mode 100644 index 0000000..aa93348 --- /dev/null +++ b/client/igmpIfP_service.go @@ -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 + } +} diff --git a/client/igmpIfPol_service.go b/client/igmpIfPol_service.go new file mode 100644 index 0000000..21200bb --- /dev/null +++ b/client/igmpIfPol_service.go @@ -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 +} diff --git a/client/l3extLIfP_service.go b/client/l3extLIfP_service.go index 422a6dc..8ca6d2e 100644 --- a/client/l3extLIfP_service.go +++ b/client/l3extLIfP_service.go @@ -369,3 +369,141 @@ func (sm *ServiceManager) ReadRelationl3extRsNdIfPolFromLogicalInterfaceProfile( } } + +func (sm *ServiceManager) CreateRelationPIMRsIfPolFromLogicalInterfaceProfile(parentDn, tDn string) error { + dn := fmt.Sprintf("%s/rsIfPol", parentDn) + containerJSON := []byte(fmt.Sprintf(`{ + "%s": { + "attributes": { + "dn": "%s", + "annotation": "orchestrator:terraform", + "tDn": "%s" + } + } + }`, "pimRsIfPol", dn, 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) ReadRelationPIMRsIfPolFromLogicalInterfaceProfile(parentDn string) (interface{}, error) { + dnUrl := fmt.Sprintf("%s/%s/%s/%s.json", models.BaseurlStr, parentDn, models.RnPimIfP, "pimRsIfPol") + cont, err := sm.GetViaURL(dnUrl) + contList := models.ListFromContainer(cont, "pimRsIfPol") + + if len(contList) > 0 { + dat := models.G(contList[0], "tDn") + return dat, err + } else { + return nil, err + } +} + +func (sm *ServiceManager) DeleteRelationPIMRsIfPolFromLogicalInterfaceProfile(parentDn string) error { + dn := fmt.Sprintf("%s/rsIfPol", parentDn) + return sm.DeleteByDn(dn, "pimRsIfPol") +} + +func (sm *ServiceManager) CreateRelationPIMIPv6RsIfPolFromLogicalInterfaceProfile(parentDn, tDn string) error { + dn := fmt.Sprintf("%s/rsV6IfPol", parentDn) + containerJSON := []byte(fmt.Sprintf(`{ + "%s": { + "attributes": { + "dn": "%s", + "annotation": "orchestrator:terraform", + "tDn": "%s" + } + } + }`, "pimRsV6IfPol", dn, 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) ReadRelationPIMIPv6RsIfPolFromLogicalInterfaceProfile(parentDn string) (interface{}, error) { + dnUrl := fmt.Sprintf("%s/%s/%s/%s.json", models.BaseurlStr, parentDn, models.RnPimIPV6IfP, "pimRsV6IfPol") + cont, err := sm.GetViaURL(dnUrl) + contList := models.ListFromContainer(cont, "pimRsV6IfPol") + + if len(contList) > 0 { + dat := models.G(contList[0], "tDn") + return dat, err + } else { + return nil, err + } +} + +func (sm *ServiceManager) DeleteRelationPIMIPv6RsIfPolFromLogicalInterfaceProfile(parentDn string) error { + dn := fmt.Sprintf("%s/rsV6IfPol", parentDn) + return sm.DeleteByDn(dn, "pimRsV6IfPol") +} + +func (sm *ServiceManager) CreateRelationIGMPRsIfPolFromLogicalInterfaceProfile(parentDn, tDn string) error { + dn := fmt.Sprintf("%s/rsIfPol", parentDn) + containerJSON := []byte(fmt.Sprintf(`{ + "%s": { + "attributes": { + "dn": "%s", + "annotation": "orchestrator:terraform", + "tDn": "%s" + } + } + }`, "igmpRsIfPol", dn, 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) ReadRelationIGMPRsIfPolFromLogicalInterfaceProfile(parentDn string) (interface{}, error) { + dnUrl := fmt.Sprintf("%s/%s/%s/%s.json", models.BaseurlStr, parentDn, models.RnIgmpIfP, "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 + } +} + +func (sm *ServiceManager) DeleteRelationIGMPRsIfPolFromLogicalInterfaceProfile(parentDn string) error { + dn := fmt.Sprintf("%s/rsIfPol", parentDn) + return sm.DeleteByDn(dn, "igmpRsIfPol") +} diff --git a/client/pimExtP_service.go b/client/pimExtP_service.go new file mode 100644 index 0000000..81d9ce9 --- /dev/null +++ b/client/pimExtP_service.go @@ -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 +} diff --git a/client/pimIPV6IfP_service.go b/client/pimIPV6IfP_service.go new file mode 100644 index 0000000..2a29723 --- /dev/null +++ b/client/pimIPV6IfP_service.go @@ -0,0 +1,104 @@ +package client + +import ( + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/ciscoecosystem/aci-go-client/v2/models" +) + +func (sm *ServiceManager) CreatePIMIPv6InterfaceProfile(logical_interface_profile string, logical_node_profile string, l3_outside string, tenant string, description string, pimIPV6IfPAttr models.PIMIPv6InterfaceProfileAttributes) (*models.PIMIPv6InterfaceProfile, error) { + + parentDn := fmt.Sprintf(models.ParentDnPimIPV6IfP, tenant, l3_outside, logical_node_profile, logical_interface_profile) + pimIPV6IfP := models.NewPIMIPv6InterfaceProfile(parentDn, description, pimIPV6IfPAttr) + + err := sm.Save(pimIPV6IfP) + return pimIPV6IfP, err +} + +func (sm *ServiceManager) ReadPIMIPv6InterfaceProfile(logical_interface_profile string, logical_node_profile string, l3_outside string, tenant string) (*models.PIMIPv6InterfaceProfile, error) { + + parentDn := fmt.Sprintf(models.ParentDnPimIPV6IfP, tenant, l3_outside, logical_node_profile, logical_interface_profile) + dn := fmt.Sprintf("%s/%s", parentDn, models.RnPimIPV6IfP) + + cont, err := sm.Get(dn) + if err != nil { + return nil, err + } + pimIPV6IfP := models.PIMIPv6InterfaceProfileFromContainer(cont) + return pimIPV6IfP, nil +} + +func (sm *ServiceManager) DeletePIMIPv6InterfaceProfile(logical_interface_profile string, logical_node_profile string, l3_outside string, tenant string) error { + + parentDn := fmt.Sprintf(models.ParentDnPimIPV6IfP, tenant, l3_outside, logical_node_profile, logical_interface_profile) + dn := fmt.Sprintf("%s/%s", parentDn, models.RnPimIPV6IfP) + + return sm.DeleteByDn(dn, models.PimIPV6IfPClassName) +} + +func (sm *ServiceManager) UpdatePIMIPv6InterfaceProfile(logical_interface_profile string, logical_node_profile string, l3_outside string, tenant string, description string, pimIPV6IfPAttr models.PIMIPv6InterfaceProfileAttributes) (*models.PIMIPv6InterfaceProfile, error) { + + parentDn := fmt.Sprintf(models.ParentDnPimIPV6IfP, tenant, l3_outside, logical_node_profile, logical_interface_profile) + pimIPV6IfP := models.NewPIMIPv6InterfaceProfile(parentDn, description, pimIPV6IfPAttr) + + pimIPV6IfP.Status = "modified" + err := sm.Save(pimIPV6IfP) + return pimIPV6IfP, err +} + +func (sm *ServiceManager) ListPIMIPv6InterfaceProfile(logical_interface_profile string, logical_node_profile string, l3_outside string, tenant string) ([]*models.PIMIPv6InterfaceProfile, error) { + + parentDn := fmt.Sprintf(models.ParentDnPimIPV6IfP, tenant, l3_outside, logical_node_profile, logical_interface_profile) + dnUrl := fmt.Sprintf("%s/%s/%s.json", models.BaseurlStr, parentDn, models.PimIPV6IfPClassName) + + cont, err := sm.GetViaURL(dnUrl) + list := models.PIMIPv6InterfaceProfileListFromContainer(cont) + return list, err +} + +func (sm *ServiceManager) CreateRelationPIMIPv6RsIfPol(parentDn, annotation, tDn string) error { + dn := fmt.Sprintf("%s/rsV6IfPol", parentDn) + containerJSON := []byte(fmt.Sprintf(`{ + "%s": { + "attributes": { + "dn": "%s", + "annotation": "%s", + "tDn": "%s" + } + } + }`, "pimRsV6IfPol", 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) DeleteRelationPIMIPv6RsIfPol(parentDn string) error { + dn := fmt.Sprintf("%s/rsV6IfPol", parentDn) + return sm.DeleteByDn(dn, "pimRsV6IfPol") +} + +func (sm *ServiceManager) ReadRelationPIMIPv6RsIfPol(parentDn string) (interface{}, error) { + dnUrl := fmt.Sprintf("%s/%s/%s.json", models.BaseurlStr, parentDn, "pimRsV6IfPol") + cont, err := sm.GetViaURL(dnUrl) + contList := models.ListFromContainer(cont, "pimRsV6IfPol") + + if len(contList) > 0 { + dat := models.G(contList[0], "tDn") + return dat, err + } else { + return nil, err + } +} diff --git a/client/pimIfP_service.go b/client/pimIfP_service.go new file mode 100644 index 0000000..4641898 --- /dev/null +++ b/client/pimIfP_service.go @@ -0,0 +1,104 @@ +package client + +import ( + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/ciscoecosystem/aci-go-client/v2/models" +) + +func (sm *ServiceManager) CreatePIMInterfaceProfile(logical_interface_profile string, logical_node_profile string, l3_outside string, tenant string, description string, pimIfPAttr models.PIMInterfaceProfileAttributes) (*models.PIMInterfaceProfile, error) { + + parentDn := fmt.Sprintf(models.ParentDnPimIfP, tenant, l3_outside, logical_node_profile, logical_interface_profile) + pimIfP := models.NewPIMInterfaceProfile(parentDn, description, pimIfPAttr) + + err := sm.Save(pimIfP) + return pimIfP, err +} + +func (sm *ServiceManager) ReadPIMInterfaceProfile(logical_interface_profile string, logical_node_profile string, l3_outside string, tenant string) (*models.PIMInterfaceProfile, error) { + + parentDn := fmt.Sprintf(models.ParentDnPimIfP, tenant, l3_outside, logical_node_profile, logical_interface_profile) + dn := fmt.Sprintf("%s/%s", parentDn, models.RnPimIfP) + + cont, err := sm.Get(dn) + if err != nil { + return nil, err + } + pimIfP := models.PIMInterfaceProfileFromContainer(cont) + return pimIfP, nil +} + +func (sm *ServiceManager) DeletePIMInterfaceProfile(logical_interface_profile string, logical_node_profile string, l3_outside string, tenant string) error { + + parentDn := fmt.Sprintf(models.ParentDnPimIfP, tenant, l3_outside, logical_node_profile, logical_interface_profile) + dn := fmt.Sprintf("%s/%s", parentDn, models.RnPimIfP) + + return sm.DeleteByDn(dn, models.PimIfPClassName) +} + +func (sm *ServiceManager) UpdatePIMInterfaceProfile(logical_interface_profile string, logical_node_profile string, l3_outside string, tenant string, description string, pimIfPAttr models.PIMInterfaceProfileAttributes) (*models.PIMInterfaceProfile, error) { + + parentDn := fmt.Sprintf(models.ParentDnPimIfP, tenant, l3_outside, logical_node_profile, logical_interface_profile) + pimIfP := models.NewPIMInterfaceProfile(parentDn, description, pimIfPAttr) + + pimIfP.Status = "modified" + err := sm.Save(pimIfP) + return pimIfP, err +} + +func (sm *ServiceManager) ListPIMInterfaceProfile(logical_interface_profile string, logical_node_profile string, l3_outside string, tenant string) ([]*models.PIMInterfaceProfile, error) { + + parentDn := fmt.Sprintf(models.ParentDnPimIfP, tenant, l3_outside, logical_node_profile, logical_interface_profile) + dnUrl := fmt.Sprintf("%s/%s/%s.json", models.BaseurlStr, parentDn, models.PimIfPClassName) + + cont, err := sm.GetViaURL(dnUrl) + list := models.PIMInterfaceProfileListFromContainer(cont) + return list, err +} + +func (sm *ServiceManager) CreateRelationPIMRsIfPol(parentDn, annotation, tDn string) error { + dn := fmt.Sprintf("%s/rsIfPol", parentDn) + containerJSON := []byte(fmt.Sprintf(`{ + "%s": { + "attributes": { + "dn": "%s", + "annotation": "%s", + "tDn": "%s" + } + } + }`, "pimRsIfPol", 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) DeleteRelationPIMRsIfPol(parentDn string) error { + dn := fmt.Sprintf("%s/rsIfPol", parentDn) + return sm.DeleteByDn(dn, "pimRsIfPol") +} + +func (sm *ServiceManager) ReadRelationPIMRsIfPol(parentDn string) (interface{}, error) { + dnUrl := fmt.Sprintf("%s/%s/%s.json", models.BaseurlStr, parentDn, "pimRsIfPol") + cont, err := sm.GetViaURL(dnUrl) + contList := models.ListFromContainer(cont, "pimRsIfPol") + + if len(contList) > 0 { + dat := models.G(contList[0], "tDn") + return dat, err + } else { + return nil, err + } +} diff --git a/client/pimIfPol_service.go b/client/pimIfPol_service.go new file mode 100644 index 0000000..8ce92b3 --- /dev/null +++ b/client/pimIfPol_service.go @@ -0,0 +1,65 @@ +package client + +import ( + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/models" +) + +func (sm *ServiceManager) CreatePIMInterfacePolicy(name string, tenant string, description string, pimIfPolAttr models.PIMInterfacePolicyAttributes) (*models.PIMInterfacePolicy, error) { + + rn := fmt.Sprintf(models.RnPimIfPol, name) + + parentDn := fmt.Sprintf(models.ParentDnPimIfPol, tenant) + pimIfPol := models.NewPIMInterfacePolicy(rn, parentDn, description, pimIfPolAttr) + + err := sm.Save(pimIfPol) + return pimIfPol, err +} + +func (sm *ServiceManager) ReadPIMInterfacePolicy(name string, tenant string) (*models.PIMInterfacePolicy, error) { + + rn := fmt.Sprintf(models.RnPimIfPol, name) + + parentDn := fmt.Sprintf(models.ParentDnPimIfPol, tenant) + dn := fmt.Sprintf("%s/%s", parentDn, rn) + + cont, err := sm.Get(dn) + if err != nil { + return nil, err + } + pimIfPol := models.PIMInterfacePolicyFromContainer(cont) + return pimIfPol, nil +} + +func (sm *ServiceManager) DeletePIMInterfacePolicy(name string, tenant string) error { + + rn := fmt.Sprintf(models.RnPimIfPol, name) + + parentDn := fmt.Sprintf(models.ParentDnPimIfPol, tenant) + dn := fmt.Sprintf("%s/%s", parentDn, rn) + + return sm.DeleteByDn(dn, models.PimIfPolClassName) +} + +func (sm *ServiceManager) UpdatePIMInterfacePolicy(name string, tenant string, description string, pimIfPolAttr models.PIMInterfacePolicyAttributes) (*models.PIMInterfacePolicy, error) { + + rn := fmt.Sprintf(models.RnPimIfPol, name) + + parentDn := fmt.Sprintf(models.ParentDnPimIfPol, tenant) + pimIfPol := models.NewPIMInterfacePolicy(rn, parentDn, description, pimIfPolAttr) + + pimIfPol.Status = "modified" + err := sm.Save(pimIfPol) + return pimIfPol, err +} + +func (sm *ServiceManager) ListPIMInterfacePolicy(tenant string) ([]*models.PIMInterfacePolicy, error) { + + parentDn := fmt.Sprintf(models.ParentDnPimIfPol, tenant) + dnUrl := fmt.Sprintf("%s/%s/%s.json", models.BaseurlStr, parentDn, models.PimIfPolClassName) + + cont, err := sm.GetViaURL(dnUrl) + list := models.PIMInterfacePolicyListFromContainer(cont) + return list, err +} diff --git a/models/cloudtemplate_region_detail.go b/models/cloudtemplate_region_detail.go index 51aa85a..bca6666 100644 --- a/models/cloudtemplate_region_detail.go +++ b/models/cloudtemplate_region_detail.go @@ -27,7 +27,7 @@ func NewCloudTemplateRegion(cloudtemplateRegionDetailRn, parentDn string, cloudt return &CloudTemplateRegion{ BaseAttributes: BaseAttributes{ DistinguishedName: dn, - Status: "modified", + Status: "created, modified", ClassName: CloudtemplateRegionDetailClassName, Rn: cloudtemplateRegionDetailRn, }, diff --git a/models/igmp_if_p.go b/models/igmp_if_p.go new file mode 100644 index 0000000..1af0845 --- /dev/null +++ b/models/igmp_if_p.go @@ -0,0 +1,83 @@ +package models + +import ( + "fmt" + "strconv" + + "github.com/ciscoecosystem/aci-go-client/v2/container" +) + +const ( + RnIgmpIfP = "igmpIfP" + IgmpIfPClassName = "igmpIfP" +) + +type IGMPInterfaceProfile struct { + BaseAttributes + IGMPInterfaceProfileAttributes +} + +type IGMPInterfaceProfileAttributes struct { + Annotation string `json:",omitempty"` + Name string `json:",omitempty"` + NameAlias string `json:",omitempty"` +} + +func NewIGMPInterfaceProfile(parentDn, description string, igmpIfPAttr IGMPInterfaceProfileAttributes) *IGMPInterfaceProfile { + dn := fmt.Sprintf("%s/%s", parentDn, RnIgmpIfP) + return &IGMPInterfaceProfile{ + BaseAttributes: BaseAttributes{ + DistinguishedName: dn, + Description: description, + Status: "created, modified", + ClassName: IgmpIfPClassName, + Rn: RnIgmpIfP, + }, + IGMPInterfaceProfileAttributes: igmpIfPAttr, + } +} + +func (igmpIfP *IGMPInterfaceProfile) ToMap() (map[string]string, error) { + igmpIfPMap, err := igmpIfP.BaseAttributes.ToMap() + if err != nil { + return nil, err + } + + A(igmpIfPMap, "annotation", igmpIfP.Annotation) + A(igmpIfPMap, "name", igmpIfP.Name) + A(igmpIfPMap, "nameAlias", igmpIfP.NameAlias) + return igmpIfPMap, err +} + +func IGMPInterfaceProfileFromContainerList(cont *container.Container, index int) *IGMPInterfaceProfile { + InterfaceProfileCont := cont.S("imdata").Index(index).S(IgmpIfPClassName, "attributes") + return &IGMPInterfaceProfile{ + BaseAttributes{ + DistinguishedName: G(InterfaceProfileCont, "dn"), + Description: G(InterfaceProfileCont, "descr"), + Status: G(InterfaceProfileCont, "status"), + ClassName: IgmpIfPClassName, + Rn: G(InterfaceProfileCont, "rn"), + }, + IGMPInterfaceProfileAttributes{ + Annotation: G(InterfaceProfileCont, "annotation"), + Name: G(InterfaceProfileCont, "name"), + NameAlias: G(InterfaceProfileCont, "nameAlias"), + }, + } +} + +func IGMPInterfaceProfileFromContainer(cont *container.Container) *IGMPInterfaceProfile { + return IGMPInterfaceProfileFromContainerList(cont, 0) +} + +func IGMPInterfaceProfileListFromContainer(cont *container.Container) []*IGMPInterfaceProfile { + length, _ := strconv.Atoi(G(cont, "totalCount")) + arr := make([]*IGMPInterfaceProfile, length) + + for i := 0; i < length; i++ { + arr[i] = IGMPInterfaceProfileFromContainerList(cont, i) + } + + return arr +} diff --git a/models/igmp_if_pol.go b/models/igmp_if_pol.go new file mode 100644 index 0000000..9c62240 --- /dev/null +++ b/models/igmp_if_pol.go @@ -0,0 +1,118 @@ +package models + +import ( + "fmt" + "strconv" + + "github.com/ciscoecosystem/aci-go-client/v2/container" +) + +const ( + RnIgmpIfPol = "igmpIfPol-%s" + DnIgmpIfPol = "uni/tn-%s/igmpIfPol-%s" + ParentDnIgmpIfPol = "uni/tn-%s" + IgmpIfPolClassName = "igmpIfPol" +) + +type IGMPInterfacePolicy struct { + BaseAttributes + IGMPInterfacePolicyAttributes +} + +type IGMPInterfacePolicyAttributes struct { + Annotation string `json:",omitempty"` + GrpTimeout string `json:",omitempty"` + IfCtrl string `json:",omitempty"` + LastMbrCnt string `json:",omitempty"` + LastMbrRespTime string `json:",omitempty"` + Name string `json:",omitempty"` + NameAlias string `json:",omitempty"` + QuerierTimeout string `json:",omitempty"` + QueryIntvl string `json:",omitempty"` + RobustFac string `json:",omitempty"` + RspIntvl string `json:",omitempty"` + StartQueryCnt string `json:",omitempty"` + StartQueryIntvl string `json:",omitempty"` + Ver string `json:",omitempty"` +} + +func NewIGMPInterfacePolicy(igmpIfPolRn, parentDn, description string, igmpIfPolAttr IGMPInterfacePolicyAttributes) *IGMPInterfacePolicy { + dn := fmt.Sprintf("%s/%s", parentDn, igmpIfPolRn) + return &IGMPInterfacePolicy{ + BaseAttributes: BaseAttributes{ + DistinguishedName: dn, + Description: description, + Status: "created, modified", + ClassName: IgmpIfPolClassName, + Rn: igmpIfPolRn, + }, + IGMPInterfacePolicyAttributes: igmpIfPolAttr, + } +} + +func (igmpIfPol *IGMPInterfacePolicy) ToMap() (map[string]string, error) { + igmpIfPolMap, err := igmpIfPol.BaseAttributes.ToMap() + if err != nil { + return nil, err + } + + A(igmpIfPolMap, "annotation", igmpIfPol.Annotation) + A(igmpIfPolMap, "grpTimeout", igmpIfPol.GrpTimeout) + A(igmpIfPolMap, "ifCtrl", igmpIfPol.IfCtrl) + A(igmpIfPolMap, "lastMbrCnt", igmpIfPol.LastMbrCnt) + A(igmpIfPolMap, "lastMbrRespTime", igmpIfPol.LastMbrRespTime) + A(igmpIfPolMap, "name", igmpIfPol.Name) + A(igmpIfPolMap, "nameAlias", igmpIfPol.NameAlias) + A(igmpIfPolMap, "querierTimeout", igmpIfPol.QuerierTimeout) + A(igmpIfPolMap, "queryIntvl", igmpIfPol.QueryIntvl) + A(igmpIfPolMap, "robustFac", igmpIfPol.RobustFac) + A(igmpIfPolMap, "rspIntvl", igmpIfPol.RspIntvl) + A(igmpIfPolMap, "startQueryCnt", igmpIfPol.StartQueryCnt) + A(igmpIfPolMap, "startQueryIntvl", igmpIfPol.StartQueryIntvl) + A(igmpIfPolMap, "ver", igmpIfPol.Ver) + return igmpIfPolMap, err +} + +func IGMPInterfacePolicyFromContainerList(cont *container.Container, index int) *IGMPInterfacePolicy { + IGMPInterfacePolicyCont := cont.S("imdata").Index(index).S(IgmpIfPolClassName, "attributes") + return &IGMPInterfacePolicy{ + BaseAttributes{ + DistinguishedName: G(IGMPInterfacePolicyCont, "dn"), + Description: G(IGMPInterfacePolicyCont, "descr"), + Status: G(IGMPInterfacePolicyCont, "status"), + ClassName: IgmpIfPolClassName, + Rn: G(IGMPInterfacePolicyCont, "rn"), + }, + IGMPInterfacePolicyAttributes{ + Annotation: G(IGMPInterfacePolicyCont, "annotation"), + GrpTimeout: G(IGMPInterfacePolicyCont, "grpTimeout"), + IfCtrl: G(IGMPInterfacePolicyCont, "ifCtrl"), + LastMbrCnt: G(IGMPInterfacePolicyCont, "lastMbrCnt"), + LastMbrRespTime: G(IGMPInterfacePolicyCont, "lastMbrRespTime"), + Name: G(IGMPInterfacePolicyCont, "name"), + NameAlias: G(IGMPInterfacePolicyCont, "nameAlias"), + QuerierTimeout: G(IGMPInterfacePolicyCont, "querierTimeout"), + QueryIntvl: G(IGMPInterfacePolicyCont, "queryIntvl"), + RobustFac: G(IGMPInterfacePolicyCont, "robustFac"), + RspIntvl: G(IGMPInterfacePolicyCont, "rspIntvl"), + StartQueryCnt: G(IGMPInterfacePolicyCont, "startQueryCnt"), + StartQueryIntvl: G(IGMPInterfacePolicyCont, "startQueryIntvl"), + Ver: G(IGMPInterfacePolicyCont, "ver"), + }, + } +} + +func IGMPInterfacePolicyFromContainer(cont *container.Container) *IGMPInterfacePolicy { + return IGMPInterfacePolicyFromContainerList(cont, 0) +} + +func IGMPInterfacePolicyListFromContainer(cont *container.Container) []*IGMPInterfacePolicy { + length, _ := strconv.Atoi(G(cont, "totalCount")) + arr := make([]*IGMPInterfacePolicy, length) + + for i := 0; i < length; i++ { + arr[i] = IGMPInterfacePolicyFromContainerList(cont, i) + } + + return arr +} diff --git a/models/pim_ext_p.go b/models/pim_ext_p.go new file mode 100644 index 0000000..4fbe34e --- /dev/null +++ b/models/pim_ext_p.go @@ -0,0 +1,88 @@ +package models + +import ( + "fmt" + "strconv" + + "github.com/ciscoecosystem/aci-go-client/v2/container" +) + +const ( + RnPimExtP = "pimextp" + DnPimExtP = "uni/tn-%s/out-%s/pimextp" + ParentDnPimExtP = "uni/tn-%s/out-%s" + PimExtPClassName = "pimExtP" +) + +type PIMExternalProfile struct { + BaseAttributes + PIMExternalProfileAttributes +} + +type PIMExternalProfileAttributes struct { + Annotation string `json:",omitempty"` + EnabledAf string `json:",omitempty"` + Name string `json:",omitempty"` + NameAlias string `json:",omitempty"` +} + +func NewPIMExternalProfile(parentDn, description string, pimExtPAttr PIMExternalProfileAttributes) *PIMExternalProfile { + dn := fmt.Sprintf("%s/%s", parentDn, RnPimExtP) + return &PIMExternalProfile{ + BaseAttributes: BaseAttributes{ + DistinguishedName: dn, + Description: description, + Status: "created, modified", + ClassName: PimExtPClassName, + Rn: RnPimExtP, + }, + PIMExternalProfileAttributes: pimExtPAttr, + } +} + +func (pimExtP *PIMExternalProfile) ToMap() (map[string]string, error) { + pimExtPMap, err := pimExtP.BaseAttributes.ToMap() + if err != nil { + return nil, err + } + + A(pimExtPMap, "annotation", pimExtP.Annotation) + A(pimExtPMap, "enabledAf", pimExtP.EnabledAf) + A(pimExtPMap, "name", pimExtP.Name) + A(pimExtPMap, "nameAlias", pimExtP.NameAlias) + return pimExtPMap, err +} + +func PIMExternalProfileFromContainerList(cont *container.Container, index int) *PIMExternalProfile { + ExternalProfileCont := cont.S("imdata").Index(index).S(PimExtPClassName, "attributes") + return &PIMExternalProfile{ + BaseAttributes{ + DistinguishedName: G(ExternalProfileCont, "dn"), + Description: G(ExternalProfileCont, "descr"), + Status: G(ExternalProfileCont, "status"), + ClassName: PimExtPClassName, + Rn: G(ExternalProfileCont, "rn"), + }, + PIMExternalProfileAttributes{ + Annotation: G(ExternalProfileCont, "annotation"), + EnabledAf: G(ExternalProfileCont, "enabledAf"), + Name: G(ExternalProfileCont, "name"), + NameAlias: G(ExternalProfileCont, "nameAlias"), + }, + } +} + +func PIMExternalProfileFromContainer(cont *container.Container) *PIMExternalProfile { + return PIMExternalProfileFromContainerList(cont, 0) +} + +func PIMExternalProfileListFromContainer(cont *container.Container) []*PIMExternalProfile { + length, _ := strconv.Atoi(G(cont, "totalCount")) + arr := make([]*PIMExternalProfile, length) + + for i := 0; i < length; i++ { + arr[i] = PIMExternalProfileFromContainerList(cont, i) + } + + return arr +} diff --git a/models/pim_if_p.go b/models/pim_if_p.go new file mode 100644 index 0000000..6ccaa72 --- /dev/null +++ b/models/pim_if_p.go @@ -0,0 +1,85 @@ +package models + +import ( + "fmt" + "strconv" + + "github.com/ciscoecosystem/aci-go-client/v2/container" +) + +const ( + RnPimIfP = "pimifp" + DnPimIfP = "uni/tn-%s/out-%s/lnodep-%s/lifp-%s/pimifp" + ParentDnPimIfP = "uni/tn-%s/out-%s/lnodep-%s/lifp-%s" + PimIfPClassName = "pimIfP" +) + +type PIMInterfaceProfile struct { + BaseAttributes + PIMInterfaceProfileAttributes +} + +type PIMInterfaceProfileAttributes struct { + Annotation string `json:",omitempty"` + Name string `json:",omitempty"` + NameAlias string `json:",omitempty"` +} + +func NewPIMInterfaceProfile(parentDn, description string, pimIfPAttr PIMInterfaceProfileAttributes) *PIMInterfaceProfile { + dn := fmt.Sprintf("%s/%s", parentDn, RnPimIfP) + return &PIMInterfaceProfile{ + BaseAttributes: BaseAttributes{ + DistinguishedName: dn, + Description: description, + Status: "created, modified", + ClassName: PimIfPClassName, + Rn: RnPimIfP, + }, + PIMInterfaceProfileAttributes: pimIfPAttr, + } +} + +func (pimIfP *PIMInterfaceProfile) ToMap() (map[string]string, error) { + pimIfPMap, err := pimIfP.BaseAttributes.ToMap() + if err != nil { + return nil, err + } + + A(pimIfPMap, "annotation", pimIfP.Annotation) + A(pimIfPMap, "name", pimIfP.Name) + A(pimIfPMap, "nameAlias", pimIfP.NameAlias) + return pimIfPMap, err +} + +func PIMInterfaceProfileFromContainerList(cont *container.Container, index int) *PIMInterfaceProfile { + InterfaceProfileCont := cont.S("imdata").Index(index).S(PimIfPClassName, "attributes") + return &PIMInterfaceProfile{ + BaseAttributes{ + DistinguishedName: G(InterfaceProfileCont, "dn"), + Description: G(InterfaceProfileCont, "descr"), + Status: G(InterfaceProfileCont, "status"), + ClassName: PimIfPClassName, + Rn: G(InterfaceProfileCont, "rn"), + }, + PIMInterfaceProfileAttributes{ + Annotation: G(InterfaceProfileCont, "annotation"), + Name: G(InterfaceProfileCont, "name"), + NameAlias: G(InterfaceProfileCont, "nameAlias"), + }, + } +} + +func PIMInterfaceProfileFromContainer(cont *container.Container) *PIMInterfaceProfile { + return PIMInterfaceProfileFromContainerList(cont, 0) +} + +func PIMInterfaceProfileListFromContainer(cont *container.Container) []*PIMInterfaceProfile { + length, _ := strconv.Atoi(G(cont, "totalCount")) + arr := make([]*PIMInterfaceProfile, length) + + for i := 0; i < length; i++ { + arr[i] = PIMInterfaceProfileFromContainerList(cont, i) + } + + return arr +} diff --git a/models/pim_if_pol.go b/models/pim_if_pol.go new file mode 100644 index 0000000..f56ffdf --- /dev/null +++ b/models/pim_if_pol.go @@ -0,0 +1,109 @@ +package models + +import ( + "fmt" + "strconv" + + "github.com/ciscoecosystem/aci-go-client/v2/container" +) + +const ( + RnPimIfPol = "pimifpol-%s" + DnPimIfPol = "uni/tn-%s/pimifpol-%s" + ParentDnPimIfPol = "uni/tn-%s" + PimIfPolClassName = "pimIfPol" +) + +type PIMInterfacePolicy struct { + BaseAttributes + PIMInterfacePolicyAttributes +} + +type PIMInterfacePolicyAttributes struct { + Annotation string `json:",omitempty"` + AuthKey string `json:",omitempty"` + AuthT string `json:",omitempty"` + Ctrl string `json:",omitempty"` + DrDelay string `json:",omitempty"` + DrPrio string `json:",omitempty"` + HelloItvl string `json:",omitempty"` + JpInterval string `json:",omitempty"` + Name string `json:",omitempty"` + NameAlias string `json:",omitempty"` + SecureAuthKey string `json:",omitempty"` +} + +func NewPIMInterfacePolicy(pimIfPolRn, parentDn, description string, pimIfPolAttr PIMInterfacePolicyAttributes) *PIMInterfacePolicy { + dn := fmt.Sprintf("%s/%s", parentDn, pimIfPolRn) + return &PIMInterfacePolicy{ + BaseAttributes: BaseAttributes{ + DistinguishedName: dn, + Description: description, + Status: "created, modified", + ClassName: PimIfPolClassName, + Rn: pimIfPolRn, + }, + PIMInterfacePolicyAttributes: pimIfPolAttr, + } +} + +func (pimIfPol *PIMInterfacePolicy) ToMap() (map[string]string, error) { + pimIfPolMap, err := pimIfPol.BaseAttributes.ToMap() + if err != nil { + return nil, err + } + + A(pimIfPolMap, "annotation", pimIfPol.Annotation) + A(pimIfPolMap, "authKey", pimIfPol.AuthKey) + A(pimIfPolMap, "authT", pimIfPol.AuthT) + A(pimIfPolMap, "ctrl", pimIfPol.Ctrl) + A(pimIfPolMap, "drDelay", pimIfPol.DrDelay) + A(pimIfPolMap, "drPrio", pimIfPol.DrPrio) + A(pimIfPolMap, "helloItvl", pimIfPol.HelloItvl) + A(pimIfPolMap, "jpInterval", pimIfPol.JpInterval) + A(pimIfPolMap, "name", pimIfPol.Name) + A(pimIfPolMap, "nameAlias", pimIfPol.NameAlias) + A(pimIfPolMap, "secureAuthKey", pimIfPol.SecureAuthKey) + return pimIfPolMap, err +} + +func PIMInterfacePolicyFromContainerList(cont *container.Container, index int) *PIMInterfacePolicy { + PIMInterfacePolicyCont := cont.S("imdata").Index(index).S(PimIfPolClassName, "attributes") + return &PIMInterfacePolicy{ + BaseAttributes{ + DistinguishedName: G(PIMInterfacePolicyCont, "dn"), + Description: G(PIMInterfacePolicyCont, "descr"), + Status: G(PIMInterfacePolicyCont, "status"), + ClassName: PimIfPolClassName, + Rn: G(PIMInterfacePolicyCont, "rn"), + }, + PIMInterfacePolicyAttributes{ + Annotation: G(PIMInterfacePolicyCont, "annotation"), + AuthKey: G(PIMInterfacePolicyCont, "authKey"), + AuthT: G(PIMInterfacePolicyCont, "authT"), + Ctrl: G(PIMInterfacePolicyCont, "ctrl"), + DrDelay: G(PIMInterfacePolicyCont, "drDelay"), + DrPrio: G(PIMInterfacePolicyCont, "drPrio"), + HelloItvl: G(PIMInterfacePolicyCont, "helloItvl"), + JpInterval: G(PIMInterfacePolicyCont, "jpInterval"), + Name: G(PIMInterfacePolicyCont, "name"), + NameAlias: G(PIMInterfacePolicyCont, "nameAlias"), + SecureAuthKey: G(PIMInterfacePolicyCont, "secureAuthKey"), + }, + } +} + +func PIMInterfacePolicyFromContainer(cont *container.Container) *PIMInterfacePolicy { + return PIMInterfacePolicyFromContainerList(cont, 0) +} + +func PIMInterfacePolicyListFromContainer(cont *container.Container) []*PIMInterfacePolicy { + length, _ := strconv.Atoi(G(cont, "totalCount")) + arr := make([]*PIMInterfacePolicy, length) + + for i := 0; i < length; i++ { + arr[i] = PIMInterfacePolicyFromContainerList(cont, i) + } + + return arr +} diff --git a/models/pim_ipv6_if_p.go b/models/pim_ipv6_if_p.go new file mode 100644 index 0000000..d13c5ed --- /dev/null +++ b/models/pim_ipv6_if_p.go @@ -0,0 +1,85 @@ +package models + +import ( + "fmt" + "strconv" + + "github.com/ciscoecosystem/aci-go-client/v2/container" +) + +const ( + RnPimIPV6IfP = "pimipv6ifp" + DnPimIPV6IfP = "uni/tn-%s/out-%s/lnodep-%s/lifp-%s/pimipv6ifp" + ParentDnPimIPV6IfP = "uni/tn-%s/out-%s/lnodep-%s/lifp-%s" + PimIPV6IfPClassName = "pimIPV6IfP" +) + +type PIMIPv6InterfaceProfile struct { + BaseAttributes + PIMIPv6InterfaceProfileAttributes +} + +type PIMIPv6InterfaceProfileAttributes struct { + Annotation string `json:",omitempty"` + Name string `json:",omitempty"` + NameAlias string `json:",omitempty"` +} + +func NewPIMIPv6InterfaceProfile(parentDn, description string, pimIPV6IfPAttr PIMIPv6InterfaceProfileAttributes) *PIMIPv6InterfaceProfile { + dn := fmt.Sprintf("%s/%s", parentDn, RnPimIPV6IfP) + return &PIMIPv6InterfaceProfile{ + BaseAttributes: BaseAttributes{ + DistinguishedName: dn, + Description: description, + Status: "created, modified", + ClassName: PimIPV6IfPClassName, + Rn: RnPimIPV6IfP, + }, + PIMIPv6InterfaceProfileAttributes: pimIPV6IfPAttr, + } +} + +func (pimIPV6IfP *PIMIPv6InterfaceProfile) ToMap() (map[string]string, error) { + pimIPV6IfPMap, err := pimIPV6IfP.BaseAttributes.ToMap() + if err != nil { + return nil, err + } + + A(pimIPV6IfPMap, "annotation", pimIPV6IfP.Annotation) + A(pimIPV6IfPMap, "name", pimIPV6IfP.Name) + A(pimIPV6IfPMap, "nameAlias", pimIPV6IfP.NameAlias) + return pimIPV6IfPMap, err +} + +func PIMIPv6InterfaceProfileFromContainerList(cont *container.Container, index int) *PIMIPv6InterfaceProfile { + InterfaceProfileCont := cont.S("imdata").Index(index).S(PimIPV6IfPClassName, "attributes") + return &PIMIPv6InterfaceProfile{ + BaseAttributes{ + DistinguishedName: G(InterfaceProfileCont, "dn"), + Description: G(InterfaceProfileCont, "descr"), + Status: G(InterfaceProfileCont, "status"), + ClassName: PimIPV6IfPClassName, + Rn: G(InterfaceProfileCont, "rn"), + }, + PIMIPv6InterfaceProfileAttributes{ + Annotation: G(InterfaceProfileCont, "annotation"), + Name: G(InterfaceProfileCont, "name"), + NameAlias: G(InterfaceProfileCont, "nameAlias"), + }, + } +} + +func PIMIPv6InterfaceProfileFromContainer(cont *container.Container) *PIMIPv6InterfaceProfile { + return PIMIPv6InterfaceProfileFromContainerList(cont, 0) +} + +func PIMIPv6InterfaceProfileListFromContainer(cont *container.Container) []*PIMIPv6InterfaceProfile { + length, _ := strconv.Atoi(G(cont, "totalCount")) + arr := make([]*PIMIPv6InterfaceProfile, length) + + for i := 0; i < length; i++ { + arr[i] = PIMIPv6InterfaceProfileFromContainerList(cont, i) + } + + return arr +}