-
Notifications
You must be signed in to change notification settings - Fork 29
/
isisLvlComp_service.go
46 lines (39 loc) · 1.92 KB
/
isisLvlComp_service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package client
import (
"fmt"
"github.com/ciscoecosystem/aci-go-client/models"
)
func (sm *ServiceManager) CreateISISLevel(isis_level_type string, isis_domain_policy string, description string, nameAlias string, isisLvlCompAttr models.ISISLevelAttributes) (*models.ISISLevel, error) {
rn := fmt.Sprintf(models.RnisisLvlComp, isis_level_type)
parentDn := fmt.Sprintf(models.ParentDnisisLvlComp, isis_domain_policy)
isisLvlComp := models.NewISISLevel(rn, parentDn, description, nameAlias, isisLvlCompAttr)
err := sm.Save(isisLvlComp)
return isisLvlComp, err
}
func (sm *ServiceManager) ReadISISLevel(isis_level_type string, isis_domain_policy string) (*models.ISISLevel, error) {
dn := fmt.Sprintf(models.DnisisLvlComp, isis_domain_policy, isis_level_type)
cont, err := sm.Get(dn)
if err != nil {
return nil, err
}
isisLvlComp := models.ISISLevelFromContainer(cont)
return isisLvlComp, nil
}
func (sm *ServiceManager) DeleteISISLevel(isis_level_type string, isis_domain_policy string) error {
dn := fmt.Sprintf(models.DnisisLvlComp, isis_domain_policy, isis_level_type)
return sm.DeleteByDn(dn, models.IsislvlcompClassName)
}
func (sm *ServiceManager) UpdateISISLevel(isis_level_type string, isis_domain_policy string, description string, nameAlias string, isisLvlCompAttr models.ISISLevelAttributes) (*models.ISISLevel, error) {
rn := fmt.Sprintf(models.RnisisLvlComp, isis_level_type)
parentDn := fmt.Sprintf(models.ParentDnisisLvlComp, isis_domain_policy)
isisLvlComp := models.NewISISLevel(rn, parentDn, description, nameAlias, isisLvlCompAttr)
isisLvlComp.Status = "modified"
err := sm.Save(isisLvlComp)
return isisLvlComp, err
}
func (sm *ServiceManager) ListISISLevel(isis_domain_policy string) ([]*models.ISISLevel, error) {
dnUrl := fmt.Sprintf("%s/uni/fabric/isisDomP-%s/isisLvlComp.json", models.BaseurlStr, isis_domain_policy)
cont, err := sm.GetViaURL(dnUrl)
list := models.ISISLevelListFromContainer(cont)
return list, err
}