Presentation is loading. Please wait.

Presentation is loading. Please wait.

OpenDaylight Architecture

Similar presentations


Presentation on theme: "OpenDaylight Architecture"— Presentation transcript:

1 OpenDaylight Architecture
Ed Warnicke – Note: Read with animations

2 Yangtools – What is Yang?
Cisco Live 2015 4/19/2017 Yangtools – What is Yang? Yang is a modeling language Models semantics and data organization Models can be ‘augmented’ Can model: Config/Operational data as a tree RPCs Notifications Text base Simple Compact Standard based (RFC 6020)

3 Yangtools – What does Yangtools do?
Cisco Live 2015 4/19/2017 Yangtools – What does Yangtools do? 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 Other bindings (AMQP expected this summer) Java code xml json exi

4 Yang to Java Example - typedef
Cisco Live 2015 4/19/2017 Yang Java typedef bridge-name { type string; } Yang to Java Example - typedef 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;

5 Yang to Java Example - grouping
Cisco Live 2015 4/19/2017 Yang Java grouping bridge-attributes { leaf bridge-name { type bridge-name; } Yang to Java Example - grouping public interface BridgeAttributes extends DataObject { BridgeName getBridgeName(); }

6 Yang to Java Example - container - interface
Cisco Live 2015 4/19/2017 Yang Java container connection-info { uses connection-info-attributes; } Yang to Java Example - container - interface public interface ConnectionInfo extends Augmentable<ConnectionInfo>, ConnectionInfoAttributes { }

7 Yang to Java Example - container - builder
Cisco Live 2015 4/19/2017 Yang Java container connection-info { uses connection-info-attributes; } Yang to Java Example - container - builder public class ConnectionInfoBuilder implements Builder <ConnectionInfo> { /* fields */ public void setRemoteIp(IpAddress value) public IpAddress getRemoteIp() public ConnectionInfo build() { return new ConnectionInfoImpl(this); }

8 Yang to Java Example - list - interface
Cisco Live 2015 4/19/2017 Yang Java list controller-entry { key “target” leaf target { type inet:uri; } Yang to Java Example - list - interface public interface ControllerEntry extends Augmentable<ControllerEntry>, Identifiable<ControllerEntryKey> { Uri getTarget(); ControllerEntryKey getKey(); }

9 Yang to Java Example - list - builder
Cisco Live 2015 4/19/2017 Yang Java list controller-entry { key “target” leaf target { type inet:uri; } Yang to Java Example - list - builder 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);

10 Yang to Java Example - rpc – service interface
Cisco Live 2015 4/19/2017 Yang Java rpc hello-world { input { leaf name { type string; } output { leaf greating { Yang to Java Example - rpc – service interface public interface HelloService extends RpcService { Future<RpcResult<HelloWorldOutput>> helloWorld( HelloWorldInput input); }

11 Yang to Java Example - rpc – input interface
Cisco Live 2015 4/19/2017 Yang Java rpc hello-world { input { leaf name { type string; } output { leaf greating { Yang to Java Example - rpc – input interface public interface HelloWorldInput extends DataObject, Augmentable<HelloWorldInput> { String getName(); }

12 Yang to Java Example - rpc – input builder
Cisco Live 2015 4/19/2017 Yang Java rpc hello-world { input { leaf name { type string; } output { leaf greating { Yang to Java Example - rpc – input builder public class HelloWorldInputBuilder implements Builder <HelloWorldInput> { /* fields */ public HelloWorldInputBuilder setName(String value) { this._name = value; return this; } public HelloWorldInput build() { return new HelloWorldInputImpl(this);

13 Yang to Java Example - rpc – output interface
Cisco Live 2015 4/19/2017 Yang Java rpc hello-world { input { leaf name { type string; } output { leaf greating { Yang to Java Example - rpc – output interface public interface HelloWorldOutput extends DataObject, Augmentable<HelloWorldOutput> { String getGreating(); }

14 Yang to Java Example - rpc – output builder
Cisco Live 2015 4/19/2017 Yang Java rpc hello-world { input { leaf name { type string; } output { leaf greating { Yang to Java Example - rpc – output builder public class HelloWorldOutputBuilder implements Builder <HelloWorldOutput> { /* fields */ public HelloWorldOutputBuilder setName(String value) { this._name = value; return this; } public HelloWorldOutput build() { return new HelloWorldOutputImpl(this);

15 Yang to Java Example - notification - interface
Cisco Live 2015 4/19/2017 Yang Java notification random-greeting-notification { leaf random-greeting { type string; } Yang to Java Example - notification - interface public interface RandomGreetingNotification extends ChildOf<DataObject>, Augmentable<RandomGreetingNotification>, Notification { String getRandomGreeting(); }

16 Yang to Java Example - notification - builder
Cisco Live 2015 4/19/2017 Yang Java notification random-greeting-notification { leaf random-greeting { type string; } Yang to Java Example - notification - builder public class RandomGreetingNotificationBuilder implements Builder<RandomGreetingNotification> { public RandomGreetingNotificationBuilder setRandomGreeting(String value) { this._randomGreeting = value; return this; } public RandomGreetingNotification build() { return new RandomGreetingNotificationImpl(this);

17 Cisco Live 2015 4/19/2017 Yang to Java benefits Consistent Data Transfer Objects (DTOs) everywhere 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

18 MD-SAL – 3 Brokers put publish store notify notify Data Broker
Cisco Live 2015 4/19/2017 MD-SAL – 3 Brokers Data Broker notify put store RPC Broker call Notification Broker publish notify

19 Datastore – key concepts
Cisco Live 2015 4/19/2017 Datastore – key concepts Yang data is a tree Two Logical Data Stores config operational Unified View InstanceIdentifier: Pointer to a node OpenDaylight Platform NETCONF MD-SAL ... Flow-Capable Node Inventory Manager Model Statistics Manager OpenFlow Topology Exporter BGP-LS Topology Exporter /operational /config network-topo nodes Flow/2 of:1 of:2 Of:n ... Tables Meters Table/2 Table/n Flow/1 Flow/n Ports nc:1 nc:2 p1 p2 BGP-LS BGPv4 BGPv6 nodes links prefixes n1 n2 nx l2 l1 ... lx px OpenFlow Groups Table/1 Table-stats Flow-stats

20 Datastore – Transactions – Reading and Writing
Cisco Live 2015 4/19/2017 Datastore – Transactions – Reading and Writing ReadWriteTransaction transaction = dataBroker.newReadWriteTransaction(); Optional<Node> nodeOptional; nodeOptional = transaction.read( LogicalDataStore.OPERATIONAL, n1InstanceIdentifier); transaction.put( LogicalDataStore.CONFIG, n2InstanceIdentifier, topologyNodeBuilder.build()); transaction.delete( n3InstanceIdentifier); CheckedFuture future; future = transaction.submit(); transaction Datastore /operational /config network-topo overlay1 BGPv4 nodes nodes n3 n2 n3 n1 n1

21 Datastore – Transactions – Merging
Cisco Live 2015 4/19/2017 Datastore – Transactions – Merging WriteOnlyTransaction transaction = dataBroker.newWriteOnlyTransaction(); InstanceIdentifier<Node> path = InstanceIdentifier .create(NetworkTopology.class) .child(Topology.class, new TopologyKey( “overlay1”)); transaction.merge( LogicalDataStore.CONFIG, path, topologyBuilder.build()); CheckedFuture future; future = transaction.submit(); transaction Datastore /operational /config network-topo nodes n4 overlay1 overlay1 BGPv4 nodes nodes n4 n3 n1 n1

22 Datastore – Transactions – Merge vs Put
Cisco Live 2015 4/19/2017 Datastore – Transactions – Merge vs Put WriteOnlyTransaction transaction = dataBroker.newWriteOnlyTransaction(); InstanceIdentifier<Node> path = InstanceIdentifier .create(NetworkTopology.class) .child(Topology.class, new TopologyKey( “overlay1”)); transaction.put( LogicalDataStore.CONFIG, path, topologyBuilder.build()); CheckedFuture future; future = transaction.submit(); transaction Datastore /operational /config network-topo nodes n4 overlay1 overlay1 BGPv4 nodes nodes n4 n3 n1 n1

23 DataChangeListeners – Finding out about change
Cisco Live 2015 4/19/2017 DataChangeListeners – Finding out about change transaction Datastore dataBroker.registerDataChangeListener( LogicalDatastoreType.CONFIGURATION, myInstanceId, myDataChangeListener, DataChangeScope.SUBTREE); /operational /config network-topo nodes n4 overlay1 n4 overlay1 nodes overlay1 n3 nodes overlay1 BGPv4 nodes myDataChangeListener nodes n4 n3 n1 n1 n4 n3 AsyncDataChangeEvent created deleted updated original

24 RPCs – Unicast Messages
Cisco Live 2015 4/19/2017 RPCs – Unicast Messages RPCs allow you to: Send a message Receive a response Asynchronously Without knowledge of provider of implementation RPCs come in two flavors: Global – One receiver Routed – One receiver per context Consumer MD-SAL Provider

25 RPCs – Sending a Message - Synchronous
Cisco Live 2015 4/19/2017 RPCs – Sending a Message - Synchronous HelloService helloService= session.getRpcService(HelloService.class); Future<RpcResult<HelloWorldOutput>> future; future= helloService .helloWorld(helloWorldInput); HelloWorldOutput helloWorldOutput = future.get().getResult(); consumer future helloService MD-SAL getRpcService() return: helloService helloWorld(helloWorldInput) return: future get() set(helloOutput) return: RpcResult<HelloWorldOutput>

26 RPCs – Sending a Message - Asynchronous
Cisco Live 2015 4/19/2017 RPCs – Sending a Message - Asynchronous HelloService helloService= session.getRpcService(HelloService.class); Future<RpcResult<HelloWorldOutput>> future; future= helloService .helloWorld(helloWorldInput); while(! future.isDone()) { /* Do other work */ } HelloWorldOutput helloWorldOutput = future.get().getResult(); consumer future helloService MD-SAL getRpcService() return: helloService helloWorld(helloWorldInput) return: future isDone() false set(helloOutput) isDone() true get() return: RpcResult<HelloWorldOutput>

27 Global RPCs – processing a message - Sync
Cisco Live 2015 4/19/2017 Global RPCs – processing a message - Sync public class HelloWorldImpl implements HelloService { public HelloWorldImpl(ProviderContext session){ session.addRpcImplementation( HelloService.class, this); public Future<RpcResult<HelloWorldOutput>> helloWorld(HelloWorldInput input) { /* construct output */ return RpcResultBuilder .success(helloWorldOutput) .buildFuture(); MD-SAL helloWorldImpl addRpcImplementation(this) helloWorld(helloWorldInput) return: future

28 Global RPCs – processing a message - Sync
Cisco Live 2015 4/19/2017 Global RPCs – processing a message - Sync public class HelloWorldImpl implements HelloService { public HelloWorldImpl(ProviderContext session){ session.addRpcImplementation( HelloService.class, this); public Future<RpcResult<HelloWorldOutput>> helloWorld(HelloWorldInput input) { /* construct output */ return RpcResultBuilder .success(helloWorldOutput) .buildFuture(); MD-SAL helloWorldImpl addRpcImplementation(this) helloWorld(helloWorldInput) return: future

29 Global RPCs – processing a message - ASync
Cisco Live 2015 4/19/2017 Global RPCs – processing a message - ASync public class HelloWorldImpl implements HelloService { public HelloWorldImpl(ProviderContext session){ session.addRpcImplementation( HelloService.class, this); public Future<RpcResult<HelloWorldOutput>> helloWorld(HelloWorldInput input) { SettableFuture future = new SettableFuture(); process (input,future); return future; MD-SAL future helloWorldImpl addRpcImplementation(this) helloWorld(helloWorldInput) process(helloWorldInput,future) return: future

30 Global RPCs – processing a message - ASync
Cisco Live 2015 4/19/2017 Global RPCs – processing a message - ASync public class HelloWorldImpl implements HelloService { /* * see previous slide for * calls to addRpcImplementation * and the helloWorld method */ private process(HelloWorldInput input, SettableFuture future) { /* process in new thread */ future.set(RpcResultBuilder .success(helloWorldOutput) .build()); } MD-SAL future helloWorldImpl addRpcImplementation(this) helloWorld(helloWorldInput) process(helloWorldInput,future) return: future set(helloOutput)

31 Routed RPCs – What are they?
Cisco Live 2015 4/19/2017 Routed RPCs – What are they? A Unicast Message Well defined Input/Output Processor is context dependent Input includes ‘Context’ InstanceIdentifier Pointer to a place in the tree defining message context Consumer is unaware RPC is routed Registration includes ‘Context’ MD-SAL ‘routes’ to correct message processor for ‘Context’ Consumer MD-SAL Provider1 Provider2

32 Routed RPCs – processing a message - Sync
Cisco Live 2015 4/19/2017 Routed RPCs – processing a message - Sync public class HelloWorldImpl1 implements HelloService { public HelloWorldImpl(ProviderContext session){ RoutedRpcRegistration<HelloService> reg1 = session.addRoutedRpcImplementation( HelloService.class, this); reg1.registerPath(MyContext.class,iid1); } /* helloWorld() implementation works as before */ MD-SAL reg2 helloWorldImpl2 reg1 helloWorldImpl1 addRoutedRpcImplementation(this) return: reg1 registerPath(…) addRoutedRpcImplementation(this) return: reg2 public class HelloWorldImpl2 implements HelloService { public HelloWorldImpl(ProviderContext session){ RoutedRpcRegistration<HelloService> reg2 = session.addRoutedRpcImplementation( HelloService.class, this); reg2.registerPath(MyContext.class,iid2); } /* helloWorld() implementation works as before */ registerPath(…) helloWorld(helloWorldInput1) return: future helloWorld(helloWorldInput2) return: future

33 Cisco Live 2015 4/19/2017 Let Make a Deal If you don’t make me show you Routed RPC working Asynchronously I won’t make you sit through it  Nobody has to know Online Session Review: mention how epic the Routed RPC Async slide was 

34 Notifications - publishing
Cisco Live 2015 4/19/2017 Notifications - publishing publisher MD-SAL notificationPublishService.putNotification(notification); putNotification(notification)

35 Notifications - subscribing
Cisco Live 2015 4/19/2017 Notifications - subscribing MyNotificationListener MD-SAL public class MyNotificationListener<MyNotification> implements NotificationListener { public MyNotificationListener( NotificationService ns) { ns.registerNotificationListener(this); } onNotification(MyNotification notification){ /* process notification */ registerNotificationListener(this) onNotification(notification)

36 Clustering - Datastore
Cisco Live 2015 4/19/2017 Clustering - Datastore Datastore Sharded Replicated But not everywhere RAFT algorithm for consistency Node -1 Node -2 Node -3 /operational /config /operational /config /operational /config network-topo network-topo network-topo overlay1 overlay1 overlay1 BGPv4 BGPv4 BGPv4 nodes nodes nodes nodes nodes nodes n4 n3 n4 n3 n4 n3 n1 n1 n1 n1 n1 n1

37 Clustering - RPCs RPCs Routed across the cluster Node -1 Node -2
Cisco Live 2015 4/19/2017 Clustering - RPCs RPCs Routed across the cluster Node -1 Node -2 Consumer MD-SAL MD-SAL Provider


Download ppt "OpenDaylight Architecture"

Similar presentations


Ads by Google