public void validateNtwkOffForVpc() {
//validate network offering
//1) correct network offering
boolean result = false;
try {
_vpcService.validateNtwkOffForNtwkInVpc(2L, 1, "0.0.0.0", "111-", _vpcService.getVpc(1), "10.1.1.1", new AccountVO(), null);
result = true;
} catch (Exception ex) {
} finally {
assertTrue("Validate network offering: Test passed: the offering is valid for vpc creation", result);
}
//2) invalid offering - source nat is not included
result = false;
try {
_vpcService.validateNtwkOffForNtwkInVpc(2L, 2, "0.0.0.0", "111-", _vpcService.getVpc(1), "10.1.1.1", new AccountVO(), null);
result = true;
} catch (InvalidParameterValueException ex) {
} finally {
assertFalse("Validate network offering: TEST FAILED, can't use network offering without SourceNat service", result);
}
//3) invalid offering - conserve mode is off
result = false;
try {
_vpcService.validateNtwkOffForNtwkInVpc(2L, 3, "0.0.0.0", "111-", _vpcService.getVpc(1), "10.1.1.1", new AccountVO(), null);
result = true;
} catch (InvalidParameterValueException ex) {
} finally {
assertFalse("Validate network offering: TEST FAILED, can't use network offering without conserve mode = true", result);
}
//4) invalid offering - guest type shared
result = false;
try {
_vpcService.validateNtwkOffForNtwkInVpc(2L, 4, "0.0.0.0", "111-", _vpcService.getVpc(1), "10.1.1.1", new AccountVO(), null);
result = true;
} catch (InvalidParameterValueException ex) {
} finally {
assertFalse("Validate network offering: TEST FAILED, can't use network offering with guest type = Shared", result);
}
//5) Invalid offering - no redundant router support
result = false;
try {
_vpcService.validateNtwkOffForNtwkInVpc(2L, 5, "0.0.0.0", "111-", _vpcService.getVpc(1), "10.1.1.1", new AccountVO(), null);
result = true;
} catch (InvalidParameterValueException ex) {
} finally {
assertFalse("TEST FAILED, can't use network offering with guest type = Shared", result);
}