def delete_device(self, device): # This Method deletes the device state from the DB. status = DB().get_status() state = DB().get_state(device) status.remove(state[0]) DB().save_status(status)
def delete_policy(self, device): # This Method deletes a policy of a specific device and removes the device from # the Switching service. query = DB().get_policies() policy = DB().get_policy(device) query.remove(policy[0]) DB().save_policies(query) DB().update_status( policy[0]['device'], 'policy', 'undefined') # The device state entry must be updated. policy[0]['action'] = 'block' self.set_policy(policy[0])