...
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 | ||
---|---|---|
| ||
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 | ||
---|---|---|
| ||
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.