Register now for better personalized quote!

Interacting with Metapod from the OpenStack CLI (or Building your OpenStack CLI VM)

Nov, 09, 2015 Hi-network.com

Back in September 2014 Cisco acquired private OpenStack cloud service company Metacloud (http://newsroom.cisco.com/press-release-content?articleId=1489587). Initially known as Cisco OpenStack Private Cloud (COPC) and now known as Cisco Metapod?. Cisco Metapod represents one of most robust and scalable OpenStack-as-a-Service or On-Premise Public Cloud Experience offering in the market. With the agility and vision of a startup, the stability and expertise of Cisco, this is a solution and a service that helps businesses with the adoption of the agile/mode 2 or cloud native applications.

For the networking or IT teams, all these new solutions and technologies might seem intimidating at first. Do I have to become an OpenStack expert? Am I going to have my CLI or am I to become a GUI guy?

Well, you are going to have a CLI: the OpenStack CLI. The Cisco Metapod? is OpenStack and as such it maintains the standard OpenStack API so we use the standard OpenStack client libraries for this.

The following steps guide you over the process for creating your own VM with the OpenStack client libraries, which you can use as the CLI to interact with any standard OpenStack deployment.

Preparing a CentOS 7.x VM with the OpenStack client libraries and CLI:

Install EPEL repo:

#yum -y install epel-release.noarch

Upgrade the VM after the EPEL repo installation so you start with a good base.

#yum -y update

Install the OpenStack client libraries. CentOS maintain a repo with the OpenStack RPMs.

#yum -y centos-release-openstack.noarch

Finally install the OpenStack client libraries

#yum -y python-openstackclient.noarch

Now we are ready to start using the OpenStack CLI with the Cisco Metapod? environment.

Setting up the environment:

The OpenStack client libraries interact over REST APIs. A REST API uses the URI/URL format, just like when we interact with a webpage. A REST API is stateless. The interaction with a stateless service requires certain attributes to be sent with each interaction. In OpenStack CLI, these are parameters like the username, the tenant project and password. These parameters can be specified during the execution of each command or we can use environment variables for this.

With Cisco Metapod? we can either create a keystone resource file with the correct environment variables or we can download it form the Metapod dashboard.

To manually create the file (i.e. keystone_mpod) use the following example as reference:

#--- file start here ---

export OS_USERNAME=mymetapodadminuser

export OS_TENANT_NAME=mytenantproject

export OS_PASSWORD=myplaintextpassword

export OS_AUTH_URL=http://url.to.your.metapod.cloud:5000/v2.0

export PS1='[\u@\h \W(mpod)]\$'

#--- file end here ---

 

To download the keystone resource file from the Metapod dashboard:

  1. Login to Metapod dashboard with your user and go to your tenant (in my case mpod_demo)> Project > Access & Securityand click theAPI Accesstab
  2. ClickDownload OpenStack RC Fileto download the corresponding resource file.

The Metapod resource file is a little more advance. Instead of sourcing it we have to execute it.

If it is not already executable, make sure it is executable.

[root@centosvm ~]#chmod +x./<your-tenant-openrc.sh>

Then execute the file.

[root@centosvm ~]# ./<your-tenant-openrc.sh>

This will prompt for your OpenStack tenant password. The file will be similar to the following image:

 

 Using Cisco Metapod? with the OpenStack client libraries and CLI:

Source the keystone resource file to define the environment variables required for the OpenStack CLI access. The shell prompt will change.

[root@centosvm ~]#source keystone_mpod

[root@centosvm ~(mpod)]#

The shell prompt will change. Now we are ready to start using the OpenStack CLI.

If using the Metapod RC file, you will be prompted for the password when executing it:

[root@centosvm ~]#./your-tenant-openrc.sh

Please enter your OpenStack Password:

[root@centosvm ~]#

Now you may try some commands. For example, lets say we want a list of all the Instances (Virtual Machines) in the environment we can execute the following query:

 

Here are some other commands you may try:

[root@centosvm ~(mpod)]#openstack user list

[root@centosvm ~(mpod)]#openstack role list

[root@centosvm ~(mpod)]#openstack project list

[root@centosvm ~(mpod)]#nova floating-ip-bulk-list

[root@centosvm ~(mpod)]#keystone user-list

[root@centosvm ~(mpod)]#nova flavor-list

[root@centosvm ~(mpod)]#glance image-list

Each project brings a set of commands and client libraries. Search for your favorite OpenStack project and the available commands at http://docs.openstack.org.

Have fun!


tag-icon Hot Tags : #CiscoChampion OpenStack Cisco Metacloud Cisco Metapod

Copyright © 2014-2024 Hi-Network.com | HAILIAN TECHNOLOGY CO., LIMITED | All Rights Reserved.