diff --git a/inventory_provider/db/ims_data.py b/inventory_provider/db/ims_data.py index 944978888555238bd34dedb6c2e3d88bc392d402..cee29568719761c3b378ae89314ecc33cc2b2136 100644 --- a/inventory_provider/db/ims_data.py +++ b/inventory_provider/db/ims_data.py @@ -30,15 +30,15 @@ def lookup_lg_routers(ds): return True site_nav_props = [ - ims.SITE_PROPERTIES['aliases'], - ims.SITE_PROPERTIES['city'], - ims.SITE_PROPERTIES['country'] + ims.SITE_PROPERTIES['SiteAliases'], + ims.SITE_PROPERTIES['City'], + ims.SITE_PROPERTIES['Country'] ] eq_definitions = ds.get_filtered_entities( 'EquipmentDefinition', 'Name like mx', - ims.EQUIP_DEF_PROPERTIES['nodes']) + ims.EQUIP_DEF_PROPERTIES['Nodes']) for eq_def in eq_definitions: nodes = eq_def['Nodes'] @@ -172,8 +172,6 @@ def otrs_get_customer_contacts(ds): 'city': '', 'country': '', 'comments': '', - # 'type_0': 'customer', - # 'type': customer['CustomerType']['Name'] }) if not _is_valid_customer(t_customer_user): continue @@ -212,8 +210,6 @@ def otrs_get_vendor_contacts(ds): 'city': '', 'country': '', 'comments': '', - # 'type_0': 'vendor', - # 'type': '' }) if not _is_valid_customer(t_customer_user): continue @@ -228,9 +224,6 @@ def otrs_get_customer_users_rows(ds): yield ['email', 'username', 'customer_id', 'customer_id_2', 'title', 'firstname', 'lastname', 'phone', 'fax', 'mobile', 'street', 'zip', 'city', 'country', 'comments'] - # yield ['email', 'username', 'customer_id', 'customer_id_2', 'title', - # 'firstname', 'lastname', 'phone', 'fax', 'mobile', 'street', 'zip', - # 'city', 'country', 'comments', 'type', 'type_2'] def get_all_cus_user_rows(): yield from otrs_get_customer_contacts(ds) @@ -240,56 +233,3 @@ def otrs_get_customer_users_rows(ds): # this will be used to prioritisation for cu in sorted_cus: yield list(cu.values()) - - -if __name__ == '__main__': - import sys - username = sys.argv[1] - password = sys.argv[2] - ds = IMS('http://83.97.94.128:81/api', username, password) - - equipment_names = [ - 'mx1.ams.nl', - 'mx1.ath2.gr', - 'mx1.buc.ro', - 'mx1.bud.hu', - 'mx1.dub.ie', - 'mx1.dub2.ie', - 'mx1.fra.de', - 'mx1.gen.ch', - 'mx1.ham.de', - 'mx1.kau.lt', - 'mx1.lis.pt', - 'mx1.lon.uk', - 'mx1.lon2.uk', - 'mx1.mad.es', - 'mx1.mar.fr', - 'mx1.mil2.it', - 'mx1.par.fr', - 'mx1.poz.pl', - 'mx1.pra.cz', - 'mx1.sof.bg', - 'mx1.tal.ee', - 'mx1.vie.at', - 'mx2.ath.gr', - 'mx2.bra.sk', - 'mx2.bru.be', - 'mx2.kau.lt', - 'mx2.lis.pt', - 'mx2.lju.si', - 'mx2.rig.lv', - 'mx2.tal.ee', - 'mx2.zag.hr', - 'qfx.fra.de', - 'qfx.lon2.uk', - 'qfx.par.fr' - ] - for equipment in equipment_names: - r = lookup_pop_info(ds, equipment) - print(r) - - print('--------------------') - print('--------------------') - - for r in lookup_lg_routers(ds): - print(r)