2. SDN is the physical separation of the network control plane
from the forwarding plane and where the control plane
controls several devices.
So what should this control plane (SDN Controller) be?The
SDN
A platform for deploying SDN applications
Provide (or be associated with) an SDN application
development environment
3. SDN
Controller:
Platform
Requirements
Flexibility
Accommodate a variety of diverse applications
Controller applications SHOULD use a common framework and
programming
model and provide consistent APIs to their client
Scale the development process:
No infrastructure code hotspots
Independent development of controller applications & short
integration times
Run-time Extensibility and Modularity:
Load new protocol and service/application plugins at run-time.
Adapt to data schemas (models) discovered in the network
Performance & Scale
4. SDN Controller: App Development Requirements
A DSL for modeling to describe internal and external system behavior
Modeling tools for the controller aligned with modeling tools for devices
Code generation from models:
Enforce standard API contracts
Generate boilerplate code performing repetitive and error-prone tasks
Produce functionally equivalent APIs for different language bindings
Model-to-model adaptations for services and devices
Consumption of aligned device models
In the OpenDaylight Project, these requirements are satisfied with YANG (and YANG
extensions) and via the YANG tool-chain, manifested in the MD-SAL
6. YANG models defined in MD-SAL help in generating the bindings for the RESTCONF and the
south-bound plugins
OpenDaylight Software Architecture
7. MD-SAL Overview
• Model Driven Service Abstraction Layer (MD-SAL) is the core of Opendaylight project which
helps in connecting between different layer & modules through well defined API
• The MD-SAL uses YANG as the modeling language for both interface and data definitions, and
provides a messaging and data-centric runtime for such services based on YANG modelling
• YANG tools is used to compile YANG template and generate Java classes/interfaces and
automatically build REST API doc explorer.
8. Yangtools
Generates Java code from YANG
Provides ‘codecs’ to convert
Generated Java classes to DOM
DOM to various formats
XML
JSON
Etc.
Codecs make possible automatic:
RESTCONF
NETCONF
AMQP
Other bindings
9. YANG → Java … why?
Immutable: to avoid thread contention
Strongly typed: reduce coding errors
Consistent: reduce learning curve
Improvable – generation can be improved and all DTOs get those improvements
immediately system wide
Automated Bindings:
restconf – xml and json
netconf
amqp and xmpp – on the horizon
Runtime Generatable
Consistent Data Transfer Objects (DTOs) everywhere
15. Yang to Java Example - typedef
15
Yang Java
public class BridgeName implements Serializable {
private final String _value;
@ConstructorProperties("value")
public BridgeName(String _value) {
…
}
public BridgeName(BridgeName source) {
this._value = source._value;
}
public String getValue() {
return _value;
}
…
}
typedef bridge-name {
type string;
}
16. Yang to Java Example - grouping
16
Yang Java
public interface BridgeAttributes
extends DataObject {
BridgeName getBridgeName();
…
}
grouping bridge-attributes {
leaf bridge-name {
type bridge-name;
}
…
}
17. Yang to Java Eg - container - interface
17
Yang Java
public interface ConnectionInfo
extends Augmentable<ConnectionInfo>,
ConnectionInfoAttributes {
}
container connection-info {
uses connection-info-attributes;
}
18. Yang to Java Eg - container - builder
18
Yang Java
public class ConnectionInfoBuilder
implements Builder <ConnectionInfo> {
/* fields */
public void setRemoteIp(IpAddress value)
…
public IpAddress getRemoteIp()
…
public ConnectionInfo build() {
return new ConnectionInfoImpl(this);
}
}
container connection-info {
uses connection-info-attributes;
}
19. Yang to Java Example - list - interface
19
Yang Java
public interface ControllerEntry
extends Augmentable<ControllerEntry>,
Identifiable<ControllerEntryKey> {
Uri getTarget();
ControllerEntryKey getKey();
…
}
list controller-entry {
key “target”
leaf target {
type inet:uri;
}
}
20. Yang to Java Example - list - builder
20
Yang Java
public class ControllerEntryBuilder
implements Builder <ControllerEntry> {
/* fields */
public ControllerEntryBuilder setTarget(Uri value) {
…
}
…
public Uri getTarget(Uri value) {…}
ControllerEntryKey getKey() {…}
…
public ControllerEntry build() {
return new ControllerEntryImpl(this);
}
…
}
list controller-entry {
key “target”
leaf target {
type inet:uri;
}
}
21. Yang to Java Eg. - rpc service interface
21
Yang Java
public interface HelloService
extends RpcService {
Future<RpcResult<HelloWorldOutput>> helloWorld(
HelloWorldInput input);
}
rpc hello-world {
input {
leaf name {
type string;
}
}
output {
leaf greating {
type string;
}
}
}
22. Yang to Java Eg. - rpc - input interface
22
Yang Java
public interface HelloWorldInput
extends DataObject,
Augmentable<HelloWorldInput> {
String getName();
}
rpc hello-world {
input {
leaf name {
type string;
}
}
output {
leaf greating {
type string;
}
}
}
23. Yang to Java Example - rpc – input builder
23
Yang Java
public class HelloWorldInputBuilder
implements Builder <HelloWorldInput> {
/* fields */
public HelloWorldInputBuilder setName(String value) {
this._name = value;
return this;
}
public HelloWorldInput build() {
return new HelloWorldInputImpl(this);
}
…
}
rpc hello-world {
input {
leaf name {
type string;
}
}
output {
leaf greating {
type string;
}
}
}
24. Yang to Java Eg. - rpc - output interface
24
Yang Java
public interface HelloWorldOutput
extends DataObject,
Augmentable<HelloWorldOutput> {
String getGreating();
}
rpc hello-world {
input {
leaf name {
type string;
}
}
output {
leaf greating {
type string;
}
}
}
25. Yang to Java Eg. - rpc - output builder
25
Yang Java
public class HelloWorldOutputBuilder
implements Builder <HelloWorldOutput> {
/* fields */
public HelloWorldOutputBuilder setName(String value) {
this._name = value;
return this;
}
public HelloWorldOutput build() {
return new HelloWorldOutputImpl(this);
}
…
}
rpc hello-world {
input {
leaf name {
type string;
}
}
output {
leaf greating {
type string;
}
}
}
26. Yang to Java Eg. - notification - interface
26
Yang Java
public interface RandomGreetingNotification
extends ChildOf<DataObject>,
Augmentable<RandomGreetingNotification>,
Notification {
String getRandomGreeting();
}
notification random-greeting-notification
{
leaf random-greeting {
type string;
}
}
27. Yang to Java Example - notification - builder
27
Yang Java
public class RandomGreetingNotificationBuilder
implements Builder<RandomGreetingNotification> {
public RandomGreetingNotificationBuilder
setRandomGreeting(String value) {
this._randomGreeting = value;
return this;
}
public RandomGreetingNotification build() {
return new RandomGreetingNotificationImpl(this);
}
…
}
notification random-greeting-notification
{
leaf random-greeting {
type string;
}
}
28. 28
Thank
You
Connect with us@
Email: Sabapathy@cloudenablers.com
dvinod@Cloudenablers.com
LinkedIn: http://in.linkedin.com/in/arsabapathy
Twitter: https://twitter.com/arsabapathy