Package com.woorea.openstack.quantum

Examples of com.woorea.openstack.quantum.Quantum


      access = keystone
          .tokens()
          .authenticate(
              new TokenAuthentication(access.getToken().getId()))
          .withTenantId("tenantId").execute();
      Quantum quantum = new Quantum(KeystoneUtils.findEndpointURL(
          access.getServiceCatalog(), "network", null, "public"));
      quantum.setTokenProvider(new OpenStackSimpleTokenProvider(access
          .getToken().getId()));
      NetworkForCreate netcreate = new NetworkForCreate();
      netcreate.setTenantId("tenantId");
      netcreate.setName("net2");
      netcreate.setAdminStateUp(true);

      network = quantum.networks().create(netcreate).execute();

      // Creating Subnet
      try {
        Subnet sub = new Subnet();
        SubnetForCreate subnet = new SubnetForCreate();
        subnet.setCidr("");
        subnet.setName("");
        subnet.setNetworkId(network.getId());
        subnet.setIpVersion(4);
        sub = quantum.subnets().create(subnet).execute();
        RouterForCreate routerForCreate = new RouterForCreate();
        routerForCreate.setName("routerName");
        routerForCreate.setTenantId("tenantId");
        Router router = quantum.routers().create(routerForCreate)
            .execute();
        RouterForAddInterface routerForAdd = new RouterForAddInterface();
        routerForAdd.setSubnetId(sub.getId());
        routerForAdd.setRouterId(router.getId());
        quantum.routers().addInterface(routerForAdd).execute();

        // System.out.println(sub);
      } catch (Exception e) {
        System.out.println(e.getMessage());
      }

      Networks networks = quantum.networks().list().execute();

      for (Network network1 : networks) {
        System.out.println(network1);
      }
    } else {
View Full Code Here


    // try to exchange token using the first tenant
    if (tenants.getList().size() > 0) {
      // access with tenant
      access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute();

      Quantum quantumClient = new Quantum(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "network",  null, "public"));
      quantumClient.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId()));

      Network networkQuery = new Network();
      networkQuery.setName("benn.cs");
      networkQuery.setAdminStateUp(true);
      /*
 
View Full Code Here

    // try to exchange token using the first tenant
    if (tenants.getList().size() > 0) {
      // access with tenant
      access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute();

      Quantum quantum = new Quantum(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "network",  null, "public"));
      quantum.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId()));

      Networks networks = quantum.networks().list().execute();
      for (Network network : networks) {
        System.out.println(network);
      }
    } else {
      System.out.println("No tenants found!");
View Full Code Here

TOP

Related Classes of com.woorea.openstack.quantum.Quantum

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.