Created
August 27, 2019 07:53
-
-
Save Enteee/460b21b3a4fc3dcb7c4a86388f4c49c2 to your computer and use it in GitHub Desktop.
ucmdb-api example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import string | |
N=20 | |
api.insert([ | |
{ | |
'ucmdbId': i, | |
'type': 'node', | |
'properties': { | |
'name': ''.join(random.choices(string.ascii_uppercase + string.digits, k=N)) | |
} | |
} | |
for i in range(1000) | |
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
'name': 'all_nodes', | |
'nodes': [ | |
{ | |
'type': 'node', | |
'queryIdentifier': 'Node', | |
'visible': True, | |
'includeSubtypes': True, | |
'layout': [], | |
'ids': [] | |
} | |
], | |
'relations': [] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def enter_next(i): | |
while True: | |
sys.stdin.readline() | |
yield next(i) | |
# print len | |
print( | |
len( | |
list( | |
j for i in enter_next(api.topology_generator('all_nodes')) | |
for j in i['cis'] | |
) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment