Skip to content

Instantly share code, notes, and snippets.

@Enteee
Created August 27, 2019 07:53
Show Gist options
  • Save Enteee/460b21b3a4fc3dcb7c4a86388f4c49c2 to your computer and use it in GitHub Desktop.
Save Enteee/460b21b3a4fc3dcb7c4a86388f4c49c2 to your computer and use it in GitHub Desktop.
ucmdb-api example
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)
])
{
'name': 'all_nodes',
'nodes': [
{
'type': 'node',
'queryIdentifier': 'Node',
'visible': True,
'includeSubtypes': True,
'layout': [],
'ids': []
}
],
'relations': []
}
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