Skip to content

Commit

Permalink
[bugfix] Add function to extract dn or empty string from container an…
Browse files Browse the repository at this point in the history
…d apply it to fvAEPg model file (#279)
  • Loading branch information
abrahammughal authored Jul 27, 2023
1 parent cd2aa76 commit 65db596
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion models/fv_ae_pg.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func ApplicationEPGFromContainerList(cont *container.Container, index int) *Appl
ApplicationEPGCont := cont.S("imdata").Index(index).S(FvaepgClassName, "attributes")
return &ApplicationEPG{
BaseAttributes{
DistinguishedName: G(ApplicationEPGCont, "dn"),
DistinguishedName: GetDnFromContainer(ApplicationEPGCont),
Description: G(ApplicationEPGCont, "descr"),
Status: G(ApplicationEPGCont, "status"),
ClassName: FvaepgClassName,
Expand Down
4 changes: 4 additions & 0 deletions models/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ func G(cont *container.Container, key string) string {
return StripQuotes(cont.S(key).String())
}

func GetDnFromContainer(cont *container.Container) string {
return CurlyBraces(StripQuotes(cont.S("dn").String()))
}

func GetMOName(dn string) string {
arr := strings.Split(dn, "/")
hashedName := arr[len(arr)-1]
Expand Down

0 comments on commit 65db596

Please sign in to comment.