Package org.jclouds.compute.extensions

Examples of org.jclouds.compute.extensions.SecurityGroupExtension


      Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
      requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
      requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
      requestResponseMap.put(list, listResponse).build();

      SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();

      Set<SecurityGroup> groups = extension.listSecurityGroups();
      assertEquals(groups.size(), 1);
   }
View Full Code Here


      Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
      requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
      requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
      requestResponseMap.put(list, listResponse).build();

      SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();

      Set<SecurityGroup> groups = extension.listSecurityGroupsInLocation(new LocationBuilder()
              .scope(LocationScope.ZONE)
              .id(zone)
              .description("zone")
              .build());
      assertEquals(groups.size(), 1);
View Full Code Here

      requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
      requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
      requestResponseMap.put(serverReq, serverResponse);
      requestResponseMap.put(list, listResponse).build();

      SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();

      Set<SecurityGroup> groups = extension.listSecurityGroupsForNode(zone + "/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb");
      assertEquals(groups.size(), 1);
   }
View Full Code Here

      requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
      requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
      requestResponseMap.put(getSecurityGroup, getSecurityGroupResponse);
      requestResponseMap.put(list, listResponse).build();

      SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();

      SecurityGroup group = extension.getSecurityGroupById(zone + "/160");
      assertEquals(group.getId(), zone + "/160");
   }
View Full Code Here

      requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
      requestResponseMap.put(create, createResponse);
      requestResponseMap.put(list, listResponse);
      requestResponseMap.put(getSecurityGroup, getSecurityGroupResponse).build();

      SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();

      SecurityGroup group = extension.createSecurityGroup("test", new LocationBuilder()
              .scope(LocationScope.ZONE)
              .id(zone)
              .description("zone")
              .build());
      assertEquals(group.getId(), zone + "/160");
View Full Code Here

      requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
      requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
      requestResponseMap.put(getSecurityGroup, getSecurityGroupResponse);
      requestResponseMap.put(delete, deleteResponse).build();

      SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();

      assertTrue(extension.removeSecurityGroup(zone + "/160"), "Expected removal of securitygroup to be successful");
   }
View Full Code Here

      HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
              payloadFromResource("/securitygroup_details_extension.json")).build();


      SecurityGroupExtension extension = orderedRequestsSendResponses(ImmutableList.of(keystoneAuthWithUsernameAndPasswordAndTenantName,
              extensionsOfNovaRequest, getSecurityGroup, createRule, getSecurityGroup, list, list),
              ImmutableList.of(responseWithKeystoneAccess, extensionsOfNovaResponse, getSecurityGroupNoRulesResponse,
                      createRuleResponse, getSecurityGroupResponse, listResponse, listResponse)).getSecurityGroupExtension().get();

      IpPermission.Builder builder = IpPermission.builder();

      builder.ipProtocol(IpProtocol.TCP);
      builder.fromPort(22);
      builder.toPort(22);
      builder.cidrBlock("10.2.6.0/24");

      IpPermission perm = builder.build();

      SecurityGroup origGroup = extension.getSecurityGroupById(zone + "/160");

      assertNotNull(origGroup);
      SecurityGroup newGroup = extension.addIpPermission(perm, origGroup);

      assertNotNull(newGroup);
   }
View Full Code Here

      HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
              payloadFromResource("/securitygroup_details_extension.json")).build();


      SecurityGroupExtension extension = orderedRequestsSendResponses(ImmutableList.of(keystoneAuthWithUsernameAndPasswordAndTenantName,
              extensionsOfNovaRequest, getSecurityGroup, createRule, getSecurityGroup, list, list),
              ImmutableList.of(responseWithKeystoneAccess, extensionsOfNovaResponse, getSecurityGroupNoRulesResponse,
                      createRuleResponse, getSecurityGroupResponse, listResponse, listResponse)).getSecurityGroupExtension().get();

      SecurityGroup origGroup = extension.getSecurityGroupById(zone + "/160");

      assertNotNull(origGroup);
      SecurityGroup newGroup = extension.addIpPermission(IpProtocol.TCP,
              22,
              22,
              emptyMultimap(),
              ImmutableSet.of("10.2.6.0/24"),
              emptyStringSet(),
View Full Code Here

      HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
              payloadFromResource("/securitygroup_details_extension.json")).build();


      SecurityGroupExtension extension = orderedRequestsSendResponses(ImmutableList.of(keystoneAuthWithUsernameAndPasswordAndTenantName,
              extensionsOfNovaRequest, getSecurityGroup, createRule, getSecurityGroup, list, list),
              ImmutableList.of(responseWithKeystoneAccess, extensionsOfNovaResponse, getSecurityGroupNoRulesResponse,
                      createRuleResponse, getSecurityGroupResponse, listResponse, listResponse)).getSecurityGroupExtension().get();

      IpPermission.Builder builder = IpPermission.builder();

      builder.ipProtocol(IpProtocol.TCP);
      builder.fromPort(22);
      builder.toPort(22);
      builder.groupId("admin/11111");

      IpPermission perm = builder.build();

      SecurityGroup origGroup = extension.getSecurityGroupById(zone + "/160");

      assertNotNull(origGroup);
      SecurityGroup newGroup = extension.addIpPermission(perm, origGroup);

      assertNotNull(newGroup);
   }
View Full Code Here

      HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
              payloadFromResource("/securitygroup_details_extension.json")).build();


      SecurityGroupExtension extension = orderedRequestsSendResponses(ImmutableList.of(keystoneAuthWithUsernameAndPasswordAndTenantName,
              extensionsOfNovaRequest, getSecurityGroup, createRule, getSecurityGroup, list, list),
              ImmutableList.of(responseWithKeystoneAccess, extensionsOfNovaResponse, getSecurityGroupNoRulesResponse,
                      createRuleResponse, getSecurityGroupResponse, listResponse, listResponse)).getSecurityGroupExtension().get();

      SecurityGroup origGroup = extension.getSecurityGroupById(zone + "/160");

      assertNotNull(origGroup);
      SecurityGroup newGroup = extension.addIpPermission(IpProtocol.TCP,
              22,
              22,
              emptyMultimap(),
              emptyStringSet(),
              ImmutableSet.of("admin/11111"),
View Full Code Here

TOP

Related Classes of org.jclouds.compute.extensions.SecurityGroupExtension

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.