-
Notifications
You must be signed in to change notification settings - Fork 30
/
l3ext_rs_path_l3_out_att.go
154 lines (97 loc) · 4.01 KB
/
l3ext_rs_path_l3_out_att.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
package models
import (
"fmt"
"strconv"
"github.com/ciscoecosystem/aci-go-client/container"
)
const L3extrspathl3outattClassName = "l3extRsPathL3OutAtt"
type L3outPathAttachment struct {
BaseAttributes
L3outPathAttachmentAttributes
}
type L3outPathAttachmentAttributes struct {
TDn string `json:",omitempty"`
Addr string `json:",omitempty"`
Annotation string `json:",omitempty"`
Autostate string `json:",omitempty"`
Encap string `json:",omitempty"`
EncapScope string `json:",omitempty"`
IfInstT string `json:",omitempty"`
Ipv6Dad string `json:",omitempty"`
LlAddr string `json:",omitempty"`
Mac string `json:",omitempty"`
Mode string `json:",omitempty"`
Mtu string `json:",omitempty"`
TargetDscp string `json:",omitempty"`
}
func NewL3outPathAttachment(l3extRsPathL3OutAttRn, parentDn, description string, l3extRsPathL3OutAttattr L3outPathAttachmentAttributes) *L3outPathAttachment {
dn := fmt.Sprintf("%s/%s", parentDn, l3extRsPathL3OutAttRn)
return &L3outPathAttachment{
BaseAttributes: BaseAttributes{
DistinguishedName: dn,
Description: description,
Status: "created, modified",
ClassName: L3extrspathl3outattClassName,
Rn: l3extRsPathL3OutAttRn,
},
L3outPathAttachmentAttributes: l3extRsPathL3OutAttattr,
}
}
func (l3extRsPathL3OutAtt *L3outPathAttachment) ToMap() (map[string]string, error) {
l3extRsPathL3OutAttMap, err := l3extRsPathL3OutAtt.BaseAttributes.ToMap()
if err != nil {
return nil, err
}
A(l3extRsPathL3OutAttMap, "tDn", l3extRsPathL3OutAtt.TDn)
A(l3extRsPathL3OutAttMap, "addr", l3extRsPathL3OutAtt.Addr)
A(l3extRsPathL3OutAttMap, "annotation", l3extRsPathL3OutAtt.Annotation)
A(l3extRsPathL3OutAttMap, "autostate", l3extRsPathL3OutAtt.Autostate)
A(l3extRsPathL3OutAttMap, "encap", l3extRsPathL3OutAtt.Encap)
A(l3extRsPathL3OutAttMap, "encapScope", l3extRsPathL3OutAtt.EncapScope)
A(l3extRsPathL3OutAttMap, "ifInstT", l3extRsPathL3OutAtt.IfInstT)
A(l3extRsPathL3OutAttMap, "ipv6Dad", l3extRsPathL3OutAtt.Ipv6Dad)
A(l3extRsPathL3OutAttMap, "llAddr", l3extRsPathL3OutAtt.LlAddr)
A(l3extRsPathL3OutAttMap, "mac", l3extRsPathL3OutAtt.Mac)
A(l3extRsPathL3OutAttMap, "mode", l3extRsPathL3OutAtt.Mode)
A(l3extRsPathL3OutAttMap, "mtu", l3extRsPathL3OutAtt.Mtu)
A(l3extRsPathL3OutAttMap, "targetDscp", l3extRsPathL3OutAtt.TargetDscp)
return l3extRsPathL3OutAttMap, err
}
func L3outPathAttachmentFromContainerList(cont *container.Container, index int) *L3outPathAttachment {
L3outPathAttachmentCont := cont.S("imdata").Index(index).S(L3extrspathl3outattClassName, "attributes")
return &L3outPathAttachment{
BaseAttributes{
DistinguishedName: G(L3outPathAttachmentCont, "dn"),
Description: G(L3outPathAttachmentCont, "descr"),
Status: G(L3outPathAttachmentCont, "status"),
ClassName: L3extrspathl3outattClassName,
Rn: G(L3outPathAttachmentCont, "rn"),
},
L3outPathAttachmentAttributes{
TDn: G(L3outPathAttachmentCont, "tDn"),
Addr: G(L3outPathAttachmentCont, "addr"),
Annotation: G(L3outPathAttachmentCont, "annotation"),
Autostate: G(L3outPathAttachmentCont, "autostate"),
Encap: G(L3outPathAttachmentCont, "encap"),
EncapScope: G(L3outPathAttachmentCont, "encapScope"),
IfInstT: G(L3outPathAttachmentCont, "ifInstT"),
Ipv6Dad: G(L3outPathAttachmentCont, "ipv6Dad"),
LlAddr: G(L3outPathAttachmentCont, "llAddr"),
Mac: G(L3outPathAttachmentCont, "mac"),
Mode: G(L3outPathAttachmentCont, "mode"),
Mtu: G(L3outPathAttachmentCont, "mtu"),
TargetDscp: G(L3outPathAttachmentCont, "targetDscp"),
},
}
}
func L3outPathAttachmentFromContainer(cont *container.Container) *L3outPathAttachment {
return L3outPathAttachmentFromContainerList(cont, 0)
}
func L3outPathAttachmentListFromContainer(cont *container.Container) []*L3outPathAttachment {
length, _ := strconv.Atoi(G(cont, "totalCount"))
arr := make([]*L3outPathAttachment, length)
for i := 0; i < length; i++ {
arr[i] = L3outPathAttachmentFromContainerList(cont, i)
}
return arr
}