blob: 450e92f8930b09a26b28f39a2543fb59cb54163c [file] [log] [blame]
Tommy Carpenter42493982019-11-06 07:27:16 -05001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2.. SPDX-License-Identifier: CC-BY-4.0
3
Lott, Christopher (cl778h)39c9ab62020-05-27 09:45:49 -04004Overview
5========
Tommy Carpenter3959ac92019-11-19 13:13:40 -05006
Lott, Christopher (cl778h)c91a4a12020-05-27 15:56:20 -04007.. contents::
8 :depth: 3
9 :local:
10
Lott, Christopher (cl778h)39c9ab62020-05-27 09:45:49 -040011The RAN Intelligent Controller (RIC) Platform's A1 Mediator component
12listens for policy type and policy instance requests sent via HTTP
13(the "northbound" interface), and publishes those requests to running
14xApps via RMR messages (the "southbound" interface).
Lott, Christopher (cl778h)14d016e2020-04-27 10:45:47 -040015
Tommy Carpenter50487bf2019-11-19 15:04:47 -050016Code
17----
Lott, Christopher (cl778h)14d016e2020-04-27 10:45:47 -040018
19Code is managed in this Gerrit repository:
20
Tommy Carpenter50487bf2019-11-19 15:04:47 -050021https://gerrit.o-ran-sc.org/r/admin/repos/ric-plt/a1
22
Tommy Carpenterdd29e4d2019-11-19 09:35:23 -050023
24Policy Overview
Tommy Carpenter3959ac92019-11-19 13:13:40 -050025----------------
Tommy Carpenterdd29e4d2019-11-19 09:35:23 -050026
Lott, Christopher (cl778h)39c9ab62020-05-27 09:45:49 -040027There are two "object types" associated with policy: policy types and
28policy instances.
Tommy Carpenterdd29e4d2019-11-19 09:35:23 -050029
Lott, Christopher (cl778h)39c9ab62020-05-27 09:45:49 -040030Policy Types
31~~~~~~~~~~~~
Tommy Carpenterdd29e4d2019-11-19 09:35:23 -050032
Lott, Christopher (cl778h)39c9ab62020-05-27 09:45:49 -040033Policy types define the name, description, and most importantly the
34schema of all instances of that type. Think of policy types as
35defining a JSON schema for the messages sent from A1 to xapps. Xapps
36do not receive policy types from A1; types are used only by A1 to
37validate instance creation requests. However, xapps must register to
38receive instances of type ids in their xapp descriptor. Xapp
39developers can also create new policy types, though the exact process
40of where these are stored is still TBD. For practical purposes, when
41the RIC is running, A1s API needs to be invoked to load the policy
42types before instances can be created. Xapps can "sign up" for
43multiple policy types using their xapp descriptor.
Tommy Carpenterdd29e4d2019-11-19 09:35:23 -050044
Lott, Christopher (cl778h)39c9ab62020-05-27 09:45:49 -040045Policy Instances
46~~~~~~~~~~~~~~~~
Tommy Carpenterdd29e4d2019-11-19 09:35:23 -050047
Lott, Christopher (cl778h)39c9ab62020-05-27 09:45:49 -040048Policy instances are concrete instantiations of a policy type. They
49give concrete values of a policy. There may be many instances of a
50single type. Whenever a policy instance is created in A1, messages are
51sent over RMR to all xapps registered for that policy type; see below.
52Xapps are expected to handle multiple simultaneous instances of each
53type that they are registered for.
Tommy Carpenter5957e312019-12-12 09:47:05 -050054
55
56Known differences from A1 1.0.0 spec
57------------------------------------
Tommy Carpenter5957e312019-12-12 09:47:05 -050058
Lott, Christopher (cl778h)39c9ab62020-05-27 09:45:49 -040059This is a list of some of the known differences between the API here
60and the a1 spec dated 2019.09.30. In some cases, the spec is
61deficient and RIC is "ahead", in other cases this does not yet conform
62to recent spec changes.
Tommy Carpenter5957e312019-12-12 09:47:05 -050063
Lott, Christopher (cl778h)39c9ab62020-05-27 09:45:49 -040064#. [RIC is ahead] There is no notion of policy types in the spec,
65 however this aspect is quite critical for the intended use of the
66 RIC, where many Xapps may implement the same policy, and new Xapps
67 may be created often that define new types. Moreover, policy types
68 define the schema for policy instances, and without types, A1
69 cannot validate whether instances are valid, which the RIC A1m
70 does. The RIC A1 Mediator view of things is that, there are a set
71 of schemas, called policy types, and one or more instances of each
72 schema can be created. Instances are validated against types. The
73 spec currently provides no mechanism for the implementation of A1
74 to know whether policy [instances] are correct since there is no
75 schema for them. This difference has the rather large consequence
76 that none of the RIC A1m URLs match the spec.
77#. [RIC is ahead] There is a rich status URL in the RIC A1m for policy
78 instances, but this is not in the spec.
79#. [RIC is ahead] There is a state machine for when instances are
80 actually deleted from the RIC (at which point all URLs referencing
81 it are a 404); this is a configurable option when deploying the RIC
82 A1m.
83#. [CR coming to spec] The spec contains a PATCH for partially
84 updating a policy instance, and creating/deleting multiple
85 instances, however the team agreed to remove this from a later
86 version of the Spec. The RIC A1m does not have this operation.
87#. [Spec is ahead] The RIC A1 PUT bodies for policy instances do not
88 exactly conform to the "scope" and "statements" block that the spec
89 defines. They are very close otherwise, however. (I would argue
90 some of the spec is redundant; for example "policy [instance] id"
91 is a key inside the PUT body to create an instance, but it is
92 already in the URL.)
93#. [Spec is ahead] The RIC A1m does not yet notify external clients
94 when instance statuses change.
95#. [Spec is ahead] The spec defines that a query of all policy
96 instances should return the full bodies, however right now the RIC
97 A1m returns a list of IDs (assuming subsequent queries can fetch
98 the bodies).
99#. [?] The spec document details some very specific "types", but the
100 RIC A1m allows these to be loaded in (see #1). For example, spec
101 section 4.2.6.2. We believe this should be removed from the spec
102 and rather defined as a type. Xapps can be created that define new
103 types, so the spec will quickly become "stale" if "types" are
104 defined in the spec.
Tommy Carpenter0719e9e2020-01-16 11:23:02 -0500105
106
107Resiliency
108----------
109
Lott, Christopher (cl778h)39c9ab62020-05-27 09:45:49 -0400110A1 is resilient to the majority of failures, but not all currently
111(though a solution is known).
Tommy Carpenter0719e9e2020-01-16 11:23:02 -0500112
Lott, Christopher (cl778h)39c9ab62020-05-27 09:45:49 -0400113A1 uses the RIC SDL library to persist all policy state information:
114this includes the policy types, policy instances, and policy statuses.
115If state is built up in A1, and A1 fails (where Kubernetes will then
116restart it), none of this state is lost.
Tommy Carpenter0719e9e2020-01-16 11:23:02 -0500117
Lott, Christopher (cl778h)39c9ab62020-05-27 09:45:49 -0400118The tiny bit of state that *is currently* in A1 (volatile) is its
119"next second" job queue. Specifically, when policy instances are
120created or deleted, A1 creates jobs in a job queue (in memory). An
121rmr thread polls that thread every second, dequeues the jobs, and
122performs them.
Tommy Carpenter0719e9e2020-01-16 11:23:02 -0500123
Lott, Christopher (cl778h)39c9ab62020-05-27 09:45:49 -0400124If A1 were killed at *exactly* the right time, you could have jobs
125lost, meaning the PUT or DELETE of an instance wouldn't actually take.
126This isn't drastic, as the operations are idempotent and could always
127be re-performed.
Tommy Carpenter0719e9e2020-01-16 11:23:02 -0500128
Lott, Christopher (cl778h)39c9ab62020-05-27 09:45:49 -0400129In order for A1 to be considered completely resilient, this job queue
130would need to be moved to SDL. SDL uses Redis as a backend, and Redis
131natively supports queues via LIST, LPUSH, RPOP. I've asked the SDL
132team to consider an extension to SDL to support these Redis
133operations.