@@ -16,7 +16,7 @@ import (
16
16
17
17
"github.com/containernetworking/cni/libcni"
18
18
"github.com/containernetworking/cni/pkg/types"
19
- "github.com/containernetworking/cni/pkg/types/current "
19
+ cniv04 "github.com/containernetworking/cni/pkg/types/040 "
20
20
"github.com/containernetworking/cni/pkg/version"
21
21
"github.com/containernetworking/plugins/pkg/ns"
22
22
"github.com/containernetworking/plugins/pkg/testutils"
@@ -78,7 +78,7 @@ type TestConf struct {
78
78
Type string `json:"type,omitempty"`
79
79
}
80
80
81
- func (f * fakeExec ) addPlugin (expectedEnv []string , expectedConf string , result * current .Result , err error ) {
81
+ func (f * fakeExec ) addPlugin (expectedEnv []string , expectedConf string , result types .Result , err error ) {
82
82
f .plugins = append (f .plugins , & fakePlugin {
83
83
expectedEnv : expectedEnv ,
84
84
expectedConf : expectedConf ,
@@ -473,18 +473,18 @@ var _ = Describe("ocicni operations", func() {
473
473
Expect (err ).NotTo (HaveOccurred ())
474
474
475
475
fake := & fakeExec {}
476
- expectedResult := & current .Result {
476
+ expectedResult := & cniv04 .Result {
477
477
CNIVersion : "0.3.1" ,
478
- Interfaces : []* current .Interface {
478
+ Interfaces : []* cniv04 .Interface {
479
479
{
480
480
Name : "eth0" ,
481
481
Mac : "01:23:45:67:89:01" ,
482
482
Sandbox : networkNS .Path (),
483
483
},
484
484
},
485
- IPs : []* current .IPConfig {
485
+ IPs : []* cniv04 .IPConfig {
486
486
{
487
- Interface : current .Int (0 ),
487
+ Interface : cniv04 .Int (0 ),
488
488
Version : "4" ,
489
489
Address : * ensureCIDR ("1.1.1.2/24" ),
490
490
},
@@ -505,7 +505,7 @@ var _ = Describe("ocicni operations", func() {
505
505
Expect (err ).NotTo (HaveOccurred ())
506
506
Expect (fake .addIndex ).To (Equal (len (fake .plugins )))
507
507
Expect (len (results )).To (Equal (1 ))
508
- r := results [0 ].Result .(* current .Result )
508
+ r := results [0 ].Result .(* cniv04 .Result )
509
509
Expect (reflect .DeepEqual (r , expectedResult )).To (BeTrue ())
510
510
511
511
// Make sure loopback device is up
@@ -535,38 +535,37 @@ var _ = Describe("ocicni operations", func() {
535
535
Expect (err ).NotTo (HaveOccurred ())
536
536
537
537
fake := & fakeExec {}
538
- expectedResult1 := & current .Result {
538
+ expectedResult1 := & cniv04 .Result {
539
539
CNIVersion : "0.3.1" ,
540
- Interfaces : []* current .Interface {
540
+ Interfaces : []* cniv04 .Interface {
541
541
{
542
542
Name : "eth0" ,
543
543
Mac : "01:23:45:67:89:01" ,
544
544
Sandbox : networkNS .Path (),
545
545
},
546
546
},
547
- IPs : []* current .IPConfig {
547
+ IPs : []* cniv04 .IPConfig {
548
548
{
549
- Interface : current .Int (0 ),
549
+ Interface : cniv04 .Int (0 ),
550
550
Version : "4" ,
551
551
Address : * ensureCIDR ("1.1.1.2/24" ),
552
552
},
553
553
},
554
554
}
555
555
fake .addPlugin (nil , conf1 , expectedResult1 , nil )
556
556
557
- expectedResult2 := & current .Result {
557
+ expectedResult2 := & cniv04 .Result {
558
558
CNIVersion : "0.3.1" ,
559
- Interfaces : []* current .Interface {
559
+ Interfaces : []* cniv04 .Interface {
560
560
{
561
561
Name : "eth1" ,
562
562
Mac : "01:23:45:67:89:02" ,
563
563
Sandbox : networkNS .Path (),
564
564
},
565
565
},
566
- IPs : []* current .IPConfig {
566
+ IPs : []* cniv04 .IPConfig {
567
567
{
568
- Interface : current .Int (0 ),
569
- Version : "4" ,
568
+ Interface : cniv04 .Int (0 ),
570
569
Address : * ensureCIDR ("1.1.1.3/24" ),
571
570
},
572
571
},
@@ -590,9 +589,9 @@ var _ = Describe("ocicni operations", func() {
590
589
Expect (err ).NotTo (HaveOccurred ())
591
590
Expect (fake .addIndex ).To (Equal (len (fake .plugins )))
592
591
Expect (len (results )).To (Equal (2 ))
593
- r := results [0 ].Result .(* current .Result )
592
+ r := results [0 ].Result .(* cniv04 .Result )
594
593
Expect (reflect .DeepEqual (r , expectedResult1 )).To (BeTrue ())
595
- r = results [1 ].Result .(* current .Result )
594
+ r = results [1 ].Result .(* cniv04 .Result )
596
595
Expect (reflect .DeepEqual (r , expectedResult2 )).To (BeTrue ())
597
596
598
597
err = ocicni .TearDownPod (podNet )
@@ -612,37 +611,37 @@ var _ = Describe("ocicni operations", func() {
612
611
Expect (err ).NotTo (HaveOccurred ())
613
612
614
613
fake := & fakeExec {}
615
- expectedResult1 := & current .Result {
614
+ expectedResult1 := & cniv04 .Result {
616
615
CNIVersion : "0.4.0" ,
617
- Interfaces : []* current .Interface {
616
+ Interfaces : []* cniv04 .Interface {
618
617
{
619
618
Name : "eth0" ,
620
619
Mac : "01:23:45:67:89:01" ,
621
620
Sandbox : networkNS .Path (),
622
621
},
623
622
},
624
- IPs : []* current .IPConfig {
623
+ IPs : []* cniv04 .IPConfig {
625
624
{
626
- Interface : current .Int (0 ),
625
+ Interface : cniv04 .Int (0 ),
627
626
Version : "4" ,
628
627
Address : * ensureCIDR ("1.1.1.2/24" ),
629
628
},
630
629
},
631
630
}
632
631
fake .addPlugin (nil , conf1 , expectedResult1 , nil )
633
632
634
- expectedResult2 := & current .Result {
633
+ expectedResult2 := & cniv04 .Result {
635
634
CNIVersion : "0.4.0" ,
636
- Interfaces : []* current .Interface {
635
+ Interfaces : []* cniv04 .Interface {
637
636
{
638
637
Name : "eth1" ,
639
638
Mac : "01:23:45:67:89:02" ,
640
639
Sandbox : networkNS .Path (),
641
640
},
642
641
},
643
- IPs : []* current .IPConfig {
642
+ IPs : []* cniv04 .IPConfig {
644
643
{
645
- Interface : current .Int (0 ),
644
+ Interface : cniv04 .Int (0 ),
646
645
Version : "4" ,
647
646
Address : * ensureCIDR ("1.1.1.3/24" ),
648
647
},
@@ -667,17 +666,17 @@ var _ = Describe("ocicni operations", func() {
667
666
Expect (err ).NotTo (HaveOccurred ())
668
667
Expect (fake .addIndex ).To (Equal (len (fake .plugins )))
669
668
Expect (len (results )).To (Equal (2 ))
670
- r := results [0 ].Result .(* current .Result )
669
+ r := results [0 ].Result .(* cniv04 .Result )
671
670
Expect (reflect .DeepEqual (r , expectedResult1 )).To (BeTrue ())
672
- r = results [1 ].Result .(* current .Result )
671
+ r = results [1 ].Result .(* cniv04 .Result )
673
672
Expect (reflect .DeepEqual (r , expectedResult2 )).To (BeTrue ())
674
673
675
674
resultsStatus , errStatus := ocicni .GetPodNetworkStatus (podNet )
676
675
Expect (errStatus ).NotTo (HaveOccurred ())
677
676
Expect (len (resultsStatus )).To (Equal (2 ))
678
- r = resultsStatus [0 ].Result .(* current .Result )
677
+ r = resultsStatus [0 ].Result .(* cniv04 .Result )
679
678
Expect (reflect .DeepEqual (r , expectedResult1 )).To (BeTrue ())
680
- r = resultsStatus [1 ].Result .(* current .Result )
679
+ r = resultsStatus [1 ].Result .(* cniv04 .Result )
681
680
Expect (reflect .DeepEqual (r , expectedResult2 )).To (BeTrue ())
682
681
683
682
err = ocicni .TearDownPod (podNet )
0 commit comments