-
Notifications
You must be signed in to change notification settings - Fork 0
/
readme
executable file
·193 lines (166 loc) · 5.46 KB
/
readme
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
version: 1.1.1
description:
This app is driven by user input data-model yaml config files.
It configures IxNetwork using the SDK ixnetwork_restpy python
package to execute IxNetwork ReST APIs.
Requirements:
- Runs on Linux OS only.
- pip install requests, PyYaml
- data-model yml config file
Note: This ixNetworkDataModel package comes with ixnetwork_restpy.
It is inside the /Apps/IxNetworkDataModel/IxNetworkRestpy directory.
- For port capturing requirements:
- IxNetwork Wireshark installed
- Linux OS wireshark installed
- sudo chmod o+x /usr/bin/dumpcap (For redhat distributions)
- sudo chmod o+x /usr/sbin/dumpcap (For ubuntu distributions)
In your testcase yml files:
pythonScript: /Modules/IxNetworkDataModel/Scripts/<the_python_script_to_run>.py
configParametersFile: configs.yml
importAppLibraryPaths:
- /Apps/IxNetworkDataModel/src
- /Apps/IxNetworkDataModel/IxNetworkRestpy
configFile sample (configs.yml):
ixNetworkApiServerIp: 192.168.28.10
# Below are for Linux API server only
username: admin
password: admin
apiKey: None
deleteSession: False
forceTakePortOwnership: True
releasePorts: False
restPort: None
logLevel: info
ports:
- name: Host1
port: 192.168.28.5, 1, 1
#type: novusHundredGigLanFcoe
#enableAutoNegotiation: false
#ieeeL1Defaults: false
packetCapture:
enable: True
rxMode: captureAndMeasure
controlPlane: False
dataPlane: True
sliceSize: 80
- name: Host2
port: 192.168.28.5, 1, 2
#type: novusHundredGigLanFcoe
#enableAutoNegotiation: false
#ieeeL1Defaults: false
packetCapture:
enable: True
rxMode: captureAndMeasure
controlPlane: False
dataPlane: True
sliceSize: 80
topologies:
- name: Host1
ports:
- Host1
deviceGroups:
- name: Host1
multiplier: 1
ethernet:
name: Host1
ipv4:
name: Host1
ipStartValue: 1.1.1.1
ipStepValue: 0.0.0.0
subnet: 255.255.255.0
ipGatewayStartValue: 1.1.1.2
ipGatewayStepValue: 0.0.0.0
- name: Host2
ports:
- Host2
deviceGroups:
- name: Host2
multiplier: 1
ethernet:
name: Host2
ipv4:
name: Host2
ipStartValue: 1.1.1.2
ipStepValue: 0.0.0.0
subnet: 255.255.255.0
ipGatewayStartValue: 1.1.1.1
ipGatewayStepValue: 0.0.0.0
trafficItems:
- name: Host1
enable: True
trafficType: raw
srcPortName: Host1
destPortName: Host2
biDirection: True
frameRate:
type: percentLineRate
rate: 50
transmissionControl:
# fixedFrameCount | continuous
type: fixedFrameCount
frameCount: 100
frameSize: 128
packetHeaders:
ethernet:
src:
valueType: increment
startValue: ngpfSrcMac
stepValue: 00:00:00:00:00:00
stepValue: 00:00:00:00:00:00
count: 1
dst:
valueType: increment
startValue: ngpfResolvedGatewayMac
stepValue: 00:00:00:00:00:01
count: 1
ipv4:
appendToStack: ethernet
src:
valueType: increment
startValue: 1.1.1.1
stepValue: 0.0.0.1
count: 1
dst:
valueType: increment
startValue: 1.1.1.2
stepValue: 0.0.0.1
count: 1
udp:
appendToStack: ipv4
dstPort:
startValue: 4791
srcPort:
startValue: 1111
script example:
import sys, traceback
from ixNetworkDataModel import ConfigIxNetworkRestPy
from keystackEnv import keystackObj
dataModelYamlFile = keystackObj.configParamsFileFullPath
try:
mainObj = ConfigIxNetworkRestPy(dataModelFile=dataModelYamlFile, dataModelObj=None,
sessionName=None, sessionId=None, apiKey=None, clearConfig=True,
logLevel='info', logFilename=None, keystackObj=keystackObj)
mainObj.ports.assignPorts()
mainObj.portCapture.configure()
mainObj.closeAllTabs()
mainObj.ngpf.configure()
mainObj.ngpf.startAllProtocols()
mainObj.ngpf.verifyProtocolsUp()
ngpfMacAddresses = mainObj.ngpf.getNgpfLearnedMacAddresses()
mainObj.trafficItem.configRawTrafficItems(ngpfMacAddresses=ngpfMacAddresses)
mainObj.trafficItem.generateAll()
mainObj.trafficItem.apply()
mainObj.portCapture.start()
mainObj.trafficItem.start()
mainObj.trafficItem.waitForTrafficCompletion(maxCounter=10)
mainObj.portCapture.stop()
mainObj.portCapture.getDataPlaneCaptureFile(writeCaptureToFile=False,
amountOfPacketsToWrite=5,
captureFileDestPath=keystackObj.moduleProperties['artifactsRepo'])
if mainObj.configs.get('releasePorts', False):
mainObj.ports.releasePorts()
if mainObj.configs.get('deleteSession', True):
mainObj.deleteSession()
except Exception as errMsg:
if 'mainObj' in locals():
mainObj.logFailed(traceback.format_exc(None, errMsg))