This repository has been archived by the owner on Nov 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
ethernet_span_cfg.go
239 lines (191 loc) · 9.91 KB
/
ethernet_span_cfg.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
// This module contains a collection of YANG definitions
// for Cisco IOS-XR Ethernet-SPAN package configuration.
//
// This module contains definitions
// for the following management objects:
// span-monitor-session: none
//
// This YANG module augments the
// Cisco-IOS-XR-ifmgr-cfg,
// Cisco-IOS-XR-l2vpn-cfg
// modules with configuration data.
//
// Copyright (c) 2013-2018 by Cisco Systems, Inc.
// All rights reserved.
package ethernet_span_cfg
import (
"fmt"
"github.com/CiscoDevNet/ydk-go/ydk"
"github.com/CiscoDevNet/ydk-go/ydk/types"
"github.com/CiscoDevNet/ydk-go/ydk/types/yfilter"
"github.com/CiscoDevNet/ydk-go/ydk/models/cisco_ios_xr"
"reflect"
)
func init() {
ydk.YLogDebug(fmt.Sprintf("Registering top level entities for package ethernet_span_cfg"))
ydk.RegisterEntity("{http://cisco.com/ns/yang/Cisco-IOS-XR-Ethernet-SPAN-cfg span-monitor-session}", reflect.TypeOf(SpanMonitorSession{}))
ydk.RegisterEntity("Cisco-IOS-XR-Ethernet-SPAN-cfg:span-monitor-session", reflect.TypeOf(SpanMonitorSession{}))
}
// SpanTrafficDirection represents Span traffic direction
type SpanTrafficDirection string
const (
// Replicate only received (ingress) traffic
SpanTrafficDirection_rx_only SpanTrafficDirection = "rx-only"
// Replicate only transmitted (egress) traffic
SpanTrafficDirection_tx_only SpanTrafficDirection = "tx-only"
)
// SpanMirrorInterval represents Span mirror interval
type SpanMirrorInterval string
const (
// Mirror 1 in every 512 packets
SpanMirrorInterval_Y_512 SpanMirrorInterval = "512"
// Mirror 1 in every 1024 packets
SpanMirrorInterval_Y_1k SpanMirrorInterval = "1k"
// Mirror 1 in every 2048 packets
SpanMirrorInterval_Y_2k SpanMirrorInterval = "2k"
// Mirror 1 in every 4096 packets
SpanMirrorInterval_Y_4k SpanMirrorInterval = "4k"
// Mirror 1 in every 8192 packets
SpanMirrorInterval_Y_8k SpanMirrorInterval = "8k"
// Mirror 1 in every 16384 packets
SpanMirrorInterval_Y_16k SpanMirrorInterval = "16k"
)
// SpanDestination represents Span destination
type SpanDestination string
const (
// Destination Interface
SpanDestination_interface_ SpanDestination = "interface"
// Destination Pseudowire
SpanDestination_pseudowire SpanDestination = "pseudowire"
// Destination next-hop IPv4 address
SpanDestination_ipv4_address SpanDestination = "ipv4-address"
// Destination next-hop IPv6 address
SpanDestination_ipv6_address SpanDestination = "ipv6-address"
)
// SpanMonitorSession
// none
type SpanMonitorSession struct {
EntityData types.CommonEntityData
YFilter yfilter.YFilter
// Monitor-session configuration commands.
Sessions SpanMonitorSession_Sessions
}
func (spanMonitorSession *SpanMonitorSession) GetEntityData() *types.CommonEntityData {
spanMonitorSession.EntityData.YFilter = spanMonitorSession.YFilter
spanMonitorSession.EntityData.YangName = "span-monitor-session"
spanMonitorSession.EntityData.BundleName = "cisco_ios_xr"
spanMonitorSession.EntityData.ParentYangName = "Cisco-IOS-XR-Ethernet-SPAN-cfg"
spanMonitorSession.EntityData.SegmentPath = "Cisco-IOS-XR-Ethernet-SPAN-cfg:span-monitor-session"
spanMonitorSession.EntityData.AbsolutePath = spanMonitorSession.EntityData.SegmentPath
spanMonitorSession.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()
spanMonitorSession.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()
spanMonitorSession.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()
spanMonitorSession.EntityData.Children = types.NewOrderedMap()
spanMonitorSession.EntityData.Children.Append("sessions", types.YChild{"Sessions", &spanMonitorSession.Sessions})
spanMonitorSession.EntityData.Leafs = types.NewOrderedMap()
spanMonitorSession.EntityData.YListKeys = []string {}
return &(spanMonitorSession.EntityData)
}
// SpanMonitorSession_Sessions
// Monitor-session configuration commands
type SpanMonitorSession_Sessions struct {
EntityData types.CommonEntityData
YFilter yfilter.YFilter
// Configuration for a particular Monitor Session. The type is slice of
// SpanMonitorSession_Sessions_Session.
Session []*SpanMonitorSession_Sessions_Session
}
func (sessions *SpanMonitorSession_Sessions) GetEntityData() *types.CommonEntityData {
sessions.EntityData.YFilter = sessions.YFilter
sessions.EntityData.YangName = "sessions"
sessions.EntityData.BundleName = "cisco_ios_xr"
sessions.EntityData.ParentYangName = "span-monitor-session"
sessions.EntityData.SegmentPath = "sessions"
sessions.EntityData.AbsolutePath = "Cisco-IOS-XR-Ethernet-SPAN-cfg:span-monitor-session/" + sessions.EntityData.SegmentPath
sessions.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()
sessions.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()
sessions.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()
sessions.EntityData.Children = types.NewOrderedMap()
sessions.EntityData.Children.Append("session", types.YChild{"Session", nil})
for i := range sessions.Session {
sessions.EntityData.Children.Append(types.GetSegmentPath(sessions.Session[i]), types.YChild{"Session", sessions.Session[i]})
}
sessions.EntityData.Leafs = types.NewOrderedMap()
sessions.EntityData.YListKeys = []string {}
return &(sessions.EntityData)
}
// SpanMonitorSession_Sessions_Session
// Configuration for a particular Monitor Session
type SpanMonitorSession_Sessions_Session struct {
EntityData types.CommonEntityData
YFilter yfilter.YFilter
YListKey string
// This attribute is a key. Session Name. The type is string with length:
// 1..79.
Session interface{}
// Enable a Monitor Session. Setting this item causes the Monitor Session to
// be created. The type is SpanSessionClass. The default value is ethernet.
Class interface{}
// Specify the inject interface name. The type is string with pattern:
// [a-zA-Z0-9._/-]+.
InjectInterface interface{}
// Specify a destination.
Destination SpanMonitorSession_Sessions_Session_Destination
}
func (session *SpanMonitorSession_Sessions_Session) GetEntityData() *types.CommonEntityData {
session.EntityData.YFilter = session.YFilter
session.EntityData.YangName = "session"
session.EntityData.BundleName = "cisco_ios_xr"
session.EntityData.ParentYangName = "sessions"
session.EntityData.SegmentPath = "session" + types.AddKeyToken(session.Session, "session")
session.EntityData.AbsolutePath = "Cisco-IOS-XR-Ethernet-SPAN-cfg:span-monitor-session/sessions/" + session.EntityData.SegmentPath
session.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()
session.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()
session.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()
session.EntityData.Children = types.NewOrderedMap()
session.EntityData.Children.Append("destination", types.YChild{"Destination", &session.Destination})
session.EntityData.Leafs = types.NewOrderedMap()
session.EntityData.Leafs.Append("session", types.YLeaf{"Session", session.Session})
session.EntityData.Leafs.Append("class", types.YLeaf{"Class", session.Class})
session.EntityData.Leafs.Append("inject-interface", types.YLeaf{"InjectInterface", session.InjectInterface})
session.EntityData.YListKeys = []string {"Session"}
return &(session.EntityData)
}
// SpanMonitorSession_Sessions_Session_Destination
// Specify a destination
type SpanMonitorSession_Sessions_Session_Destination struct {
EntityData types.CommonEntityData
YFilter yfilter.YFilter
// Specify the type of destination. The type is SpanDestination.
DestinationType interface{}
// Specify the destination interface name. The type is string with pattern:
// [a-zA-Z0-9._/-]+.
DestinationInterfaceName interface{}
// Specify the destination next-hop IPv4 address. The type is string with
// pattern:
// (([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?.
DestinationIpv4Address interface{}
// Specify the destination next-hop IPv6 address. The type is string with
// pattern:
// ((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\p{N}\p{L}]+)?.
DestinationIpv6Address interface{}
}
func (destination *SpanMonitorSession_Sessions_Session_Destination) GetEntityData() *types.CommonEntityData {
destination.EntityData.YFilter = destination.YFilter
destination.EntityData.YangName = "destination"
destination.EntityData.BundleName = "cisco_ios_xr"
destination.EntityData.ParentYangName = "session"
destination.EntityData.SegmentPath = "destination"
destination.EntityData.AbsolutePath = "Cisco-IOS-XR-Ethernet-SPAN-cfg:span-monitor-session/sessions/session/" + destination.EntityData.SegmentPath
destination.EntityData.CapabilitiesTable = cisco_ios_xr.GetCapabilities()
destination.EntityData.NamespaceTable = cisco_ios_xr.GetNamespaces()
destination.EntityData.BundleYangModelsLocation = cisco_ios_xr.GetModelsPath()
destination.EntityData.Children = types.NewOrderedMap()
destination.EntityData.Leafs = types.NewOrderedMap()
destination.EntityData.Leafs.Append("destination-type", types.YLeaf{"DestinationType", destination.DestinationType})
destination.EntityData.Leafs.Append("destination-interface-name", types.YLeaf{"DestinationInterfaceName", destination.DestinationInterfaceName})
destination.EntityData.Leafs.Append("destination-ipv4-address", types.YLeaf{"DestinationIpv4Address", destination.DestinationIpv4Address})
destination.EntityData.Leafs.Append("destination-ipv6-address", types.YLeaf{"DestinationIpv6Address", destination.DestinationIpv6Address})
destination.EntityData.YListKeys = []string {}
return &(destination.EntityData)
}