[Anima] ASA life cycle

Brian E Carpenter <brian.e.carpenter@gmail.com> Wed, 03 February 2021 03:58 UTC

Return-Path: <brian.e.carpenter@gmail.com>
X-Original-To: anima@ietfa.amsl.com
Delivered-To: anima@ietfa.amsl.com
Received: from localhost (localhost []) by ietfa.amsl.com (Postfix) with ESMTP id A3E413A1319 for <anima@ietfa.amsl.com>; Tue, 2 Feb 2021 19:58:12 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.098
X-Spam-Status: No, score=-2.098 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([]) by localhost (ietfa.amsl.com []) (amavisd-new, port 10024) with ESMTP id orYBS1c966Za for <anima@ietfa.amsl.com>; Tue, 2 Feb 2021 19:58:11 -0800 (PST)
Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 3C59C3A1318 for <anima@ietf.org>; Tue, 2 Feb 2021 19:58:11 -0800 (PST)
Received: by mail-pl1-x62d.google.com with SMTP id g3so13719656plp.2 for <anima@ietf.org>; Tue, 02 Feb 2021 19:58:11 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:organization:to:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=BOi7SS8xlv1LolouB5LZAddCFnFZccHGT6ccspXHACk=; b=rL9C0q55i2vJJ23TE9+Jzqa5NtC7gSqcfGYSuVWWY6lAOqpneH6hmNktyXw7pTaREZ XK1dBxM+FzBCLT5S3yXaCLHhgHkXtGqCoLuxGqnPAJhcDIx0db3oHVQdFdN7EnJZTZIp MEZ4TwvMPGiz0mJjsoFssFJMzcUWJur+reh9rVAzocoKRCSC+UUXMOSuxr/Lj8QQnP5z d73CC055oFxqd3wxn4HH5l/W+RZLGdkf42Xr5NkD0bgowEd1iBsDG1iCG9laOT0a+m5O kKR+0OFJo2bgFXC7Lpb1vmuDya+L27jy8PNSpTe46+ydB4DyOJll+Z3devuK7TGw58o3 8lrw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:organization:to:message-id:date :user-agent:mime-version:content-language:content-transfer-encoding; bh=BOi7SS8xlv1LolouB5LZAddCFnFZccHGT6ccspXHACk=; b=gqK2MJPgrdP9ZHLaZ04u4oDGDq79wwZ57PW7RibHRtyASbBJTfOjPrehtlqyyRXeoH y93/KmFekjujYhYCicwx58AKm/19tKmwg+lxY178sMujajWR8EdL7StGnyQvs8nZiEIO jb2+djfgSz7FC5BeXAeqQW1LpkBvD+XEsvZxa4k3pXOY/6hLnlnSgw+eTM9AsGnEEUxu AoEnbIgFn04o1BuL08KealmiAJ9PnyzD0HilaontVBXxExNKY2hRyP1y2ae+5B5AAxBp rqbGdv8LPgnhxfUqDiQ8t2AJOpCHTClCH0i4vL97EsmbtVoM5hsHQ/eZh8H+rumpCo9E 7m1w==
X-Gm-Message-State: AOAM5337OphpHoQk+6zXFDM7CTFryzqGNvKgLN9IZllCfpFDB9aVG7X2 vHXQ487l/k14BcNcavjF8bvYEG9tOVpINA==
X-Google-Smtp-Source: ABdhPJxuZvgcGvOYQEjwgxMJ4B5itKvyq0EkuuhfJuA34wnjSQM4DoYWPOVUvu2prKKMWp50u467LQ==
X-Received: by 2002:a17:90a:604e:: with SMTP id h14mr1128018pjm.221.1612324690119; Tue, 02 Feb 2021 19:58:10 -0800 (PST)
Received: from [] ([]) by smtp.gmail.com with ESMTPSA id d4sm438278pgq.32.2021. for <anima@ietf.org> (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Feb 2021 19:58:09 -0800 (PST)
From: Brian E Carpenter <brian.e.carpenter@gmail.com>
Organization: University of Auckland
To: Anima WG <anima@ietf.org>
Message-ID: <7b259f7e-b70a-589d-c6dc-beab8d2fdb15@gmail.com>
Date: Wed, 3 Feb 2021 16:58:06 +1300
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/anima/u1TCJQ0PpOJSVs9bdqr5akwA25w>
Subject: [Anima] ASA life cycle
X-BeenThere: anima@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Autonomic Networking Integrated Model and Approach <anima.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/anima>, <mailto:anima-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/anima/>
List-Post: <mailto:anima@ietf.org>
List-Help: <mailto:anima-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/anima>, <mailto:anima-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 03 Feb 2021 03:58:13 -0000


Thinking a little more about the ANIMA ecosystem, I decided
to do some quick prototyping of some of the ideas on the
Autonomic Service Agent (ASA) life cycle that are in
draft-ietf-anima-asa-guidelines (and in more detail in expired

So I wrote a very crude "ASA loader" that can load (and unload)
multiple ASAs onto the same GRASP instance. All in Python, of
course. I learned quite a lot about how to dynamically load
Python code into a running Python module, but that's an
implementation detail. It's no more than a proof of concept.

I concluded that the only new feature needed, as far as the
ASA programmer is concerned, is one function that must be called
regularly in the main loop. I called it checkrun(), and if it
returns True the ASA may continue, and if it returns False,
the ASA must exit gracefully (i.e. conclude all current
actions first).

The code is a new module 'ASA_loader.py' at

The only documentation is in the code itself, as follows:

Experimental ASA Loader. Definitely not production code.
This is just for proof of concept. See module graspi.py
for copyright and licence info.

An ASA handled by the loader must call
   graspi.checkrun(asa_handle, asa_name)
regularly in its main loop. If the function
returns False, the ASA must gracefully close down
all operations and sub-threads and then exit.

The ASA loader regularly checks the file 'asafs.txt'
and (re)loads any modules listed in the file that are
not already running. Each module will be a separate
Python thread. The check is repeated after one minute.

If an ASA module exits (gracefully or by an exception)
it will be reloaded (after up to one minute).

If a module name in the file is preceded by "-",
the ASA will be signalled to stop via checkrun()
and unloaded (after up to one minute).

A line in the file starting with "#" is a comment.