@@ -101,19 +101,6 @@ func (acl *ACLPolicy) convertToAclSettings(aclID string) (*NPMACLPolSettings, er
101101 // Ignore adding ruletype for now as there is a bug
102102 // policySettings.RuleType = hcn.RuleTypeSwitch
103103
104- // ACLPolicy settings uses ID field of SetPolicy in LocalAddresses or RemoteAddresses
105- var srcListStr , dstListStr string
106- // Check if we have direct IPs (NPM Lite /32 bypass)
107- if len (acl .SrcDirectIPs ) > 0 || len (acl .DstDirectIPs ) > 0 {
108- srcListStr = strings .Join (acl .SrcDirectIPs , "," )
109- dstListStr = strings .Join (acl .DstDirectIPs , "," )
110- } else {
111- // Original IPSet-based approach
112- srcListStr = getAddrListFromSetInfo (acl .SrcList )
113- dstListStr = getAddrListFromSetInfo (acl .DstList )
114- }
115- dstPortStr := getPortStrFromPorts (acl .DstPorts )
116-
117104 // HNS has confusing Local and Remote address defintions
118105 // For Traffic Direction INGRESS
119106 // LocalAddresses = Source Sets
@@ -135,8 +122,11 @@ func (acl *ACLPolicy) convertToAclSettings(aclID string) (*NPMACLPolSettings, er
135122 // LocalAddresses = Destination IPs
136123 // RemoteAddresses = Source IPs
137124
125+ var srcListStr , dstListStr string
138126 // if direct IPs are used, we leave local addresses to be an empty string
139127 if len (acl .SrcDirectIPs ) > 0 || len (acl .DstDirectIPs ) > 0 {
128+ srcListStr = strings .Join (acl .SrcDirectIPs , "," )
129+ dstListStr = strings .Join (acl .DstDirectIPs , "," )
140130 policySettings .LocalAddresses = ""
141131 if policySettings .Direction == hcn .DirectionTypeOut {
142132 // EGRESS: Remote = Destination IPs from policy
@@ -146,10 +136,15 @@ func (acl *ACLPolicy) convertToAclSettings(aclID string) (*NPMACLPolSettings, er
146136 policySettings .RemoteAddresses = srcListStr
147137 }
148138 } else {
139+ // Original IPSet-based approach
140+ srcListStr = getAddrListFromSetInfo (acl .SrcList )
141+ dstListStr = getAddrListFromSetInfo (acl .DstList )
149142 policySettings .LocalAddresses = srcListStr
150143 policySettings .RemoteAddresses = dstListStr
151144 }
152145
146+ dstPortStr := getPortStrFromPorts (acl .DstPorts )
147+
153148 // Switch ports based on direction
154149 policySettings .RemotePorts = ""
155150 policySettings .LocalPorts = dstPortStr
0 commit comments