예제 #1
0
    if "physicalInterfaceId" in result.keys():
        physicalInterfaceId = result[
            "physicalInterfaceId"]  # get the physical interface id
        print("Physical interface id", physicalInterfaceId)
        result = api.removePhysicalInterfaceFromDeviceType(devicetype)

        # list event types on the physical interface
        result = api.getEvents(physicalInterfaceId)
        eventIds = [res["eventId"] for res in result]
        eventTypeIds = [res["eventTypeId"] for res in result]
        print(eventIds, eventTypeIds)

        for eventId in eventIds:
            result = api.deleteEvent(
                physicalInterfaceId,
                eventId)  # remove event mapping from device type

            result = api.deletePhysicalInterface(physicalInterfaceId)
            print("Physical interface deleted")

        # delete event types and schemas
        count = 0
        schemaIds = []
        for eventTypeId in eventTypeIds:
            schemaId = api.getEventType(eventTypeId)["schemaId"]
            result = api.deleteEventType(eventTypeId)
            result = api.deleteSchema(schemaId)
            count += 2
            schemaIds.append(schemaId)
        print("Event types and event type schemas deleted:", count, schemaIds)
예제 #2
0
        mm.pop()
        mm.push()  # device type
        mm.insert("draft")
        mm.push()  # draft
        getPhysicalInterface(api, mm, devicetype, draft=True)
        mm.pop()  # draft
        getLogicalInterfaces(api, mm, devicetype, draft=True)
        mm.pop()  # device type

        # Devices
        devices = api.getDevicesForType(devicetype["id"])["results"]
        for device in devices:
            mm.insert("Device: " + device["deviceId"])
            mm.gotoParent()

    linkedtodevicetypes = False

    # Now delete any resources not associated with a device type

    for physicalInterfaceId in draftPhysicalInterfaces:
        api.deletePhysicalInterface(physicalInterfaceId)

    for eventTypeId in draftEventTypes:
        api.deleteEventType(eventTypeId)

    for logicalInterfaceId in draftLogicalInterfaces:
        api.deleteLogicalInterface(logicalInterfaceId)

    for schemaId in draftSchemaIds:
        api.deleteSchema(schemaId)
예제 #3
0
    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())
  if "physicalInterfaceId" in result.keys():
    physicalInterfaceId = result["physicalInterfaceId"]  # get the physical interface id
    print("Physical interface id", physicalInterfaceId)
    result = api.removePhysicalInterfaceFromDeviceType(devicetype)

  	# list event types on the physical interface
    result = api.getEvents(physicalInterfaceId)
    eventIds = [res["eventId"] for res in result]
    eventTypeIds = [res["eventTypeId"] for res in result]
    print(eventIds, eventTypeIds)
    
    for eventId in eventIds:
     	result = api.deleteEvent(physicalInterfaceId, eventId) # remove event mapping from device type
  	
  	result = api.deletePhysicalInterface(physicalInterfaceId)
  	print("Physical interface deleted")
  	
    # delete event types and schemas
    count = 0; schemaIds = []
    for eventTypeId in eventTypeIds:
      schemaId = api.getEventType(eventTypeId)["schemaId"]
      result = api.deleteEventType(eventTypeId)
      result = api.deleteSchema(schemaId)
      count += 2; schemaIds.append(schemaId)
    print("Event types and event type schemas deleted:", count, schemaIds)
	  
		
  
    

예제 #5
0
      
  # 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())