summaryrefslogtreecommitdiffstats
path: root/VnfMgrSim/vnfmgr/vnfmgr_os
diff options
context:
space:
mode:
authorblsaws <blsaws@hotmail.com>2015-11-10 14:17:22 -0800
committerblsaws <blsaws@hotmail.com>2015-11-10 14:31:51 -0800
commit51f1c01d34888b48694e3c4ea67f707706532310 (patch)
tree2ec8f1354b906431bc45ca2a1d76f544fc736442 /VnfMgrSim/vnfmgr/vnfmgr_os
parentdc75170d734debbe8a5de88cc71b52c3e53fd45e (diff)
Correct structure
Add docs folder Update HTML theme Remove example docs JIRA: SFC-3 Change-Id: If0158796aee5f020f3bb4403b8a67952f9e6bb26 Signed-off-by: blsaws <blsaws@hotmail.com>
Diffstat (limited to 'VnfMgrSim/vnfmgr/vnfmgr_os')
-rw-r--r--VnfMgrSim/vnfmgr/vnfmgr_os/__init__.py0
-rwxr-xr-xVnfMgrSim/vnfmgr/vnfmgr_os/vnfmgr_os.py68
2 files changed, 0 insertions, 68 deletions
diff --git a/VnfMgrSim/vnfmgr/vnfmgr_os/__init__.py b/VnfMgrSim/vnfmgr/vnfmgr_os/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/VnfMgrSim/vnfmgr/vnfmgr_os/__init__.py
+++ /dev/null
diff --git a/VnfMgrSim/vnfmgr/vnfmgr_os/vnfmgr_os.py b/VnfMgrSim/vnfmgr/vnfmgr_os/vnfmgr_os.py
deleted file mode 100755
index 00678503..00000000
--- a/VnfMgrSim/vnfmgr/vnfmgr_os/vnfmgr_os.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#################################################################
-# #
-# Copyright 2015 Ericsson AB #
-# All Rights Reserved #
-# #
-# Author: Manuel Buil <Manuel.Buil@ericsson.com> #
-# Version: 0.1 #
-# #
-#################################################################
-
-import pdb
-
-from novaclient.v2 import client as nova
-from novaclient import exceptions as novaexceptions
-from keystoneclient.v2_0 import client as keystone
-from glanceclient import client as glance
-
-
-class OpenStack_API:
- def __init__(self, authurl, tenantName, tenantUser, tenantPass):
- self.authurl=authurl
- self.tenantName=tenantName
- self.tenantUser=tenantUser
- self.tenantPass=tenantPass
-
- def get_token(self):
- # Establish connection to Openstack controller
- osconn = keystone.Client(username=self.tenantUser, password=self.tenantPass, tenant_name=self.tenantName, auth_url=self.authurl)
- token = osconn.auth_token
- return token
-
- def get_endpoint(self,service_type, endpoint_type):
- # Establish connection to Openstack controller
- osconn = keystone.Client(username=self.tenantUser, password=self.tenantPass, tenant_name=self.tenantName, auth_url=self.authurl)
- endpoint = osconn.service_catalog.url_for(service_type=service_type, endpoint_type=endpoint_type)
- return endpoint
-
- def find_image(self,SF_type):
- # Find in glance the image that matches the SF we want to deploy
- token = self.get_token()
- endpoint = self.get_endpoint('image','publicURL')
- osconn = glance.Client('1',endpoint=endpoint,token=token)
- image_list = osconn.images.list()
- for item in image_list:
- try:
- image_type = item.properties.get('image_type', None)
- image_id=None
- if (image_type == SF_type):
- image_id = item.id
- break
- except:
- print("Errrorr")
-
- #Search image which matches the SF type
- return image_id
-
- def create_vm(self, name, image, flavor, nics=None):
- # Establish connection to Openstack controller
- osconn = nova.Client(self.tenantUser, self.tenantPass, self.tenantName, self.authurl, service_type="compute")
- try:
- if nics is None:
- vm = osconn.servers.create(name,image,flavor)
- else:
- vm = osconn.servers.create(name,image,flavor,nics)
- except:
- print("Something wrong happened while creating the VM")
- vm = None
- return vm