Openstack Integration with Apache Camel Project
Total Page:16
File Type:pdf, Size:1020Kb
Masaryk University Faculty of Informatics OpenStack integration with Apache Camel project Master’s Thesis Jan Bouška Brno, Spring 2017 Masaryk University Faculty of Informatics OpenStack integration with Apache Camel project Master’s Thesis Jan Bouška Brno, Spring 2017 Replace this page with a copy of the official signed thesis assignment and the copy of the Statement of an Author. Declaration Hereby I declare that this paper is my original authorial work, which I have worked out on my own. All sources, references, and literature used or excerpted during elaboration of this work are properly cited and listed in complete reference to the due source. Jan Bouška Advisor: Mgr. Marek Grác, Ph.D. i Acknowledgement I would like to thank to my supervisor Mgr. Marek Grác, Ph.D. and my technical supervisor from Red Hat Czech, s.r.o, Ing. Jiří Pechanec, for providing constant feedback during the preparation of this master’s thesis. I would also like to thank to all my other colleagues from Red Hat that expressed their valuable thoughts and helped to make this thesis better. iii Abstract The purpose of this master’s thesis is to design and develop new Camel component by integrating two open-source project Apache Camel and OpenStack. This new component will act as OpenStack service provider in the Camel integration framework. iv Keywords Apache Camel, OpenStack, component, integration framework, cloud computing v Contents 1 Introduction 1 2 Technologies 3 2.1 Apache Camel .........................3 2.1.1 Camel core features . .3 2.1.2 Camel’s Architecture . .6 2.2 OpenStack ........................... 10 2.2.1 Why we need OpenStack . 10 2.2.2 OpenStack - platform for cloud computing . 12 2.2.3 How it works . 12 3 Analysis and Design 17 3.0.1 Existing ways to use OpenStack with Camel . 17 3.0.2 Requirements . 17 3.0.3 Use case diagram . 20 3.0.4 Component’s Data flow . 20 3.0.5 Camel OpenStack URI . 21 3.0.6 OpenStack4j . 23 3.0.7 Class Diagram . 25 3.0.8 Dynamic component loading . 26 4 Implementation 27 4.1 Component structure ..................... 28 4.1.1 openstack-nova . 32 4.1.2 openstack-glance . 33 4.1.3 openstack-neutron . 34 4.1.4 openstack-keystone . 35 4.1.5 openstack-swift . 36 4.1.6 openstack-cinder . 38 4.2 Testing ............................. 39 4.2.1 Unit Tests . 39 4.2.2 Integration Tests . 40 4.3 Documentation ........................ 41 5 Conclusion 43 vii A Sub-components class diagrams 45 B Camel OpenStack documentation 51 C Contents of attached CD 73 Bibliography 75 viii List of Figures 2.1 Construction of the route in Camel DSL 4 2.2 Java DSL 4 2.3 XML DSL 4 2.4 Scala DSL 4 2.5 Camel context 6 2.6 Cloud compute stack 11 2.7 OpenStack software diagram 12 2.8 OpenStack Conceptual View 13 3.1 Camel OpenStack use case diagram 20 3.2 Camel OpenStack Data Flow diagram 21 3.3 Class diagram 26 3.4 Component resources directory 26 4.1 Package diagram 28 4.2 OpenstackConstants 29 4.3 AbstractOpenstackEndpoint 30 4.4 AbstractOpenstackProducer 30 4.5 Component class 31 4.6 Endpoint class 31 4.7 Producer class 32 4.8 Nova producers 32 4.9 Glance producer 34 4.10 Neutron producers 35 4.11 Keystone producers 36 4.12 Swift producers 37 4.13 Cinder producers 38 4.14 Tests structure 40 A.1 openstack-nova class diagram 45 A.2 openstack-glance class diagram 46 A.3 openstack-keystone class diagram 47 A.4 openstack-neutron class diagram 48 A.5 openstack-swift class diagram 49 A.6 openstack-cinder class diagram 50 ix 1 Introduction The age we live in right now is very often called "The age of Information technologies". This is exactly the term which describes our everyday life. We use information technologies almost everyday and everywhere. There are systems used for weather prediction, systems used in health centers and many other systems which are used for different things. The majority of these systems are constructed in order to produce useful information for us. It is no surprise that if we connect systems we can get much more information and profit from it. Lets imagine for example an airline company. Our company has to find out information about weather, collect information from other airline companies and assemble flight plans, provide their services to the customers over web interface and there are lots of other things to do. It is obvious that those systems should communicate with each other. It does not seem to be a difficult thing but the modern technologies are based on different programming languages, different frameworks and have alot of other differences. The consequence is that these systems don’t have a common language for communication. This is the main purpose of integration frameworks which are designed to solve these problems. The main goal of integration frameworks is to allow communica- tion across different API1, data formats and interfaces. Moreover they are trying to be lightweight, straightforward and easy to learn. One of the integration frameworks is called Apache Camel[1]. This framework is very powerful and user-friendly. This project is devel- oped under Apache and is very popular because it is open source and it has very large developer community. Camel is based on the book called "Enterprise Integration Patterns"[6] or EIP written by Gregor Hohpe and Bobby Wolf. In this book there are described 65 patterns for the use of enterprise application integration and message-oriented middleware. Apache Camel is highly modular because the core mod- ule contains only few basic features and the other communication protocols can be used as an extension of the camel-core module. These extensions are called camel components. The modulation helps Camel to be lightweight and nice to use. 1. Application Programming Interface 1 1. Introduction The main purpose of this thesis is to create a new Camel component which would allow Camel users to communicate and manage services in OpenStack system[11]. Based on community given approach the new component is named Camel OpenStack. OpenStack is free, open source platform for cloud computing. The OpenStack system is also widely used and OpenStack developers could be proud of the similar benefits as Camel developers i.e. user friendliness and modularity. Openstack consists of several compo- nents. The main component is called Nova. Nova is designed to man- age pools of virtual computers and resources. The other important components are Neutron, Cinder, Glance, Swift and Keystone. This are the six components which the Camel OpenStack component will support. There are other OpenStack components which are not in the frame of this thesis. This thesis is divided into five thematic parts. The first chapter contains brief introduction and the aim of this thesis. The second chapter introduces technologies used in this project (mainly the Apache Camel project and the OpenStack project). It is not indeed to cover these projects to the detail but there are described the most important facts about the projects. You can find more detailed information if you follow the links to the documentation. The third chapter is focused on the analysis and design of the new Camel component. The fourth chapter describes the process of the implementation and testing of camel-openstack component. The last chapter is called Conclusion. This chapter is here to sum up the results and the opportunities to enhance and enlarge the range of functionality of the newly created component. 2 2 Technologies This chapter describes technologies used for implementation of Camel OpenStack component. The first section of this chapter deals with the Apache Camel project and the second part is about OpenStack system. 2.1 Apache Camel Apache Camel[2] is open source integration framework written in Java. This framework is based on theory of Enterprise Integration Patterns or EIP, described in the book written by Gregor Hohpe and Bobby Wolf. As well as other integration frameworks Camel mainly focuses on interaction between applications. This interaction is based on the routing exchanges. But there are very many different features which purpose is not routing of exchanges but they could be useful for mod- ifying data or monitoring and maintaining of the whole system. Camel has also very extensible and modular architecture which was designed to allow implementation and seamless plugin support for new protocols. Another fundamental principle of Camel is that data are trans- ported in unified format. This feature is very useful because develop- ers can’t convert data to or from any canonical format. This assumption also allow Camel users to integrate together any kind of systems. 2.1.1 Camel core features Camel’s main feature is moving data from one application to another and vice versa. This movement is based on the route’s configuration. The routes in Camel are configured with a combination of EIP and Camel’s domain-specific language (DSL). Domain Specific Language Domain specific language allows users to specify their rules in declar- ative way. This approach helps Camel minimizes number of lines of source code and makes Camel very nice to use. Camel’s DSL was 3 2. Technologies inspired by natural language and helps inexperienced users to under- stand Camel rules very quickly. Lets show a simple example how Camel’s routes are created with Camel DSL. Imagine a situation when we have an e-shop. Incoming data are orders from our e-shop and we want to route them to the widget inventory or to the gadget inventory.