Пример #1
0
# *****************************************************************************

from __future__ import print_function

import requests, json, time

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
    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
# *****************************************************************************


from __future__ import print_function
import requests, json, time


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)
  
Пример #3
0
    print(params)
    api = ibmiotf.api.ApiClient(params)
    api.verify = verify

    # make sure device type is deactivated
    try:
        api.deactivateDeviceTypeConfiguration(properties.devicetype)
        #time.sleep(5)
    except Exception as exc:
        print("Deactivate exception", exc.response.json())
        if exc.response.status_code != 409:
            sys.exit()

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

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

    try:
Пример #4
0
            try:
                result = api.deleteLogicalInterface(appintid)
            except Exception as exc:
                print(exc)

    # find all physical interfaces
    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