use of com.vmware.photon.controller.model.adapters.awsadapter.util.AWSSecurityGroupClient in project photon-model by vmware.
the class TestProvisionAWSSecurityGroup method validateAWSArtifacts.
private void validateAWSArtifacts(String securityGroupDescriptionLink, AuthCredentialsServiceState creds) throws Throwable {
SecurityGroupState securityGroup = getSecurityGroupState(securityGroupDescriptionLink);
AWSSecurityGroupClient client = new AWSSecurityGroupClient(AWSUtils.getAsyncClient(creds, this.region, getExecutor()));
// if any artifact is not present then an error will be thrown
SecurityGroup sg = client.getSecurityGroupById(securityGroup.customProperties.get(AWSSecurityGroupService.SECURITY_GROUP_ID));
assertNotNull(sg);
assertNotNull(sg.getIpPermissions());
assertTrue(sg.getIpPermissions().size() == 2);
// check that there is a rule that enables internal communication
assertTrue(isInternalRule(sg.getGroupId(), sg.getIpPermissions()));
assertNotNull(sg.getIpPermissionsEgress());
// there are two egress rules (one that was added as part of this test, and the default one)
assertTrue(sg.getIpPermissionsEgress().size() == 2);
// check that there is a rule that enables internal communication
assertTrue(isInternalRule(sg.getGroupId(), sg.getIpPermissionsEgress()));
}
use of com.vmware.photon.controller.model.adapters.awsadapter.util.AWSSecurityGroupClient in project photon-model by vmware.
the class TestAWSSecurityGroupService method setUp.
@Before
public void setUp() throws Exception {
CommandLineArgumentParser.parseFromProperties(this);
// ignore if any of the required properties are missing
org.junit.Assume.assumeTrue(TestUtils.isNull(this.privateKey, this.privateKeyId, this.region, this.subnet));
this.host = VerificationHost.create(0);
try {
this.host.start();
PhotonModelServices.startServices(this.host);
PhotonModelMetricServices.startServices(this.host);
PhotonModelTaskServices.startServices(this.host);
this.svc = new AWSSecurityGroupService();
this.host.startService(Operation.createPost(UriUtils.buildUri(this.host, AWSSecurityGroupService.class)), this.svc);
this.client = new AWSSecurityGroupClient(TestUtils.getClient(this.privateKeyId, this.privateKey, this.region, false));
} catch (Throwable e) {
throw new Exception(e);
}
}
Aggregations