Пример #1
0
    import ibmiotf.api

    api = ibmiotf.api.ApiClient({"auth-key": key, "auth-token": token})

    # get mappings
    try:
        result = api.getMappingsOnDeviceType(devicetype)
    except:
        result = []

    count = 0
    ids = []
    for mapping in result:
        logicalInterfaceId = mapping["logicalInterfaceId"]
        # delete the mappings for this device type
        result = api.deleteMappingsFromDeviceType(devicetype,
                                                  logicalInterfaceId)
        count += 1
        ids.append(logicalInterfaceId)
    print("Mappings deleted:", count, ids)

    # list application interfaces for the device type
    schemaIds = []
    try:
        ids, result = api.getLogicalInterfacesOnDeviceType(devicetype)
        print("Application interfaces found:", ids)
        print("Schemas found:", schemaIds)
    except:
        ids = result = []

    # disassociate and delete the application interfaces from the device type
    count = 0
Пример #2
0
if __name__ == "__main__":
    from properties import orgid, key, token, devicetype, deviceid

    import ibmiotf.api

    api = ibmiotf.api.ApiClient({"auth-key": key, "auth-token": token})

    # get mappings
    result = api.getMappingsOnDeviceType(devicetype)

    count = 0
    ids = []
    for mapping in result:
        applicationInterfaceId = mapping["applicationInterfaceId"]
        # delete the mappings for this device type
        result = api.deleteMappingsFromDeviceType(devicetype,
                                                  applicationInterfaceId)
        count += 1
        ids.append(applicationInterfaceId)
    print("Mappings deleted:", count, ids)

    # list application interfaces for the device type
    schemaIds = []
    ids, result = api.getApplicationInterfacesOnDeviceType(devicetype)
    print("Application interfaces found:", ids)
    print("Schemas found:", schemaIds)

    # disassociate and delete the application interfaces from the device type
    count = 0
    for applicationInterfaceId in ids:
        result = api.removeApplicationInterfaceFromDeviceType(
            devicetype, applicationInterfaceId)
if __name__ == "__main__":    
  from properties import orgid, key, token, devicetype, deviceid
  
  import ibmiotf.api
  
  api = ibmiotf.api.ApiClient({"auth-key": key, "auth-token": token})
  
  # get mappings
  result = api.getMappingsOnDeviceType(devicetype)
  
  count = 0; ids = []
  for mapping in result:
    applicationInterfaceId = mapping["applicationInterfaceId"]
    # delete the mappings for this device type
    result = api.deleteMappingsFromDeviceType(devicetype, applicationInterfaceId)
    count += 1; ids.append(applicationInterfaceId)
  print("Mappings deleted:", count, ids)
  
  # list application interfaces for the device type
  schemaIds = []
  ids, result = api.getApplicationInterfacesOnDeviceType(devicetype)
  print("Application interfaces found:", ids)
  print("Schemas found:", schemaIds)
  
  # disassociate and delete the application interfaces from the device type
  count = 0
  for applicationInterfaceId in ids:
    result = api.removeApplicationInterfaceFromDeviceType(devicetype, applicationInterfaceId)
    result = api.deleteApplicationInterface(applicationInterfaceId)
    count += 1
Пример #4
0
    physintids, result = api.getPhysicalInterfaces(draft=True)
    if len(physintids) > 0:
        print("Physical interface ids", physintids)
    for physintid in physintids:
        resp = clearPhysicalInterface(physintid)

    # get all mappings for the device types
    for devicetype in devicetypes:
        try:
            resp = api.getMappingsOnDeviceType(devicetype, draft=True)
        except Exception as exc:
            print(exc.response.json())
        for a in resp:
            print("deleting mappings for devicetype", devicetype,
                  "application interface", a["logicalInterfaceId"])
            resp = api.deleteMappingsFromDeviceType(devicetype,
                                                    a["logicalInterfaceId"])

    # list and delete event types
    eventTypeIds, result = api.getEventTypes(draft=True)
    for eventTypeId in eventTypeIds:
        result = api.deleteEventType(
            eventTypeId)  # remove event mapping from device type

    # list and delete schemas
    ids, resp = api.getSchemas(draft=True)
    for schemaId in ids:
        try:
            resp = api.deleteSchema(schemaId)
        except Exception as exc:
            print(exc.response.json())
Пример #5
0
                print(exc)

    # find all physical interfaces
    physintids, result = api.getPhysicalInterfaces()
    if len(physintids) > 0:
        print("Physical interface ids", physintids)
    for physintid in physintids:
        resp = clearPhysicalInterface(physintid)

    # get all mappings for the device types
    for devicetype in devicetypes:
        resp = api.getMappingsOnDeviceType(devicetype)
        for a in resp:
            print("deleting mappings for devicetype", devicetype,
                  "application interface", a["applicationInterfaceId"])
            resp = api.deleteMappingsFromDeviceType(
                devicetype, a["applicationInterfaceId"])

    # list and delete event types
    eventTypeIds, result = api.getEventTypes()
    for eventTypeId in eventTypeIds:
        result = api.deleteEventType(
            eventTypeId)  # remove event mapping from device type

    # list and delete schemas
    ids, resp = api.getSchemas()
    for schemaId in ids:
        try:
            resp = api.deleteSchema(schemaId)
        except Exception as exc:
            print(exc.response.json())
Пример #6
0
      except Exception as exc:
        print(exc)
      
  # find all physical interfaces
  physintids, result = api.getPhysicalInterfaces()
  if len(physintids) > 0:
    print("Physical interface ids", physintids)
  for physintid in physintids:
    resp = clearPhysicalInterface(physintid)
  
  # get all mappings for the device types
  for devicetype in devicetypes:
    resp = api.getMappingsOnDeviceType(devicetype)
    for a in resp:
      print("deleting mappings for devicetype", devicetype, "application interface", a["applicationInterfaceId"])
      resp = api.deleteMappingsFromDeviceType(devicetype, a["applicationInterfaceId"])
	
  # list and delete event types 
  eventTypeIds, result = api.getEventTypes()
  for eventTypeId in eventTypeIds:
   	result = api.deleteEventType(eventTypeId) # remove event mapping from device type
   	
  # list and delete schemas
  ids, resp = api.getSchemas()
  for schemaId in ids:
    try:
      resp = api.deleteSchema(schemaId)
    except Exception as exc:
      print(exc.response.json())