-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathlogical_interconnect_api_1200.rb
257 lines (236 loc) · 6.51 KB
/
logical_interconnect_api_1200.rb
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
# (c) Copyright 2020 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# NOTE 1: This recipe requires:
# Ethernet Networks: EthernetNetwork1, EthernetNetwork2
# For apiversion:1200 type is portMonitorV1
my_client = {
url: ENV['ONEVIEWSDK_URL'],
user: ENV['ONEVIEWSDK_USER'],
password: ENV['ONEVIEWSDK_PASSWORD'],
api_version: 1200
}
# No action
oneview_logical_interconnect 'test_chef-test_chef' do
client my_client
end
# Set the EthernetNetwork1 and EthernetNetwork2 as internal networks for the logical interconnect
oneview_logical_interconnect 'test_chef-test_chef' do
client my_client
internal_networks ['EthernetNetwork1', 'EthernetNetwork2']
action :update_internal_networks
end
# Increase the ethernet settings refresh and timeout intervals
oneview_logical_interconnect 'test_chef-test_chef' do
client my_client
data(
ethernetSettings: {
igmpIdleTimeoutInterval: 230,
macRefreshInterval: 15
}
)
action :update_ethernet_settings
end
# Update igmp settings refresh and timeout intervals
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
client my_client
data(
igmpSettings: {
igmpIdleTimeoutInterval: 230,
}
)
action :update_igmp_settings
end
# Activate the port monitor service
oneview_logical_interconnect 'test_chef-test_chef' do
client my_client
port_monitor(
analyzerPort: {
portName: 'd1',
portMonitorConfigInfo: 'AnalyzerPort'
},
enablePortMonitor: true,
type: 'port-monitorV1',
monitoredPorts: [
{
portName: 'd3',
portMonitorConfigInfo: 'MonitoredBoth'
}
]
)
action :update_port_monitor
end
# Disable the port monitor service
oneview_logical_interconnect 'test_chef-test_chef' do
client my_client
port_monitor(
analyzerPort: nil,
enablePortMonitor: false,
type: 'port-monitorV1',
monitoredPorts: []
)
action :update_port_monitor
end
# Activate the port monitor service with data
oneview_logical_interconnect 'test_chef-test_chef' do
client my_client
data(
portMonitor: {
analyzerPort: {
portUri: '/rest/interconnects/b9e993a0-9023-43b3-8538-51e9ac8f12b1/ports/b9e993a0-9023-43b3-8538-51e9ac8f12b1:d1',
portMonitorConfigInfo: 'AnalyzerPort'
},
enablePortMonitor: true,
type: 'port-monitorV1',
monitoredPorts: [
{
portUri: '/rest/interconnects/b9e993a0-9023-43b3-8538-51e9ac8f12b1/ports/b9e993a0-9023-43b3-8538-51e9ac8f12b1:d3',
portMonitorConfigInfo: 'MonitoredBoth'
}
]
}
)
action :update_port_monitor
end
# Disable the port monitor service with data
oneview_logical_interconnect 'test_chef-test_chef' do
client my_client
data(
portMonitor: {
analyzerPort: nil,
enablePortMonitor: false,
type: 'port-monitorV1',
monitoredPorts: []
}
)
action :update_port_monitor
end
# Activate the port monitor service with data and port_monitor property
oneview_logical_interconnect 'test_chef-test_chef' do
client my_client
data(
portMonitor: {
analyzerPort: {
portUri: '/rest/interconnects/b9e993a0-9023-43b3-8538-51e9ac8f12b1/ports/b9e993a0-9023-43b3-8538-51e9ac8f12b1:d1',
portMonitorConfigInfo: 'AnalyzerPort'
},
enablePortMonitor: true,
type: 'port-monitorV1'
}
)
port_monitor(
monitoredPorts: [
{
portName: 'd1',
portMonitorConfigInfo: 'MonitoredBoth'
}
]
)
action :update_port_monitor
end
# Update quality of service configuration
oneview_logical_interconnect 'test_chef-test_chef' do
client my_client
data(
qosConfiguration: {
activeQosConfig: {
configType: 'Passthrough',
description: 'Configured by chef-oneview'
}
}
)
action :update_qos_configuration
end
# Update telemetry configuration
oneview_logical_interconnect 'test_chef-test_chef' do
client my_client
data(
telemetryConfiguration: {
sampleCount: 25,
sampleInterval: 225
}
)
action :update_telemetry_configuration
end
# Add one SNMP Trap configuration
oneview_logical_interconnect 'test_chef-test_chef' do
client my_client
data(
snmpConfiguration: {
snmpAccess: ['172.18.6.15/24']
}
)
trap_destinations(
'172.18.6.16' => {
trapFormat: 'SNMPv1',
communityString: 'public',
severities: ['Critical', 'Major', 'Unknown'],
vcmTraps: ['Legacy'],
enetTraps: ['PortStatus', 'PortThresholds'],
fcTraps: ['Other']
}
)
action :update_snmp_configuration
end
# Clean the SNMP Traps
oneview_logical_interconnect 'test_chef-test_chef' do
client my_client
data(
snmpConfiguration: {
snmpAccess: []
}
)
action :update_snmp_configuration
end
# Stage one firmware bundle in the Logical Interconnect with sme flahsing options
oneview_logical_interconnect 'test_chef-test_chef' do
client my_client
firmware 'ROM Flash - SPP'
firmware_data(
ethernetActivationDelay: 10,
ethernetActivationType: 'OddEven',
fcActivationDelay: 10,
fcActivationType: 'Serial',
force: false
)
action :stage_firmware
end
# Update the staged firmware driver flahsing options
oneview_logical_interconnect 'test_chef-test_chef' do
client my_client
firmware 'ROM Flash - SPP'
firmware_data(
ethernetActivationDelay: 15,
fcActivationDelay: 20,
force: true
)
action :update_firmware
end
# Activate the staged firmware in the logical interconnect
# It starts the flashing process in each managed interconnect
oneview_logical_interconnect 'test_chef-test_chef' do
client my_client
firmware 'ROM Flash - SPP'
firmware_data(
force: false
)
action :activate_firmware
end
# Start to reapply the configuration in each managed interconnect
oneview_logical_interconnect 'test_chef-test_chef' do
client my_client
action :reapply_configuration
end
# Compliance update
# Update the logical interconnect according to its associated logical interconnect group
oneview_logical_interconnect 'test_chef-test_chef' do
client my_client
action :update_from_group
end