[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-4045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16308097#comment-16308097
 ] 

ASF GitHub Bot commented on CLOUDSTACK-4045:
--------------------------------------------

DaanHoogland commented on a change in pull request #2382: CLOUDSTACK-4045 
URL: https://github.com/apache/cloudstack/pull/2382#discussion_r159233316
 
 

 ##########
 File path: server/test/com/cloud/network/IpAddressManagerTest.java
 ##########
 @@ -17,38 +17,109 @@
 
 package com.cloud.network;
 
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.dao.IPAddressDao;
+import com.cloud.network.dao.IPAddressVO;
+import com.cloud.network.dao.NetworkDao;
+import com.cloud.network.dao.NetworkVO;
+import com.cloud.network.rules.StaticNat;
+import com.cloud.network.rules.StaticNatImpl;
+import com.cloud.offerings.NetworkOfferingVO;
+import com.cloud.offerings.dao.NetworkOfferingDao;
+import com.cloud.user.AccountVO;
+import com.cloud.utils.net.Ip;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
+import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
-
-import com.cloud.network.dao.IPAddressDao;
-import com.cloud.network.dao.IPAddressVO;
-import com.cloud.network.rules.StaticNat;
-import com.cloud.network.rules.StaticNatImpl;
-import com.cloud.utils.net.Ip;
-
-import static org.mockito.Mockito.when;
+import org.mockito.Spy;
 
 import java.util.Collections;
 import java.util.List;
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.anyLong;
+import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 public class IpAddressManagerTest {
 
     @Mock
     IPAddressDao _ipAddrDao;
 
+    @Mock
+    NetworkDao _networkDao;
+
+    @Mock
+    NetworkOfferingDao _networkOfferingDao;
+
+    @Mock
+    NetworkModel _networkModel;
+
+    @Spy
     @InjectMocks
     IpAddressManagerImpl _ipManager;
 
+    IPAddressVO ipAddressVO;
+
+    NetworkVO networkAllocated;
+
+    NetworkVO networkImplemented;
+
+    NetworkVO networkNat;
+
+    AccountVO account;
+
     @Before
-    public void setup() {
+    public void setup() throws ResourceUnavailableException {
         MockitoAnnotations.initMocks(this);
+
 
 Review comment:
   a lot of this mock data is test specific and should not be in the setup 
method

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> IP address acquired with associateIpAddress is marked as source NAT, causing 
> disassociateIpAddress to fail later
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-4045
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-4045
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>    Affects Versions: 4.0.0, 4.0.1, 4.0.2, 4.1.0, 4.1.1, 4.2.0
>            Reporter: Murali Reddy
>            Assignee: Murali Reddy
>             Fix For: Future
>
>
> When you can create network, network is in allocated state. when network is 
> implemented CloudStack implicitly should acquire a public IP for source nat. 
> But there is assumption that first IP this is associated with network is 
> always for source NAT IP. So when you do
> 1. create network (network is in allocated state)
> 2. acquire a public IP and associate with the network
> 3. disassociate ip address
> #3 will fail because CloudStack marks the IP acquired in #1 to be source NAT. 
> For users this is counter-intutive because when a IP is acquired, he/she 
> should be able to release it as well.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to