~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/apiserver/common/networkingcommon/types_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
        "errors"
8
8
        "fmt"
9
9
        "io/ioutil"
10
 
        "math/rand"
11
10
        "net"
12
11
        "os"
13
12
        "path/filepath"
41
40
        }
42
41
}
43
42
 
44
 
func (s *TypesSuite) TestCopyNetworkConfig(c *gc.C) {
45
 
        inputAndExpectedOutput := []params.NetworkConfig{{
46
 
                InterfaceName: "foo",
47
 
                DNSServers:    []string{"bar", "baz"},
48
 
                Address:       "0.1.2.3",
49
 
        }, {
50
 
                DeviceIndex:         124,
51
 
                ParentInterfaceName: "parent",
52
 
                ProviderId:          "nic-id",
53
 
        }}
54
 
 
55
 
        output := networkingcommon.CopyNetworkConfigs(inputAndExpectedOutput)
56
 
        c.Assert(output, jc.DeepEquals, inputAndExpectedOutput)
57
 
}
58
 
 
59
43
func mustParseMAC(value string) net.HardwareAddr {
60
44
        parsedMAC, err := net.ParseMAC(value)
61
45
        if err != nil {
194
178
        "br-eth1.13":  {fakeAddr("10.13.19.101/24"), fakeAddr("fe80::5054:ff:fedd:eef1/64")},
195
179
}
196
180
 
197
 
var expectedSortedObservedNetworkConfigs = []params.NetworkConfig{{
 
181
var expectedObservedNetworkConfigs = []params.NetworkConfig{{
198
182
        DeviceIndex:   1,
199
183
        InterfaceName: "lo",
200
184
        InterfaceType: string(network.LoopbackInterface),
206
190
}, {
207
191
        DeviceIndex:   10,
208
192
        InterfaceName: "br-eth0",
209
 
        InterfaceType: string(network.EthernetInterface),
 
193
        InterfaceType: string(network.BridgeInterface),
210
194
        MACAddress:    "aa:bb:cc:dd:ee:f0",
211
195
        CIDR:          "10.20.19.0/24",
212
196
        Address:       "10.20.19.100",
213
197
        MTU:           1500,
 
198
        ConfigType:    string(network.ConfigStatic),
214
199
}, {
215
200
        DeviceIndex:   10,
216
201
        InterfaceName: "br-eth0",
217
 
        InterfaceType: string(network.EthernetInterface),
 
202
        InterfaceType: string(network.BridgeInterface),
218
203
        MACAddress:    "aa:bb:cc:dd:ee:f0",
219
204
        CIDR:          "10.20.19.0/24",
220
205
        Address:       "10.20.19.123",
221
206
        MTU:           1500,
 
207
        ConfigType:    string(network.ConfigStatic),
222
208
}, {
223
209
        DeviceIndex:   12,
224
210
        InterfaceName: "br-eth0.100",
225
 
        InterfaceType: string(network.VLAN_8021QInterface),
 
211
        InterfaceType: string(network.BridgeInterface),
226
212
        MACAddress:    "aa:bb:cc:dd:ee:f0",
227
213
        CIDR:          "10.100.19.0/24",
228
214
        Address:       "10.100.19.100",
230
216
}, {
231
217
        DeviceIndex:   14,
232
218
        InterfaceName: "br-eth0.250",
233
 
        InterfaceType: string(network.VLAN_8021QInterface),
 
219
        InterfaceType: string(network.BridgeInterface),
234
220
        MACAddress:    "aa:bb:cc:dd:ee:f0",
235
221
        CIDR:          "10.250.19.0/24",
236
222
        Address:       "10.250.19.100",
237
223
        MTU:           1500,
 
224
        ConfigType:    string(network.ConfigStatic),
238
225
}, {
239
226
        DeviceIndex:   16,
240
227
        InterfaceName: "br-eth0.50",
241
 
        InterfaceType: string(network.VLAN_8021QInterface),
 
228
        InterfaceType: string(network.BridgeInterface),
242
229
        MACAddress:    "aa:bb:cc:dd:ee:f0",
243
230
        CIDR:          "10.50.19.0/24",
244
231
        Address:       "10.50.19.100",
245
232
        MTU:           1500,
246
 
}, {
247
 
        DeviceIndex:   2,
248
 
        InterfaceName: "eth0",
249
 
        InterfaceType: string(network.EthernetInterface),
250
 
        MACAddress:    "aa:bb:cc:dd:ee:f0",
251
 
        MTU:           1500,
252
 
}, {
253
 
        DeviceIndex:   13,
254
 
        InterfaceName: "eth0.100",
255
 
        InterfaceType: string(network.VLAN_8021QInterface),
256
 
        MACAddress:    "aa:bb:cc:dd:ee:f0",
257
 
        MTU:           1500,
258
 
}, {
259
 
        DeviceIndex:   15,
260
 
        InterfaceName: "eth0.250",
261
 
        InterfaceType: string(network.VLAN_8021QInterface),
262
 
        MACAddress:    "aa:bb:cc:dd:ee:f0",
263
 
        MTU:           1500,
264
 
}, {
265
 
        DeviceIndex:   17,
266
 
        InterfaceName: "eth0.50",
267
 
        InterfaceType: string(network.VLAN_8021QInterface),
268
 
        MACAddress:    "aa:bb:cc:dd:ee:f0",
269
 
        MTU:           1500,
 
233
        ConfigType:    string(network.ConfigStatic),
 
234
}, {
 
235
        DeviceIndex:         2,
 
236
        InterfaceName:       "eth0",
 
237
        ParentInterfaceName: "br-eth0",
 
238
        InterfaceType:       string(network.EthernetInterface),
 
239
        MACAddress:          "aa:bb:cc:dd:ee:f0",
 
240
        MTU:                 1500,
 
241
        ConfigType:          string(network.ConfigManual),
 
242
}, {
 
243
        DeviceIndex:         13,
 
244
        InterfaceName:       "eth0.100",
 
245
        ParentInterfaceName: "br-eth0.100",
 
246
        InterfaceType:       string(network.VLAN_8021QInterface),
 
247
        MACAddress:          "aa:bb:cc:dd:ee:f0",
 
248
        MTU:                 1500,
 
249
        ConfigType:          string(network.ConfigManual),
 
250
}, {
 
251
        DeviceIndex:         15,
 
252
        InterfaceName:       "eth0.250",
 
253
        ParentInterfaceName: "br-eth0.250",
 
254
        InterfaceType:       string(network.VLAN_8021QInterface),
 
255
        MACAddress:          "aa:bb:cc:dd:ee:f0",
 
256
        MTU:                 1500,
 
257
        ConfigType:          string(network.ConfigManual),
 
258
}, {
 
259
        DeviceIndex:         17,
 
260
        InterfaceName:       "eth0.50",
 
261
        ParentInterfaceName: "br-eth0.50",
 
262
        InterfaceType:       string(network.VLAN_8021QInterface),
 
263
        MACAddress:          "aa:bb:cc:dd:ee:f0",
 
264
        MTU:                 1500,
 
265
        ConfigType:          string(network.ConfigManual),
270
266
}, {
271
267
        DeviceIndex:   11,
272
268
        InterfaceName: "br-eth1",
273
 
        InterfaceType: string(network.EthernetInterface),
 
269
        InterfaceType: string(network.BridgeInterface),
274
270
        MACAddress:    "aa:bb:cc:dd:ee:f1",
275
271
        CIDR:          "10.20.19.0/24",
276
272
        Address:       "10.20.19.105",
277
273
        MTU:           1500,
 
274
        ConfigType:    string(network.ConfigStatic),
278
275
}, {
279
276
        DeviceIndex:   18,
280
277
        InterfaceName: "br-eth1.11",
281
 
        InterfaceType: string(network.VLAN_8021QInterface),
 
278
        InterfaceType: string(network.BridgeInterface),
282
279
        MACAddress:    "aa:bb:cc:dd:ee:f1",
283
280
        CIDR:          "10.11.19.0/24",
284
281
        Address:       "10.11.19.101",
285
282
        MTU:           1500,
 
283
        ConfigType:    string(network.ConfigStatic),
286
284
}, {
287
285
        DeviceIndex:   20,
288
286
        InterfaceName: "br-eth1.12",
289
 
        InterfaceType: string(network.VLAN_8021QInterface),
 
287
        InterfaceType: string(network.BridgeInterface),
290
288
        MACAddress:    "aa:bb:cc:dd:ee:f1",
291
289
        CIDR:          "10.12.19.0/24",
292
290
        Address:       "10.12.19.101",
293
291
        MTU:           1500,
 
292
        ConfigType:    string(network.ConfigStatic),
294
293
}, {
295
294
        DeviceIndex:   22,
296
295
        InterfaceName: "br-eth1.13",
297
 
        InterfaceType: string(network.VLAN_8021QInterface),
 
296
        InterfaceType: string(network.BridgeInterface),
298
297
        MACAddress:    "aa:bb:cc:dd:ee:f1",
299
298
        CIDR:          "10.13.19.0/24",
300
299
        Address:       "10.13.19.101",
301
300
        MTU:           1500,
302
 
}, {
303
 
        DeviceIndex:   3,
304
 
        InterfaceName: "eth1",
305
 
        InterfaceType: string(network.EthernetInterface),
306
 
        MACAddress:    "aa:bb:cc:dd:ee:f1",
307
 
        MTU:           1500,
308
 
}, {
309
 
        DeviceIndex:   19,
310
 
        InterfaceName: "eth1.11",
311
 
        InterfaceType: string(network.VLAN_8021QInterface),
312
 
        MACAddress:    "aa:bb:cc:dd:ee:f1",
313
 
        MTU:           1500,
314
 
}, {
315
 
        DeviceIndex:   21,
316
 
        InterfaceName: "eth1.12",
317
 
        InterfaceType: string(network.VLAN_8021QInterface),
318
 
        MACAddress:    "aa:bb:cc:dd:ee:f1",
319
 
        MTU:           1500,
320
 
}, {
321
 
        DeviceIndex:   23,
322
 
        InterfaceName: "eth1.13",
323
 
        InterfaceType: string(network.VLAN_8021QInterface),
324
 
        MACAddress:    "aa:bb:cc:dd:ee:f1",
325
 
        MTU:           1500,
 
301
        ConfigType:    string(network.ConfigStatic),
 
302
}, {
 
303
        DeviceIndex:         3,
 
304
        InterfaceName:       "eth1",
 
305
        ParentInterfaceName: "br-eth1",
 
306
        InterfaceType:       string(network.EthernetInterface),
 
307
        MACAddress:          "aa:bb:cc:dd:ee:f1",
 
308
        MTU:                 1500,
 
309
        ConfigType:          string(network.ConfigManual),
 
310
}, {
 
311
        DeviceIndex:         19,
 
312
        InterfaceName:       "eth1.11",
 
313
        ParentInterfaceName: "br-eth1.11",
 
314
        InterfaceType:       string(network.VLAN_8021QInterface),
 
315
        MACAddress:          "aa:bb:cc:dd:ee:f1",
 
316
        MTU:                 1500,
 
317
        ConfigType:          string(network.ConfigManual),
 
318
}, {
 
319
        DeviceIndex:         21,
 
320
        InterfaceName:       "eth1.12",
 
321
        ParentInterfaceName: "br-eth1.12",
 
322
        InterfaceType:       string(network.VLAN_8021QInterface),
 
323
        MACAddress:          "aa:bb:cc:dd:ee:f1",
 
324
        MTU:                 1500,
 
325
        ConfigType:          string(network.ConfigManual),
 
326
}, {
 
327
        DeviceIndex:         23,
 
328
        InterfaceName:       "eth1.13",
 
329
        ParentInterfaceName: "br-eth1.13",
 
330
        InterfaceType:       string(network.VLAN_8021QInterface),
 
331
        MACAddress:          "aa:bb:cc:dd:ee:f1",
 
332
        MTU:                 1500,
 
333
        ConfigType:          string(network.ConfigManual),
326
334
}}
327
335
 
328
 
var expectedSortedProviderNetworkConfigs = []params.NetworkConfig{{
 
336
var expectedProviderNetworkConfigs = []params.NetworkConfig{{
329
337
        InterfaceName:       "eth0",
330
338
        InterfaceType:       string(network.EthernetInterface),
331
339
        MACAddress:          "aa:bb:cc:dd:ee:f0",
453
461
        ProviderAddressId:   "1302",
454
462
}}
455
463
 
456
 
var expectedSortedMergedNetworkConfigs = []params.NetworkConfig{{
 
464
var expectedFinalNetworkConfigs = []params.NetworkConfig{{
457
465
        DeviceIndex:         1,
458
466
        InterfaceName:       "lo",
459
467
        InterfaceType:       string(network.LoopbackInterface),
499
507
        Address:             "10.100.19.100",
500
508
        MTU:                 1500,
501
509
        ConfigType:          string(network.ConfigStatic),
502
 
        ParentInterfaceName: "br-eth0",
 
510
        ParentInterfaceName: "",
503
511
        ProviderSubnetId:    "6",
504
512
        ProviderVLANId:      "5005",
505
513
        VLANTag:             100,
513
521
        Address:             "10.250.19.100",
514
522
        MTU:                 1500,
515
523
        ConfigType:          string(network.ConfigStatic),
516
 
        ParentInterfaceName: "br-eth0",
 
524
        ParentInterfaceName: "",
517
525
        ProviderSubnetId:    "8",
518
526
        ProviderVLANId:      "5008",
519
527
        VLANTag:             250,
527
535
        Address:             "10.50.19.100",
528
536
        MTU:                 1500,
529
537
        ConfigType:          string(network.ConfigStatic),
530
 
        ParentInterfaceName: "br-eth0",
 
538
        ParentInterfaceName: "",
531
539
        ProviderSubnetId:    "5",
532
540
        ProviderVLANId:      "5004",
533
541
        VLANTag:             50,
603
611
        Address:             "10.11.19.101",
604
612
        MTU:                 1500,
605
613
        ConfigType:          string(network.ConfigStatic),
606
 
        ParentInterfaceName: "br-eth1",
 
614
        ParentInterfaceName: "",
607
615
        ProviderSubnetId:    "9",
608
616
        ProviderVLANId:      "5013",
609
617
        VLANTag:             11,
617
625
        Address:             "10.12.19.101",
618
626
        MTU:                 1500,
619
627
        ConfigType:          string(network.ConfigStatic),
620
 
        ParentInterfaceName: "br-eth1",
 
628
        ParentInterfaceName: "",
621
629
        ProviderSubnetId:    "10",
622
630
        ProviderVLANId:      "5014",
623
631
        VLANTag:             12,
630
638
        CIDR:                "10.13.19.0/24",
631
639
        Address:             "10.13.19.101",
632
640
        MTU:                 1500,
633
 
        ParentInterfaceName: "br-eth1",
 
641
        ParentInterfaceName: "",
634
642
        ConfigType:          string(network.ConfigStatic),
635
643
        ProviderSubnetId:    "11",
636
644
        ProviderVLANId:      "5015",
686
694
        VLANTag:             13,
687
695
}}
688
696
 
689
 
var expectedSortedNetworkConfigsByInterfaceName = []params.NetworkConfig{
690
 
        {InterfaceName: "br-eth0"},
691
 
        {InterfaceName: "br-eth0.12"},
692
 
        {InterfaceName: "br-eth0.34"},
693
 
        {InterfaceName: "br-eth1"},
694
 
        {InterfaceName: "br-eth1.100"},
695
 
        {InterfaceName: "br-eth1.250"},
696
 
        {InterfaceName: "br-eth1.50"},
697
 
        {InterfaceName: "eth0"},
698
 
        {InterfaceName: "eth0.12"},
699
 
        {InterfaceName: "eth0.34"},
700
 
        {InterfaceName: "eth1"},
701
 
        {InterfaceName: "eth1.100"},
702
 
        {InterfaceName: "eth1.250"},
703
 
        {InterfaceName: "eth1.50"},
704
 
}
705
 
 
706
 
var expectedLinkLayerDeviceArgsWithMergedNetworkConfig = []state.LinkLayerDeviceArgs{{
 
697
var expectedLinkLayerDeviceArgsWithFinalNetworkConfig = []state.LinkLayerDeviceArgs{{
707
698
        Name:        "lo",
708
699
        MTU:         65536,
709
700
        Type:        state.LoopbackDevice,
723
714
        MACAddress:  "aa:bb:cc:dd:ee:f0",
724
715
        IsAutoStart: true,
725
716
        IsUp:        true,
726
 
        ParentName:  "br-eth0",
 
717
        ParentName:  "",
727
718
}, {
728
719
        Name:        "br-eth0.250",
729
720
        MTU:         1500,
731
722
        MACAddress:  "aa:bb:cc:dd:ee:f0",
732
723
        IsAutoStart: true,
733
724
        IsUp:        true,
734
 
        ParentName:  "br-eth0",
 
725
        ParentName:  "",
735
726
}, {
736
727
        Name:        "br-eth0.50",
737
728
        MTU:         1500,
739
730
        MACAddress:  "aa:bb:cc:dd:ee:f0",
740
731
        IsAutoStart: true,
741
732
        IsUp:        true,
742
 
        ParentName:  "br-eth0",
 
733
        ParentName:  "",
743
734
}, {
744
735
        Name:        "eth0",
745
736
        MTU:         1500,
790
781
        MACAddress:  "aa:bb:cc:dd:ee:f1",
791
782
        IsAutoStart: true,
792
783
        IsUp:        true,
793
 
        ParentName:  "br-eth1",
 
784
        ParentName:  "",
794
785
}, {
795
786
        Name:        "br-eth1.12",
796
787
        MTU:         1500,
798
789
        MACAddress:  "aa:bb:cc:dd:ee:f1",
799
790
        IsAutoStart: true,
800
791
        IsUp:        true,
801
 
        ParentName:  "br-eth1",
 
792
        ParentName:  "",
802
793
}, {
803
794
        Name:        "br-eth1.13",
804
795
        MTU:         1500,
806
797
        MACAddress:  "aa:bb:cc:dd:ee:f1",
807
798
        IsAutoStart: true,
808
799
        IsUp:        true,
809
 
        ParentName:  "br-eth1",
 
800
        ParentName:  "",
810
801
}, {
811
802
        Name:        "eth1",
812
803
        MTU:         1500,
845
836
        ParentName:  "br-eth1.13",
846
837
}}
847
838
 
848
 
var expectedLinkLayerDeviceAdressesWithMergedNetworkConfig = []state.LinkLayerDeviceAddress{{
 
839
var expectedLinkLayerDeviceAdressesWithFinalNetworkConfig = []state.LinkLayerDeviceAddress{{
849
840
        DeviceName:   "lo",
850
841
        ConfigMethod: state.LoopbackAddress,
851
842
        CIDRAddress:  "127.0.0.1/8",
896
887
        ProviderID:   "1302",
897
888
}}
898
889
 
899
 
func (s *TypesSuite) TestSortNetworkConfigsByParentsWithObservedConfigs(c *gc.C) {
900
 
        s.checkSortNetworkConfigsByParentsWithAllInputPremutationsMatches(c, expectedSortedObservedNetworkConfigs)
901
 
}
902
 
 
903
 
func (s *TypesSuite) checkSortNetworkConfigsByParentsWithAllInputPremutationsMatches(c *gc.C, expectedOutput []params.NetworkConfig) {
904
 
        expectedLength := len(expectedOutput)
905
 
        jsonExpected := s.networkConfigsAsJSON(c, expectedOutput)
906
 
        for i := 0; i < expectedLength; i++ {
907
 
                shuffledInput := shuffleNetworkConfigs(expectedOutput)
908
 
                result := networkingcommon.SortNetworkConfigsByParents(shuffledInput)
909
 
                c.Assert(result, gc.HasLen, expectedLength)
910
 
                jsonResult := s.networkConfigsAsJSON(c, result)
911
 
                c.Check(jsonResult, gc.Equals, jsonExpected)
912
 
        }
913
 
}
914
 
 
915
 
func (s *TypesSuite) networkConfigsAsJSON(c *gc.C, input []params.NetworkConfig) string {
916
 
        asJSON, err := networkingcommon.NetworkConfigsToIndentedJSON(input)
917
 
        c.Assert(err, jc.ErrorIsNil)
918
 
        return asJSON
919
 
}
920
 
 
921
 
func shuffleNetworkConfigs(input []params.NetworkConfig) []params.NetworkConfig {
922
 
        inputLength := len(input)
923
 
        output := make([]params.NetworkConfig, inputLength)
924
 
        shuffled := rand.Perm(inputLength)
925
 
        for i, j := range shuffled {
926
 
                output[i] = input[j]
927
 
        }
928
 
        return output
929
 
}
930
 
 
931
 
func (s *TypesSuite) TestSortNetworkConfigsByParentsWithProviderConfigs(c *gc.C) {
932
 
        s.checkSortNetworkConfigsByParentsWithAllInputPremutationsMatches(c, expectedSortedProviderNetworkConfigs)
933
 
}
934
 
 
935
 
func (s *TypesSuite) TestSortNetworkConfigsByParentsWithMergedConfigs(c *gc.C) {
936
 
        s.checkSortNetworkConfigsByParentsWithAllInputPremutationsMatches(c, expectedSortedMergedNetworkConfigs)
937
 
}
938
 
 
939
 
func (s *TypesSuite) TestSortNetworkConfigsByInterfaceName(c *gc.C) {
940
 
        expectedLength := len(expectedSortedNetworkConfigsByInterfaceName)
941
 
        jsonExpected := s.networkConfigsAsJSON(c, expectedSortedNetworkConfigsByInterfaceName)
942
 
        for i := 0; i < expectedLength; i++ {
943
 
                shuffledInput := shuffleNetworkConfigs(expectedSortedNetworkConfigsByInterfaceName)
944
 
                result := networkingcommon.SortNetworkConfigsByInterfaceName(shuffledInput)
945
 
                c.Assert(result, gc.HasLen, expectedLength)
946
 
                jsonResult := s.networkConfigsAsJSON(c, result)
947
 
                c.Check(jsonResult, gc.Equals, jsonExpected)
948
 
        }
949
 
}
950
 
 
951
890
func (s *TypesSuite) TestNetworkConfigsToStateArgs(c *gc.C) {
952
 
        devicesArgs, devicesAddrs := networkingcommon.NetworkConfigsToStateArgs(expectedSortedMergedNetworkConfigs)
953
 
 
954
 
        c.Check(devicesArgs, jc.DeepEquals, expectedLinkLayerDeviceArgsWithMergedNetworkConfig)
955
 
        c.Check(devicesAddrs, jc.DeepEquals, expectedLinkLayerDeviceAdressesWithMergedNetworkConfig)
 
891
        devicesArgs, devicesAddrs := networkingcommon.NetworkConfigsToStateArgs(expectedFinalNetworkConfigs)
 
892
 
 
893
        c.Check(devicesArgs, jc.DeepEquals, expectedLinkLayerDeviceArgsWithFinalNetworkConfig)
 
894
        c.Check(devicesAddrs, jc.DeepEquals, expectedLinkLayerDeviceAdressesWithFinalNetworkConfig)
 
895
}
 
896
 
 
897
func (s *TypesSuite) TestMergeProviderAndObservedNetworkConfigsBothNil(c *gc.C) {
 
898
        result := networkingcommon.MergeProviderAndObservedNetworkConfigs(nil, nil)
 
899
        c.Check(result, gc.IsNil)
 
900
}
 
901
 
 
902
func (s *TypesSuite) TestMergeProviderAndObservedNetworkConfigsNilObservedConfigs(c *gc.C) {
 
903
        input := expectedProviderNetworkConfigs
 
904
        result := networkingcommon.MergeProviderAndObservedNetworkConfigs(input, nil)
 
905
        c.Check(result, gc.IsNil)
 
906
}
 
907
 
 
908
func (s *TypesSuite) TestMergeProviderAndObservedNetworkConfigsNilProviderConfigs(c *gc.C) {
 
909
        input := expectedObservedNetworkConfigs
 
910
        result := networkingcommon.MergeProviderAndObservedNetworkConfigs(nil, input)
 
911
        c.Check(result, jc.DeepEquals, input)
956
912
}
957
913
 
958
914
func (s *TypesSuite) TestMergeProviderAndObservedNetworkConfigs(c *gc.C) {
959
 
        observedConfigsLength := len(expectedSortedObservedNetworkConfigs)
960
 
        providerConfigsLength := len(expectedSortedProviderNetworkConfigs)
961
 
        jsonExpected := s.networkConfigsAsJSON(c, expectedSortedMergedNetworkConfigs)
962
 
        for i := 0; i < observedConfigsLength; i++ {
963
 
                shuffledObservedConfigs := shuffleNetworkConfigs(expectedSortedObservedNetworkConfigs)
964
 
                for j := 0; j < providerConfigsLength; j++ {
965
 
                        shuffledProviderConfigs := shuffleNetworkConfigs(expectedSortedProviderNetworkConfigs)
966
 
 
967
 
                        mergedConfigs, err := networkingcommon.MergeProviderAndObservedNetworkConfigs(shuffledProviderConfigs, shuffledObservedConfigs)
968
 
                        c.Assert(err, jc.ErrorIsNil)
969
 
                        jsonResult := s.networkConfigsAsJSON(c, mergedConfigs)
970
 
                        c.Check(jsonResult, gc.Equals, jsonExpected)
971
 
                }
972
 
        }
 
915
        observedConfig := expectedObservedNetworkConfigs
 
916
        providerConfig := expectedProviderNetworkConfigs
 
917
        result := networkingcommon.MergeProviderAndObservedNetworkConfigs(providerConfig, observedConfig)
 
918
        c.Check(result, jc.DeepEquals, expectedFinalNetworkConfigs)
973
919
}
974
920
 
975
921
func (s *TypesSuite) TestGetObservedNetworkConfigInterfacesError(c *gc.C) {