예제 #1
0
    def setUpClass(cls):
        """
        Instantiate a fresh DNSaaS object before every test
        """
        # checking vor credentials
        if 'OS_USERNAME' not in os.environ or 'OS_PASSWORD' not in os.environ:
            raise AttributeError(
                'Please provide OS_USERNAME, OS_PASSWORD as env vars.')
        if 'DESIGN_URI' in os.environ:
            kep = os.environ['DESIGN_URI']
        else:
            kep = 'http://localhost:35357/v2.0'

        user = os.environ['OS_USERNAME']
        pwd = os.environ['OS_PASSWORD']

        # retrieve token for later usage
        if 'OS_TENANT_NAME' in os.environ:
            cls.tenant = os.environ['OS_TENANT_NAME']
        else:
            cls.tenant = 'mcn-dns'

        keystone = client.Client(username=user,
                                 password=pwd,
                                 tenant_name=cls.tenant,
                                 auth_url=kep)
        cls.token = keystone.auth_token

        # instantiate class under test.
        #cls.cut = util.get_dnsaas(cls.token, tenant_name=cls.tenant, mcn_endpoint_api='130.92.70.245')

        cls.cut = util.get_dnsaas(cls.token, tenant_name=cls.tenant)
    def setUpClass(cls):
        """
        Instantiate a fresh DNSaaS object before every test
        """
        # checking vor credentials
        if 'OS_USERNAME' not in os.environ or 'OS_PASSWORD' not in os.environ:
            raise AttributeError('Please provide OS_USERNAME, OS_PASSWORD as env vars.')
        if 'DESIGN_URI' in os.environ:
            kep = os.environ['DESIGN_URI']
        else:
            kep = 'http://localhost:35357/v2.0'

        user = os.environ['OS_USERNAME']
        pwd = os.environ['OS_PASSWORD']

        # retrieve token for later usage
        if 'OS_TENANT_NAME' in os.environ:
            cls.tenant = os.environ['OS_TENANT_NAME']
        else:
            cls.tenant = 'mcn-dns'

        keystone = client.Client(username=user, password=pwd,
                                 tenant_name=cls.tenant, auth_url=kep)
        cls.token = keystone.auth_token

        # instantiate class under test.
        cls.cut = util.get_dnsaas(cls.token, tenant_name=cls.tenant)
user = os.environ['OS_USERNAME']
pwd = os.environ['OS_PASSWORD']
if 'OS_TENANT_NAME' in os.environ:
    t_name = os.environ['OS_TENANT_NAME']
else:
    t_name = 'demo'
keystone = client.Client(username=user,
                        password=pwd,
                        tenant_name=t_name,
                        auth_url=kep)
token = keystone.auth_token
#print token

ts = time.time()
dns=util.get_dnsaas(token, tenant_name=t_name, maas_endpoint_address="160.85.4.50")
#dns=util.get_dnsaas(token, tenant_name=t_name)

te = time.time()

print( "Time get_dnsaas= %3.5f" % (te-ts))

if dns is not None:
    time.sleep(10) # make sure dns is ready

    print dns.get_address()

    res = dns.create_domain('testdnsaas.com', '*****@*****.**', 3600, token)
    idDomain=dns.get_domain("testdnsaas.com", token)
    print idDomain