-
Notifications
You must be signed in to change notification settings - Fork 30
/
ipNexthopEpP_service.go
46 lines (37 loc) · 1.85 KB
/
ipNexthopEpP_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) CreateNexthopEpPReachability(nhAddr string, parent_dn string, description string, nameAlias string, ipNexthopEpPAttr models.NexthopEpPReachabilityAttributes) (*models.NexthopEpPReachability, error) {
rn := fmt.Sprintf(models.RnipNexthopEpP, nhAddr)
ipNexthopEpP := models.NewNexthopEpPReachability(rn, parent_dn, description, nameAlias, ipNexthopEpPAttr)
err := sm.Save(ipNexthopEpP)
return ipNexthopEpP, err
}
func (sm *ServiceManager) ReadNexthopEpPReachability(nhAddr string, parent_dn string) (*models.NexthopEpPReachability, error) {
dn := parent_dn + "/" + fmt.Sprintf(models.RnipNexthopEpP, nhAddr)
cont, err := sm.Get(dn)
if err != nil {
return nil, err
}
ipNexthopEpP := models.NexthopEpPReachabilityFromContainer(cont)
return ipNexthopEpP, nil
}
func (sm *ServiceManager) DeleteNexthopEpPReachability(nhAddr string, parent_dn string) error {
dn := parent_dn + "/" + fmt.Sprintf(models.RnipNexthopEpP, nhAddr)
return sm.DeleteByDn(dn, models.IpnexthopeppClassName)
}
func (sm *ServiceManager) UpdateNexthopEpPReachability(nhAddr string, parent_dn string, description string, nameAlias string, ipNexthopEpPAttr models.NexthopEpPReachabilityAttributes) (*models.NexthopEpPReachability, error) {
rn := fmt.Sprintf(models.RnipNexthopEpP, nhAddr)
ipNexthopEpP := models.NewNexthopEpPReachability(rn, parent_dn, description, nameAlias, ipNexthopEpPAttr)
ipNexthopEpP.Status = "modified"
err := sm.Save(ipNexthopEpP)
return ipNexthopEpP, err
}
func (sm *ServiceManager) ListNexthopEpPReachability(parent_dn string) ([]*models.NexthopEpPReachability, error) {
dnUrl := fmt.Sprintf("%s/%s/ipNexthopEpP.json", models.BaseurlStr, parent_dn)
cont, err := sm.GetViaURL(dnUrl)
list := models.NexthopEpPReachabilityListFromContainer(cont)
return list, err
}