def main(): parser = ArgumentParser(str(__file__)) parser.add_argument('-i', '--ip', help='IFC IP Address', default='172.21.197.80') parser.add_argument('-p', '--port', help='IFC Port', default='8000') parser.add_argument('-U', '--username', help='Username', default='admin') parser.add_argument('-P', '--password', help='Password', default='ins3965!') parser.add_argument('-o', '--object', help='Object class to query for (e.g., fvTenant, infraInfra)', required=True) parser.add_argument('-d', '--depth', help='Query depth: How many levels under the top level object to query', default=2) args = parser.parse_args() # Import the access library from the insieme python SDK from insieme.mit import access # Change the access mode to REST access.rest() # Connect to the IFC REST interface and authenticate using the specified credentials directory = access.MoDirectory(ip=args.ip, port=args.port, user=args.username, password=args.password) depth = int(args.depth) # Query the IFC for object type passed as argument and print depth specified tenants = directory.lookupByClass(args.object) queryObjects(directory, tenants, depth)
import sys sys.path.append('pysdk') from insieme.mit import access access.rest() directory = access.MoDirectory(ip='172.21.128.100', port='8000', user='******', password='******') polUni = directory.lookupByDn('uni') fvTenantMo = directory.create('fv.Tenant', polUni, name='Tenant1') d = directory.commit(polUni)