cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-10199) Support requesting a specific IPv4 address in Basic Networking during Instance creation
Date Thu, 03 May 2018 01:22:00 GMT

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

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

rafaelweingartner commented on a change in pull request #2595: CLOUDSTACK-10199: Support requesting
a specific IPv4 address
URL: https://github.com/apache/cloudstack/pull/2595#discussion_r185680530
 
 

 ##########
 File path: engine/orchestration/src/test/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestratorTest.java
 ##########
 @@ -159,4 +174,255 @@ public void testDontRemoveDhcpServiceWhenNotProvided() {
         verify(testOrchastrator._ntwkSrvcDao, never()).getProviderForServiceInNetwork(network.getId(),
Service.Dhcp);
         verify(testOrchastrator._networksDao, times(1)).findById(nic.getNetworkId());
     }
+
+    @Test
+    public void testConfigureNicProfileBasedOnRequestedIpTestMacNull() {
+        Network network = mock(Network.class);
+        NicProfile requestedNicProfile = new NicProfile();
+        NicProfile nicProfile = Mockito.spy(new NicProfile());
+
+        configureTestConfigureNicProfileBasedOnRequestedIpTests(nicProfile, 0l, false, IPAddressVO.State.Free,
"192.168.100.1", "255.255.255.0", "00-88-14-4D-4C-FB",
+                requestedNicProfile, null, "192.168.100.150");
+
+        testOrchastrator.configureNicProfileBasedOnRequestedIp(requestedNicProfile, nicProfile,
network);
+
+        verifyAndAssert("192.168.100.150", "192.168.100.1", "255.255.255.0", nicProfile,
1, 1);
+    }
+
+    @Test
+    public void testConfigureNicProfileBasedOnRequestedIpTestNicProfileMacNotNull() {
+        Network network = mock(Network.class);
+        NicProfile requestedNicProfile = new NicProfile();
+        NicProfile nicProfile = Mockito.spy(new NicProfile());
+
+        configureTestConfigureNicProfileBasedOnRequestedIpTests(nicProfile, 0l, false, IPAddressVO.State.Free,
"192.168.100.1", "255.255.255.0", "00-88-14-4D-4C-FB",
+                requestedNicProfile, "00-88-14-4D-4C-FB", "192.168.100.150");
+
+        testOrchastrator.configureNicProfileBasedOnRequestedIp(requestedNicProfile, nicProfile,
network);
+
+        verifyAndAssert("192.168.100.150", "192.168.100.1", "255.255.255.0", nicProfile,
1, 0);
+    }
+
+    @Test
+    public void testConfigureNicProfileBasedOnRequestedIpTestRequestedIpNull() {
+        testConfigureNicProfileBasedOnRequestedIpTestRequestedIp(null, "", false);
+    }
+
+    @Test
+    public void testConfigureNicProfileBasedOnRequestedIpTestRequestedIpIsBlank() {
+        testConfigureNicProfileBasedOnRequestedIpTestRequestedIp("", "The requested [IPv4
address=''] is not a valid IP address", true);
+    }
+
+    @Test
+    public void testConfigureNicProfileBasedOnRequestedIpTestRequestedIpIsNotValid() {
+        testConfigureNicProfileBasedOnRequestedIpTestRequestedIp("123", "The requested [IPv4
address='123'] is not a valid IP address", true);
+    }
+
+    private void testConfigureNicProfileBasedOnRequestedIpTestRequestedIp(String requestedIpv4Address,
String exceptionAssert, boolean expectException) {
+        Network network = mock(Network.class);
+        NicProfile requestedNicProfile = new NicProfile();
+        NicProfile nicProfile = Mockito.spy(new NicProfile());
+
+        configureTestConfigureNicProfileBasedOnRequestedIpTests(nicProfile, 0l, false, IPAddressVO.State.Free,
"192.168.100.1", "255.255.255.0", "00-88-14-4D-4C-FB",
+                requestedNicProfile, null, requestedIpv4Address);
+        try {
+            testOrchastrator.configureNicProfileBasedOnRequestedIp(requestedNicProfile, nicProfile,
network);
+        } catch (InvalidParameterValueException e) {
+            assertEquals(exceptionAssert, e.getMessage());
 
 Review comment:
   why not use the `@Test` with the `expected` parameter?

----------------------------------------------------------------
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:
users@infra.apache.org


> Support requesting a specific IPv4 address in Basic Networking during Instance creation
> ---------------------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-10199
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10199
>             Project: CloudStack
>          Issue Type: Improvement
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: API
>         Environment: CloudStack 4.10
>            Reporter: Wido den Hollander
>            Priority: Major
>              Labels: basic-networking
>
> DirectPodBasedNetworkGuru does not support requesting a custom IP-Address while creating
a new NIC/Instance.
> {quote}
> Error 530: Does not support custom ip allocation at this time: NicProfile[0-0-null-null-null
> {
>   "cserrorcode": 4250,
>   "errorcode": 530,
>   "errortext": "Does not support custom ip allocation at this time: NicProfile[0-0-null-null-null",
>   "uuidList": []
> }
> {quote}
> Some use-cases prefer the ability to request the IPv4 address which the Instance will
get.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message