Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ed Warnicke – Note: Read with animations

Similar presentations


Presentation on theme: "Ed Warnicke – Note: Read with animations"— Presentation transcript:

1 Ed Warnicke – 2015-07-27 Note: Read with animations
ODL Tutorial Ed Warnicke – Note: Read with animations

2 Environment Setup Grab a USB Key
Copy the contents to the laptop (May take about 5-10 mins) Install VirtualBox for your platform Unzip ODLTutorial.zip Import the OVA into VirtualBox or VMWare Fusion(If you have it) Boot up the Virtual Machine and Login Login User/Password: ODL-Developer Wiki Page: Go to wiki.opendaylight.org Search for : “Application Development Tutorial” in the Search Box on the right IRC Channel for today: #opendaylight-tutorial

3 Cisco Live 2014 Goals 4/21/2017 This very hands on tutorial will walk you through writing a simple OpenDaylight application and SB Plugin. Along the way we will explore: Writing effective models Available design patterns for your application and protocol plugin How to achieve those patterns in your code Building applications from micro-services Getting along with other applications Clustering considerations Performance considerations Error handling  At the end of this tutorial you will have written a simple application and southbound plugin Using best practices and have an understanding of *why* it was written that way.

4 OSGi Framework (Equinox)
ODL Technology Stack Java chosen as an enterprise-grade, cross-platform compatible language Java Interfaces are used for event listening, specifications and forming patterns Maven – build system for Java OSGi: Allows dynamically loading bundles Allows registering dependencies and services exported For exchanging information across bundles Karaf: Light-weight Runtime for loading modules/bundles OSGi based. Primary distribution mechanism since Helium FeatureA FeatureB SAL Karaf OSGi Framework (Equinox) 23, 25 ABOUT KARAF ADD: DLUX / GUI SLIDE ON SOLVING HARD PROBLEMS VIA INDUSTRY VIA CODE VS PRODUCTS TALK ABOUT POLICY – DEBATE INTERNALLY IN CODE SECURITY AND TRIPLE AAA LOAD BALANCING AS A SERVICE ETC. ON 23-28

5 OpenDaylight: SDN Controller Architecture
Network Applications Orchestration & Services Applications Controller NETCONF REST APIs Service Functions Base Network Functions Controller Platform Topology Exporter ... Inventory Manager Configuration Subsystem Statistics Manager Forwarding Rules Manager ... PCEP Topology Exporter Inventory Manager Topology Exporter Inventory Manager Service Adaptation Layer OpenFlow 1.0/1.3 BGP-LS PCEP Netconf Client OVSDB LISP Southbound Interfaces & Protocol Plugins Network Devices

6 OpenDaylight: Software Architecture
Network Devices Applications Network Devices Applications Network Applications Orchestration & Services Network Devices Applications Controller NETCONF SERVER Protocol Plugin ... Protocol Plugin App/Service Plugin ... App/Service Plugin RESTCONF Plugins & Applications Config Subsystem Model-Driven SAL (MD-SAL) Controller Platform Messaging Data Store Clustering Remote Controller Instance Remote Controller Instance

7 Cisco Live 2014 4/21/2017 The Tools A text editor, preferably an IDE like IntelliJ IDEA or Eclipse YANG – Modeling language (see RFC 6020) Java 1.7 or 1.8 – Programming language Maven >= – Build tool OSGi – technology for building modular systems Karaf – technology for deploying and managing OSGi bundles

8 Apache Karaf Container
Modular (Deploy only the features/bundles you need) Hot Deployment Dynamic Configuration Powerful Extensible Shell Console + Remote Access Native OS Integration Logging Security Framework Supports any Component that can be wrapped as Jar f1 f2 A:bundle C:bundle B:bundle common X:bundle my-features.xml Y:bundle

9 The Service Development Process
YANG Model (s) Service Implementation Karaf Feature Definition 1 3 4 Generate API Yang Tools Maven Build Tools Maven Build Tools OSGi API JAR OSGI IMPL JAR Features.xml Generated API OSGi IMPL JAR Karaf KAR 2 Maven Build Tools 5 Deploy Controller OSGi API JAR

10 Yangtools – What is Yang?
Cisco Live 2015 4/21/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)

11 Yangtools – What does Yangtools do?
Cisco Live 2015 4/21/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

12 Cisco Live 2015 4/21/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

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

14 RPCs – Unicast Messages
Cisco Live 2015 4/21/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

15 RPCs – Sending a Message - Synchronous
Cisco Live 2015 4/21/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>

16 RPCs – Sending a Message - Asynchronous
Cisco Live 2015 4/21/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>

17 Global RPCs – processing a message - Sync
Cisco Live 2015 4/21/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

18 Global RPCs – processing a message - Sync
Cisco Live 2015 4/21/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

19 Global RPCs – processing a message - ASync
Cisco Live 2015 4/21/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

20 Global RPCs – processing a message - ASync
Cisco Live 2015 4/21/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)

21 Routed RPCs – What are they?
Cisco Live 2015 4/21/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

22 Routed RPCs – processing a message - Sync
Cisco Live 2015 4/21/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

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

24 Cisco Live 2015 4/21/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

25 Datastore – key concepts
Cisco Live 2015 4/21/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

26 Datastore – Transactions – Reading and Writing
Cisco Live 2015 4/21/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

27 Datastore – Transactions – Merging
Cisco Live 2015 4/21/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

28 Datastore – Transactions – Merge vs Put
Cisco Live 2015 4/21/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

29 DataChangeListeners – Finding out about change
Cisco Live 2015 4/21/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

30 Clustering - Datastore
Cisco Live 2015 4/21/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


Download ppt "Ed Warnicke – Note: Read with animations"

Similar presentations


Ads by Google