Exemplo n.º 1
0
 def test_0003(self):
     """Register extension"""
     name = config['vcloud']['ext_name']
     system = System(session=self.vca.vcloud_session, verify=self.vca.verify, log=self.vca.log)
     extension = system.register_extension(name, name, name, name)
     assert extension is not None
     assert name == extension.attrib['name']
Exemplo n.º 2
0
 def test_0004(self):
     """Get extension"""
     system = System(session=self.vca.vcloud_session, verify=self.vca.verify, log=self.vca.log)
     extension = system.get_extension(config['vcloud']['ext_name'])
     assert extension is not None
     name = extension.attrib['name']
     assert name == config['vcloud']['ext_name']
Exemplo n.º 3
0
 def test_0002(self):
     """List extensions"""
     system = System(session=self.vca.vcloud_session,
                     verify=self.vca.verify,
                     log=self.vca.log)
     extensions = system.get_extensions()
     assert extensions
Exemplo n.º 4
0
 def test_0007(self):
     """Unregister extension"""
     system = System(session=self.vca.vcloud_session, verify=self.vca.verify, log=self.vca.log)
     extension = system.get_extension(config['vcloud']['ext_name'])
     assert extension is not None
     name = extension.attrib['name']
     assert name == config['vcloud']['ext_name']
     result = system.unregister_extension(config['vcloud']['ext_name'], extension.attrib['href'])
     extension = system.get_extension(config['vcloud']['ext_name'])
     assert extension is None
Exemplo n.º 5
0
 def test_0006(self):
     """Disable extension"""
     system = System(session=self.vca.vcloud_session, verify=self.vca.verify, log=self.vca.log)
     extension = system.get_extension(config['vcloud']['ext_name'])
     assert extension is not None
     name = extension.attrib['name']
     assert name == config['vcloud']['ext_name']
     result = system.enable_extension(name,
                                      extension.attrib['href'],
                                      enabled=False)
     extension = system.get_extension(config['vcloud']['ext_name'])
     assert extension is not None
     name = extension.attrib['name']
     assert name == config['vcloud']['ext_name']
     enabled = '****'
     for node in extension.findall('.//{http://www.vmware.com/vcloud/extension/v1.5}Enabled'):
         enabled = node.text
     assert enabled == 'false'
Exemplo n.º 6
0
password = os.environ['PASSWORD']
org = 'System'
org_url = 'https://%s/cloud' % host
verify = False
log = True
version = '27.0'
extension_name = sys.argv[1]

vca = VCA(host=host,
          username=username,
          service_type='standalone',
          version=version,
          verify=verify,
          log=log)

result = vca.login(password=password, org=org, org_url=org_url)
print_vca(vca)

system = System(session=vca.vcloud_session, verify=verify, log=log)

patterns = ['/cluster', '/cluster/.*', '/cluster/.*/.*']
result = system.register_extension(extension_name, extension_name,
                                   extension_name, patterns)
print(result)

extension = system.get_extension(extension_name)
if extension == None:
    print(('extension %s not found' % extension_name))
else:
    print((extension.attrib['name']))
Exemplo n.º 7
0
org_url = 'https://%s/cloud' % host
verify = False
log = True
version = '27.0'

vca = VCA(host=host,
          username=username,
          service_type='standalone',
          version=version,
          verify=verify,
          log=log)

result = vca.login(password=password, org=org, org_url=org_url)
print_vca(vca)

system = System(session=vca.vcloud_session, verify=verify, log=log)
# orgs = system.get_orgs()
# print(json.dumps(orgs))

extensions = system.get_extensions()
print(extensions)

sys.exit(0)

extension_name = 'gcp-ticketing'
extension_metadata = """
<vmext:Service xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" name="%s">
   <vmext:Namespace>%s</vmext:Namespace>
   <vmext:Enabled>true</vmext:Enabled>
   <vmext:RoutingKey>%s</vmext:RoutingKey>
   <vmext:Exchange>vcdext</vmext:Exchange>
Exemplo n.º 8
0
        else:
            print('vca vcloud session:   ', vca.vcloud_session)
    else:
        print('vca: ', vca)


host = 'vcd.cpsbu.eng.vmware.com'
username = '******'
password = os.environ['PASSWORD']
org = 'System'
org_url = 'https://%s/cloud' % host
verify = False
log = True
version = '27.0'

vca = VCA(host=host,
          username=username,
          service_type='standalone',
          version=version,
          verify=verify,
          log=log)

result = vca.login(password=password, org=org, org_url=org_url)
print_vca(vca)

system = System(session=vca.vcloud_session, verify=verify, log=log)

print('extension found:')
extension = system.get_extension(sys.argv[1])
print((extension.__dict__))
Exemplo n.º 9
0
verify = False
log = True
version = '27.0'
extension_name = sys.argv[1]

vca = VCA(host=host,
          username=username,
          service_type='standalone',
          version=version,
          verify=verify,
          log=log)

result = vca.login(password=password, org=org, org_url=org_url)
print_vca(vca)

system = System(session=vca.vcloud_session, verify=verify, log=log)

extension = system.get_extension(extension_name)
if extension == None:
    print('extension %s not found' % extension_name)
else:
    print(extension.attrib['name'])
    print(extension.attrib['href'])

result = system.enable_extension(extension_name,
                                 extension.attrib['href'],
                                 enabled=False)

result = system.unregister_extension(extension_name, extension.attrib['href'])

extension = system.get_extension(extension_name)
Exemplo n.º 10
0
host = 'vcd.cpsbu.eng.vmware.com'
username = '******'
password = os.environ['PASSWORD']
org = 'System'
org_url = 'https://%s/cloud' % host
verify = False
log = True
version = '27.0'

vca = VCA(host=host,
          username=username,
          service_type='standalone',
          version=version,
          verify=verify,
          log=log)

result = vca.login(password=password, org=org, org_url=org_url)
print_vca(vca)

system = System(session=vca.vcloud_session, verify=verify, log=log)

print('extension found:')
extensions = system.get_extensions()
for extension in extensions:
    if 'name' in extension.attrib:
        print('ext=%s, namespace=%s, enabled=%s, href=%s' %
              (extension.attrib['name'], extension.attrib['namespace'],
               extension.attrib['enabled'], extension.attrib['href']))
        print(extension.__dict__)