@@ -10,9 +10,9 @@ import (
1010 "github.com/Azure/azure-container-networking/cni"
1111 "github.com/Azure/azure-container-networking/cni/util"
1212 "github.com/Azure/azure-container-networking/cns"
13- acn "github.com/Azure/azure-container-networking/common"
1413 "github.com/Azure/azure-container-networking/iptables"
1514 "github.com/Azure/azure-container-networking/network"
15+ "github.com/Azure/azure-container-networking/network/policy"
1616 cniSkel "github.com/containernetworking/cni/pkg/skel"
1717 "github.com/stretchr/testify/require"
1818)
@@ -536,14 +536,14 @@ func TestCNSIPAMInvoker_Add(t *testing.T) {
536536 "Priority": 10000
537537 }` )
538538
539- expectedDefaultDenyACL := []acn. KVPair {
539+ expectedEndpointPolicies := []policy. Policy {
540540 {
541- Name : "EndpointPolicy" ,
542- Value : valueOut ,
541+ Type : policy . ACLPolicy ,
542+ Data : valueOut ,
543543 },
544544 {
545- Name : "EndpointPolicy" ,
546- Value : valueIn ,
545+ Type : policy . ACLPolicy ,
546+ Data : valueIn ,
547547 },
548548 }
549549 tests := []struct {
@@ -583,8 +583,8 @@ func TestCNSIPAMInvoker_Add(t *testing.T) {
583583 PrimaryIP : "10.0.0.1" ,
584584 Subnet : "10.0.0.0/24" ,
585585 },
586- NICType : cns .InfraNIC ,
587- DefaultDenyACL : expectedDefaultDenyACL ,
586+ NICType : cns .InfraNIC ,
587+ EndpointPolicies : expectedEndpointPolicies ,
588588 },
589589 },
590590 Response : cns.Response {
@@ -613,7 +613,7 @@ func TestCNSIPAMInvoker_Add(t *testing.T) {
613613 Gateway : net .ParseIP ("10.0.0.1" ),
614614 },
615615 },
616- DefaultDenyACL : expectedDefaultDenyACL ,
616+ EndpointPolicies : expectedEndpointPolicies ,
617617 Routes : []network.RouteInfo {
618618 {
619619 Dst : network .Ipv4DefaultRouteDstPrefix ,
@@ -654,7 +654,7 @@ func TestCNSIPAMInvoker_Add(t *testing.T) {
654654 PrimaryIP : "10.0.0.1" ,
655655 Subnet : "10.0.0.0/24" ,
656656 },
657- DefaultDenyACL : expectedDefaultDenyACL ,
657+ EndpointPolicies : expectedEndpointPolicies ,
658658 },
659659 },
660660 Response : cns.Response {
@@ -683,7 +683,7 @@ func TestCNSIPAMInvoker_Add(t *testing.T) {
683683 Gateway : net .ParseIP ("10.0.0.1" ),
684684 },
685685 },
686- DefaultDenyACL : expectedDefaultDenyACL ,
686+ EndpointPolicies : expectedEndpointPolicies ,
687687 Routes : []network.RouteInfo {
688688 {
689689 Dst : network .Ipv4DefaultRouteDstPrefix ,
@@ -724,8 +724,8 @@ func TestCNSIPAMInvoker_Add(t *testing.T) {
724724 PrimaryIP : "10.0.0.1" ,
725725 Subnet : "10.0.0.0/24" ,
726726 },
727- NICType : cns .InfraNIC ,
728- DefaultDenyACL : expectedDefaultDenyACL ,
727+ NICType : cns .InfraNIC ,
728+ EndpointPolicies : expectedEndpointPolicies ,
729729 },
730730 {
731731 PodIPConfig : cns.IPSubnet {
@@ -745,8 +745,8 @@ func TestCNSIPAMInvoker_Add(t *testing.T) {
745745 PrimaryIP : "fe80::1234:5678:9abc" ,
746746 Subnet : "fd11:1234::/112" ,
747747 },
748- NICType : cns .InfraNIC ,
749- DefaultDenyACL : expectedDefaultDenyACL ,
748+ NICType : cns .InfraNIC ,
749+ EndpointPolicies : expectedEndpointPolicies ,
750750 },
751751 },
752752 Response : cns.Response {
@@ -779,7 +779,7 @@ func TestCNSIPAMInvoker_Add(t *testing.T) {
779779 Gateway : net .ParseIP ("fe80::1234:5678:9abc" ),
780780 },
781781 },
782- DefaultDenyACL : expectedDefaultDenyACL ,
782+ EndpointPolicies : expectedEndpointPolicies ,
783783 Routes : []network.RouteInfo {
784784 {
785785 Dst : network .Ipv4DefaultRouteDstPrefix ,
@@ -807,7 +807,7 @@ func TestCNSIPAMInvoker_Add(t *testing.T) {
807807 result : & cns.IPConfigsResponse {
808808 PodIPInfo : []cns.PodIpInfo {
809809 {
810- DefaultDenyACL : expectedDefaultDenyACL ,
810+ EndpointPolicies : expectedEndpointPolicies ,
811811 },
812812 },
813813 Response : cns.Response {
@@ -836,7 +836,7 @@ func TestCNSIPAMInvoker_Add(t *testing.T) {
836836 }
837837 ipamAddResult , err := invoker .Add (IPAMAddConfig {nwCfg : tt .args .nwCfg , args : tt .args .args , options : tt .args .options })
838838 if tt .wantErr {
839- require .Equalf ([]acn. KVPair (nil ), ipamAddResult .interfaceInfo [string (cns .InfraNIC )].DefaultDenyACL , "Correct default deny ACL " )
839+ require .Equalf ([]policy. Policy (nil ), ipamAddResult .interfaceInfo [string (cns .InfraNIC )].EndpointPolicies , "There was an error requesting IP addresses from cns " )
840840 require .Error (err )
841841 } else {
842842 require .NoError (err )
@@ -852,7 +852,7 @@ func TestCNSIPAMInvoker_Add(t *testing.T) {
852852 }
853853 if ifInfo .NICType == cns .InfraNIC {
854854 require .Equalf (tt .wantDefaultResult , ifInfo , "incorrect default response" )
855- require .Equalf (expectedDefaultDenyACL , ifInfo .DefaultDenyACL , "Correct default deny ACL" )
855+ require .Equalf (expectedEndpointPolicies , ifInfo .EndpointPolicies , "Correct default deny ACL" )
856856 }
857857 }
858858 })
0 commit comments