Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Decision

Decision: Option A. Data will be represented as documents (REST) and or generic objects (glorified maps in Java)

Details

The data that is read from and written to the CPS must comply with a known format. This is relevant to both Java and REST interfaces. The choices here are to provide generic objects/documents, or highly typed (using model info).

...

Generic objects/documents

The CPSDataObject will be a 'glorified' map -- not a basic map, but one level more concrete (in terms of abstractions). I.e. at the language level
Sample methods:

Code Block
languagejava
public class CPSDataObject extends Map {...}

CPSDataObject tree = cps.getTree(obj, level, filter)
List<CPSDataObject> refs = cps.getRefs(obj)
CPSDataObject parent = cps.getParent(obj)
List<CPSDataObject> children = cps.getChildren(obj)


filter: An XPath expression

YANG <-> Java type mapping: Mostly simple; UINT64 and IdentityRef (which has two strings) will require direction

Option B

Given an example of a object in YANG (from https://tools.ietf.org/id/draft-vassilev-netmod-network-bridge-01.html)

Code Block
languageyml
container bridge {
    container ports {
      list port {
        key "name";
        unique "index";
        leaf name {
          type string;
        }
        leaf index {
          type uint64;
        }
      }
    }
  }

Highly typed (using information in models). There is so much more to add to these classes, for example how to relate the class instance to the database record is deliberately not shown. The intention of the example is solely to illustrate the option for payload representation.

Code Block
languagejava
public class bridge extends Map {
	private List<port> ports;
	public List<port> get_ports() {...};
	public void set_ports() {...}
}
public class port extends Map {
	private String name;
	private long index;
	...
}
Discussion

For typed languages (such as Java) Option B requires code generation and class loading. Class loading leads to issues with deployment complexity.

Option A lends itself to a low cost transformation to and from a REST interface with simple JSON payload (with generic JSON schema).

Discussed Fri 17/June: Broad agreement with Option A. Discussion taken with Interface style Decision will be approved unless major objection Fri 24/June.