Method: Fog::Network::Softlayer::Mock#create_network

Defined in:
lib/fog/softlayer/requests/network/create_network.rb

#create_network(order) ⇒ Object

Raises:

  • (ArgumentError)


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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/fog/softlayer/requests/network/create_network.rb', line 13

def create_network(order)
  raise ArgumentError, "Order argument for #{self.class.name}##{__method__} must be Hash." unless order.is_a?(Hash)
  # TODO: make this better, this will never fail...
  @networks << {
    'accountId' => Fog::Softlayer.,
    'id' => Fog::Mock.random_numbers(6).to_i,
    'modifyDate' => Time.now.iso8601,
    'name' => order['name'],
    'networkVrfId' => nil,
    'primarySubnetId' => Fog::Mock.random_numbers(6).to_i,
    'vlanNumber' => Fog::Mock.random_numbers(4).to_i,
    'networkSpace' => 'PRIVATE',
    'primaryRouter' =>
      {
        'bareMetalInstanceFlag' => 0,
        'domain' => 'softlayer.com',
        'fullyQualifiedDomainName' => order['router'] << '.softlayer.com',
        'hostname' => order['router'],
        'id' => order['routerId'],
        'notes' => '',
        'serviceProviderId' => 1,
        'serviceProviderResourceId' => Fog::Mock.random_numbers(6).to_i,
        'datacenter' => {'id' => order['location'], 'longName' => 'Lilliput 4', 'name' => 'llp04'},
        'primaryIpAddress' => Fog::Mock.random_ip
      },
    'subnets' =>
    [
      {
        'broadcastAddress' => Fog::Mock.random_ip,
        'cidr' => 30,
        'gateway' => Fog::Mock.random_ip,
        'id' => Fog::Mock.random_numbers(6).to_i,
        'isCustomerOwned' => false,
        'isCustomerRoutable' => false,
        'modifyDate' => Time.now.iso8601,
        'netmask' => '255.255.255.0',
        'networkIdentifier' => Fog::Mock.random_ip,
        'networkVlanId' => Fog::Mock.random_numbers(6).to_i,
        'sortOrder' => '4',
        'subnetType' => 'PRIMARY',
        'totalIpAddresses' => 4,
        'usableIpAddressCount' => 1,
        'version' => 4
      }
    ],
    'tagReferences' => [],
    'type' =>
    {
      'description' => 'Standard network VLAN',
      'id' => 1,
      'keyName' => 'STANDARD',
      'name' => 'Standard'
    }
  }

  response = Excon::Response.new
  response.status = 200
  response.body = {
      'orderDate' => Time.now.iso8601,
      'orderDetails' =>
          {
              'bigDataOrderFlag' => false,
              'billingInformation' =>
                  {
                      'billingAddressLine1' => '42 Haviture Way.',
                      'billingCity' => 'Glover',
                      'billingCountryCode' => 'US',
                      'billingEmail' => '[email protected]',
                      'billingNameCompany' => 'SLayer\'s Inc.',
                      'billingNameFirst' => 'Mr.',
                      'billingNameLast' => 'Rogers',
                      'billingPhoneVoice' => '123.456.7890',
                      'billingPostalCode' => '90210',
                      'billingState' => 'VT',
                      'cardExpirationMonth' => nil,
                      'cardExpirationYear' => nil,
                      'taxExempt' => 0
                  },
              'billingOrderItemId' => nil,
              'containerSplHash' => '00000000000000000000000000000000',
              'currencyShortName' => 'USD',
              'extendedHardwareTesting' => nil,
              'imageTemplateId' => nil,
              'isManagedOrder' => 0,
              'itemCategoryQuestionAnswers' => [],
              'location' => Fog::Mock.random_numbers(6).to_i,
              'locationObject' =>
                  {
                      'id' => Fog::Mock.random_numbers(6).to_i,
                      'longName' => 'Amsterdam 1',
                      'name' => 'ams01',
                      'activePresaleEvents' => []},
              'packageId' => 0,
              'paymentType' => 'PAYPAL',
              'postTaxRecurring' => '0',
              'postTaxRecurringHourly' => '0',
              'postTaxRecurringMonthly' => '0',
              'postTaxSetup' => '0',
              'preTaxRecurring' => '0',
              'preTaxRecurringHourly' => '0',
              'preTaxRecurringMonthly' => '0',
              'preTaxSetup' => '0',
              'presetId' => nil,
              'prices' =>
                  [
                      {
                          'currentPriceFlag' => nil,
                          'hourlyRecurringFee' => '0',
                          'id' => Fog::Mock.random_numbers(4).to_i,
                          'itemId' => Fog::Mock.random_numbers(4).to_i,
                          'laborFee' => '0',
                          'onSaleFlag' => nil,
                          'oneTimeFee' => '0',
                          'oneTimeFeeTax' => '0',
                          'proratedRecurringFee' => '0',
                          'proratedRecurringFeeTax' => '0',
                          'quantity' => nil,
                          'recurringFee' => '0',
                          'recurringFeeTax' => '0',
                          'setupFee' => '0',
                          'sort' => 0,
                          'categories' =>
                              [
                                  {
                                      'categoryCode' => 'network_vlan',
                                      'id' => 113,
                                      'name' => 'Network Vlan',
                                      'quantityLimit' => 0}],
                          'item' =>
                              {
                                  'capacity' => '0',
                                  'description' => 'Private Network Vlan',
                                  'id' => Fog::Mock.random_numbers(4).to_i,
                                  'softwareDescriptionId' => nil,
                                  'units' => 'N/A',
                                  'upgradeItemId' => nil,
                                  'bundle' => [],
                                  'itemCategory' =>
                                      {
                                          'categoryCode' => 'network_vlan',
                                          'id' => 113,
                                          'name' => 'Network Vlan',
                                          'quantityLimit' => 0}}},
                      {
                          'currentPriceFlag' => nil,
                          'hourlyRecurringFee' => '0',
                          'id' => Fog::Mock.random_numbers(4).to_i,
                          'itemId' => 577,
                          'laborFee' => '0',
                          'onSaleFlag' => nil,
                          'oneTimeFee' => '0',
                          'oneTimeFeeTax' => '0',
                          'proratedRecurringFee' => '0',
                          'proratedRecurringFeeTax' => '0',
                          'quantity' => nil,
                          'recurringFee' => '0',
                          'recurringFeeTax' => '0',
                          'setupFee' => '0',
                          'sort' => 0,
                          'categories' =>
                              [
                                  {
                                      'categoryCode' => 'static_sec_ip_addresses',
                                      'id' => 53,
                                      'name' => 'Public Secondary Static IP Addresses',
                                      'quantityLimit' => 0}],
                          'item' =>
                              {
                                  'capacity' => '4',
                                  'description' => '4 Static Public IP Addresses',
                                  'id' => 577,
                                  'softwareDescriptionId' => nil,
                                  'upgradeItemId' => nil,
                                  'bundle' => [],
                                  'itemCategory' =>
                                      {
                                          'categoryCode' => 'static_sec_ip_addresses',
                                          'id' => 53,
                                          'name' => 'Public Secondary Static IP Addresses',
                                          'quantityLimit' => 0
                                      }
                              }
                      }
                  ],
              'primaryDiskPartitionId' => nil,
              'privateCloudOrderFlag' => false,
              'properties' => [],
              'proratedInitialCharge' => '0',
              'proratedOrderTotal' => '0',
              'quantity' => 1,
              'resourceGroupId' => nil,
              'resourceGroupTemplateId' => nil,
              'sendQuoteEmailFlag' => nil,
              'serverCoreCount' => nil,
              'sourceVirtualGuestId' => nil,
              'sshKeys' => [],
              'stepId' => nil,
              'storageGroups' => [],
              'totalRecurringTax' => '0',
              'totalSetupTax' => '0',
              'useHourlyPricing' => false,
              'id' => nil,
              'name' => 'foobar',
              'router' =>
                  {
                      'bareMetalInstanceFlag' => 0,
                      'domain' => 'softlayer.com',
                      'fullyQualifiedDomainName' => order['router'] << '.softlayer.com',
                      'hostname' => order['router'],
                      'id' => Fog::Mock.random_numbers(6).to_i,
                      'notes' => '',
                      'serviceProviderId' => 1,
                      'serviceProviderResourceId' => Fog::Mock.random_numbers(6).to_i,
                      'datacenter' => {'id' => order['location'], 'longName' => 'Lilliput 4', 'name' => 'llp04'}
                  },
              'routerId' => order['routerId'],
              'vlanNumber' => nil
          },
      'orderId' => Fog::Mock.random_numbers(7).to_i,
      'placedOrder' =>
          {
              'accountId' => Fog::Mock.random_numbers(6).to_i,
              'createDate' => Time.now.iso8601,
              'id' => Fog::Mock.random_numbers(7).to_i,
              'impersonatingUserRecordId' => nil,
              'modifyDate' => nil,
              'orderQuoteId' => nil,
              'orderTypeId' => 4,
              'presaleEventId' => nil,
              'privateCloudOrderFlag' => false,
              'status' => 'PENDING_AUTO_APPROVAL',
              'userRecordId' => Fog::Mock.random_numbers(6).to_i,
              'account' =>
                  {
                      'accountStatusId' => Fog::Mock.random_numbers(4).to_i,
                      'address1' => '4849 Alpha Rd.',
                      'allowedPptpVpnQuantity' => 1,
                      'brandId' => 2,
                      'city' => 'Dallas',
                      'claimedTaxExemptTxFlag' => false,
                      'companyName' => 'SoftLayer Internal - Development Community',
                      'country' => 'US',
                      'createDate' => Time.now.iso8601,
                      'email' => '[email protected]',
                      'firstName' => 'Phil',
                      'id' => Fog::Mock.random_numbers(6).to_i,
                      'isReseller' => 0,
                      'lastName' => 'Jackson',
                      'lateFeeProtectionFlag' => nil,
                      'modifyDate' => Time.now.iso8601,
                      'officePhone' => '281.714.3156',
                      'postalCode' => '75244',
                      'state' => 'TX',
                      'statusDate' => nil,
                      'hardwareCount' => 7,
                      'canOrderAdditionalVlansFlag' => true,
                      'hasPendingOrder' => 3},
              'items' =>
                  [
                      {
                          'categoryCode' => 'network_vlan',
                          'description' => 'Private Network Vlan',
                          'id' => Fog::Mock.random_numbers(8).to_i,
                          'itemId' => Fog::Mock.random_numbers(4).to_i,
                          'itemPriceId' => '2019',
                          'laborFee' => '0',
                          'laborFeeTaxRate' => '.066',
                          'oneTimeFee' => '0',
                          'oneTimeFeeTaxRate' => '.066',
                          'parentId' => nil,
                          'promoCodeId' => nil,
                          'quantity' => nil,
                          'recurringFee' => '0',
                          'setupFee' => '0',
                          'setupFeeDeferralMonths' => 12,
                          'setupFeeTaxRate' => '.066',
                          'bundledItems' => [],
                          'category' =>
                              {
                                  'categoryCode' => 'network_vlan',
                                  'id' => 113,
                                  'name' => 'Network Vlan',
                                  'quantityLimit' => 0},
                          'children' =>
                              [
                                  {
                                      'categoryCode' => 'static_sec_ip_addresses',
                                      'description' => '4 Static Public IP Addresses',
                                      'id' => Fog::Mock.random_numbers(8).to_i,
                                      'itemId' => 577,
                                      'itemPriceId' => '1084',
                                      'laborFee' => '0',
                                      'laborFeeTaxRate' => '.066',
                                      'oneTimeFee' => '0',
                                      'oneTimeFeeTaxRate' => '.066',
                                      'parentId' => Fog::Mock.random_numbers(8).to_i,
                                      'promoCodeId' => nil,
                                      'quantity' => nil,
                                      'recurringFee' => '0',
                                      'setupFee' => '0',
                                      'setupFeeDeferralMonths' => 12,
                                      'setupFeeTaxRate' => '.066',
                                      'bundledItems' => [],
                                      'category' =>
                                          {
                                              'categoryCode' => 'static_sec_ip_addresses',
                                              'id' => 53,
                                              'name' => 'Public Secondary Static IP Addresses',
                                              'quantityLimit' => 0},
                                      'children' => [],
                                      'order' => nil,
                                      'storageGroups' => []
                                  }
                              ],
                          'location' => {'id' => Fog::Mock.random_numbers(6).to_i, 'longName' => 'Amsterdam 1', 'name' => 'ams01'},
                          'order' => nil,
                          'storageGroups' => []},
                      {
                          'categoryCode' => 'static_sec_ip_addresses',
                          'description' => '4 Static Public IP Addresses',
                          'id' => Fog::Mock.random_numbers(8).to_i,
                          'itemId' => 577,
                          'itemPriceId' => '1084',
                          'laborFee' => '0',
                          'laborFeeTaxRate' => '.066',
                          'oneTimeFee' => '0',
                          'oneTimeFeeTaxRate' => '.066',
                          'parentId' => Fog::Mock.random_numbers(8).to_i,
                          'promoCodeId' => nil,
                          'quantity' => nil,
                          'recurringFee' => '0',
                          'setupFee' => '0',
                          'setupFeeDeferralMonths' => 12,
                          'setupFeeTaxRate' => '.066',
                          'bundledItems' => [],
                          'category' =>
                              {
                                  'categoryCode' => 'static_sec_ip_addresses',
                                  'id' => 53,
                                  'name' => 'Public Secondary Static IP Addresses',
                                  'quantityLimit' => 0},
                          'children' => [],
                          'order' => nil,
                          'storageGroups' => []
                      }
                  ],
              'orderTopLevelItems' =>
                  [
                      {
                          'categoryCode' => 'network_vlan',
                          'description' => 'Private Network Vlan',
                          'id' => Fog::Mock.random_numbers(8).to_i,
                          'itemId' => Fog::Mock.random_numbers(4).to_i,
                          'itemPriceId' => '2019',
                          'laborFee' => '0',
                          'laborFeeTaxRate' => '.066',
                          'oneTimeFee' => '0',
                          'oneTimeFeeTaxRate' => '.066',
                          'parentId' => nil,
                          'promoCodeId' => nil,
                          'quantity' => nil,
                          'recurringFee' => '0',
                          'setupFee' => '0',
                          'setupFeeDeferralMonths' => 12,
                          'setupFeeTaxRate' => '.066',
                          'bundledItems' => [],
                          'category' =>
                              {
                                  'categoryCode' => 'network_vlan',
                                  'id' => 113,
                                  'name' => 'Network Vlan',
                                  'quantityLimit' => 0},
                          'children' =>
                              [
                                  {
                                      'categoryCode' => 'static_sec_ip_addresses',
                                      'description' => '4 Static Public IP Addresses',
                                      'id' => Fog::Mock.random_numbers(8).to_i,
                                      'itemId' => 577,
                                      'itemPriceId' => '1084',
                                      'laborFee' => '0',
                                      'laborFeeTaxRate' => '.066',
                                      'oneTimeFee' => '0',
                                      'oneTimeFeeTaxRate' => '.066',
                                      'parentId' => Fog::Mock.random_numbers(8).to_i,
                                      'promoCodeId' => nil,
                                      'quantity' => nil,
                                      'recurringFee' => '0',
                                      'setupFee' => '0',
                                      'setupFeeDeferralMonths' => 12,
                                      'setupFeeTaxRate' => '.066',
                                      'bundledItems' => [],
                                      'category' =>
                                          {
                                              'categoryCode' => 'static_sec_ip_addresses',
                                              'id' => 53,
                                              'name' => 'Public Secondary Static IP Addresses',
                                              'quantityLimit' => 0},
                                      'children' => [],
                                      'order' => nil,
                                      'storageGroups' => []
                                  }
                              ],
                          'location' => {'id' => 265592, 'longName' => 'Amsterdam 1', 'name' => 'ams01'},
                          'order' => nil,
                          'storageGroups' => []
                      }
                  ],
              'userRecord' =>
                  {
                      'accountId' => Fog::Mock.random_numbers(6).to_i,
                      'address1' => '315 Capitol Street',
                      'authenticationToken' =>
                          {
                              'hash' => 'd83e82b1c9a04befe6ac48368d9b61f3',
                              'user' => nil,
                              'userId' => 184064
                          },
                      'city' => 'Houston',
                      'companyName' => 'SLayer\'s Inc.',
                      'country' => 'US',
                      'createDate' => Time.now.iso8601,
                      'daylightSavingsTimeFlag' => true,
                      'denyAllResourceAccessOnCreateFlag' => false,
                      'displayName' => 'PulseL',
                      'email' => '[email protected]',
                      'firstName' => 'Mr.',
                      'forumPasswordHash' => '000000000000000000000000000000000000000000',
                      'id' => Fog::Mock.random_numbers(6).to_i,
                      'lastName' => 'Rogers',
                      'localeId' => 1,
                      'modifyDate' => Time.now.iso8601,
                      'parentId' => Fog::Mock.random_numbers(6).to_i,
                      'passwordExpireDate' => nil,
                      'permissionSystemVersion' => 2,
                      'postalCode' => '77002',
                      'pptpVpnAllowedFlag' => false,
                      'savedId' => Fog::Mock.random_numbers(6).to_i,
                      'secondaryLoginManagementFlag' => nil,
                      'secondaryLoginRequiredFlag' => nil,
                      'secondaryPasswordModifyDate' => Time.now.iso8601,
                      'secondaryPasswordTimeoutDays' => 0,
                      'sslVpnAllowedFlag' => false,
                      'state' => 'TX',
                      'statusDate' => nil,
                      'timezoneId' => 113,
                      'userStatusId' => Fog::Mock.random_numbers(4).to_i,
                      'username' => 'sl307608-meldridge',
                      'vpnManualConfig' => false,
                      'hasFullHardwareAccessFlag' => true,
                      'timezone' =>
                          {
                              'id' => 113,
                              'longName' => '(GMT-06:00) America/Chicago - CST',
                              'name' => 'America/Chicago',
                              'offset' => '-0600',
                              'shortName' => 'CST'
                          }
                  }
          }
  }
  response


end