Skip to content

Commit d38e9ee

Browse files
author
Alena Prokharchyk
committed
VPC: CS-15850 - don't unplug the nic for public network when there are existing ips in the same vlan having network rules
Conflicts: server/src/com/cloud/network/vpc/VpcManagerImpl.java
1 parent a83c753 commit d38e9ee

8 files changed

Lines changed: 408 additions & 64 deletions

File tree

‎server/src/com/cloud/network/vpc/VpcManagerImpl.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,7 @@ public void validateNtkwOffForVpc(long ntwkOffId, String cidr, String networkDom
963963

964964
throw new InvalidParameterValueException("Only networks of type " + GuestType.Isolated + " with service "
965965
+ Service.SourceNat + " can be added as a part of VPC");
966+
966967
}
967968

968969
//3) No redundant router support

‎server/test/com/cloud/vpc/VpcApiUnitTest.java‎

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public class VpcApiUnitTest extends TestCase{
4949
MockComponentLocator _locator;
5050
VpcManager _vpcService;
5151

52-
5352
@Override
5453
@Before
5554
public void setUp() throws Exception {
@@ -94,53 +93,76 @@ public void test() {
9493
try {
9594
_vpcService.validateNtkwOffForVpc(1, "0.0.0.0", "111-", new AccountVO(), _vpcService.getVpc(1), 2L, "10.1.1.1");
9695
result = true;
97-
s_logger.debug("Test1 passed, the offering is valid for vpc creation");
96+
s_logger.debug("Test passed: the offering is valid for vpc creation");
9897
} catch (Exception ex) {
99-
s_logger.warn("Test1 failed due to exc ", ex);
98+
s_logger.warn("TEST FAILED due to exc ", ex);
10099
}
101100

102101

103102
//2) invalid offering - source nat is not included
104103
result = false;
104+
String msg = null;
105105
try {
106106
_vpcService.validateNtkwOffForVpc(2, "0.0.0.0", "111-", new AccountVO(), _vpcService.getVpc(1), 2L, "10.1.1.1");
107107
result = true;
108108
} catch (InvalidParameterValueException ex) {
109+
msg = ex.getMessage();
109110
} finally {
110111
if (!result) {
111-
s_logger.debug("Test2 passed, can't use network offering without SourceNat service");
112+
s_logger.debug("Test passed: " + msg);
112113
} else {
113-
s_logger.warn("Test2 failed, can't use network offering without SourceNat service");
114+
s_logger.warn("TEST FAILED, can't use network offering without SourceNat service");
114115
}
115116
}
116117

117118
//3) invalid offering - conserve mode is off
118119
result = false;
120+
msg = null;
119121
try {
120122
_vpcService.validateNtkwOffForVpc(3, "0.0.0.0", "111-", new AccountVO(), _vpcService.getVpc(1), 2L, "10.1.1.1");
121123
result = true;
122124
} catch (InvalidParameterValueException ex) {
125+
msg = ex.getMessage();
123126
} finally {
124127
if (!result) {
125-
s_logger.debug("Test3 passed, can't use network offering without conserve mode = true");
128+
s_logger.debug("Test passed: " + msg);
126129
} else {
127-
s_logger.warn("Test3 failed, can't use network offering without conserve mode = true");
130+
s_logger.warn("TEST FAILED, can't use network offering without conserve mode = true");
128131
}
129132
}
130133

131-
//3) invalid offering - guest type shared
134+
//4) invalid offering - guest type shared
132135
result = false;
133136
try {
134137
_vpcService.validateNtkwOffForVpc(4, "0.0.0.0", "111-", new AccountVO(), _vpcService.getVpc(1), 2L, "10.1.1.1");
135138
result = true;
136-
} catch (InvalidParameterValueException ex) {
139+
} catch (InvalidParameterValueException ex) {
140+
msg = ex.getMessage();
137141
} finally {
138142
if (!result) {
139-
s_logger.debug("Test4 passed, can't use network offering with guest type = Shared");
143+
s_logger.debug("Test passed: " + msg);
140144
} else {
141-
s_logger.warn("Test4 failed, can't use network offering with guest type = Shared");
145+
s_logger.warn("TEST FAILED, can't use network offering with guest type = Shared");
142146
}
143147
}
148+
149+
//5) Invalid offering - no redundant router supportresult = false;
150+
try {
151+
_vpcService.validateNtkwOffForVpc(5, "0.0.0.0", "111-", new AccountVO(), _vpcService.getVpc(1), 2L, "10.1.1.1");
152+
result = true;
153+
} catch (InvalidParameterValueException ex) {
154+
msg = ex.getMessage();
155+
} finally {
156+
if (!result) {
157+
s_logger.debug("Test passed: " + msg);
158+
} else {
159+
s_logger.warn("TEST FAILED, can't use network offering with guest type = Shared");
160+
}
161+
}
162+
163+
//6) Only one network in the VPC can support LB service - positive scenario
164+
165+
//7) Only one netowrk in the VPC can support LB service - negative scenario
144166
}
145167

146168
}

0 commit comments

Comments
 (0)