示例#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']
示例#2
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']))
示例#3
0
# 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>
   <vmext:ApiFilters>
      <vmext:ApiFilter>
         <vmext:UrlPattern>(/api/org/.*/%s/*[0-9]*)</vmext:UrlPattern>
      </vmext:ApiFilter>
   </vmext:ApiFilters>
</vmext:Service>
""" % (extension_name, extension_name, extension_name, extension_name)

result = system.register_extension(extension_metadata)
print(result)

extension = system.get_extension(extension_name)
if extension == None:
    print(('extension %s not found' % extension_name))
else:
    print((json.dumps(extension)))