-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathospfv2-traffic.yaml
268 lines (231 loc) · 5.67 KB
/
ospfv2-traffic.yaml
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# -*- coding: utf-8 -*-
# @Author: mkatta for OSPFv3 and traffic
# @Date: 2021-09-28
-
name: Create session
stc:
action: session
user: ansible
name: ospf_traffic1
chassis: "{{ hostvars[inventory_hostname].chassis }}"
-
name: Create the base ports
stc:
action: create
objects:
- project:
- port:
location: "//${chassis[0]}/1/1"
name: Port1
- port:
location: "//${chassis[1]}/1/1"
name: Port2
-
name: create 1 OSPF device under port1
stc:
action: perform
command: DeviceCreate
properties:
ParentList: ref:/project
CreateCount: 1
DeviceCount: 1
Port: ref:/port[@Name='Port1']
IfStack: Ipv4If EthIIIf
IfCount: '1 1'
name: "OSPFDevice1"
-
name: Configure the IP address of device 1
stc:
action: config
count: 1
objects: ref:/EmulatedDevice[@Name='OSPFDevice1']
properties:
Ipv4If:
Gateway: 10.0.0.3
Address: 10.0.0.2
-
name: create OSPF on this device 1
stc:
action: create
under: /EmulatedDevice[@Name='OSPFDevice1']
count: 1
objects:
- Ospfv2RouterConfig:
AreaId: 0.0.0.0
NetworkType: P2P
name: "OSPFRouter1"
-
name: create 1 OSPF device under port2
stc:
action: perform
command: DeviceCreate
properties:
ParentList: ref:/project
CreateCount: 1
DeviceCount: 1
Port: ref:/port[@Name='Port2']
IfStack: Ipv4If EthIIIf
IfCount: '1 1'
name: "OSPFDevice2"
-
name: Configure the IP address of device 2
stc:
action: config
count: 1
objects: /EmulatedDevice[@Name='OSPFDevice2']
properties:
Ipv4If:
Gateway: 10.0.0.2
Address: 10.0.0.3
-
name: create OSPF on the device2
stc:
action: create
under: /EmulatedDevice[@Name='OSPFDevice2']
count: 1
objects:
- Ospfv2RouterConfig:
AreaId: 0.0.0.0
NetworkType: P2P
name: "OSPFRouter2"
-
name: create NSSA on device1
stc:
action: create
under: /EmulatedDevice[@Name='OSPFDevice1']/Ospfv2RouterConfig[@Name='OSPFRouter1']
count: 1
objects:
- ExternalLsaBlock:
name: "NSSA1"
Ipv4NetworkBlock:
NetworkCount: 10
StartIpList: 2.2.2.2
-
name: create NSSA on device2
stc:
action: create
under: /EmulatedDevice[@Name='OSPFDevice2']/Ospfv2RouterConfig[@Name='OSPFRouter2']
count: 1
objects:
- ExternalLsaBlock:
name: "NSSA2"
Ipv4NetworkBlock:
NetworkCount: 10
StartIpList: 1.1.1.1
-
name: Configure the traffic generator1
stc:
count: 1
action: create
under: /project
objects:
- StreamBlock:
EnableStreamOnlyGeneration: true
SrcBinding-targets: |
ref:/EmulatedDevice[@Name='OSPFDevice1']/Ospfv2RouterConfig[@Name='OSPFRouter1']
/ExternalLsaBlock[@Name='NSSA1']/Ipv4NetworkBlock
DstBinding-targets: |
ref:/EmulatedDevice[@Name='OSPFDevice2']/Ospfv2RouterConfig[@Name='OSPFRouter2']
/ExternalLsaBlock[@Name='NSSA2']/Ipv4NetworkBlock
AffiliationStreamBlockLoadProfile:
Load: 10
-
name: subscribe to ospf results
stc:
action: perform
command: SubscribeResultsView
properties:
ExecuteSynchronous: true
TemplateUri: "/Result Views/Routing Protocols/OSPFv2 Results.xml"
-
name: Take the ports online
stc:
action: perform
command: AttachPorts
properties:
RevokeOwner: true
PortList: ref:/port
-
name: start devices
stc:
action: perform
command: DeviceStart
properties:
DeviceList: ref:/project
-
name: Wait for the OSPF1 Adjacency to be formed
stc:
action: wait
objects: ref:/EmulatedDevice[@Name='OSPFDevice1']/Ospfv2RouterConfig[@Name='OSPFRouter1']
until: AdjacencyStatus=FULL
-
name: Wait for the OSPF2 Adjacency to be formed
stc:
action: wait
objects: ref:/EmulatedDevice[@Name='OSPFDevice2']/Ospfv2RouterConfig[@Name='OSPFRouter2']
until: AdjacencyStatus=FULL
-
name: Get the OSPFv2 results
register: ospfv2result
stc:
action: get
objects: /EmulatedDevice[@Name='OSPFDevice1']/Ospfv2RouterConfig/Ospfv2RouterResults
- debug:
var: ospfv2result
-
name: Start the traffic
stc:
action: perform
command: GeneratorStart
properties:
GeneratorList: ref:/project
-
name: subscribe to streamblock results
stc:
action: perform
command: SubscribeResultsView
properties:
ExecuteSynchronous: true
TemplateUri: "Result Views/Stream Results/Stream Block Results.xml"
- name: wait 10 sec
pause:
seconds: 10
-
name: Stop the traffic
stc:
action: perform
command: GeneratorStop
properties:
GeneratorList: ref:/project
- name: wait 10 sec
pause:
seconds: 10
-
name: get StreamBlock Rx Results
register: resultRx
stc:
action: get
objects: /port/StreamBlock/RxStreamBlockResults
-
name: get StreamBlock Results
register: result
stc:
action: get
objects: /port/StreamBlock/TxStreamBlockResults
-
name: Take the ports offline
stc:
action: perform
command: DetachPortsCommand
properties:
PortList: ref:/port
-
name: Delete OSPF object
stc:
action: delete
objects: ref:/EmulatedDevice[@Name='OSPFDevice1']/Ospfv2RouterConfig[@Name='OSPFRouter1']
-
name: Delete OSPF object
stc:
action: delete
objects: ref:/EmulatedDevice[@Name='OSPFDevice2']/Ospfv2RouterConfig[@Name='OSPFRouter2']