 Hi everyone, welcome. So, we are here to talk about OpenStack Python SDK. Before that, who am I? Well, yet another developer. I am individual contributor to OpenStack and I started contributing to OpenStack as an outreach intern. And outreach is, for those who don't know, outreach is nothing but an internship program to help to get started under represented group in computer science to take part in open source projects. And most at most of the places like IRC, GitHub, Twitter, my Nick is Explorciapalli. So, this is the agenda for today. I have divided this talk into three different sections. In the first section, we will see what are the different ways with which one can use OpenStack Cloud services. In the second section, we will see how to use OpenStack Python SDK. And in the third section, briefly we will discuss about few internals of the Python SDK, how it is being developed and what is its architecture. So, let's begin. There are majorly three ways with which one can use OpenStack Cloud services and manage all the resources of OpenStack Cloud. The very first is GUI, which is a web-based graphical user interface, where user can visualize everything graphically and they can click and select all their resources and manage them. And who will tell me the code name of this project? What we call this dashboard in OpenStack language? Horizon. Absolutely, yeah. That's Horizon. Another way to use OpenStack Cloud is using command line. You can type commands to operate your OpenStack Cloud and all the resources. And for that, you need to install OpenStack Clients. There are different clients for different components. And also, there is one OpenStack Client, which is now being developed, which allow you to operate all the components of OpenStack. So, you can, I mean, to use it, you will need to install it as you install every other tool in your operating system. For example, you can do, so do I get install OpenStack Client if you are using Debian base distribution of Linux. And you can type the commands like OpenStack user list if you want to list out all the users or OpenStack server list if you want to list out all the servers. And there is one more way to use and manage your OpenStack Cloud services, which is SDK. How it is different is it is mainly developed to provide better and different experience to web developers and operators of OpenStack Cloud so that they can operate the whole cloud with their code. So, there are SDKs available for many other languages other than Python. But here we will talk about Python SDK. So, you can write Python script to manage your OpenStack Cloud. For example, if you are building a Django application and you want to store all your media files of your application to not to not on your server's hard disk, but on your OpenStack Cloud, you can use Python SDK for that. Okay. The one point to note here is all of the three interfaces about which we have talked, whether it's GUI or command line or SDK, all of them, underneath, they use APIs. So, all components of OpenStack, they provide restful APIs for the resources. And all these three ways which we have seen, whether it's GUI or SDK or command line, they all use those APIs and manage authentication and many other details, wrap all of them together and provide a simple way to us to use OpenStack Cloud. Okay. So, that was the first section. Now let's see how to use Python OpenStack SDK. We have already talked about what SDK is. And as a software development kit, this Python OpenStack SDK provide all set of library and tools to manage all OpenStack services at the same place. So, you can operate your OpenStack Cloud with the Python code. And along with that, it also provide good examples and documentations which you can go through to learn how to work with the ecosystem. To install OpenStack SDK, you just need to do PIP install OpenStack SDK because it is available on Python packaging index. Once you have installed it, you can import OpenStack library. And before looking more into the code about how to use OpenStack SDK exactly, we need to know about few basics. Let's talk about them. So, the very first thing one should know is connection interface. If you want to use, if you want to manage your OpenStack Cloud resources with your Python code, you will need something to connect to that cloud. And that's what this connection class will do. So, first thing that you will need is to create a connection object by providing all the authentication and all your other preferences which will create a connection object. After creating a connection object, once you have established a connection with the cloud, you will need to specify which specific service you want to talk to. So, if your connection object is gone, then you will need to specify, okay, I want to talk to network service or I want to talk to identity service. And one thing to note here is that OpenStack SDK are being developed with considering the point that end user actually does not know about the different code names of the projects. So, end user actually does not know that we use Keystone term for our identity service or we use Nova for our compute service. So, here to access any service, you will not need to specify any OpenStack term, but you will need to specify the real service that end user wants to use or you want to use. So, after connection object, you will specify network, not neutron, if you want to access network service. And after that, you will need to specify which resource of that service you want to access. So, if you want to list out, let's say, all the servers that you have on the cloud, you will do connection.comput.servers where compute will be your service and connection will be your resources. And last thing is you will need to be sure which version of component you want to talk to. Here we will talk about Keystone version 3. If you want to use version 2, you can definitely do that, but you will need to specify it explicitly. So, this is how a connection object can be created. So, very first, we will need to import the connection module. So, with OpenStack library, you have imported connection module in the first line and then you can create connection object by passing all the authentication details which you can get simply in your IRC file. And then once you have created the connection object, you can list out all the servers that you have or you can list out all the images that you have. So, what you will need to do is connection.comput.servers and it will return generators of all the available servers that your OpenStack cloud have. And similarly, you can list out all the images, all those whom you can access. Similarly, you can list out all the flavors, con.comput.flavors and then you can print flavor name or you can perform any other action that you want to do. Similarly, you can access identity service and all the resources of those identity service like identity dot endpoints and then print out the endpoints. Same for the projects, for the users. Same thing we can do with network. You can create a network. Similarly, you can create any server as well. You can span any instance with the OpenStack SDK. But here I have added one example to how to create a network with the Python code using SDK. So, con.network.create and in the argument you will need to pass which the name of your network that you want to create and then you can also create a subnet by providing proper arguments. So, again you will need to do con.network.create subnet and you can pass out the name of the subnet that you want and network ID that you have just created and then which version you want and other details if you want to specify. So, that was how you can use Python Stack SDK. Now, we will briefly discuss how exactly these SDK are being developed about their architecture. So, these are actually the main interfaces or the main classes on the top of which OpenStack SDK are being developed. The very first is the connection class which is the main user interface. It is a class with which usually user talks to and it perform three main actions. Out of them very first is it creates a profile object. Now, what profile do? Profile basically list out all the user preferences. So, you can before creating a connection object you can actually create a profile object and specify all your preferences. For example, I want to use this particular version for this specific service or any other this particular region for this particular service. So, you can specify all those things by creating profile object and then you can pass that profile object while creating your connection object. So, that is how profile and connection are being created. If profile is not there in the request for creating connection object, connection object will create a profile which will have all the default services. After creating a profile object, connection object will create a session object and here session do what session literally means. It manage all your authentication and transport session. So, it talks to the Keystone. It brings a token for you and it connects the token with the profile with the given profile which we have which connection object has just created. So, you have all the user preferences listed, you have all the authentication details now. After that connection object list out all the collection of available services proxy. Now, what proxy is? Proxy is a collection of available resources methods. For example, if I call compute.server on connection object, then I am actually accessing proxy methods of compute service which will help me, which will basically take me to the resource of the compute service and will take, will call the real resource which is our server because we have done compute.server call. So, resources are the main API resources that the components API provides and to access all those resources proxy objects are being created. Proxy objects have proxy methods which talk to the real resource APIs. So, this is how it is being layered. Resources are the under most layer which talks to the API and it exposes through proxy objects which provide different methods for the resources and all these proxy objects are connected with the services and collection object and collection object also connected with the session object. So, this is how all things are being connected. These are the references. Thank you. If you have any questions. Yeah. Yeah, sure. Yeah. Sorry. It is aimed to build like a unified CLI only, but I am not sure if it is support each and every component right now, but it does support all the main components of OpenStack and people are using it in production. You will have to pass it to the connection object. It is not necessary that you need to specify everything in the connection object. You can definitely use the environment objects and use OS module or something similar to read it by Python. Any other question?