diff --git a/inventory_provider/db/ims.py b/inventory_provider/db/ims.py index 832c39b6a9a758a62c7c3d7049fc49bf6b060c26..6f95241328eb905dff7bd168c5b6189bcf3cce11 100644 --- a/inventory_provider/db/ims.py +++ b/inventory_provider/db/ims.py @@ -11,6 +11,17 @@ from enum import Enum CIRCUIT_PROPERTIES = { 'InternalPorts': 1024 } +# http://149.210.162.190:81/ImsVersions/4.19.9/html/dbc969d0-e735-132e-6281-f724c6d7da64.htm # NOQA +CONTACT_PROPERTIES = { + 'SiteRelatedContacts': 8, + 'CustomerRelatedContacts': 16, + 'GroupRelatedContacts': 32, + 'VendorRelatedContacts': 64 +} +# http://149.210.162.190:81/ImsVersions/4.19.9/html/5a40472e-48ee-c120-0a36-52a85d52127c.htm # NOQA +CUSTOMER_PROPERTIES = { + 'CustomerRelatedContacts': 32768 +} # http://149.210.162.190:81/ImsVersions/4.19.9/html/2d27d509-77cb-537d-3ffa-796de7e82af8.htm # noqa NODE_PROPERTIES = { 'equipment definition': 16, @@ -45,6 +56,15 @@ class InventoryStatus(Enum): READY_FOR_CEASURE = 7 +class RelateType(Enum): + VENDOR = 1 + CONTACT = 2 + GROUP = 3 + CONTRACT = 4 + CUSTOMER = 5 + SITE = 6 + + class IMSError(Exception): pass @@ -125,6 +145,7 @@ class IMS(object): if j is None: # Sometime the API returns a 200 response but with no # body when the token has expired e.g. on a filtered query + # This also happens when there is an error in the query :( return True if j and isinstance(j, dict) and \ j.get('HasErrors', False) and 'guid expired' in \