RFC 8991: GeneRic Autonomic Signaling Protocol Application Program Interface (GRASP API)
- B. Carpenter,
- B. Liu, Ed.,
- W. Wang,
- X. Gong
Abstract
This document is a conceptual outline of an Application Programming Interface (API) for the GeneRic Autonomic Signaling Protocol (GRASP). Such an API is needed for Autonomic Service Agents (ASAs) calling the GRASP protocol module to exchange Autonomic Network messages with other ASAs. Since GRASP is designed to support asynchronous operations, the API will need to be adapted according to the support for asynchronicity in various programming languages and operating systems.¶
Status of This Memo
This document is not an Internet Standards Track specification; it is published for informational purposes.¶
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Not all documents approved by the IESG are candidates for any level of Internet Standard; see Section 2 of RFC 7841.¶
Information about the current status of this document, any
errata, and how to provide feedback on it may be obtained at
https://
Copyright Notice
Copyright (c) 2021 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(https://
1. Introduction
As defined in [RFC8993], the Autonomic Service Agent (ASA) is the atomic entity of an autonomic function, and it is instantiated on autonomic nodes. These nodes are members of a secure Autonomic Control Plane (ACP) such as defined by [RFC8994].¶
When ASAs communicate with each other, they should
use the GeneRic Autonomic Signaling Protocol (GRASP) [RFC8990].
GRASP relies on the message confidentiality and integrity provided by the ACP; a
consequence of this is that all nodes in a
given Autonomic Network share the same trust boundary, i.e., the boundary of the ACP.
Nodes that have not successfully joined the ACP cannot send, receive, or intercept GRASP messages
via the ACP and cannot usurp ACP addresses.
An ASA runs in an ACP node and therefore benefits from the node's security properties when
transmitting over the ACP, i.e.,
message integrity, message confidentiality
An important feature of GRASP is the concept of a GRASP objective. This is a data structure
encoded, like all GRASP messages, in Concise Binary Object Representation (CBOR) [RFC8949].
Its main contents are a name and a value, explained at more length in the Terminology section
of [RFC8990]. When an objective is passed
from one ASA to another using GRASP, its value is either conveyed in one direction
(by a process of synchronization or flooding) or negotiated bilaterally. The
semantics of the value are opaque to GRASP and therefore to the API. Each objective
must be accurately specified in a dedicated specification, as discussed in
"Objective Options" (Section 2.10 of [RFC8990]).
In particular, the specification will define the syntax and semantics of the
value of the objective, whether and how it supports a negotiation process,
whether it supports a dry-run mode, and any other details needed for interoperabilit
As Figure 1 shows, a GRASP implementation could contain several sub-layers. The bottom layer is the GRASP base protocol module, which is only responsible for sending and receiving GRASP messages and maintaining shared data structures. Above that is the basic API described in this document. The upper layer contains some extended API functions based upon the GRASP basic protocol. For example, [GRASP-DISTRIB] describes a possible extended function.¶
Multiple ASAs in a single node will share the same instance of GRASP, much as multiple applications share a single TCP/IP stack. This aspect is hidden from individual ASAs by the API and is not further discussed here.¶
It is desirable that ASAs be designed as portable user-space programs
using a system
Both the GRASP library and the extended function modules should be available to the ASAs. However, since the extended functions are expected to be added in an incremental manner, they will be the subject of future documents. This document only describes the basic GRASP API.¶
The functions provided by the API do not map one-to-one onto GRASP messages. Rather, they are intended to offer convenient support for message sequences (such as a discovery request followed by responses from several peers or a negotiation request followed by various possible responses). This choice was made to assist ASA programmers in writing code based on their application requirements rather than needing to understand protocol details.¶
In addition to containing the autonomic infrastructure components described in [RFC8994] and [RFC8995], a simple autonomic node might contain very few ASAs. Such a node might directly integrate a GRASP protocol stack in its code and therefore not require this API to be installed. However, the programmer would need a deeper understanding of the GRASP protocol than what is needed to use the API.¶
This document gives a conceptual outline of the API. It is not a formal
specification for any particular programming language or operating system,
and it is expected that details will be clarified in individual implementations
2. GRASP API for ASA
2.1. Design Assumptions
The design assumes that an ASA needs to call a separate GRASP implementation. The latter handles protocol details (security, sending and listening for GRASP messages, waiting, caching discovery results, negotiation looping, sending and receiving synchronization data, etc.) but understands nothing about individual GRASP objectives (see Section 2.10 of [RFC8990]). The semantics of objectives are unknown to the GRASP protocol and are handled only by the ASAs. Thus, this is an abstract API for use by ASAs. Individual language bindings should be defined in separate documents.¶
Different ASAs may utilize GRASP features differently, by using GRASP for:¶
The API also assumes that one ASA may support multiple objectives. Nothing prevents an ASA from supporting some objectives for synchronization and others for negotiation.¶
The API design assumes that the operating system and programming language provide a mechanism for simultaneous asynchronous operations. This is discussed in detail in Section 2.2.¶
A few items are out of scope in this version, since practical experience is required before including them:¶
2.2. Asynchronous Operations
GRASP depends on asynchronous operations and wait states, and some of its messages are not idempotent, meaning that repeating a message may cause repeated changes of state in the recipient ASA. Many ASAs will need to support several concurrent operations; for example, an ASA might need to negotiate one objective with a peer while discovering and synchronizing a different objective with a different peer. Alternatively, an ASA that acts as a resource manager might need to run simultaneous negotiations for a given objective with multiple different peers. Such an ASA will probably need to support uninterruptible atomic changes to its internal data structures, using a mechanism provided by the operating system and programming language in use.¶
2.2.1. Alternative Asynchronous Mechanisms
Some ASAs need to support asynchronous operations; therefore, the GRASP core must do so. Depending on both the operating system and the programming language in use, there are various techniques for such parallel operations, three of which we consider here: multithreading, an event loop structure using polling, and an event loop structure using callback functions.¶
2.2.2. Multiple Negotiation Scenario
The design of GRASP allows the following scenario. Consider an ASA "A" that acts as a resource allocator for some objective. An ASA "B" launches a negotiation with "A" to obtain or release a quantity of the resource. While this negotiation is under way, "B" chooses to launch a second simultaneous negotiation with "A" for a different quantity of the same resource. "A" must therefore conduct two separate negotiation sessions at the same time with the same peer and must not mix them up.¶
Note that ASAs could be designed to avoid such a scenario, i.e., restricted to exactly one negotiation session at a time for a given objective, but this would be a voluntary restriction not required by the GRASP protocol. In fact, GRASP assumes that any ASA managing a resource may need to conduct multiple parallel negotiations, possibly with the same peer. Communication patterns could be very complex, with a group of ASAs overlapping negotiations among themselves, as described in [ANIMA-COORD]. Therefore, the API design allows for such scenarios.¶
In the callback model, for the scenario just described, the ASAs "A" and "B" will each provide two instances of the callback function, one for each session. For this reason, each ASA must be able to distinguish the two sessions, and the peer's IP address is not sufficient for this. It is also not safe to rely on transport port numbers for this, since future variants of GRASP might use shared ports rather than a separate port per session. Hence, the GRASP design includes a Session ID. Thus, when necessary, a session handle (see the next section) is used in the API to distinguish simultaneous GRASP sessions from each other, so that any number of sessions may proceed asynchronously in parallel.¶
2.2.3. Overlapping Sessions and Operations
A GRASP session consists of a finite sequence of messages (for discovery,
synchronization
On the first call in a new GRASP session, the API returns a 'session
An additional mechanism that might increase efficiency for polling implementations is to add a general call, say notify(), which would check the status of all outstanding operations for the calling ASA and return the session_handle values for all sessions that have changed state. This would eliminate the need for repeated calls to the individual functions returning a 'noReply'. This call is not described below as the details are likely to be implementation specific.¶
An implication of the above for all GRASP implementations is that the GRASP core must keep state for each GRASP operation in progress, most likely keyed by the GRASP Session ID and the GRASP source address of the session initiator. Even in a threaded implementation, the GRASP core will need such state internally. The session_handle parameter exposes this aspect of the implementation.¶
2.2.4. Session Termination
GRASP sessions may terminate for numerous reasons. A session ends when discovery succeeds or times out, negotiation succeeds or fails, a synchronization result is delivered, the other end fails to respond before a timeout expires, a loop count expires, or a network socket error occurs. Note that a timeout at one end of a session might result in a timeout or a socket error at the other end, since GRASP does not send error messages in this case. In all cases, the API will return an appropriate code to the caller, which should then release any reserved resources. After failure cases, the GRASP specification recommends an exponential backoff before retrying.¶
2.3. API Definition
2.3.1. Overview of Functions
The functions provided by the API fall into several groups:¶
- Registration:
- These functions allow an ASA to register itself with the GRASP core and allow a registered ASA to register the GRASP objectives that it will manipulate.¶
- Discovery:
- This function allows an ASA that needs to initiate negotiation or synchronization of a particular objective to discover a peer willing to respond.¶
- Negotiation:
- These functions allow an ASA to act as an initiator (requester) or responder (listener) for a GRASP negotiation session. After initiation, negotiation is a symmetric process, so most of the functions can be used by either party.¶
- Synchronization:
- These functions allow an ASA to act as an initiator (requester) or responder (listener and data source) for a GRASP synchronization session.¶
- Flooding:
- These functions allow an ASA to send and receive an objective that is flooded to all nodes of the ACP.¶
Some example logic flows for a resource management ASA are given in [ASA-GUIDE], which may be of help in understanding the following descriptions. The next section describes parameters and data structures used in multiple API calls. The following sections describe various groups of function APIs. Those APIs that do not list asynchronous mechanisms are implicitly synchronous in their behavior.¶
2.3.2. Parameters and Data Structures
2.3.2.1. Integers
In this API, integers are assumed to be 32-bit unsigned integers (uint32_t) unless otherwise indicated.¶
2.3.2.2. Errorcode
All functions in the API have an unsigned 'errorcode' integer as their return value (the first return value in languages that allow multiple return values). An errorcode of zero indicates success. Any other value indicates failure of some kind. The first three errorcodes have special importance:¶
- 1 - Declined:
- used to indicate that the other end has sent a GRASP Negotiation End message (M_END) with a Decline option (O_DECLINE).¶
- 2 - No reply:
- used in non-blocking calls to indicate that the other end has sent no reply so far (see Section 2.2).¶
- 3 - Unspecified error:
- used when no more specific error codes apply.¶
Appendix A gives a full list of currently suggested error codes, based on implementation experience. While there is no absolute requirement for all implementations to use the same error codes, this is highly recommended for portability of applications.¶
2.3.2.3. Timeout
Whenever a 'timeout' parameter appears, it is an unsigned integer expressed
in milliseconds. If it is zero, the GRASP
default timeout
2.3.2.4. Objective
An 'objective' parameter is a data structure with the following components:¶
- name (UTF-8 string):
- The objective's name¶
- neg (Boolean flag):
- True if objective supports negotiation (default False)¶
- synch (Boolean flag):
- True if objective supports synchronization (default False)¶
- dry (Boolean flag):
-
True if objective supports dry-run negotiation (default False)¶
- Note 1:
- Only one of 'synch' or 'neg' may be True.¶
- Note 2:
- 'dry' must not be True unless 'neg' is also True.¶
- Note 3:
- In some programming languages, the preferred implementation may be to represent the Boolean flags as bits in a single byte, which is how they are encoded in GRASP messages. In other languages, an enumeration might be preferable.¶
- loop_count (unsigned integer, uint8_t):
- Limit on negotiation steps, etc. (default GRASP
_DEF _LOOPCT; see [RFC8990]). The 'loop_count' is set to a suitable value by the initiator of a negotiation, to prevent indefinite loops. It is also used to limit the propagation of discovery and flood messages.¶ - value:
-
A specific data structure expressing the value of the objective. The format is language dependent, with the constraint that it can be validly represented in CBOR [RFC8949].¶
The 'name' and 'value' fields are of variable length. GRASP does not set a maximum length for these fields, but only for the total length of a GRASP message. Implementations might impose length limits.¶
An example data structure definition for an objective in the C language, using at least the C99 version, and assuming the use of a particular CBOR library [libcbor], is:¶
An example data structure definition for an objective in the Python language (version 3.4 or later) is:¶
2.3.2.5. asa_locator
An 'asa_locator' parameter is a data structure with the following contents:¶
- locator:
- The actual locator, either an IP address or an ASCII string.¶
- ifi (unsigned integer):
- The interface identifier index via which this was discovered (of limited use to most ASAs).¶
- expire (system dependent type):
- The time on the local system clock when this locator will expire from the cache.¶
- The following covers all locator types currently supported by GRASP:
-
These options are mutually exclusive. Depending on the programming language, they could be represented as a bit pattern or an enumeration.¶
- diverted (Boolean):
- True if the locator was discovered via a Divert option.¶
- protocol (unsigned integer):
- Applicable transport protocol (IPPROTO_TCP or IPPROTO_UDP). These constants are defined in the CDDL specification of GRASP [RFC8990].¶
- port (unsigned integer):
- Applicable port number.¶
The 'locator' field is of variable length in the case of an FQDN or a URI. GRASP does not set a maximum length for this field, but only for the total length of a GRASP message. Implementations might impose length limits.¶
It should be noted that when one ASA discovers the asa_locator of another, there is no explicit authentication mechanism. In accordance with the trust model provided by the secure ACP, ASAs are presumed to provide correct locators in response to discovery. See "Locator Options" (Section 2.9.5 of [RFC8990]) for further details.¶
2.3.2.6. Tagged_objective
A 'tagged
2.3.2.7. asa_handle
Although an authentication and authorization scheme for ASAs has not been defined, the API
provides a very simple hook for such a scheme. When an ASA starts up, it registers itself
with the GRASP core, which provides it with an opaque handle that, although not cryptographical
Thus, in most calls, an 'asa_handle' parameter is required. It is generated when an ASA first registers with GRASP, and the ASA must then store the asa_handle and use it in every subsequent GRASP call. Any call in which an invalid handle is presented will fail. It is an up to 32-bit opaque value (for example, represented as a uint32_t, depending on the language). Since it is only used locally, and not in GRASP messages, it is only required to be unique within the local GRASP instance. It is valid until the ASA terminates. It should be unpredictable; a possible implementation is to use the same mechanism that GRASP uses to generate Session IDs (see Section 2.3.2.8).¶
2.3.2.8. Session_handle and Callbacks
In some calls, a 'session
In an event loop implementation, callback functions (Section 2.2.1) may be supported for all API functions that involve waiting for a remote operation:¶
Further details of callbacks are implementation dependent.¶
2.3.3. Registration
These functions are used to register an ASA, and the objectives that it modifies, with the GRASP module. In the absence of an authorization model, these functions are very simple, but they will avoid multiple ASAs choosing the same name and will prevent multiple ASAs manipulating the same objective. If an authorization model is added to GRASP, these API calls would need to be modified accordingly.¶
2.3.4. Discovery
2.3.5. Negotiation
Since the negotiation mechanism is different from a typical client/server exchange, Figure 2 illustrates the sequence of calls and GRASP messages in a negotiation. Note that after the first protocol exchange, the process is symmetrical, with negotiating steps strictly alternating between the two sides. Either side can end the negotiation. Also, the side that is due to respond next can insert a delay at any time, to extend the other side's timeout. This would be used, for example, if an ASA needed to negotiate with a third party before continuing with the current negotiation.¶
The loop count embedded in the objective that is the subject of negotiation is initialized by the ASA that starts a negotiation and is then decremented by the GRASP core at each step, prior to sending each M_NEGOTIATE message. If it reaches zero, the negotiation will fail, and each side will receive an error code.¶
As the negotiation proceeds, each side will update the value of the objective in accordance with its particular semantics, defined in the specification of the objective. Although many objectives will have values that can be ordered, so that negotiation can be a simple bidding process, it is not a requirement.¶
Failure to agree, a timeout, or loop count exhaustion may all end a negotiation session, but none of these cases are protocol failures.¶
2.3.6. Synchronization and Flooding
2.3.7. Invalid Message Function
3. Security Considerations
Security considerations for the GRASP protocol are discussed in [RFC8990].
These include denial
As a general precaution, all ASAs able to handle multiple negotiation or synchronization requests
in parallel may protect themselves against a denial
As noted earlier, the trust model is that all ASAs in a given Autonomic Network communicate via a secure autonomic control plane; therefore, they trust each other's messages. Specific authorization of ASAs to use particular GRASP objectives is a subject for future study, also briefly discussed in [RFC8990].¶
The careful reader will observe that a malicious ASA could extend a negotiation session
indefinitely by use of the negotiate
The 'asa_handle' is used in the API as a first line of defense against a malware process attempting
to imitate a legitimately registered ASA. The 'session
4. IANA Considerations
This document has no IANA actions.¶
5. References
5.1. Normative References
- [RFC8610]
-
Birkholz, H., Vigano, C., and C. Bormann, "Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures", RFC 8610, DOI 10
.17487 , , <https:///RFC8610 www >..rfc -editor .org /info /rfc8610 - [RFC8949]
-
Bormann, C. and P. Hoffman, "Concise Binary Object Representation (CBOR)", STD 94, RFC 8949, DOI 10
.17487 , , <https:///RFC8949 www >..rfc -editor .org /info /rfc8949 - [RFC8990]
-
Bormann, C., Carpenter, B., Ed., and B. Liu, Ed., "GeneRic Autonomic Signaling Protocol (GRASP)", RFC 8990, DOI 10
.17487 , , <https:///RFC8990 www >..rfc -editor .org /info /rfc8990
5.2. Informative References
- [ANIMA-COORD]
-
Ciavaglia, L. and P. Peloso, "Autonomic Functions Coordination", Work in Progress, Internet-Draft, draft
-ciavaglia , , <https://-anima -coordination -01 tools >..ietf .org /html /draft -ciavaglia -anima -coordination -01 - [ASA-GUIDE]
-
Carpenter, B., Ciavaglia, L., Jiang, S., and P. Peloso, "Guidelines for Autonomic Service Agents", Work in Progress, Internet-Draft, draft
-ietf , , <https://-anima -asa -guidelines -00 tools >..ietf .org /html /draft -ietf -anima -asa -guidelines -00 - [GRASP-DISTRIB]
-
Liu, B., Xiao, X., Hecker, A., Jiang, S., Despotovic, Z., and B. Carpenter, "Information Distribution over GRASP", Work in Progress, Internet-Draft, draft
-ietf , , <https://-anima -grasp -distribution -02 tools >..ietf .org /html /draft -ietf -anima -grasp -distribution -02 - [libcbor]
-
Kalvoda, P., "libcbor - libcbor 0.8.0 documentation", , <https://
libcbor >..readthedocs .io / - [RFC8993]
-
Behringer, M., Ed., Carpenter, B., Eckert, T., Ciavaglia, L., and J. Nobre, "A Reference Model for Autonomic Networking", RFC 8993, DOI 10
.17487 , , <https:///RFC8993 www >..rfc -editor .org /info /rfc8993 - [RFC8994]
-
Eckert, T., Ed., Behringer, M., Ed., and S. Bjarnason, "An Autonomic Control Plane (ACP)", RFC 8994, DOI 10
.17487 , , <https:///RFC8994 www >..rfc -editor .org /info /rfc8994 - [RFC8995]
-
Pritikin, M., Richardson, M., Eckert, T., Behringer, M., and K. Watsen, "Bootstrapping Remote Secure Key Infrastructure (BRSKI)", RFC 8995, DOI 10
.17487 , , <https:///RFC8995 www >..rfc -editor .org /info /rfc8995
Appendix A. Error Codes
This appendix lists the error codes defined so far on the basis of implementation experience, with suggested symbolic names and corresponding descriptive strings in English. It is expected that complete API implementations will provide for localization of these descriptive strings, and that additional error codes will be needed according to implementation details.¶
The error codes that may only be returned by one or two functions are annotated accordingly, and the others may be returned by numerous functions. The 'noSecurity' error will be returned to most calls if GRASP is running in an insecure mode (i.e., with no secure substrate such as the ACP), except for the specific DULL usage mode described in "Discovery Unsolicited Link-Local (DULL) GRASP" (Section 2.5.2 of [RFC8990].¶
Acknowledgements
Excellent suggestions were made by Ignas Bagdonas, Carsten Bormann, Laurent Ciavaglia, Roman Danyliw, Toerless Eckert, Benjamin Kaduk, Erik Kline, Murray Kucherawy, Paul Kyzivat, Guangpeng Li, Michael Richardson, Joseph Salowey, Éric Vyncke, Magnus Westerlund, Rob Wilton, and other participants in the ANIMA WG and the IESG.¶