update from RIFT as of 696b75d2fe9fb046261b08c616f1bcf6c0b54a9b second try
Signed-off-by: Jeremy Mordkoff <Jeremy.Mordkoff@riftio.com>
diff --git a/rwcal/CMakeLists.txt b/rwcal/CMakeLists.txt
index 8eba04a..9e7c2e4 100644
--- a/rwcal/CMakeLists.txt
+++ b/rwcal/CMakeLists.txt
@@ -19,23 +19,19 @@
cmake_minimum_required(VERSION 2.8)
-set(PKG_NAME rwcal)
-set(PKG_VERSION 1.0)
-set(PKG_RELEASE 1)
-set(PKG_LONG_NAME ${PKG_NAME}-${PKG_VERSION})
-
set(subdirs src plugins test)
rift_add_subdirs(SUBDIR_LIST ${subdirs})
install(FILES include/riftware/rwcal-api.h
DESTINATION usr/include/riftware
- COMPONENT ${PKG_LONG_NAME})
+ COMPONENT ${INSTALL_COMPONENT}
+ )
install(
PROGRAMS
etc/userdata-template
DESTINATION etc
- COMPONENT ${PKG_LONG_NAME}
+ COMPONENT ${INSTALL_COMPONENT}
)
@@ -49,12 +45,12 @@
rift/cal/utils.py
rift/cal/rwcal_status.py
PYTHON3_ONLY
- COMPONENT rwcal-1.0)
+ COMPONENT ${INSTALL_COMPONENT})
install(
PROGRAMS
rift/cal/cloudsim
DESTINATION usr/bin
- COMPONENT rwcal-1.0
+ COMPONENT ${INSTALL_COMPONENT}
)
diff --git a/rwcal/include/riftware/rwcal-api.h b/rwcal/include/riftware/rwcal-api.h
index 6ef5f6a..966dfb9 100644
--- a/rwcal/include/riftware/rwcal-api.h
+++ b/rwcal/include/riftware/rwcal-api.h
@@ -103,8 +103,8 @@
*/
rw_status_t rwcal_get_image_list(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
- rwpb_gi_Rwcal_VimResources **images);
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources **images);
/*
* Delete Image.
@@ -116,7 +116,7 @@
*/
rw_status_t rwcal_delete_image(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
const char * image_id);
/*
@@ -131,8 +131,8 @@
*/
rw_status_t rwcal_create_flavor(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
- rwpb_gi_Rwcal_FlavorInfoItem *flavor,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources_FlavorinfoList *flavor,
char *flavor_id);
@@ -146,7 +146,7 @@
*/
rw_status_t rwcal_delete_flavor(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
const char * flavor_id);
/*
@@ -162,9 +162,9 @@
*/
rw_status_t rwcal_get_flavor(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
const char * flavor_id,
- rwpb_gi_Rwcal_FlavorInfoItem **flavor);
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources_FlavorinfoList **flavor);
/*
* Get a list of the details for all flavors
@@ -177,8 +177,8 @@
*/
rw_status_t rwcal_get_flavor_list(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
- rwpb_gi_Rwcal_VimResources **flavors);
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources **flavors);
/*
* Create a virtual machine.
@@ -194,8 +194,8 @@
*/
rw_status_t rwcal_create_vm(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
- rwpb_gi_Rwcal_VMInfoItem *vm,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources_VminfoList *vm,
char **vm_id);
/*
@@ -208,7 +208,7 @@
*/
rw_status_t rwcal_delete_vm(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
const char * vm_id);
/*
@@ -221,7 +221,7 @@
*/
rw_status_t rwcal_reboot_vm(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
const char * vm_id);
/*
@@ -234,7 +234,7 @@
*/
rw_status_t rwcal_start_vm(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
const char * vm_id);
/*
@@ -247,7 +247,7 @@
*/
rw_status_t rwcal_stop_vm(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
const char * vm_id);
/*
@@ -261,8 +261,8 @@
*/
rw_status_t rwcal_get_vm_list(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
- rwpb_gi_Rwcal_VimResources** vms);
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources** vms);
/*
* Create a tenant.
@@ -275,7 +275,7 @@
*/
rw_status_t rwcal_create_tenant(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
const char * tenant_name,
char *** tenant_info);
@@ -289,7 +289,7 @@
*/
rw_status_t rwcal_delete_tenant(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
const char * tenant_id);
/*
@@ -303,8 +303,8 @@
*/
rw_status_t rwcal_get_tenant_list(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
- rwpb_gi_Rwcal_VimResources **tenants);
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources **tenants);
/*
* Create a role.
@@ -317,7 +317,7 @@
*/
rw_status_t rwcal_create_role(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
const char * role_name,
char *** role_info);
@@ -331,7 +331,7 @@
*/
rw_status_t rwcal_delete_role(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
const char * role_id);
/*
@@ -345,8 +345,8 @@
*/
rw_status_t rwcal_get_role_list(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
- rwpb_gi_Rwcal_VimResources **roles);
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources **roles);
/*
* Add a new host
@@ -361,8 +361,8 @@
*/
rw_status_t rwcal_add_host(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
- rwpb_gi_Rwcal_HostInfoItem *host,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources_HostinfoList *host,
char **host_id);
/*
@@ -376,7 +376,7 @@
*/
rw_status_t rwcal_remove_host(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
const char *host_id);
/*
@@ -391,9 +391,9 @@
*/
rw_status_t rwcal_get_host(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
const char *host_id,
- rwpb_gi_Rwcal_HostInfoItem **host);
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources_HostinfoList **host);
/*
* Get a list of hosts
@@ -406,8 +406,8 @@
*/
rw_status_t rwcal_get_host_list(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
- rwpb_gi_Rwcal_VimResources **hosts);
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources **hosts);
/*
* Create a new port
@@ -422,8 +422,8 @@
*/
rw_status_t rwcal_create_port(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
- rwpb_gi_Rwcal_PortInfoItem *port,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources_PortinfoList *port,
char **port_id);
/*
@@ -437,7 +437,7 @@
*/
rw_status_t rwcal_delete_port(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
const char *port_id);
/*
@@ -452,9 +452,9 @@
*/
rw_status_t rwcal_get_port(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
const char *port_id,
- rwpb_gi_Rwcal_PortInfoItem **port);
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources_PortinfoList **port);
/*
* Get a list of ports
@@ -467,8 +467,8 @@
*/
rw_status_t rwcal_get_port_list(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
- rwpb_gi_Rwcal_VimResources **ports);
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources **ports);
/*
* Create a new network
@@ -483,8 +483,8 @@
*/
rw_status_t rwcal_create_network(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
- rwpb_gi_Rwcal_NetworkInfoItem *network,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources_NetworkinfoList *network,
char **network_id);
/*
@@ -498,7 +498,7 @@
*/
rw_status_t rwcal_delete_network(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
const char *network_id);
/*
@@ -513,9 +513,9 @@
*/
rw_status_t rwcal_get_network(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
const char *network_id,
- rwpb_gi_Rwcal_NetworkInfoItem **network);
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources_NetworkinfoList **network);
/*
* Get a the management network
@@ -528,8 +528,8 @@
*/
rw_status_t rwcal_get_management_network(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
- rwpb_gi_Rwcal_NetworkInfoItem **network);
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources_NetworkinfoList **network);
/*
* Get a list of networks
@@ -542,8 +542,8 @@
*/
rw_status_t rwcal_get_network_list(
rwcal_module_ptr_t rwcal,
- rwpb_gi_Rwcal_CloudAccount *account,
- rwpb_gi_Rwcal_VimResources **networks);
+ rwpb_gi_Rwcal_YangData_RwProject_Project_CloudAccounts_CloudAccountList *account,
+ rwpb_gi_Rwcal_YangData_RwProject_Project_VimResources **networks);
/*
* Get a RwLog Context so that log messages can go to rwlog
diff --git a/rwcal/plugins/rwcalproxytasklet/CMakeLists.txt b/rwcal/plugins/rwcalproxytasklet/CMakeLists.txt
index b700ca6..8ce0667 100644
--- a/rwcal/plugins/rwcalproxytasklet/CMakeLists.txt
+++ b/rwcal/plugins/rwcalproxytasklet/CMakeLists.txt
@@ -17,7 +17,7 @@
include(rift_plugin)
-rift_install_python_plugin(rwcalproxytasklet rwcalproxytasklet.py)
+rift_install_gobject_python_plugin(rwcalproxytasklet rwcalproxytasklet.py COMPONENT ${INSTALL_COMPONENT})
# Workaround RIFT-6485 - rpmbuild defaults to python2 for
# anything not in a site-packages directory so we have to
@@ -27,5 +27,5 @@
FILES
rift/tasklets/rwcalproxytasklet/__init__.py
rift/tasklets/rwcalproxytasklet/rwcalproxytasklet.py
- COMPONENT rwcalproxytasklet-1.0
+ COMPONENT ${INSTALL_COMPONENT}
PYTHON3_ONLY)
diff --git a/rwcal/plugins/rwcalproxytasklet/rift/tasklets/rwcalproxytasklet/rwcalproxytasklet.py b/rwcal/plugins/rwcalproxytasklet/rift/tasklets/rwcalproxytasklet/rwcalproxytasklet.py
index bb2c355..6b4b28c 100644
--- a/rwcal/plugins/rwcalproxytasklet/rift/tasklets/rwcalproxytasklet/rwcalproxytasklet.py
+++ b/rwcal/plugins/rwcalproxytasklet/rift/tasklets/rwcalproxytasklet/rwcalproxytasklet.py
@@ -478,6 +478,18 @@
),
),
+ (r"/api/get_virtual_link_by_name", CalRequestHandler,
+ mk_attrs(
+ cal_method="get_virtual_link_by_name",
+ input_params=[
+ RPCParam("link_name"),
+ ],
+ output_params=[
+ RPCParam("response", "VirtualLinkInfoParams"),
+ ],
+ ),
+ ),
+
(r"/api/get_virtual_link_list", CalRequestHandler,
mk_attrs(
cal_method="get_virtual_link_list",
@@ -567,7 +579,7 @@
super().start()
cal = self.get_cal_interface()
- account = RwcalYang.CloudAccount(account_type="cloudsim")
+ account = RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList(account_type="cloudsim")
self.app = CalProxyApp(self.log, self.loop, cal, account)
self._dts = rift.tasklets.DTS(
diff --git a/rwcal/plugins/vala/CMakeLists.txt b/rwcal/plugins/vala/CMakeLists.txt
index 3482277..0f4b469 100644
--- a/rwcal/plugins/vala/CMakeLists.txt
+++ b/rwcal/plugins/vala/CMakeLists.txt
@@ -1,5 +1,5 @@
#
-# Copyright 2016 RIFT.IO Inc
+# Copyright 2016-2017 RIFT.IO Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
VALA_PACKAGES
rw_types-1.0 rw_yang-1.0 rw_keyspec-1.0 rw_yang_pb-1.0 rw_schema_proto-1.0
rw_log_yang-1.0 rw_base_yang-1.0 rwcal_yang-1.0 rw_manifest_yang-1.0 protobuf_c-1.0 ietf_netconf_yang-1.0
- rw_log-1.0
+ rw_log-1.0 rw_project_yang-1.0 rw_user_yang-1.0 rw_rbac_base_yang-1.0
VAPI_DIRS ${RIFT_SUBMODULE_BINARY_ROOT}/rwcal/plugins/yang
${RIFT_SUBMODULE_BINARY_ROOT}/models/plugins/yang
${RIFT_SUBMODULE_BINARY_ROOT}/rwvcs/plugins/yang
@@ -49,7 +49,7 @@
GENERATE_VAPI_FILE ${VALA_LONG_NAME}.vapi
GENERATE_GIR_FILE ${VALA_TYPELIB_PREFIX}.gir
GENERATE_TYPELIB_FILE ${VALA_TYPELIB_PREFIX}.typelib
- DEPENDS rwcal_yang rwlog_gi rwschema_yang rwmanifest_yang
+ DEPENDS rwcal_yang rwmanifest_yang
)
rift_install_vala_artifacts(
@@ -58,7 +58,7 @@
VAPI_FILES ${VALA_LONG_NAME}.vapi
GIR_FILES ${VALA_TYPELIB_PREFIX}.gir
TYPELIB_FILES ${VALA_TYPELIB_PREFIX}.typelib
- COMPONENT ${PKG_LONG_NAME}
+ COMPONENT ${INSTALL_COMPONENT}
DEST_PREFIX .
)
diff --git a/rwcal/plugins/vala/rwcal.vala b/rwcal/plugins/vala/rwcal.vala
index a14388e..b53869e 100644
--- a/rwcal/plugins/vala/rwcal.vala
+++ b/rwcal/plugins/vala/rwcal.vala
@@ -16,232 +16,239 @@
* Cloud Account Credentails Validation related API
*/
public abstract RwTypes.RwStatus validate_cloud_creds(
- Rwcal.CloudAccount account,
- out Rwcal.CloudConnectionStatus status);
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ out Rwcal.YangData_Rwcal_ConnectionStatus status);
/*
* Image related APIs
*/
public abstract RwTypes.RwStatus get_image_list(
- Rwcal.CloudAccount account,
- out Rwcal.VimResources images);
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ out Rwcal.YangData_RwProject_Project_VimResources images);
public abstract RwTypes.RwStatus create_image(
- Rwcal.CloudAccount account,
- Rwcal.ImageInfoItem image,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ Rwcal.YangData_RwProject_Project_VimResources_ImageinfoList image,
out string image_id);
public abstract RwTypes.RwStatus delete_image(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string image_id);
public abstract RwTypes.RwStatus get_image(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string image_id,
- out Rwcal.ImageInfoItem image);
+ out Rwcal.YangData_RwProject_Project_VimResources_ImageinfoList image);
/*
* VM Releated APIs
*/
public abstract RwTypes.RwStatus create_vm(
- Rwcal.CloudAccount account,
- Rwcal.VMInfoItem vm,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ Rwcal.YangData_RwProject_Project_VimResources_VminfoList vm,
out string vm_id);
public abstract RwTypes.RwStatus start_vm(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string vm_id);
public abstract RwTypes.RwStatus stop_vm(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string vm_id);
public abstract RwTypes.RwStatus delete_vm(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string vm_id);
public abstract RwTypes.RwStatus reboot_vm(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string vm_id);
public abstract RwTypes.RwStatus get_vm_list(
- Rwcal.CloudAccount account,
- out Rwcal.VimResources vms);
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ out Rwcal.YangData_RwProject_Project_VimResources vms);
public abstract RwTypes.RwStatus get_vm(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string vm_id,
- out Rwcal.VMInfoItem vm);
+ out Rwcal.YangData_RwProject_Project_VimResources_VminfoList vm);
/*
* Flavor related APIs
*/
public abstract RwTypes.RwStatus create_flavor(
- Rwcal.CloudAccount account,
- Rwcal.FlavorInfoItem flavor_info_item,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ Rwcal.YangData_RwProject_Project_VimResources_FlavorinfoList flavor_info_item,
out string flavor_id);
public abstract RwTypes.RwStatus delete_flavor(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string flavor_id);
public abstract RwTypes.RwStatus get_flavor_list(
- Rwcal.CloudAccount account,
- out Rwcal.VimResources flavors);
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ out Rwcal.YangData_RwProject_Project_VimResources flavors);
public abstract RwTypes.RwStatus get_flavor(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string flavor_id,
- out Rwcal.FlavorInfoItem flavor);
+ out Rwcal.YangData_RwProject_Project_VimResources_FlavorinfoList flavor);
/*
* Tenant related APIs
*/
public abstract RwTypes.RwStatus create_tenant(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string tenant_name,
[CCode (array_length = false, array_null_terminated = true)]
out string [] tenant_info);
public abstract RwTypes.RwStatus delete_tenant(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string tenant_id);
public abstract RwTypes.RwStatus get_tenant_list(
- Rwcal.CloudAccount account,
- out Rwcal.VimResources tenants);
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ out Rwcal.YangData_RwProject_Project_VimResources tenants);
/*
* Role related APIs
*/
public abstract RwTypes.RwStatus create_role(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string role_name,
[CCode (array_length = false, array_null_terminated = true)]
out string [] role_info);
public abstract RwTypes.RwStatus delete_role(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string role_id);
public abstract RwTypes.RwStatus get_role_list(
- Rwcal.CloudAccount account,
- out Rwcal.VimResources roles);
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ out Rwcal.YangData_RwProject_Project_VimResources roles);
/*
* Port related APIs
*/
public abstract RwTypes.RwStatus create_port(
- Rwcal.CloudAccount account,
- Rwcal.PortInfoItem port,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ Rwcal.YangData_RwProject_Project_VimResources_PortinfoList port,
out string port_id);
public abstract RwTypes.RwStatus delete_port(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string port_id);
public abstract RwTypes.RwStatus get_port(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string port_id,
- out Rwcal.PortInfoItem port);
+ out Rwcal.YangData_RwProject_Project_VimResources_PortinfoList port);
public abstract RwTypes.RwStatus get_port_list(
- Rwcal.CloudAccount account,
- out Rwcal.VimResources ports);
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ out Rwcal.YangData_RwProject_Project_VimResources ports);
/*
* Host related APIs
*/
public abstract RwTypes.RwStatus add_host(
- Rwcal.CloudAccount account,
- Rwcal.HostInfoItem host,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ Rwcal.YangData_RwProject_Project_VimResources_HostinfoList host,
out string host_id);
public abstract RwTypes.RwStatus remove_host(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string host_id);
public abstract RwTypes.RwStatus get_host(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string host_id,
- out Rwcal.HostInfoItem host);
+ out Rwcal.YangData_RwProject_Project_VimResources_HostinfoList host);
public abstract RwTypes.RwStatus get_host_list(
- Rwcal.CloudAccount account,
- out Rwcal.VimResources hosts);
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ out Rwcal.YangData_RwProject_Project_VimResources hosts);
/*
* Network related APIs
*/
public abstract RwTypes.RwStatus create_network(
- Rwcal.CloudAccount account,
- Rwcal.NetworkInfoItem network,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ Rwcal.YangData_RwProject_Project_VimResources_NetworkinfoList network,
out string network_id);
public abstract RwTypes.RwStatus delete_network(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string network_id);
public abstract RwTypes.RwStatus get_network(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string network_id,
- out Rwcal.NetworkInfoItem network);
+ out Rwcal.YangData_RwProject_Project_VimResources_NetworkinfoList network);
public abstract RwTypes.RwStatus get_network_list(
- Rwcal.CloudAccount account,
- out Rwcal.VimResources networks);
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ out Rwcal.YangData_RwProject_Project_VimResources networks);
public abstract RwTypes.RwStatus get_management_network(
- Rwcal.CloudAccount account,
- out Rwcal.NetworkInfoItem network);
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ out Rwcal.YangData_RwProject_Project_VimResources_NetworkinfoList network);
/*
* Higher Order CAL APIs
*/
public abstract void create_virtual_link(
- Rwcal.CloudAccount account,
- Rwcal.VirtualLinkReqParams link_params,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ Rwcal.YangData_RwProject_Project_VirtualLinkReqParams link_params,
out RwcalStatus status,
out string link_id);
public abstract RwTypes.RwStatus delete_virtual_link(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string link_id);
public abstract RwTypes.RwStatus get_virtual_link(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string link_id,
- out Rwcal.VirtualLinkInfoParams response);
+ out Rwcal.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList response);
+
+ public abstract RwTypes.RwStatus get_virtual_link_by_name(
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ string link_name,
+ out Rwcal.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList response);
public abstract RwTypes.RwStatus get_virtual_link_list(
- Rwcal.CloudAccount account,
- out Rwcal.VNFResources resources);
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ out Rwcal.YangData_RwProject_Project_VnfResources resources);
public abstract void create_vdu(
- Rwcal.CloudAccount account,
- Rwcal.VDUInitParams vdu_params,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ Rwcal.YangData_RwProject_Project_VduInitParams vdu_params,
out RwcalStatus status,
out string vdu_id);
public abstract RwTypes.RwStatus modify_vdu(
- Rwcal.CloudAccount account,
- Rwcal.VDUModifyParams vdu_params);
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ Rwcal.YangData_RwProject_Project_VduModifyParams vdu_params);
public abstract RwTypes.RwStatus delete_vdu(
- Rwcal.CloudAccount account,
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string vdu_id);
- public abstract RwTypes.RwStatus get_vdu(
- Rwcal.CloudAccount account,
+ public abstract void get_vdu(
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
string vdu_id,
- out Rwcal.VDUInfoParams response);
+ string mgmt_network,
+ out RwcalStatus status,
+ out Rwcal.YangData_RwProject_Project_VnfResources_VduInfoList response);
- public abstract RwTypes.RwStatus get_vdu_list(
- Rwcal.CloudAccount account,
- out Rwcal.VNFResources resources);
-
+ public abstract void get_vdu_list(
+ Rwcal.YangData_RwProject_Project_CloudAccounts_CloudAccountList account,
+ out RwcalStatus status,
+ out Rwcal.YangData_RwProject_Project_VnfResources resources);
}
}
diff --git a/rwcal/plugins/vala/rwcal_aws/CMakeLists.txt b/rwcal/plugins/vala/rwcal_aws/CMakeLists.txt
index 76430b1..3bbf120 100644
--- a/rwcal/plugins/vala/rwcal_aws/CMakeLists.txt
+++ b/rwcal/plugins/vala/rwcal_aws/CMakeLists.txt
@@ -17,12 +17,9 @@
include(rift_plugin)
-set(PKG_NAME rwcal-aws)
-set(PKG_VERSION 1.0)
-set(PKG_RELEASE 1)
-set(PKG_LONG_NAME ${PKG_NAME}-${PKG_VERSION})
+set(INSTALL_COMPONENT rwcal-plugin-aws)
-rift_install_python_plugin(rwcal_aws rwcal_aws.py)
+rift_install_gobject_python_plugin(rwcal_aws rwcal_aws.py COMPONENT ${INSTALL_COMPONENT})
rift_python_install_tree(
FILES
@@ -33,5 +30,5 @@
rift/rwcal/aws/prepare_vm.py
rift/rwcal/aws/delete_vm.py
PYTHON3_ONLY
- COMPONENT ${PKG_LONG_NAME})
+ COMPONENT ${INSTALL_COMPONENT})
diff --git a/rwcal/plugins/vala/rwcal_aws/rift/rwcal/aws/aws_drv.py b/rwcal/plugins/vala/rwcal_aws/rift/rwcal/aws/aws_drv.py
index 2c47279..0e9c885 100644
--- a/rwcal/plugins/vala/rwcal_aws/rift/rwcal/aws/aws_drv.py
+++ b/rwcal/plugins/vala/rwcal_aws/rift/rwcal/aws/aws_drv.py
@@ -883,9 +883,9 @@
"""
try:
interface = self.get_network_interface(NetworkInterfaceId=NetworkInterfaceId)
- if interface and interface.association and 'AssociationId' in interface.association:
- self._ec2_client_handle.disassociate_address(AssociationId = interface.association['AssociationId'])
- self._ec2_client_handle.release_address(AllocationId=interface.association['AllocationId'])
+ if interface and interface.association_attribute and 'AssociationId' in interface.association_attribute:
+ self._ec2_client_handle.disassociate_address(AssociationId = interface.association_attribute['AssociationId'])
+ self._ec2_client_handle.release_address(AllocationId=interface.association_attribute['AllocationId'])
except Exception as e:
logger.error("AWSDriver: Associating Public IP to network interface %s failed with exception: %s",NetworkInterfaceId,(repr(e)))
raise
diff --git a/rwcal/plugins/vala/rwcal_aws/rift/rwcal/aws/delete_vm.py b/rwcal/plugins/vala/rwcal_aws/rift/rwcal/aws/delete_vm.py
index 05d744b..8c1ce04 100644
--- a/rwcal/plugins/vala/rwcal_aws/rift/rwcal/aws/delete_vm.py
+++ b/rwcal/plugins/vala/rwcal_aws/rift/rwcal/aws/delete_vm.py
@@ -41,7 +41,7 @@
logger.info("Deleting network interface with id %s",port_id)
port = drv.get_network_interface(port_id)
if port:
- if port.association and 'AssociationId' in port.association:
+ if port.association_attribute and 'AssociationId' in port.association_attribute:
drv.disassociate_public_ip_from_network_interface(NetworkInterfaceId=port.id)
drv.delete_network_interface(port.id)
else:
diff --git a/rwcal/plugins/vala/rwcal_aws/rwcal_aws.py b/rwcal/plugins/vala/rwcal_aws/rwcal_aws.py
index 4f212d7..6ad11c8 100644
--- a/rwcal/plugins/vala/rwcal_aws/rwcal_aws.py
+++ b/rwcal/plugins/vala/rwcal_aws/rwcal_aws.py
@@ -95,7 +95,7 @@
Returns:
Validation Code and Details String
"""
- status = RwcalYang.CloudConnectionStatus(
+ status = RwcalYang.YangData_Rwcal_ConnectionStatus(
status="success",
details="AWS Cloud Account validation not implemented yet"
)
@@ -221,7 +221,7 @@
Returns:
The ImageInfoItem
"""
- img = RwcalYang.ImageInfoItem()
+ img = RwcalYang.YangData_RwProject_Project_VimResources_ImageinfoList()
img.name = img_info.name
img.id = img_info.id
@@ -248,7 +248,7 @@
Returns:
The the list of images in VimResources object
"""
- response = RwcalYang.VimResources()
+ response = RwcalYang.YangData_RwProject_Project_VimResources()
images = self._get_driver(account).list_images()
for img in images:
response.imageinfo_list.append(RwcalAWSPlugin._fill_image_info(img))
@@ -334,7 +334,7 @@
Returns:
Protobuf Gi object for VM
"""
- vm = RwcalYang.VMInfoItem()
+ vm = RwcalYang.YangData_RwProject_Project_VimResources_VminfoList()
vm.vm_id = vm_info.id
vm.image_id = vm_info.image_id
vm.flavor_id = vm_info.instance_type
@@ -374,7 +374,7 @@
Returns:
List containing VM information
"""
- response = RwcalYang.VimResources()
+ response = RwcalYang.YangData_RwProject_Project_VimResources()
vms = self._get_driver(account).list_instances()
for vm in vms:
response.vminfo_list.append(RwcalAWSPlugin._fill_vm_info(vm))
@@ -412,7 +412,7 @@
vcpus = flavor.vm_flavor.vcpu_count,
disk = flavor.vm_flavor.storage_gb)
- new_flavor = RwcalYang.FlavorInfoItem()
+ new_flavor = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList()
new_flavor.name = flavor.name
new_flavor.vm_flavor.memory_mb = flavor.vm_flavor.memory_mb
new_flavor.vm_flavor.vcpu_count = flavor.vm_flavor.vcpu_count
@@ -447,7 +447,7 @@
Returns:
Object of class FlavorInfoItem
"""
- flavor = RwcalYang.FlavorInfoItem()
+ flavor = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList()
flavor.name = flavor_info.name
flavor.id = flavor_info.id
flavor.vm_flavor.memory_mb = flavor_info.vm_flavor.memory_mb
@@ -465,7 +465,7 @@
Returns:
List of flavors
"""
- response = RwcalYang.VimResources()
+ response = RwcalYang.YangData_RwProject_Project_VimResources()
for flv in self._flavor_list:
response.flavorinfo_list.append(RwcalAWSPlugin._fill_flavor_info(flv))
return response
@@ -498,7 +498,7 @@
Returns:
Network info item
"""
- network = RwcalYang.NetworkInfoItem()
+ network = RwcalYang.YangData_RwProject_Project_VimResources_NetworkinfoList()
network.network_id = network_info.subnet_id
network.subnet = network_info.cidr_block
if network_info.tags:
@@ -517,7 +517,7 @@
Returns:
List of networks
"""
- response = RwcalYang.VimResources()
+ response = RwcalYang.YangData_RwProject_Project_VimResources()
networks = self._get_driver(account).get_subnet_list()
for network in networks:
response.networkinfo_list.append(self._fill_network_info(network, account))
@@ -573,7 +573,7 @@
Returns:
Port info item
"""
- port = RwcalYang.PortInfoItem()
+ port = RwcalYang.YangData_RwProject_Project_VimResources_PortinfoList()
port.port_id = port_info.id
port.network_id = port_info.subnet_id
@@ -617,7 +617,7 @@
Returns:
Port info list
"""
- response = RwcalYang.VimResources()
+ response = RwcalYang.YangData_RwProject_Project_VimResources()
ports = self._get_driver(account).get_network_interface_list()
for port in ports:
response.portinfo_list.append(RwcalAWSPlugin._fill_port_info(port))
@@ -745,7 +745,7 @@
@staticmethod
def _fill_connection_point_info(c_point, port_info):
- """Create a GI object for RwcalYang.VDUInfoParams_ConnectionPoints()
+ """Create a GI object for RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList_ConnectionPoints()
Converts EC2.NetworkInterface object returned by AWS driver into
Protobuf Gi Object
@@ -753,15 +753,15 @@
Arguments:
port_info - Network Interface information from AWS
Returns:
- Protobuf Gi object for RwcalYang.VDUInfoParams_ConnectionPoints
+ Protobuf Gi object for RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList_ConnectionPoints
"""
c_point.virtual_link_id = port_info.subnet_id
c_point.connection_point_id = port_info.id
if port_info.attachment:
c_point.vdu_id = port_info.attachment['InstanceId']
c_point.ip_address = port_info.private_ip_address
- if port_info.association and 'PublicIp' in port_info.association:
- c_point.public_ip = port_info.association['PublicIp']
+ if port_info.association and port_info.association.public_ip:
+ c_point.public_ip = port_info.association.public_ip
if port_info.tag_set:
for tag in port_info.tag_set:
if tag['Key'] == 'Name':
@@ -786,7 +786,7 @@
Returns:
Protobuf Gi object for VirtualLinkInfoParams
"""
- link = RwcalYang.VirtualLinkInfoParams()
+ link = RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList()
if network_info.state == 'available':
link.state = 'active'
else:
@@ -816,13 +816,13 @@
Returns:
Protobuf Gi object for VDUInfoParams
"""
- vdu = RwcalYang.VDUInfoParams()
+ vdu = RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList()
vdu.vdu_id = vm_info.id
mgmt_port = [port for port in port_list if port.attachment and port.attachment['DeviceIndex'] == 0]
assert(len(mgmt_port) == 1)
vdu.management_ip = mgmt_port[0].private_ip_address
- if mgmt_port[0].association and 'PublicIp' in mgmt_port[0].association:
- vdu.public_ip = mgmt_port[0].association['PublicIp']
+ if mgmt_port[0].association and mgmt_port[0].association.public_ip:
+ vdu.public_ip = mgmt_port[0].association.public_ip
#For now set managemnet ip also to public ip
#vdu.management_ip = vdu.public_ip
if vm_info.tags:
@@ -840,11 +840,14 @@
#if vm_info.placement and 'AvailabilityZone' in vm_info.placement:
# vdu.availability_zone = vm_info.placement['AvailabilityZone']
# Fill the port information
- cp_port_list = [port for port in port_list if port.attachment and port.attachment['DeviceIndex'] != 0]
+
+ # cp_port_list = [port for port in port_list if port.attachment and port.attachment['DeviceIndex'] != 0]
+ # The above conversion of the port list was leaving out the management networks attached to the vdu.
- for port in cp_port_list:
+ for port in port_list:
c_point = vdu.connection_points.add()
RwcalAWSPlugin._fill_connection_point_info(c_point, port)
+
return vdu
@@ -857,7 +860,7 @@
link_id - id for the virtual-link
Returns:
- Object of type RwcalYang.VirtualLinkInfoParams
+ Object of type RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList
"""
drv = self._get_driver(account)
network = drv.get_subnet(SubnetId=link_id)
@@ -865,6 +868,10 @@
virtual_link = RwcalAWSPlugin._fill_virtual_link_info(network, port_list)
return virtual_link
+ @rwstatus(ret_on_failure=[None])
+ def do_get_virtual_link_by_name(self, account, link_name):
+ raise NotImplementedError()
+
@rwstatus(ret_on_failure=[[]])
def do_get_virtual_link_list(self, account):
"""Get information about all the virtual links
@@ -873,9 +880,9 @@
account - a cloud account
Returns:
- A list of objects of type RwcalYang.VirtualLinkInfoParams
+ A list of objects of type RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList
"""
- vnf_resources = RwcalYang.VNFResources()
+ vnf_resources = RwcalYang.YangData_RwProject_Project_VnfResources()
drv = self._get_driver(account)
networks = drv.get_subnet_list()
for network in networks:
@@ -923,7 +930,7 @@
Arguments:
account - a cloud account
- vdu_init - information about VDU to create (RwcalYang.VDUInitParams)
+ vdu_init - information about VDU to create (RwcalYang.YangData_RwProject_Project_VduInitParams)
Returns:
The vdu_id
@@ -987,7 +994,7 @@
Arguments:
account - a cloud account
- vdu_modify - Information about VDU Modification (RwcalYang.VDUModifyParams)
+ vdu_modify - Information about VDU Modification (RwcalYang.YangData_RwProject_Project_VduModifyParams)
"""
### First create required number of ports aka connection points
drv = self._get_driver(account)
@@ -1014,7 +1021,7 @@
for c_point in vdu_modify.connection_points_remove:
port = drv.get_network_interface(NetworkInterfaceId=c_point.connection_point_id)
#Check if elastic IP is associated with interface and release it
- if port and port.association and 'AssociationId' in port.association:
+ if port and port.association is not None:
drv.disassociate_public_ip_from_network_interface(NetworkInterfaceId=port.id)
if port and port.attachment and port.attachment['DeviceIndex'] != 0:
drv.detach_network_interface(AttachmentId = port.attachment['AttachmentId'],Force=True) #force detach as otherwise delete fails
@@ -1070,16 +1077,18 @@
self.cleanup_vdu_on_term(account,vdu_id,delete_port_list)
- @rwstatus(ret_on_failure=[None])
- def do_get_vdu(self, account, vdu_id):
+ @rwcalstatus(ret_on_failure=[None])
+ def do_get_vdu(self, account, vdu_id, mgmt_network):
"""Get information about a virtual deployment unit.
Arguments:
account - a cloud account
- vdu_id - id for the vdu
+ vdu_id - id for the vdu,
+ mgmt_network - Added due to need for mgmt network.
+ # TO DO: Investigate the need for aws.
Returns:
- Object of type RwcalYang.VDUInfoParams
+ Object of type RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList
"""
drv = self._get_driver(account)
@@ -1089,7 +1098,7 @@
return RwcalAWSPlugin._fill_vdu_info(vm,port_list)
- @rwstatus(ret_on_failure=[[]])
+ @rwcalstatus(ret_on_failure=[None])
def do_get_vdu_list(self, account):
"""Get information about all the virtual deployment units
@@ -1097,9 +1106,9 @@
account - a cloud account
Returns:
- A list of objects of type RwcalYang.VDUInfoParams
+ A list of objects of type RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList
"""
- vnf_resources = RwcalYang.VNFResources()
+ vnf_resources = RwcalYang.YangData_RwProject_Project_VnfResources()
drv = self._get_driver(account)
vms = drv.list_instances()
for vm in vms:
diff --git a/rwcal/plugins/vala/rwcal_cloudsim/CMakeLists.txt b/rwcal/plugins/vala/rwcal_cloudsim/CMakeLists.txt
index 3250db9..a23abea 100644
--- a/rwcal/plugins/vala/rwcal_cloudsim/CMakeLists.txt
+++ b/rwcal/plugins/vala/rwcal_cloudsim/CMakeLists.txt
@@ -17,12 +17,9 @@
include(rift_plugin)
-set(PKG_NAME rwcal-cloudsim)
-set(PKG_VERSION 1.0)
-set(PKG_RELEASE 1)
-set(PKG_LONG_NAME ${PKG_NAME}-${PKG_VERSION})
+set(INSTALL_COMPONENT rwcal-plugin-cloudsim)
-rift_install_python_plugin(rwcal_cloudsim rwcal_cloudsim.py)
+rift_install_gobject_python_plugin(rwcal_cloudsim rwcal_cloudsim.py COMPONENT ${INSTALL_COMPONENT})
rift_python_install_tree(
FILES
@@ -35,5 +32,5 @@
rift/rwcal/cloudsim/net.py
rift/rwcal/cloudsim/shell.py
PYTHON3_ONLY
- COMPONENT ${PKG_LONG_NAME})
+ COMPONENT ${INSTALL_COMPONENT})
diff --git a/rwcal/plugins/vala/rwcal_cloudsim/rwcal_cloudsim.py b/rwcal/plugins/vala/rwcal_cloudsim/rwcal_cloudsim.py
index 6da8a2e..2ee7df7 100644
--- a/rwcal/plugins/vala/rwcal_cloudsim/rwcal_cloudsim.py
+++ b/rwcal/plugins/vala/rwcal_cloudsim/rwcal_cloudsim.py
@@ -293,7 +293,7 @@
self._bridge_to_ports = collections.defaultdict(list)
# Create the management network
- self.mgmt_network = RwcalYang.NetworkInfoItem()
+ self.mgmt_network = RwcalYang.YangData_RwProject_Project_VimResources_NetworkinfoList()
self.mgmt_network.network_name = MGMT_NETWORK_NAME
network = MGMT_NETWORK_INTERFACE_IP.network
@@ -467,7 +467,7 @@
Returns:
Validation Code and Details String
"""
- status = RwcalYang.CloudConnectionStatus(
+ status = RwcalYang.YangData_Rwcal_ConnectionStatus(
status="success",
details=""
)
@@ -657,7 +657,7 @@
@rwstatus(ret_on_failure=[[]])
def do_get_image_list(self, account):
"""Returns a list of images"""
- resources = RwcalYang.VimResources()
+ resources = RwcalYang.YangData_RwProject_Project_VimResources()
for image in self.cal.get_image_list():
resources.imageinfo_list.append(rwcal_copy_object(image))
@@ -845,7 +845,7 @@
a list of VMInfoItem objects
"""
- resources = RwcalYang.VimResources()
+ resources = RwcalYang.YangData_RwProject_Project_VimResources()
for vm in self.cal.get_vm_list():
resources.vminfo_list.append(rwcal_copy_object(vm))
@@ -890,9 +890,9 @@
"""
Return a list of flavors
"""
- vim_resources = RwcalYang.VimResources()
+ vim_resources = RwcalYang.YangData_RwProject_Project_VimResources()
for flavor in self.cal.flavors.values():
- f = RwcalYang.FlavorInfoItem()
+ f = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList()
f.copy_from(flavor)
vim_resources.flavorinfo_list.append(f)
logger.debug("Returning list of flavor-info of size: %d", len(vim_resources.flavorinfo_list))
@@ -1017,7 +1017,7 @@
@rwstatus(ret_on_failure=[[]])
def do_get_port_list(self, account):
"""Returns a list of ports"""
- resources = RwcalYang.VimResources()
+ resources = RwcalYang.YangData_RwProject_Project_VimResources()
for port in self.datastore.cal_manager.get_port_list():
resources.portinfo_list.append(rwcal_copy_object(port))
@@ -1123,7 +1123,7 @@
@rwstatus(ret_on_failure=[[]])
def do_get_network_list(self, account):
"""Returns a list of network objects"""
- resources = RwcalYang.VimResources()
+ resources = RwcalYang.YangData_RwProject_Project_VimResources()
for network in self.cal.get_network_list():
resources.networkinfo_list.append(rwcal_copy_object(network))
@@ -1140,7 +1140,7 @@
Returns:
The vdu_id
"""
- network = RwcalYang.NetworkInfoItem()
+ network = RwcalYang.YangData_RwProject_Project_VimResources_NetworkinfoList()
network.network_name = link_params.name
network.subnet = link_params.subnet
@@ -1173,7 +1173,7 @@
@staticmethod
def fill_connection_point_info(c_point, port_info):
- """Create a GI object for RwcalYang.VDUInfoParams_ConnectionPoints()
+ """Create a GI object for RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList_ConnectionPoints()
Converts Port information dictionary object returned by container cal
driver into Protobuf Gi Object
@@ -1181,7 +1181,7 @@
Arguments:
port_info - Port information from container cal
Returns:
- Protobuf Gi object for RwcalYang.VDUInfoParams_ConnectionPoints
+ Protobuf Gi object for RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList_ConnectionPoints
"""
c_point.name = port_info.port_name
c_point.connection_point_id = port_info.port_id
@@ -1204,7 +1204,7 @@
Returns:
Protobuf Gi object for VirtualLinkInfoParams
"""
- link = RwcalYang.VirtualLinkInfoParams()
+ link = RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList()
link.name = network_info.network_name
link.state = 'active'
link.virtual_link_id = network_info.network_id
@@ -1225,7 +1225,7 @@
link_id - id for the virtual-link
Returns:
- Object of type RwcalYang.VirtualLinkInfoParams
+ Object of type RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList
"""
network = self.do_get_network(account, link_id, no_rwstatus=True)
@@ -1239,6 +1239,10 @@
return virtual_link
@rwstatus(ret_on_failure=[None])
+ def do_get_virtual_link_by_name(self, account, link_name):
+ raise NotImplementedError()
+
+ @rwstatus(ret_on_failure=[None])
def do_get_virtual_link_list(self, account):
"""Get information about all the virtual links
@@ -1246,10 +1250,10 @@
account - a cloud account
Returns:
- A list of objects of type RwcalYang.VirtualLinkInfoParams
+ A list of objects of type RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList
"""
networks = self.do_get_network_list(account, no_rwstatus=True)
- vnf_resources = RwcalYang.VNFResources()
+ vnf_resources = RwcalYang.YangData_RwProject_Project_VnfResources()
for network in networks.networkinfo_list:
virtual_link = self.do_get_virtual_link(account, network.network_id, no_rwstatus=True)
vnf_resources.virtual_link_info_list.append(virtual_link)
@@ -1263,7 +1267,7 @@
account - a cloud account
c_point - connection_points
"""
- port = RwcalYang.PortInfoItem()
+ port = RwcalYang.YangData_RwProject_Project_VimResources_PortinfoList()
port.port_name = c_point.name
port.network_id = c_point.virtual_link_id
port.port_type = 'normal' ### Find Port type from network_profile under cloud account
@@ -1277,13 +1281,13 @@
Arguments:
account - a cloud account
- vdu_init - information about VDU to create (RwcalYang.VDUInitParams)
+ vdu_init - information about VDU to create (RwcalYang.YangData_RwProject_Project_VduInitParams)
Returns:
The vdu_id
"""
### Create VM
- vm = RwcalYang.VMInfoItem()
+ vm = RwcalYang.YangData_RwProject_Project_VimResources_VminfoList()
vm.vm_name = vdu_init.name
vm.image_id = vdu_init.image_id
if vdu_init.vdu_init.has_field('userdata'):
@@ -1315,7 +1319,7 @@
Arguments:
account - a cloud account
- vdu_modify - Information about VDU Modification (RwcalYang.VDUModifyParams)
+ vdu_modify - Information about VDU Modification (RwcalYang.YangData_RwProject_Project_VduModifyParams)
"""
### First create required number of ports aka connection points
port_list = []
@@ -1369,7 +1373,7 @@
returns:
protobuf gi object for vduinfoparams
"""
- vdu = RwcalYang.VDUInfoParams()
+ vdu = RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList()
vdu.name = vm_info.vm_name
vdu.vdu_id = vm_info.vm_id
vdu.management_ip = vm_info.management_ip
@@ -1389,16 +1393,18 @@
return vdu
- @rwstatus(ret_on_failure=[None])
- def do_get_vdu(self, account, vdu_id):
+ @rwcalstatus(ret_on_failure=[None])
+ def do_get_vdu(self, account, vdu_id, mgmt_network):
"""Get information about a virtual deployment unit.
Arguments:
account - a cloud account
vdu_id - id for the vdu
+ mgmt_network - Added due to need for mgmt network.
+ # TO DO: Investigate the need for cloudsim.
Returns:
- Object of type RwcalYang.VDUInfoParams
+ Object of type RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList
"""
port_id_list = self.cal.get_vm_ports(vdu_id)
ports = [self.cal.get_port(p_id) for p_id in port_id_list]
@@ -1407,7 +1413,7 @@
return vdu_info
- @rwstatus(ret_on_failure=[None])
+ @rwcalstatus(ret_on_failure=[None])
def do_get_vdu_list(self, account):
"""Get information about all the virtual deployment units
@@ -1415,10 +1421,10 @@
account - a cloud account
Returns:
- A list of objects of type RwcalYang.VDUInfoParams
+ A list of objects of type RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList
"""
- vnf_resources = RwcalYang.VNFResources()
+ vnf_resources = RwcalYang.YangData_RwProject_Project_VnfResources()
vm_resources = self.do_get_vm_list(account, no_rwstatus=True)
for vm in vm_resources.vminfo_list:
diff --git a/rwcal/plugins/vala/rwcal_cloudsim/test/cloudsim_module_test.py b/rwcal/plugins/vala/rwcal_cloudsim/test/cloudsim_module_test.py
index 64837ad..db32aac 100755
--- a/rwcal/plugins/vala/rwcal_cloudsim/test/cloudsim_module_test.py
+++ b/rwcal/plugins/vala/rwcal_cloudsim/test/cloudsim_module_test.py
@@ -48,7 +48,7 @@
@classmethod
def create_image(cls):
- image = RwcalYang.ImageInfoItem()
+ image = RwcalYang.YangData_RwProject_Project_VimResources_ImageinfoList()
image.name = "rift-lxc-image"
image.location = "/net/sharedfiles/home1/common/vm/R0.4/rift-mano-devel-latest.qcow2"
image.disk_format = "qcow2"
@@ -61,7 +61,7 @@
cls.cleanUp()
lvm.create("rift")
- cls.account = RwcalYang.CloudAccount()
+ cls.account = RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList()
cls.cal = rwcal_cloudsim.CloudSimPlugin()
cls.create_image()
@@ -79,7 +79,7 @@
return vm
def create_virtual_link(self, index):
- link = RwcalYang.VirtualLinkReqParams()
+ link = RwcalYang.YangData_RwProject_Project_VirtualLinkReqParams()
link.name = 'link-{}'.format(index + 1)
link.subnet = '192.168.{}.0/24'.format(index + 1)
@@ -89,7 +89,7 @@
return link, link_id
def create_vdu(self, image, index, virtual_link_ids=None):
- vdu_init = RwcalYang.VDUInitParams()
+ vdu_init = RwcalYang.YangData_RwProject_Project_VduInitParams()
vdu_init.name = 'rift-vdu{}'.format(index + 1)
vdu_init.node_id = str(uuid.uuid4())
vdu_init.image_id = image.id
@@ -125,7 +125,7 @@
def test_create_delete_vdu(self):
vdu, vdu_id = self.create_vdu(self.image, 0)
- get_vdu = self.cal.do_get_vdu(self.account, vdu_id, no_rwstatus=True)
+ get_vdu = self.cal.do_get_vdu(self.account, vdu_id, None, no_rwstatus=True)
assert get_vdu.image_id == self.image.id
assert get_vdu.name == vdu.name
@@ -149,7 +149,7 @@
def test_create_vdu_single_connection_point(self):
link, link_id = self.create_virtual_link(0)
vdu, vdu_id = self.create_vdu(self.image, 0, [link_id])
- get_vdu = self.cal.do_get_vdu(self.account, vdu_id, no_rwstatus=True)
+ get_vdu = self.cal.do_get_vdu(self.account, vdu_id, None, no_rwstatus=True)
assert len(get_vdu.connection_points) == 1
cp = get_vdu.connection_points[0]
assert (ipaddress.IPv4Address(cp.ip_address) in
@@ -173,7 +173,7 @@
link_id_map = {link1_id: link1, link2_id: link2, link3_id: link3}
vdu, vdu_id = self.create_vdu(self.image, 0, link_id_map.keys())
- get_vdu = self.cal.do_get_vdu(self.account, vdu_id, no_rwstatus=True)
+ get_vdu = self.cal.do_get_vdu(self.account, vdu_id, None, no_rwstatus=True)
assert len(get_vdu.connection_points) == 3
for cp in get_vdu.connection_points:
assert cp.virtual_link_id in link_id_map
@@ -192,26 +192,26 @@
vdu, vdu_id = self.create_vdu(self.image, 0)
link, link_id = self.create_virtual_link(0)
- get_vdu = self.cal.do_get_vdu(self.account, vdu_id, no_rwstatus=True)
+ get_vdu = self.cal.do_get_vdu(self.account, vdu_id, None, no_rwstatus=True)
assert len(get_vdu.connection_points) == 0
- modify_vdu = RwcalYang.VDUModifyParams()
+ modify_vdu = RwcalYang.YangData_RwProject_Project_VduModifyParams()
modify_vdu.vdu_id = vdu_id
cp = modify_vdu.connection_points_add.add()
cp.virtual_link_id = link_id
cp.name = "link_1"
self.cal.do_modify_vdu(self.account, modify_vdu, no_rwstatus=True)
- get_vdu = self.cal.do_get_vdu(self.account, vdu_id, no_rwstatus=True)
+ get_vdu = self.cal.do_get_vdu(self.account, vdu_id, None, no_rwstatus=True)
assert len(get_vdu.connection_points) == 1
- modify_vdu = RwcalYang.VDUModifyParams()
+ modify_vdu = RwcalYang.YangData_RwProject_Project_VduModifyParams()
modify_vdu.vdu_id = vdu_id
cp = modify_vdu.connection_points_remove.add()
cp.connection_point_id = get_vdu.connection_points[0].connection_point_id
self.cal.do_modify_vdu(self.account, modify_vdu, no_rwstatus=True)
- get_vdu = self.cal.do_get_vdu(self.account, vdu_id, no_rwstatus=True)
+ get_vdu = self.cal.do_get_vdu(self.account, vdu_id, None, no_rwstatus=True)
assert len(get_vdu.connection_points) == 0
self.cal.do_delete_vdu(self.account, vdu_id, no_rwstatus=True)
diff --git a/rwcal/plugins/vala/rwcal_cloudsimproxy/CMakeLists.txt b/rwcal/plugins/vala/rwcal_cloudsimproxy/CMakeLists.txt
index 66e0a3f..014d2ff 100644
--- a/rwcal/plugins/vala/rwcal_cloudsimproxy/CMakeLists.txt
+++ b/rwcal/plugins/vala/rwcal_cloudsimproxy/CMakeLists.txt
@@ -17,11 +17,7 @@
include(rift_plugin)
-set(PKG_NAME rwcal-cloudsimproxy)
-set(PKG_VERSION 1.0)
-set(PKG_RELEASE 1)
-set(PKG_LONG_NAME ${PKG_NAME}-${PKG_VERSION})
+set(INSTALL_COMPONENT rwcal-plugin-cloudsimproxy)
-
-rift_install_python_plugin(rwcal_cloudsimproxy rwcal_cloudsimproxy.py)
+rift_install_gobject_python_plugin(rwcal_cloudsimproxy rwcal_cloudsimproxy.py COMPONENT ${INSTALL_COMPONENT})
diff --git a/rwcal/plugins/vala/rwcal_cloudsimproxy/rwcal_cloudsimproxy.py b/rwcal/plugins/vala/rwcal_cloudsimproxy/rwcal_cloudsimproxy.py
index addb4d3..e4c985f 100644
--- a/rwcal/plugins/vala/rwcal_cloudsimproxy/rwcal_cloudsimproxy.py
+++ b/rwcal/plugins/vala/rwcal_cloudsimproxy/rwcal_cloudsimproxy.py
@@ -566,7 +566,7 @@
"""
self._set_host_from_account(account)
- status = RwcalYang.CloudConnectionStatus()
+ status = RwcalYang.YangData_Rwcal_ConnectionStatus()
try:
self._proxy_rpc_call("get_vm_list")
except Exception as e:
@@ -601,17 +601,21 @@
link_id - id for the virtual-link
Returns:
- Object of type RwcalYang.VirtualLinkInfoParams
+ Object of type RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList
"""
self._set_host_from_account(account)
return self._proxy_rpc_call("get_virtual_link", link_id=link_id)
+ @rwstatus(ret_on_failure=[None])
+ def do_get_virtual_link_by_name(self, account, link_name):
+ raise NotImplementedError()
+
@rwstatus(ret_on_failure=[[]])
def do_get_virtual_link_list(self, account):
"""Returns the a list of the Virtual links
Returns:
- a list of RwcalYang.VirtualLinkInfoParams objects
+ a list of RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList objects
"""
self._set_host_from_account(account)
@@ -648,7 +652,7 @@
Arguments:
account - a cloud account
- vdu_init - information about VDU to create (RwcalYang.VDUInitParams)
+ vdu_init - information about VDU to create (RwcalYang.YangData_RwProject_Project_VduInitParams)
Returns:
The vdu_id
@@ -662,7 +666,7 @@
Arguments:
account - a cloud account
- vdu_modify - Information about VDU Modification (RwcalYang.VDUModifyParams)
+ vdu_modify - Information about VDU Modification (RwcalYang.YangData_RwProject_Project_VduModifyParams)
"""
self._set_host_from_account(account)
return self._proxy_rpc_call("modify_vdu", vdu_params=vdu_modify.as_dict())
@@ -682,15 +686,17 @@
return self._proxy_rpc_call("delete_vdu", vdu_id=vdu_id)
@rwstatus(ret_on_failure=[None])
- def do_get_vdu(self, account, vdu_id):
+ def do_get_vdu(self, account, vdu_id, mgmt_network):
"""Get information about a virtual deployment unit.
Arguments:
account - a cloud account
vdu_id - id for the vdu
+ mgmt_network - Added due to need for mgmt network.
+ # TO DO: Investigate the need for cloudsimproxy.
Returns:
- Object of type RwcalYang.VDUInfoParams
+ Object of type RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList
"""
self._set_host_from_account(account)
return self._proxy_rpc_call("get_vdu", vdu_id=vdu_id)
@@ -703,7 +709,7 @@
account - a cloud account
Returns:
- A list of objects of type RwcalYang.VDUInfoParams
+ A list of objects of type RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList
"""
self._set_host_from_account(account)
return self._proxy_rpc_call("get_vdu_list")
diff --git a/rwcal/plugins/vala/rwcal_mock/CMakeLists.txt b/rwcal/plugins/vala/rwcal_mock/CMakeLists.txt
index 1edf187..9226a36 100644
--- a/rwcal/plugins/vala/rwcal_mock/CMakeLists.txt
+++ b/rwcal/plugins/vala/rwcal_mock/CMakeLists.txt
@@ -18,10 +18,6 @@
include(rift_plugin)
### rwcal-mock package
-set(PKG_NAME rwcal-mock)
-set(PKG_VERSION 1.0)
-set(PKG_RELEASE 1)
-set(PKG_LONG_NAME ${PKG_NAME}-${PKG_VERSION})
+set(INSTALL_COMPONENT rwcal-plugin-mock)
-
-rift_install_python_plugin(rwcal_mock rwcal_mock.py)
+rift_install_gobject_python_plugin(rwcal_mock rwcal_mock.py COMPONENT ${INSTALL_COMPONENT})
diff --git a/rwcal/plugins/vala/rwcal_mock/rwcal_mock.py b/rwcal/plugins/vala/rwcal_mock/rwcal_mock.py
index a1776d1..d8268a7 100644
--- a/rwcal/plugins/vala/rwcal_mock/rwcal_mock.py
+++ b/rwcal/plugins/vala/rwcal_mock/rwcal_mock.py
@@ -94,7 +94,7 @@
)
)
- account = RwcalYang.CloudAccount()
+ account = RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList()
account.name = 'mock_account'
account.account_type = 'mock'
account.mock.username = 'mock_user'
@@ -113,7 +113,7 @@
Returns:
Validation Code and Details String
"""
- status = RwcalYang.CloudConnectionStatus(
+ status = RwcalYang.YangData_Rwcal_ConnectionStatus(
status="success",
details=""
)
@@ -223,9 +223,9 @@
"""
Return a list of the names of all available images.
"""
- boxed_image_list = RwcalYang.VimResources()
+ boxed_image_list = RwcalYang.YangData_RwProject_Project_VimResources()
for image in self.resources[account.name].images.values():
- image_entry = RwcalYang.ImageInfoItem()
+ image_entry = RwcalYang.YangData_RwProject_Project_VimResources_ImageinfoList()
image_entry.id = image.id
image_entry.name = image.name
if image.has_field('checksum'):
@@ -326,9 +326,9 @@
"""
Return a list of flavors
"""
- vim_resources = RwcalYang.VimResources()
+ vim_resources = RwcalYang.YangData_RwProject_Project_VimResources()
for flavor in self.resources[account.name].flavors.values():
- f = RwcalYang.FlavorInfoItem()
+ f = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList()
f.copy_from(flavor)
vim_resources.flavorinfo_list.append(f)
logger.debug("Returning list of flavor-info of size: %d", len(vim_resources.flavorinfo_list))
@@ -390,7 +390,7 @@
link_list = []
### Add virtual links
#for i in range(1):
- # vlink = RwcalYang.VirtualLinkReqParams()
+ # vlink = RwcalYang.YangData_RwProject_Project_VirtualLinkReqParams()
# vlink.name = 'link-'+str(i)
# vlink.subnet = '10.0.0.0/24'
# rs, vlink_id = self.do_create_virtual_link(account, vlink)
@@ -400,7 +400,7 @@
#### Add VDUs
#for i in range(8):
- # vdu = RwcalYang.VDUInitParams()
+ # vdu = RwcalYang.YangData_RwProject_Project_VduInitParams()
# vdu.name = 'vdu-'+str(i)
# vdu.node_id = str(i)
# vdu.image_id = self.get_uuid('image-'+str(i))
@@ -417,7 +417,7 @@
# logger.debug("Creating static VDU with name: %s", vdu.name)
for i in range(2):
- flavor = RwcalYang.FlavorInfoItem()
+ flavor = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList()
flavor.name = 'flavor-'+str(i)
flavor.vm_flavor.vcpu_count = 4
flavor.vm_flavor.memory_mb = 4096*2
@@ -425,28 +425,28 @@
rc, flavor_id = self.do_create_flavor(account, flavor)
for i in range(2):
- image = RwcalYang.ImageInfoItem()
+ image = RwcalYang.YangData_RwProject_Project_VimResources_ImageinfoList()
image.name = "rwimage"
image.id = self.get_uuid('image-'+str(i))
image.checksum = self.get_uuid('rwimage'+str(i))
image.location = "/dev/null"
rc, image_id = self.do_create_image(account, image)
- image = RwcalYang.ImageInfoItem()
+ image = RwcalYang.YangData_RwProject_Project_VimResources_ImageinfoList()
image.name = "Fedora-x86_64-20-20131211.1-sda.qcow2"
image.id = self.get_uuid(image.name)
image.checksum = self.get_uuid(image.name)
image.location = "/dev/null"
rc, image_id = self.do_create_image(account, image)
- image = RwcalYang.ImageInfoItem()
+ image = RwcalYang.YangData_RwProject_Project_VimResources_ImageinfoList()
image.name = "Fedora-x86_64-20-20131211.1-sda-ping.qcow2"
image.id = self.get_uuid(image.name)
image.checksum = "a6ffaa77f949a9e4ebb082c6147187cf"#self.get_uuid(image.name)
image.location = "/dev/null"
rc, image_id = self.do_create_image(account, image)
- image = RwcalYang.ImageInfoItem()
+ image = RwcalYang.YangData_RwProject_Project_VimResources_ImageinfoList()
image.name = "Fedora-x86_64-20-20131211.1-sda-pong.qcow2"
image.id = self.get_uuid(image.name)
image.checksum = "977484d95575f80ef8399c9cf1d45ebd"#self.get_uuid(image.name)
@@ -457,7 +457,7 @@
@rwcalstatus(ret_on_failure=[""])
def do_create_virtual_link(self, account, link_params):
vlink_id = self.get_uuid("%s_%s" % (link_params.name, len(self.resources[account.name].vlinks)))
- vlink = RwcalYang.VirtualLinkInfoParams()
+ vlink = RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList()
vlink.name = link_params.name
vlink.state = 'active'
vlink.virtual_link_id = vlink_id
@@ -483,11 +483,15 @@
logger.debug('Returning virtual-link-info for : {}'.format(link_id))
return vlink
+ @rwstatus(ret_on_failure=[None])
+ def do_get_virtual_link_by_name(self, account, link_name):
+ raise NotImplementedError()
+
@rwstatus(ret_on_failure=[""])
def do_get_virtual_link_list(self, account):
- vnf_resources = RwcalYang.VNFResources()
+ vnf_resources = RwcalYang.YangData_RwProject_Project_VnfResources()
for r in self.resources[account.name].vlinks.values():
- vlink = RwcalYang.VirtualLinkInfoParams()
+ vlink = RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList()
vlink.copy_from(r)
vnf_resources.virtual_link_info_list.append(vlink)
logger.debug("Returning list of virtual-link-info of size: %d", len(vnf_resources.virtual_link_info_list))
@@ -496,7 +500,7 @@
@rwcalstatus(ret_on_failure=[""])
def do_create_vdu(self, account, vdu_init):
vdu_id = self.get_uuid("%s_%s" % (vdu_init.name, len(self.resources[account.name].vdus)))
- vdu = RwcalYang.VDUInfoParams()
+ vdu = RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList()
vdu.vdu_id = vdu_id
vdu.name = vdu_init.name
vdu.node_id = vdu_init.node_id
@@ -566,7 +570,7 @@
p.virtual_link_id = c.virtual_link_id
# Need to add this connection_point to virtual link
vlink = self.resources[account.name].vlinks[c.virtual_link_id]
- aa = RwcalYang.VirtualLinkInfoParams_ConnectionPoints()
+ aa = RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList_ConnectionPoints()
aa.connection_point_id = p.connection_point_id
aa.name = p.name
aa.virtual_link_id = vlink.virtual_link_id
@@ -598,17 +602,19 @@
logger.debug('deleted vdu: {}'.format(vdu_id))
- @rwstatus(ret_on_failure=[None])
- def do_get_vdu(self, account, vdu_id):
+ @rwcalstatus(ret_on_failure=[None])
+ def do_get_vdu(self, account, vdu_id, mgmt_network):
+ # mgmt_network - Added due to need for mgmt network.
+ # TO DO: Investigate the need here.
vdu = self.resources[account.name].vdus[vdu_id]
logger.debug('Returning vdu-info for : {}'.format(vdu_id))
return vdu.copy()
- @rwstatus(ret_on_failure=[""])
+ @rwcalstatus(ret_on_failure=[None])
def do_get_vdu_list(self, account):
- vnf_resources = RwcalYang.VNFResources()
+ vnf_resources = RwcalYang.YangData_RwProject_Project_VnfResources()
for r in self.resources[account.name].vdus.values():
- vdu = RwcalYang.VDUInfoParams()
+ vdu = RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList()
vdu.copy_from(r)
vnf_resources.vdu_info_list.append(vdu)
logger.debug("Returning list of vdu-info of size: %d", len(vnf_resources.vdu_info_list))
diff --git a/rwcal/plugins/vala/rwcal_openmano/CMakeLists.txt b/rwcal/plugins/vala/rwcal_openmano/CMakeLists.txt
index 3218907..7a6b08a 100644
--- a/rwcal/plugins/vala/rwcal_openmano/CMakeLists.txt
+++ b/rwcal/plugins/vala/rwcal_openmano/CMakeLists.txt
@@ -17,4 +17,4 @@
include(rift_plugin)
-rift_install_python_plugin(rwcal_openmano rwcal_openmano.py)
+rift_install_gobject_python_plugin(rwcal_openmano rwcal_openmano.py COMPONENT ${INSTALL_COMPONENT})
diff --git a/rwcal/plugins/vala/rwcal_openmano/rwcal_openmano.py b/rwcal/plugins/vala/rwcal_openmano/rwcal_openmano.py
index 1503d64..461206d 100644
--- a/rwcal/plugins/vala/rwcal_openmano/rwcal_openmano.py
+++ b/rwcal/plugins/vala/rwcal_openmano/rwcal_openmano.py
@@ -78,7 +78,7 @@
Returns:
Validation Code and Details String
"""
- status = RwcalYang.CloudConnectionStatus(
+ status = RwcalYang.YangData_Rwcal_ConnectionStatus(
status="success",
details=""
)
@@ -151,7 +151,7 @@
@rwstatus(ret_on_failure=[[]])
def do_get_vm_list(self, account):
- return RwcalYang.VimResources()
+ return RwcalYang.YangData_RwProject_Project_VimResources()
@rwstatus
def do_create_flavor(self, account, flavor):
@@ -199,7 +199,7 @@
@rwstatus(ret_on_failure=[[]])
def do_get_port_list(self, account):
- return RwcalYang.VimResources()
+ return RwcalYang.YangData_RwProject_Project_VimResources()
@rwstatus
def do_create_network(self, account, network):
@@ -215,7 +215,7 @@
@rwstatus(ret_on_failure=[[]])
def do_get_network_list(self, account):
- return RwcalYang.VimResources()
+ return RwcalYang.YangData_RwProject_Project_VimResources()
@rwstatus(ret_on_failure=[""])
def do_create_virtual_link(self, account, link_params):
@@ -229,6 +229,10 @@
def do_get_virtual_link(self, account, link_id):
raise NotImplementedError()
+ @rwstatus(ret_on_failure=[None])
+ def do_get_virtual_link_by_name(self, account, link_name):
+ raise NotImplementedError()
+
@rwstatus(ret_on_failure=[""])
def do_get_virtual_link_list(self, account):
raise NotImplementedError()
@@ -245,10 +249,12 @@
def do_delete_vdu(self, account, vdu_id):
raise NotImplementedError()
- @rwstatus(ret_on_failure=[None])
- def do_get_vdu(self, account, vdu_id):
+ @rwcalstatus(ret_on_failure=[None])
+ def do_get_vdu(self, account, vdu_id, mgmt_network):
+ # mgmt_network - Added due to need for mgmt network.
+ # TO DO: Investigate the need for aws.
raise NotImplementedError()
- @rwstatus(ret_on_failure=[""])
+ @rwcalstatus(ret_on_failure=[None])
def do_get_vdu_list(self, account):
raise NotImplementedError()
diff --git a/rwcal/plugins/vala/rwcal_openmano_vimconnector/CMakeLists.txt b/rwcal/plugins/vala/rwcal_openmano_vimconnector/CMakeLists.txt
index 8938f0a..66fa9bf 100644
--- a/rwcal/plugins/vala/rwcal_openmano_vimconnector/CMakeLists.txt
+++ b/rwcal/plugins/vala/rwcal_openmano_vimconnector/CMakeLists.txt
@@ -17,13 +17,9 @@
include(rift_plugin)
-### rwcal-openstack package
-set(PKG_NAME rwcal-openmano-vimconnector)
-set(PKG_VERSION 1.0)
-set(PKG_RELEASE 1)
-set(PKG_LONG_NAME ${PKG_NAME}-${PKG_VERSION})
+set(INSTALL_COMPONENT rwcal-plugin-openmano-vimconnector)
-rift_install_python_plugin(rwcal_openmano_vimconnector rwcal_openmano_vimconnector.py)
+rift_install_gobject_python_plugin(rwcal_openmano_vimconnector rwcal_openmano_vimconnector.py COMPONENT ${INSTALL_COMPONENT})
rift_python_install_tree(
FILES
@@ -32,4 +28,4 @@
rift/rwcal/openmano_vimconnector/vimconn_openvim.py
rift/rwcal/openmano_vimconnector/openmano_schemas.py
PYTHON3_ONLY
- COMPONENT ${PKG_LONG_NAME})
+ COMPONENT ${INSTALL_COMPONENT})
diff --git a/rwcal/plugins/vala/rwcal_openmano_vimconnector/rwcal_openmano_vimconnector.py b/rwcal/plugins/vala/rwcal_openmano_vimconnector/rwcal_openmano_vimconnector.py
index aa3d971..4f5884a 100644
--- a/rwcal/plugins/vala/rwcal_openmano_vimconnector/rwcal_openmano_vimconnector.py
+++ b/rwcal/plugins/vala/rwcal_openmano_vimconnector/rwcal_openmano_vimconnector.py
@@ -136,7 +136,7 @@
Returns:
Validation Code and Details String
"""
- status = RwcalYang.CloudConnectionStatus()
+ status = RwcalYang.YangData_Rwcal_ConnectionStatus()
url = 'http://{}:{}/openvim/'.format(account.openvim.host,account.openvim.port)
try:
r=requests.get(url,timeout=3)
@@ -183,14 +183,14 @@
Returns:
The TenantInfoItem
"""
- tenant = RwcalYang.TenantInfoItem()
+ tenant = RwcalYang.YangData_RwProject_Project_VimResources_TenantinfoList()
tenant.tenant_name = tenant_info['name']
tenant.tenant_id = tenant_info['id']
return tenant
@rwstatus(ret_on_failure=[[]])
def do_get_tenant_list(self, account):
- response = RwcalYang.VimResources()
+ response = RwcalYang.YangData_RwProject_Project_VimResources()
with self._use_driver(account) as drv:
tenants = drv.get_tenant_list()
for tenant in tenants:
@@ -256,7 +256,7 @@
@staticmethod
def _fill_image_info(img_info):
- img = RwcalYang.ImageInfoItem()
+ img = RwcalYang.YangData_RwProject_Project_VimResources_ImageinfoList()
img.name = img_info['name']
img.id = img_info['id']
img.location = img_info['path']
@@ -274,7 +274,7 @@
@rwstatus(ret_on_failure=[[]])
def do_get_image_list(self, account):
- response = RwcalYang.VimResources()
+ response = RwcalYang.YangData_RwProject_Project_VimResources()
with self._use_driver(account) as drv:
images = drv.get_image_list()
for img in images:
@@ -304,7 +304,7 @@
@rwstatus(ret_on_failure=[[]])
def do_get_vm_list(self, account):
- return RwcalYang.VimResources()
+ return RwcalYang.YangData_RwProject_Project_VimResources()
def _fill_flavor_create_attributes(flavor):
flavor_dict = dict()
@@ -345,7 +345,7 @@
@staticmethod
def _fill_flavor_info(flavor_info):
- flavor = RwcalYang.FlavorInfoItem()
+ flavor = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList()
flavor.name = flavor_info['name']
flavor.id = flavor_info['id']
RwcalOpenmanoVimConnector._fill_epa_attributes(flavor, flavor_info)
@@ -360,7 +360,7 @@
@rwstatus(ret_on_failure=[[]])
def do_get_flavor_list(self, account):
- response = RwcalYang.VimResources()
+ response = RwcalYang.YangData_RwProject_Project_VimResources()
with self._use_driver(account) as drv:
flavors = drv.get_flavor_list()
for flav in flavors:
@@ -398,7 +398,7 @@
@rwstatus(ret_on_failure=[[]])
def do_get_port_list(self, account):
- return RwcalYang.VimResources()
+ return RwcalYang.YangData_RwProject_Project_VimResources()
@rwstatus
def do_create_network(self, account, network):
@@ -412,7 +412,7 @@
drv.delete_network(network_id)
def _fill_network_info(self, network_info):
- network = RwcalYang.NetworkInfoItem()
+ network = RwcalYang.YangData_RwProject_Project_VimResources_NetworkinfoList()
network.network_name = network_info['name']
network.network_id = network_info['id']
if ('provider:physical' in network_info) and (network_info['provider:physical']):
@@ -430,7 +430,7 @@
@rwstatus(ret_on_failure=[[]])
def do_get_network_list(self, account):
- response = RwcalYang.VimResources()
+ response = RwcalYang.YangData_RwProject_Project_VimResources()
with self._use_driver(account) as drv:
networks = drv.get_network_list()
for network in networks:
@@ -472,7 +472,7 @@
c_point.vdu_id = port_info['device_id']
def _fill_virtual_link_info(self, drv, network_info):
- link = RwcalYang.VirtualLinkInfoParams()
+ link = RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList()
link.name = network_info['name']
link.virtual_link_id = network_info['id']
if network_info['admin_state_up']:
@@ -501,9 +501,13 @@
network = drv.get_network(link_id)
return self._fill_virtual_link_info(drv,network)
+ @rwstatus(ret_on_failure=[None])
+ def do_get_virtual_link_by_name(self, account, link_name):
+ raise NotImplementedError()
+
@rwstatus(ret_on_failure=[""])
def do_get_virtual_link_list(self, account):
- response = RwcalYang.VNFResources()
+ response = RwcalYang.YangData_RwProject_Project_VnfResources()
with self._use_driver(account) as drv:
networks = drv.get_network_list()
for network in networks:
@@ -527,7 +531,7 @@
"""
Select a existing flavor if it matches the request or create new flavor
"""
- flavor = RwcalYang.FlavorInfoItem()
+ flavor = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList()
flavor.name = str(uuid.uuid4())
epa_types = ['vm_flavor', 'guest_epa', 'host_epa', 'host_aggregate', 'hypervisor_epa', 'vswitch_epa']
epa_dict = {k: v for k, v in vdu_init.as_dict().items() if k in epa_types}
@@ -605,7 +609,7 @@
@staticmethod
def _fill_vdu_info(drv,account,vm_info):
- vdu = RwcalYang.VDUInfoParams()
+ vdu = RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList()
vdu.name = vm_info['name']
vdu.vdu_id = vm_info['id']
mgmt_net_id = None
@@ -645,15 +649,17 @@
RwcalOpenmanoVimConnector._fill_epa_attributes(vdu, flavor)
return vdu
- @rwstatus(ret_on_failure=[None])
- def do_get_vdu(self, account, vdu_id):
+ @rwcalstatus(ret_on_failure=[None])
+ def do_get_vdu(self, account, vdu_id, mgmt_network):
+ # mgmt_network - Added due to need for mgmt network.
+ # TO DO: Investigate the need here.
with self._use_driver(account) as drv:
vm_info = drv.get_vminstance(vdu_id)
return RwcalOpenmanoVimConnector._fill_vdu_info(drv,account,vm_info)
- @rwstatus(ret_on_failure=[""])
+ @rwcalstatus(ret_on_failure=[None])
def do_get_vdu_list(self, account):
- vnf_resource = RwcalYang.VNFResources()
+ vnf_resource = RwcalYang.YangData_RwProject_Project_VnfResources()
with self._use_driver(account) as drv:
vms = drv.get_vminstance_list()
for vm in vms:
diff --git a/rwcal/plugins/vala/rwcal_openstack/CMakeLists.txt b/rwcal/plugins/vala/rwcal_openstack/CMakeLists.txt
index 97d314b..624c1c0 100644
--- a/rwcal/plugins/vala/rwcal_openstack/CMakeLists.txt
+++ b/rwcal/plugins/vala/rwcal_openstack/CMakeLists.txt
@@ -18,12 +18,9 @@
include(rift_plugin)
### rwcal-openstack package
-set(PKG_NAME rwcal-openstack)
-set(PKG_VERSION 1.0)
-set(PKG_RELEASE 1)
-set(PKG_LONG_NAME ${PKG_NAME}-${PKG_VERSION})
+set(INSTALL_COMPONENT rwcal-plugin-openstack)
-rift_install_python_plugin(rwcal_openstack rwcal_openstack.py)
+rift_install_gobject_python_plugin(rwcal_openstack rwcal_openstack.py COMPONENT ${INSTALL_COMPONENT})
rift_python_install_tree(
FILES
@@ -54,5 +51,5 @@
rift/rwcal/openstack/utils/image.py
PYTHON3_ONLY
- COMPONENT ${PKG_LONG_NAME})
+ COMPONENT ${INSTALL_COMPONENT})
diff --git a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/cinder/cinder_drv.py b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/cinder/cinder_drv.py
index 5bb5cc4..9c4bdb2 100644
--- a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/cinder/cinder_drv.py
+++ b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/cinder/cinder_drv.py
@@ -155,6 +155,8 @@
"""
try:
vol = self._ci_drv.volumes.get(volume_id)
+ except ciclient.exceptions.NotFound:
+ return None
except Exception as e:
self.log.error("Get volume operation failed. Exception: %s", str(e))
raise
diff --git a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/keystone/keystone_drv.py b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/keystone/keystone_drv.py
index a754ecf..51b3ddd 100644
--- a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/keystone/keystone_drv.py
+++ b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/keystone/keystone_drv.py
@@ -42,11 +42,12 @@
"""
supported_versions = [(2, ), (3, )]
- def __init__(self, auth_url, logger = None):
+ def __init__(self, auth_url, cert_validate, logger = None):
"""
Constructor for class
Arguments
auth_url(string): Keystone Auth URL
+ cert_validate (boolean): Boolean to indicate if certificate validation is required
logger (instance of logging.Logger)
"""
@@ -57,7 +58,7 @@
self.log = logger
try:
- self._discover = discover.Discover(auth_url=auth_url)
+ self._discover = discover.Discover(auth_url=auth_url, insecure = not cert_validate)
except Exception as e:
self.log.exception(str(e))
self._discover = None
diff --git a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/neutron/neutron_drv.py b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/neutron/neutron_drv.py
index ebb32d2..1e3f590 100644
--- a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/neutron/neutron_drv.py
+++ b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/neutron/neutron_drv.py
@@ -246,7 +246,7 @@
"""
networks = self._network_find(**{'id': network_id, 'name': network_name})
if not networks:
- raise NeutronException.NotFound("Could not find network. Network id: %s, Network name: %s " %(network_id, network_name))
+ return None
return networks[0]
@@ -404,7 +404,7 @@
security_groups : A List of Neutron security group Ids
}
Returns:
- A list of port_id (string)
+ A list of ports { port_id (string), tag (connection_name, string) }
"""
params = dict()
params['ports'] = ports
@@ -414,7 +414,7 @@
except Exception as e:
self.log.exception("Ports Create operation failed. Exception: %s",str(e))
raise
- return [ p['id'] for p in ports['ports'] ]
+ return [ { "id": p['id'], "tag": p['name'] } for p in ports['ports'] ]
def port_update(self, port_id, no_security_groups=None,port_security_enabled=None):
diff --git a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/nova/nova_drv.py b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/nova/nova_drv.py
index 4dc8c65..7b4b21b 100644
--- a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/nova/nova_drv.py
+++ b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/nova/nova_drv.py
@@ -64,6 +64,9 @@
self._sess_handle = sess_handle
+ self._max_api_version = None
+ self._min_api_version = None
+
#### Attempt to use API versions in prioritized order defined in
#### NovaDriver.supported_versions
def select_version(version):
@@ -74,17 +77,29 @@
service_type = service_type,
session = self._sess_handle.session,
logger = self.log)
+
+ api_version = 'v' + nvdrv.versions.api_version.get_string()
+ nova_version_list = nvdrv.versions.list()
+ max_api_version, min_api_version = None, None
+
+ for v in nova_version_list:
+ version_dict = v.to_dict()
+ if api_version == version_dict["id"]:
+ max_api_version = version_dict["version"] # Max version supported is stored in version field.
+ min_api_version = version_dict["min_version"]
+ break
+
except Exception as e:
self.log.info(str(e))
raise
else:
self.log.info("Nova API v%s selected", version)
- return (version, nvdrv)
+ return (version, nvdrv, max_api_version, min_api_version)
errors = []
for v in NovaDriver.supported_versions:
try:
- (self._version, self._nv_drv) = select_version(v)
+ (self._version, self._nv_drv, self._max_api_version, self._min_api_version) = select_version(v)
except Exception as e:
errors.append(e)
else:
@@ -146,6 +161,8 @@
"""
try:
extra_specs = flavor.get_keys()
+ except nvclient.exceptions.NotFound:
+ return None
except Exception as e:
self.log.exception("Could not get the EPA attributes for flavor with flavor_id : %s. Exception: %s",
flavor.id, str(e))
@@ -163,11 +180,19 @@
"""
try:
flavor = self._nv_drv.flavors.get(flavor_id)
+ except nvclient.exceptions.NotFound:
+ return None
except Exception as e:
self.log.exception("Did not find flavor with flavor_id : %s. Exception: %s",flavor_id, str(e))
raise
response = flavor.to_dict()
- response['extra_specs'] = self._flavor_extra_spec_get(flavor)
+ try:
+ response['extra_specs'] = self._flavor_extra_spec_get(flavor)
+ except nvclient.exceptions.NotFound:
+ pass
+ except Exception as e:
+ self.log.exception("Did not find extra_specs in flavor with flavor_id : %s. Exception: %s",flavor_id, str(e))
+ raise
return response
try:
@@ -377,7 +402,8 @@
if 'port_list' in kwargs:
for port_id in kwargs['port_list']:
- nics.append({'port-id': port_id})
+ port = { 'port-id': port_id['id'] }
+ nics.append(port)
try:
server = self._nv_drv.servers.create(
@@ -391,7 +417,7 @@
max_count = None,
userdata = kwargs['userdata'] if 'userdata' in kwargs else None,
security_groups = kwargs['security_groups'] if 'security_groups' in kwargs else None,
- availability_zone = kwargs['availability_zone'] if 'availability_zone' in kwargs else None,
+ availability_zone = kwargs['availability_zone'].name if 'availability_zone' in kwargs else None,
block_device_mapping_v2 = kwargs['block_device_mapping_v2'] if 'block_device_mapping_v2' in kwargs else None,
nics = nics,
scheduler_hints = kwargs['scheduler_hints'] if 'scheduler_hints' in kwargs else None,
@@ -535,9 +561,11 @@
try:
console_info = self._nv_drv.servers.get_vnc_console(server_id, console_type)
except Exception as e:
- self.log.exception("Server Get-Console operation failed for server_id: %s. Exception: %s",
- server_id, str(e))
- raise
+ # TODO: This error keeps repeating incase there is no console available
+ # So reduced level from exception to warning
+ self.log.warning("Server Get-Console operation failed for server_id: %s. Exception: %s",
+ server_id, str(e))
+ raise e
return console_info
def server_rebuild(self, server_id, image_id):
diff --git a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/openstack_drv.py b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/openstack_drv.py
index d6831a7..06f6203 100644
--- a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/openstack_drv.py
+++ b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/openstack_drv.py
@@ -109,7 +109,9 @@
region = kwargs['region_name'] if 'region_name' in kwargs else False
mgmt_network = kwargs['mgmt_network'] if 'mgmt_network' in kwargs else None
- discover = ks_drv.KeystoneVersionDiscover(kwargs['auth_url'], logger = self.log)
+ discover = ks_drv.KeystoneVersionDiscover(kwargs['auth_url'],
+ cert_validate,
+ logger = self.log)
(major, minor) = discover.get_version()
self.sess_drv = sess_drv.SessionDriver(auth_method = 'password',
@@ -388,7 +390,10 @@
def nova_server_create(self, **kwargs):
if 'security_groups' not in kwargs:
- kwargs['security_groups'] = [s['name'] for s in self._nova_security_groups]
+ security_groups = [s['name'] for s in self._nova_security_groups]
+ #Remove the security group names that are duplicate - RIFT-17035
+ valid_security_groups = list(filter(lambda s: security_groups.count(s) == 1, security_groups))
+ kwargs['security_groups'] = valid_security_groups
return self.nova_drv.server_create(**kwargs)
def nova_server_add_port(self, server_id, port_id):
@@ -451,6 +456,9 @@
def neutron_network_get(self, network_id):
return self.neutron_drv.network_get(network_id=network_id)
+ def neutron_network_get_by_name(self, network_name):
+ return self.neutron_drv.network_get(network_name=network_name)
+
def neutron_network_create(self, **kwargs):
return self.neutron_drv.network_create(**kwargs)
diff --git a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/prepare_vm.py b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/prepare_vm.py
index 7f3800b..972457f 100644
--- a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/prepare_vm.py
+++ b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/prepare_vm.py
@@ -28,7 +28,6 @@
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger()
-
rwlog_handler = rwlogger.RwLogger(category="rw-cal-log",
subcategory="openstack",)
logger.addHandler(rwlog_handler)
@@ -60,21 +59,26 @@
def allocate_floating_ip(drv, argument):
#### Allocate a floating_ip
- available_ip = [ ip for ip in drv.nova_floating_ip_list() if ip.instance_id == None ]
+ try:
+ available_ip = [ ip for ip in drv.nova_floating_ip_list() if ip.instance_id == None ]
- if argument.pool_name:
- ### Filter further based on IP address
- available_ip = [ ip for ip in available_ip if ip.pool == argument.pool_name ]
-
- if not available_ip:
- logger.info("<PID: %d> No free floating_ips available. Allocating fresh from pool: %s" %(os.getpid(), argument.pool_name))
- pool_name = argument.pool_name if argument.pool_name is not None else None
- floating_ip = drv.nova_floating_ip_create(pool_name)
- else:
- floating_ip = random.choice(available_ip)
- logger.info("<PID: %d> Selected floating_ip: %s from available free pool" %(os.getpid(), floating_ip))
+ if argument.pool_name:
+ ### Filter further based on IP address
+ available_ip = [ ip for ip in available_ip if ip.pool == argument.pool_name ]
+
+ if not available_ip:
+ logger.info("<PID: %d> No free floating_ips available. Allocating fresh from pool: %s" %(os.getpid(), argument.pool_name))
+ pool_name = argument.pool_name if argument.pool_name is not None else None
+ floating_ip = drv.nova_floating_ip_create(pool_name)
+ else:
+ floating_ip = random.choice(available_ip)
+ logger.info("<PID: %d> Selected floating_ip: %s from available free pool" %(os.getpid(), floating_ip))
- return floating_ip
+ return floating_ip
+
+ except Exception as e:
+ logger.error("Floating IP Allocation Failed - %s", e)
+ return None
def handle_floating_ip_assignment(drv, server, argument, management_ip):
@@ -116,8 +120,12 @@
for n_info in network_info:
if 'OS-EXT-IPS:type' in n_info and n_info['OS-EXT-IPS:type'] == 'fixed':
management_ip = n_info['addr']
- handle_floating_ip_assignment(drv, server, argument, management_ip)
- return
+ try:
+ handle_floating_ip_assignment(drv, server, argument, management_ip)
+ return
+ except Exception as e:
+ logger.error("Exception in assign_floating_ip_address : %s", e)
+ raise
else:
logger.info("Waiting for management_ip to be assigned to server: %s" %(server['name']))
time.sleep(1)
@@ -218,10 +226,13 @@
else:
logger.error("Server %s did not reach active state in %d seconds. Current state: %s" %(server['name'], wait_time, server['status']))
sys.exit(4)
-
#create_port_metadata(drv, argument)
create_volume_metadata(drv, argument)
- assign_floating_ip_address(drv, argument)
+ try:
+ assign_floating_ip_address(drv, argument)
+ except Exception as e:
+ logger.error("Exception in prepare_vm_after_boot : %s", e)
+ raise
def main():
@@ -365,10 +376,23 @@
region = argument.region)
drv = openstack_drv.OpenstackDriver(logger = logger, **kwargs)
- prepare_vm_after_boot(drv, argument)
- sys.exit(0)
+ try:
+ prepare_vm_after_boot(drv, argument)
+ except Exception as e:
+ logger.error("Exception in main of prepare_vm : %s", e)
+ raise
if __name__ == "__main__":
- main()
+ try:
+ main()
+ # Do not print anything in this script. This is a subprocess spawned by rwmain
+ # and the following print determines the success or failure of this script.
+ print("True",end="")
+ except Exception as e:
+ logger.error("Exception in prepare_vm : %s", e)
+ # Do not print anything in this script. This is a subprocess spawned by rwmain
+ # and the following print determines the success or failure of this script.
+ print("False+" + str(e),end="")
+ sys.exit(2)
diff --git a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/compute.py b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/compute.py
index e886bb2..7152962 100644
--- a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/compute.py
+++ b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/compute.py
@@ -60,12 +60,21 @@
from already existing flavors
Arguments:
- vdu_params: Protobuf GI object RwcalYang.VDUInitParams()
+ vdu_params: Protobuf GI object RwcalYang.YangData_RwProject_Project_VduInitParams()
Returns:
flavor_id(string): Flavor id for VDU instantiation
None if no flavor could be found
"""
+
+ if vdu_params.vm_flavor.has_field('vm_flavor_name') and \
+ vdu_params.vm_flavor.vm_flavor_name is not None:
+ nova_flavor_list = self.driver.nova_flavor_list()
+ for flavor in nova_flavor_list:
+ self.log.debug("Flavor {} ".format(flavor.get('name', '')))
+ if flavor.get('name', '') == vdu_params.vm_flavor.vm_flavor_name:
+ return flavor['id']
+
kwargs = { 'vcpus': vdu_params.vm_flavor.vcpu_count,
'ram' : vdu_params.vm_flavor.memory_mb,
'disk' : vdu_params.vm_flavor.storage_gb,}
@@ -85,7 +94,7 @@
is created.
Arguments:
- vdu_params: Protobuf GI object RwcalYang.VDUInitParams()
+ vdu_params: Protobuf GI object RwcalYang.YangData_RwProject_Project_VduInitParams()
Returns:
flavor_id(string): Flavor id for VDU instantiation
@@ -96,7 +105,7 @@
flavor_id, vdu_params.name)
return flavor_id
- flavor = RwcalYang.FlavorInfoItem()
+ flavor = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList()
flavor.name = str(uuid.uuid4())
epa_dict = { k: v for k, v in vdu_params.as_dict().items()
@@ -115,7 +124,7 @@
"""
Creates flavor related arguments for VDU operation
Arguments:
- vdu_params: Protobuf GI object RwcalYang.VDUInitParams()
+ vdu_params: Protobuf GI object RwcalYang.YangData_RwProject_Project_VduInitParams()
Returns:
A dictionary {'flavor_id': <flavor-id>}
@@ -127,7 +136,7 @@
"""
Creates image related arguments for VDU operation
Arguments:
- vdu_params: Protobuf GI object RwcalYang.VDUInitParams()
+ vdu_params: Protobuf GI object RwcalYang.YangData_RwProject_Project_VduInitParams()
Returns:
A dictionary {'image_id': <image-id>}
@@ -201,8 +210,8 @@
def make_vdu_volume_args(self, volume, vdu_params):
"""
Arguments:
- volume: Protobuf GI object RwcalYang.VDUInitParams_Volumes()
- vdu_params: Protobuf GI object RwcalYang.VDUInitParams()
+ volume: Protobuf GI object RwcalYang.YangData_RwProject_Project_VduInitParams_Volumes()
+ vdu_params: Protobuf GI object RwcalYang.YangData_RwProject_Project_VduInitParams()
Returns:
A dictionary required to create volume for VDU
@@ -258,7 +267,7 @@
Creates volume related arguments for VDU operation
Arguments:
- vdu_params: Protobuf GI object RwcalYang.VDUInitParams()
+ vdu_params: Protobuf GI object RwcalYang.YangData_RwProject_Project_VduInitParams()
Returns:
A dictionary required for volumes creation for VDU instantiation
@@ -283,7 +292,7 @@
"""
Creates VDU network related arguments for VDU operation
Arguments:
- vdu_params: Protobuf GI object RwcalYang.VDUInitParams()
+ vdu_params: Protobuf GI object RwcalYang.YangData_RwProject_Project_VduInitParams()
Returns:
A dictionary {'port_list' : [ports], 'network_list': [networks]}
@@ -291,6 +300,7 @@
"""
kwargs = dict()
kwargs['port_list'], kwargs['network_list'] = self.driver.utils.network.setup_vdu_networking(vdu_params)
+
return kwargs
@@ -298,7 +308,7 @@
"""
Creates VDU boot config related arguments for VDU operation
Arguments:
- vdu_params: Protobuf GI object RwcalYang.VDUInitParams()
+ vdu_params: Protobuf GI object RwcalYang.YangData_RwProject_Project_VduInitParams()
Returns:
A dictionary {
@@ -338,8 +348,12 @@
# Rift model only
if vdu_params.supplemental_boot_data.has_field('custom_meta_data'):
for cm in vdu_params.supplemental_boot_data.custom_meta_data:
- metadata[cm.name] = cm.value
- kwargs['metadata'] = metadata
+ # Adding this condition as the list contains CLOUD_INIT Variables as
+ # well. CloudInit Variables such as password are visible on the OpenStack UI
+ # if not removed from the custom_meta_data list.
+ if cm.destination == 'CLOUD_METADATA':
+ metadata[cm.name] = cm.value
+ kwargs['metadata'] = metadata
except Exception as e:
pass
@@ -367,7 +381,7 @@
Function to create kwargs required for nova server placement
Arguments:
- vdu_params: Protobuf GI object RwcalYang.VDUInitParams()
+ vdu_params: Protobuf GI object RwcalYang.YangData_RwProject_Project_VduInitParams()
Returns:
A dictionary { 'availability_zone' : < Zone >, 'scheduler_hints': <group-id> }
@@ -390,8 +404,8 @@
Function to create kwargs required for nova security group
Arguments:
- vdu_params: Protobuf GI object RwcalYang.VDUInitParams()
- account: Protobuf GI object RwcalYang.CloudAccount()
+ vdu_params: Protobuf GI object RwcalYang.YangData_RwProject_Project_VduInitParams()
+ account: Protobuf GI object RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList()
Returns:
A dictionary {'security_groups' : < group > }
@@ -407,8 +421,8 @@
Function to create kwargs required for nova_server_create API
Arguments:
- vdu_params: Protobuf GI object RwcalYang.VDUInitParams()
- account: Protobuf GI object RwcalYang.CloudAccount()
+ vdu_params: Protobuf GI object RwcalYang.YangData_RwProject_Project_VduInitParams()
+ account: Protobuf GI object RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList()
Returns:
A kwargs dictionary for VDU create operation
@@ -448,6 +462,7 @@
mgmt_ip = interface['addr']
elif interface['OS-EXT-IPS:type'] == 'floating':
public_ip = interface['addr']
+
return (mgmt_ip, public_ip)
def get_vdu_epa_info(self, vm_info):
@@ -473,7 +488,7 @@
Arguments:
vdu_id (string) : VDU Id (vm_info['id'])
Returns:
- A List of object RwcalYang.VDUInfoParams_ConnectionPoints()
+ A List of object RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList_ConnectionPoints()
"""
cp_list = []
@@ -481,7 +496,7 @@
port_list = self.driver.neutron_port_list(**{'device_id': vdu_id})
for port in port_list:
cp_info = self.driver.utils.network._parse_cp(port)
- cp = RwcalYang.VDUInfoParams_ConnectionPoints()
+ cp = RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList_ConnectionPoints()
cp.from_dict(cp_info.as_dict())
cp_list.append(cp)
return cp_list
@@ -532,18 +547,18 @@
vm_info : A dictionary returned by novaclient library listing VM attributes
Returns:
- List of RwcalYang.VDUInfoParams_SupplementalBootData()
+ List of RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList_SupplementalBootData()
"""
supplemental_boot_data = None
node_id = None
if 'config_drive' in vm_info:
- supplemental_boot_data = RwcalYang.VDUInfoParams_SupplementalBootData()
+ supplemental_boot_data = RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList_SupplementalBootData()
supplemental_boot_data.boot_data_drive = vm_info['config_drive']
# Look for any metadata
if 'metadata' not in vm_info:
return node_id, supplemental_boot_data
if supplemental_boot_data is None:
- supplemental_boot_data = RwcalYang.VDUInfoParams_SupplementalBootData()
+ supplemental_boot_data = RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList_SupplementalBootData()
for key, value in vm_info['metadata'].items():
if key == 'rift_node_id':
node_id = value
@@ -564,7 +579,7 @@
vm_info : A dictionary returned by novaclient library listing VM attributes
Returns:
- List of RwcalYang.VDUInfoParams_Volumes()
+ List of RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList_Volumes()
"""
volumes = list()
@@ -575,11 +590,13 @@
return volumes
for v in volume_list:
- volume = RwcalYang.VDUInfoParams_Volumes()
+ volume = RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList_Volumes()
try:
volume.name = (v['device']).split('/')[2]
volume.volume_id = v['volumeId']
details = self.driver.cinder_volume_get(volume.volume_id)
+ if details is None:
+ continue
try:
# Rift only
for k, v in details.metadata.items():
@@ -615,7 +632,7 @@
except Exception as e:
- self.log.exception("Exception %s occured during volume list parsing", str(e))
+ self.log.warning("Exception %s occured during volume list parsing", str(e))
return console_url
def parse_cloud_vdu_info(self, vm_info):
@@ -626,9 +643,9 @@
vm_info : A dictionary object return by novaclient library listing VM attributes
Returns:
- Protobuf GI Object of type RwcalYang.VDUInfoParams()
+ Protobuf GI Object of type RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList()
"""
- vdu = RwcalYang.VDUInfoParams()
+ vdu = RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList()
vdu.name = vm_info['name']
vdu.vdu_id = vm_info['id']
vdu.cloud_type = 'openstack'
@@ -651,17 +668,18 @@
if 'flavor' in vm_info and 'id' in vm_info['flavor']:
vdu.flavor_id = vm_info['flavor']['id']
flavor_info = self.get_vdu_epa_info(vm_info)
- vm_flavor = self.driver.utils.flavor.parse_vm_flavor_epa_info(flavor_info)
- guest_epa = self.driver.utils.flavor.parse_guest_epa_info(flavor_info)
- host_epa = self.driver.utils.flavor.parse_host_epa_info(flavor_info)
- host_aggregates = self.driver.utils.flavor.parse_host_aggregate_epa_info(flavor_info)
+ if flavor_info is not None:
+ vm_flavor = self.driver.utils.flavor.parse_vm_flavor_epa_info(flavor_info)
+ guest_epa = self.driver.utils.flavor.parse_guest_epa_info(flavor_info)
+ host_epa = self.driver.utils.flavor.parse_host_epa_info(flavor_info)
+ host_aggregates = self.driver.utils.flavor.parse_host_aggregate_epa_info(flavor_info)
- vdu.vm_flavor.from_dict(vm_flavor.as_dict())
- vdu.guest_epa.from_dict(guest_epa.as_dict())
- vdu.host_epa.from_dict(host_epa.as_dict())
- for aggr in host_aggregates:
- ha = vdu.host_aggregate.add()
- ha.from_dict(aggr.as_dict())
+ vdu.vm_flavor.from_dict(vm_flavor.as_dict())
+ vdu.guest_epa.from_dict(guest_epa.as_dict())
+ vdu.host_epa.from_dict(host_epa.as_dict())
+ for aggr in host_aggregates:
+ ha = vdu.host_aggregate.add()
+ ha.from_dict(aggr.as_dict())
node_id, boot_data = self._parse_vdu_boot_config_data(vm_info)
if node_id:
@@ -699,6 +717,5 @@
port_list = self.driver.neutron_port_list(**{'device_id': vdu_id})
for port in port_list:
- if ((port['device_owner'] == 'compute:None') or (port['device_owner'] == '')):
- self.driver.neutron_port_delete(port['id'])
+ self.driver.neutron_port_delete(port['id'])
diff --git a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/flavor.py b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/flavor.py
index 3199775..a233a1c 100644
--- a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/flavor.py
+++ b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/flavor.py
@@ -733,9 +733,9 @@
flavor_info: A dictionary object return by novaclient library listing flavor attributes
Returns:
- vm_flavor = RwcalYang.FlavorInfoItem_VmFlavor()
+ vm_flavor = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList_VmFlavor()
"""
- vm_flavor = RwcalYang.FlavorInfoItem_VmFlavor()
+ vm_flavor = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList_VmFlavor()
if 'vcpus' in flavor_info and flavor_info['vcpus']:
vm_flavor.vcpu_count = flavor_info['vcpus']
@@ -756,9 +756,11 @@
flavor_info: A dictionary object return by novaclient library listing flavor attributes
Returns:
- guest_epa = RwcalYang.FlavorInfoItem_GuestEpa()
+ guest_epa = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList_GuestEpa()
"""
- guest_epa = RwcalYang.FlavorInfoItem_GuestEpa()
+ guest_epa = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList_GuestEpa()
+ if 'extra_specs' not in flavor_info or flavor_info['extra_specs'] is None:
+ return guest_epa
for attr in flavor_info['extra_specs']:
if attr == 'hw:cpu_policy':
cpu_pinning_policy = self._epa.guest.extra_spec_to_mano_cpu_pinning_policy(flavor_info['extra_specs']['hw:cpu_policy'])
@@ -830,9 +832,11 @@
flavor_info: A dictionary object return by novaclient library listing flavor attributes
Returns:
- host_epa = RwcalYang.FlavorInfoItem_HostEpa()
+ host_epa = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList_HostEpa()
"""
- host_epa = RwcalYang.FlavorInfoItem_HostEpa()
+ host_epa = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList_HostEpa()
+ if 'extra_specs' not in flavor_info or flavor_info['extra_specs'] is None:
+ return host_epa
for attr in flavor_info['extra_specs']:
if attr == 'capabilities:cpu_info:model':
cpu_model = self._epa.host.extra_specs_to_mano_cpu_model(flavor_info['extra_specs']['capabilities:cpu_info:model'])
@@ -879,12 +883,14 @@
flavor_info: A dictionary object return by novaclient library listing flavor attributes
Returns:
- A list of objects host_aggregate of type RwcalYang.FlavorInfoItem_HostAggregate()
+ A list of objects host_aggregate of type RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList_HostAggregate()
"""
host_aggregates = list()
+ if 'extra_specs' not in flavor_info or flavor_info['extra_specs'] is None:
+ return host_aggregates
for attr in flavor_info['extra_specs']:
if attr.startswith('aggregate_instance_extra_specs:'):
- aggregate = RwcalYang.FlavorInfoItem_HostAggregate()
+ aggregate = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList_HostAggregate()
aggregate.metadata_key = ":".join(attr.split(':')[1::])
aggregate.metadata_value = flavor_info['extra_specs'][attr]
host_aggregates.append(aggregate)
@@ -898,10 +904,10 @@
flavor_info: A dictionary object returned by novaclient library listing flavor attributes
Returns:
- Protobuf GI Object of type RwcalYang.FlavorInfoItem()
+ Protobuf GI Object of type RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList()
"""
- flavor = RwcalYang.FlavorInfoItem()
+ flavor = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList()
if 'name' in flavor_info and flavor_info['name']:
flavor.name = flavor_info['name']
if 'id' in flavor_info and flavor_info['id']:
@@ -1228,14 +1234,14 @@
"""
Match EPA attributes
Arguments:
- resource_info: Protobuf GI object RwcalYang.FlavorInfoItem()
+ resource_info: Protobuf GI object RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList()
Following attributes would be accessed
- vm_flavor
- guest_epa
- host_epa
- host_aggregate
- request_params: Protobuf GI object RwcalYang.VDUInitParams().
+ request_params: Protobuf GI object RwcalYang.YangData_RwProject_Project_VduInitParams().
Following attributes would be accessed
- vm_flavor
- guest_epa
@@ -1288,8 +1294,8 @@
def match_resource_flavor(self, vdu_init, flavor_list):
"""
Arguments:
- vdu_init: Protobuf GI object RwcalYang.VDUInitParams().
- flavor_list: List of Protobuf GI object RwcalYang.FlavorInfoItem()
+ vdu_init: Protobuf GI object RwcalYang.YangData_RwProject_Project_VduInitParams().
+ flavor_list: List of Protobuf GI object RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList()
Returns:
Flavor_ID -- If match is found between vdu_init and one of flavor_info from flavor_list
diff --git a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/image.py b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/image.py
index c58fc8d..fc57bb1 100644
--- a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/image.py
+++ b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/image.py
@@ -85,7 +85,7 @@
Returns:
Protobuf GI Object of type RwcalYang.ImageInfoItem()
"""
- image = RwcalYang.ImageInfoItem()
+ image = RwcalYang.YangData_RwProject_Project_VimResources_ImageinfoList()
if 'name' in image_info and image_info['name']:
image.name = image_info['name']
if 'id' in image_info and image_info['id']:
diff --git a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/network.py b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/network.py
index 8e6f608..a7b4f1a 100644
--- a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/network.py
+++ b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/network.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
-#
+#
# Copyright 2017 RIFT.IO Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -37,40 +37,74 @@
@property
def driver(self):
return self._driver
-
+
def _parse_cp(self, cp_info):
"""
- Parse the port_info dictionary returned by neutronclient
+ Parse the port_info dictionary returned by neutronclient
Arguments:
cp_info: A dictionary object representing port attributes
Returns:
- Protobuf GI oject of type RwcalYang.VirtualLinkInfoParams_ConnectionPoints()
+ Protobuf GI oject of type RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList_ConnectionPoints()
"""
- cp = RwcalYang.VirtualLinkInfoParams_ConnectionPoints()
+ cp = RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList_ConnectionPoints()
if 'name' in cp_info and cp_info['name']:
cp.name = cp_info['name']
-
+
if 'id' in cp_info and cp_info['id']:
cp.connection_point_id = cp_info['id']
-
+
if ('fixed_ips' in cp_info) and (len(cp_info['fixed_ips']) >= 1):
if 'ip_address' in cp_info['fixed_ips'][0]:
cp.ip_address = cp_info['fixed_ips'][0]['ip_address']
-
+
if 'mac_address' in cp_info and cp_info['mac_address']:
cp.mac_addr = cp_info['mac_address']
-
+
if cp_info['status'] == 'ACTIVE':
cp.state = 'active'
else:
cp.state = 'inactive'
-
+
if 'network_id' in cp_info and cp_info['network_id']:
cp.virtual_link_id = cp_info['network_id']
-
+
if 'device_id' in cp_info and cp_info['device_id']:
cp.vdu_id = cp_info['device_id']
+
+ if 'allowed_address_pairs' in cp_info and cp_info['allowed_address_pairs']:
+ for vcp in cp_info['allowed_address_pairs']:
+ vcp_info = cp.virtual_cp_info.add()
+ if 'ip_address' in vcp and vcp['ip_address']:
+ vcp_info.ip_address = vcp['ip_address']
+ if 'mac_address' in vcp and vcp['mac_address']:
+ vcp_info.mac_address = vcp['mac_address']
+ return cp
+
+ def _parse_virtual_cp(self, cp_info):
+ """
+ Parse the port_info dictionary returned by neutronclient
+ Arguments:
+ cp_info: A dictionary object representing port attributes
+
+ Returns:
+ Protobuf GI oject of type RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList_VirtualConnectionPoints()
+ """
+ cp = RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList_VirtualConnectionPoints()
+
+ if 'id' in cp_info and cp_info['id']:
+ cp.connection_point_id = cp_info['id']
+
+ if 'name' in cp_info and cp_info['name']:
+ cp.name = cp_info['name']
+
+ if ('fixed_ips' in cp_info) and (len(cp_info['fixed_ips']) >= 1):
+ if 'ip_address' in cp_info['fixed_ips'][0]:
+ cp.ip_address = cp_info['fixed_ips'][0]['ip_address']
+
+ if 'mac_address' in cp_info and cp_info['mac_address']:
+ cp.mac_address = cp_info['mac_address']
+
return cp
def parse_cloud_virtual_link_info(self, vlink_info, port_list, subnet):
@@ -79,11 +113,11 @@
Arguments:
vlink_info : A dictionary object return by neutronclient library listing network attributes
-
+
Returns:
- Protobuf GI Object of type RwcalYang.VirtualLinkInfoParams()
+ Protobuf GI Object of type RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList()
"""
- link = RwcalYang.VirtualLinkInfoParams()
+ link = RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList()
link.name = vlink_info['name']
if 'status' in vlink_info and vlink_info['status'] == 'ACTIVE':
link.state = 'active'
@@ -92,8 +126,10 @@
link.virtual_link_id = vlink_info['id']
for port in port_list:
- if ('device_owner' in port) and (port['device_owner'] == 'compute:None'):
+ if ('device_owner' in port) and (port['device_owner'] in ['compute:nova', 'compute:None']):
link.connection_points.append(self._parse_cp(port))
+ if ('device_owner' in port) and (port['device_owner'] == ''):
+ link.virtual_connection_points.append(self._parse_virtual_cp(port))
if subnet is not None:
link.subnet = subnet['cidr']
@@ -106,80 +142,100 @@
link.provider_network.physical_network = vlink_info['provider:physical_network'].upper()
return link
-
+
def setup_vdu_networking(self, vdu_params):
"""
This function validates the networking/connectivity setup.
Arguments:
- vdu_params: object of RwcalYang.VDUInitParams()
+ vdu_params: object of RwcalYang.YangData_RwProject_Project_VduInitParams()
Returns:
A list of port_ids and network_ids for VDU
-
+
"""
port_args = list()
network_ids = list()
add_mgmt_net = False
- for cp in vdu_params.connection_points:
- if cp.virtual_link_id == self.driver._mgmt_network_id:
+
+ # Sorting Connection Points by given 'port_order'. If 'port_order' is not given then sorting by name.
+ # Please note that the GI Object (vdu_params.connection_points) has been converted into a dictionary object for sorting purposes.
+
+ sorted_connection_points = []
+ if vdu_params.has_field('connection_points'):
+ sorted_connection_points = sorted(vdu_params.as_dict().get('connection_points'), key=lambda k: ("port_order" not in k,
+ k.get("port_order", None), k['name']))
+
+ if vdu_params.mgmt_network is not None:
+ # Setting the mgmt network as found in vdu params.
+ mgmt_network = self.driver.neutron_drv.network_get(network_name=vdu_params.mgmt_network)['id']
+ else:
+ mgmt_network = self.driver._mgmt_network_id
+
+ for cp in sorted_connection_points:
+ if cp['virtual_link_id'] == mgmt_network:
### Remove mgmt_network_id from net_ids
add_mgmt_net = True
port_args.append(self._create_cp_args(cp))
-
if not add_mgmt_net:
- network_ids.append(self.driver._mgmt_network_id)
-
+ network_ids.append(mgmt_network)
+
### Create ports and collect port ids
if port_args:
port_ids = self.driver.neutron_multi_port_create(port_args)
else:
port_ids = list()
-
return port_ids, network_ids
-
-
+
+
def _create_cp_args(self, cp):
"""
Creates a request dictionary for port create call
Arguments:
- cp: Object of RwcalYang.VDUInitParams_ConnectionPoints()
+ cp: Object of Python Dictionary
Returns:
dict() of request params
"""
args = dict()
- args['name'] = cp.name
- args['network_id'] = cp.virtual_link_id
+ args['name'] = cp['name']
+
+ args['network_id'] = cp['virtual_link_id']
args['admin_state_up'] = True
- if cp.type_yang == 'VIRTIO' or cp.type_yang == 'E1000':
+ if cp['type_yang'] in ['VIRTIO', 'E1000', 'VPORT']:
args['binding:vnic_type'] = 'normal'
- elif cp.type_yang == 'SR_IOV':
+ elif cp['type_yang'] == 'SR_IOV':
args['binding:vnic_type'] = 'direct'
else:
- raise NotImplementedError("Port Type: %s not supported" %(cp.type_yang))
+ raise NotImplementedError("Port Type: %s not supported" %(cp['type_yang']))
try:
- if cp.static_ip_address:
- args["fixed_ips"] = [{"ip_address" : cp.static_ip_address}]
+ if cp['static_ip_address']:
+ args["fixed_ips"] = [{"ip_address" : cp['static_ip_address']}]
except Exception as e:
pass
if 'port_security_enabled' in cp:
- args['port_security_enabled'] = cp.port_security_enabled
+ args['port_security_enabled'] = cp['port_security_enabled']
- if cp.has_field('security_group'):
+ if 'security_group' in cp:
if self.driver._neutron_security_groups:
gid = self.driver._neutron_security_groups[0]['id']
args['security_groups'] = [ gid ]
+
+ if 'virtual_cps' in cp:
+ args['allowed_address_pairs'] = [ {'ip_address': vcp['ip_address'],
+ 'mac_address': vcp['mac_address']}
+ for vcp in cp['virtual_cps'] ]
+
return args
def make_virtual_link_args(self, link_params):
"""
Function to create kwargs required for neutron_network_create API
-
+
Arguments:
- link_params: Protobuf GI object RwcalYang.VirtualLinkReqParams()
+ link_params: Protobuf GI object RwcalYang.YangData_RwProject_Project_VirtualLinkReqParams()
Returns:
A kwargs dictionary for network operation
@@ -203,9 +259,9 @@
def make_subnet_args(self, link_params, network_id):
"""
Function to create kwargs required for neutron_subnet_create API
-
+
Arguments:
- link_params: Protobuf GI object RwcalYang.VirtualLinkReqParams()
+ link_params: Protobuf GI object RwcalYang.YangData_RwProject_Project_VirtualLinkReqParams()
Returns:
A kwargs dictionary for subnet operation
@@ -229,9 +285,9 @@
link_params.ip_profile_params.subnet_prefix_pool,
link_params.name)
raise NeutronException.NotFound("SubnetPool with name %s not found"%(link_params.ip_profile_params.subnet_prefix_pool))
-
+
kwargs['subnetpool_id'] = pools[0]
-
+
elif link_params.has_field('subnet'):
kwargs['cidr'] = link_params.subnet
else:
@@ -254,3 +310,35 @@
kwargs['gateway_ip'] = link_params.ip_profile_params.gateway_address
return kwargs
+
+ def prepare_virtual_link(self, link_params, network_id):
+ """
+ Function to create additional resources in the network during
+ network-creation process. It involves following steps
+ - Create subnets
+ - Create any virtual ports in network
+
+ Arguments:
+ link_params: Protobuf GI object RwcalYang.YangData_RwProject_Project_VirtualLinkReqParams()
+ network_id: string
+
+ Returns:
+ None
+ """
+ ### Create subnet
+ kwargs = self.make_subnet_args(link_params, network_id)
+ self.driver.neutron_subnet_create(**kwargs)
+
+ ### Create Virtual connection point
+ if link_params.has_field('virtual_cps'):
+ port_args = list()
+ for vcp in link_params.virtual_cps:
+ cp = RwcalYang.YangData_RwProject_Project_VduInitParams_ConnectionPoints()
+ cp.from_dict({k:v for k,v in vcp.as_dict().items()
+ if k in ['name','security_group', 'port_security_enabled', 'static_ip_address', 'type_yang']})
+ cp.virtual_link_id = network_id
+ port_args.append(self._create_cp_args(cp.as_dict()))
+ if port_args:
+ ### Create ports
+ self.driver.neutron_multi_port_create(port_args)
+ return
diff --git a/rwcal/plugins/vala/rwcal_openstack/rwcal_openstack.py b/rwcal/plugins/vala/rwcal_openstack/rwcal_openstack.py
index e06e311..66859c7 100644
--- a/rwcal/plugins/vala/rwcal_openstack/rwcal_openstack.py
+++ b/rwcal/plugins/vala/rwcal_openstack/rwcal_openstack.py
@@ -20,6 +20,7 @@
import subprocess
import tempfile
import yaml
+import shlex
import gi
gi.require_version('RwCal', '1.0')
@@ -63,6 +64,8 @@
class ImageUploadError(Exception):
pass
+class PrepareVduOnBoot(Exception):
+ pass
class RwcalAccountDriver(object):
"""
@@ -147,7 +150,7 @@
Returns:
Validation Code and Details String
"""
- status = RwcalYang.CloudConnectionStatus()
+ status = RwcalYang.YangData_Rwcal_ConnectionStatus()
try:
drv = self._use_driver(account)
drv.validate_account_creds()
@@ -318,7 +321,7 @@
Returns:
The the list of images in VimResources object
"""
- response = RwcalYang.VimResources()
+ response = RwcalYang.YangData_RwProject_Project_VimResources()
drv = self._use_driver(account)
try:
images = drv.glance_image_list()
@@ -478,7 +481,7 @@
Returns:
Protobuf Gi object for VM
"""
- vm = RwcalYang.VMInfoItem()
+ vm = RwcalYang.YangData_RwProject_Project_VimResources_VminfoList()
vm.vm_id = vm_info['id']
vm.vm_name = vm_info['name']
vm.image_id = vm_info['image']['id']
@@ -525,7 +528,7 @@
Returns:
List containing VM information
"""
- response = RwcalYang.VimResources()
+ response = RwcalYang.YangData_RwProject_Project_VimResources()
drv = self._use_driver(account)
vms = drv.nova_server_list()
for vm in vms:
@@ -598,7 +601,7 @@
Returns:
List of flavors
"""
- response = RwcalYang.VimResources()
+ response = RwcalYang.YangData_RwProject_Project_VimResources()
drv = self._use_driver(account)
try:
flavors = drv.nova_flavor_list()
@@ -645,7 +648,7 @@
Returns:
Network info item
"""
- network = RwcalYang.NetworkInfoItem()
+ network = RwcalYang.YangData_RwProject_Project_VimResources_NetworkinfoList()
network.network_name = network_info['name']
network.network_id = network_info['id']
if ('provider:network_type' in network_info) and (network_info['provider:network_type'] is not None):
@@ -672,7 +675,7 @@
Returns:
List of networks
"""
- response = RwcalYang.VimResources()
+ response = RwcalYang.YangData_RwProject_Project_VimResources()
drv = self._use_driver(account)
networks = drv.neutron_network_list()
for network in networks:
@@ -722,10 +725,15 @@
if network.provider_network.has_field('segmentation_id'):
kwargs['segmentation_id'] = network.provider_network.segmentation_id
- drv = self._use_driver(account)
- network_id = drv.neutron_network_create(**kwargs)
- drv.neutron_subnet_create(network_id = network_id,
- cidr = network.subnet)
+ try:
+ drv = self._use_driver(account)
+ network_id = drv.neutron_network_create(**kwargs)
+ drv.neutron_subnet_create(network_id = network_id,
+ cidr = network.subnet)
+ except Exception as e:
+ self.log.exception("Exception %s occured during create-network", str(e))
+ raise
+
return network_id
@rwstatus
@@ -752,7 +760,7 @@
Returns:
Port info item
"""
- port = RwcalYang.PortInfoItem()
+ port = RwcalYang.YangData_RwProject_Project_VimResources_PortinfoList()
port.port_name = port_info['name']
port.port_id = port_info['id']
@@ -789,7 +797,7 @@
Returns:
Port info list
"""
- response = RwcalYang.VimResources()
+ response = RwcalYang.YangData_RwProject_Project_VimResources()
drv = self._use_driver(account)
ports = drv.neutron_port_list(*{})
for port in ports:
@@ -895,21 +903,24 @@
Returns:
A kwargs dictionary for glance operation
"""
-
drv = self._use_driver(account)
+ network_id = None
try:
kwargs = drv.utils.network.make_virtual_link_args(link_params)
network_id = drv.neutron_network_create(**kwargs)
- kwargs = drv.utils.network.make_subnet_args(link_params, network_id)
- drv.neutron_subnet_create(**kwargs)
+ drv.utils.network.prepare_virtual_link(link_params, network_id)
except Exception as e:
- self.log.error("Encountered exceptions during network creation. Exception: %s", str(e))
+ self.log.exception("Encountered exceptions during network creation. Exception: %s", str(e))
# This is to delete the network if neutron_subnet_create fails after creation of network
- # Note:- Any subnet created will be implicitly deleted.
- try:
- drv.neutron_network_delete(network_id)
- except Exception as delete_exception:
- self.log.debug("Exception while deleting the network after failure of neutron_subnet_create or make_subnet_args: %s", str(delete_exception))
+ # Note:- Any subnet created will be implicitly deleted.
+ if network_id is not None:
+ try:
+ drv.neutron_network_delete(network_id)
+ except Exception as delete_exception:
+ self.log.debug("Exception while deleting the network after failure of neutron_subnet_create or make_subnet_args: %s", str(delete_exception))
+ # Raising exception so that the Exception is propagated to Resmgr.
+ # This fixes the UI Stuck at Vl-Init-Phase.
+ raise Exception(str(e) + " --> " + str(delete_exception))
raise e
return network_id
@@ -945,7 +956,7 @@
link_id - id for the virtual-link
Returns:
- Object of type RwcalYang.VirtualLinkInfoParams
+ Object of type RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList
"""
drv = self._use_driver(account)
try:
@@ -963,6 +974,34 @@
return virtual_link
@rwstatus(ret_on_failure=[None])
+ def do_get_virtual_link_by_name(self, account, link_name):
+ """Get information about virtual link.
+
+ Arguments:
+ account - a cloud account
+ link_name - name for the virtual-link
+
+ Returns:
+ Object of type RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList
+ """
+ drv = self._use_driver(account)
+ try:
+ network = drv.neutron_network_get_by_name(link_name)
+ if network:
+ port_list = drv.neutron_port_list(**{'network_id': network['id']})
+ if 'subnets' in network and network['subnets']:
+ subnet = drv.neutron_subnet_get(network['subnets'][0])
+ else:
+ subnet = None
+ virtual_link = drv.utils.network.parse_cloud_virtual_link_info(network, port_list, subnet)
+ else:
+ return None
+ except Exception as e:
+ self.log.exception("Exception %s occured during virtual-link-get-by-name", str(e))
+ raise
+ return virtual_link
+
+ @rwstatus(ret_on_failure=[None])
def do_get_virtual_link_list(self, account):
"""Get information about all the virtual links
@@ -970,9 +1009,9 @@
account - a cloud account
Returns:
- A list of objects of type RwcalYang.VirtualLinkInfoParams
+ A list of objects of type RwcalYang.YangData_RwProject_Project_VnfResources_VirtualLinkInfoList
"""
- vnf_resources = RwcalYang.VNFResources()
+ vnf_resources = RwcalYang.YangData_RwProject_Project_VnfResources()
drv = self._use_driver(account)
try:
networks = drv.neutron_network_list()
@@ -997,37 +1036,53 @@
Arguments:
account - a cloud account
- vdu_init - information about VDU to create (RwcalYang.VDUInitParams)
+ vdu_init - information about VDU to create (RwcalYang.YangData_RwProject_Project_VduInitParams)
Returns:
The vdu_id
"""
drv = self._use_driver(account)
+ vdu_prepared = True
try:
kwargs = drv.utils.compute.make_vdu_create_args(vdu_init, account)
vm_id = drv.nova_server_create(**kwargs)
- self.prepare_vdu_on_boot(account, vm_id, vdu_init)
+ vdu_prepared_on_boot = self.prepare_vdu_on_boot(account, vm_id, vdu_init)
+ vdu_prepared = vdu_prepared_on_boot["status"]
except Exception as e:
self.log.exception("Exception %s occured during create-vdu", str(e))
raise
+
+ if vdu_prepared is False:
+ drv.utils.compute.perform_vdu_network_cleanup(vm_id)
+ drv.nova_server_delete(vm_id)
+ self.log.exception("Cleaning Up VDU as Prepare Vdu Failed : %s", vdu_prepared_on_boot["exception"])
+ raise PrepareVduOnBoot(vdu_prepared_on_boot["exception"])
return vm_id
def prepare_vdu_on_boot(self, account, server_id, vdu_params):
- cmd = PREPARE_VM_CMD.format(auth_url = account.openstack.auth_url,
- username = account.openstack.key,
- password = account.openstack.secret,
- tenant_name = account.openstack.tenant,
- region = account.openstack.region,
- user_domain = account.openstack.user_domain,
- project_domain = account.openstack.project_domain,
- mgmt_network = account.openstack.mgmt_network,
- server_id = server_id)
+ if vdu_params.mgmt_network is not None:
+ mgmt_network_param = vdu_params.mgmt_network
+ else:
+ mgmt_network_param = account.openstack.mgmt_network
+
+ # Adding shell quote to all parameters in case they contain special characters.
+ cmd = PREPARE_VM_CMD.format(auth_url = shlex.quote(account.openstack.auth_url),
+ username = shlex.quote(account.openstack.key),
+ password = shlex.quote(account.openstack.secret),
+ tenant_name = shlex.quote(account.openstack.tenant),
+ region = shlex.quote(account.openstack.region),
+ user_domain = shlex.quote(account.openstack.user_domain),
+ project_domain = shlex.quote(account.openstack.project_domain),
+ mgmt_network = shlex.quote(mgmt_network_param),
+ server_id = shlex.quote(server_id))
vol_list = list()
+
+ vdu_prepared = {"status": True, "exception": None}
if vdu_params.has_field('allocate_public_address') and vdu_params.allocate_public_address:
- cmd += " --floating_ip"
if account.openstack.has_field('floating_ip_pool'):
+ cmd += " --floating_ip"
cmd += (" --pool_name " + account.openstack.floating_ip_pool)
if vdu_params.has_field('volumes'):
@@ -1039,19 +1094,34 @@
with tempfile.NamedTemporaryFile(mode='w', delete=False) as tmp_file:
yaml.dump(vol_list, tmp_file)
cmd += (" --vol_metadata {}").format(tmp_file.name)
-
+
+
exec_path = 'python3 ' + os.path.dirname(openstack_drv.__file__)
exec_cmd = exec_path + '/' + cmd
self.log.info("Running command: %s" %(exec_cmd))
- subprocess.call(exec_cmd, shell=True)
+
+ # The return code for the subprocess is always 0. Hence using check_output
+ # for validating the success/failure of the script
+ # The check_output returns False or True on the basis of exception
+ # handling in prepare_vm.py
+ prepare_vm_status = subprocess.check_output(exec_cmd, shell=True)
+
+ # prepare_vm_status is a string in the format of True/False+ error message
+ # if any. This is to propagate the detailed exception to the callers.
+ vdu_status_elems = prepare_vm_status.decode("utf-8").split("+")
+ if(vdu_status_elems[0] == 'False'):
+ self.log.exception("Exception occured while preparing vdu after boot")
+ vdu_prepared = {"status": False, "exception": vdu_status_elems[1]}
+ return vdu_prepared
+
@rwstatus
def do_modify_vdu(self, account, vdu_modify):
"""Modify Properties of existing virtual deployment unit
Arguments:
account - a cloud account
- vdu_modify - Information about VDU Modification (RwcalYang.VDUModifyParams)
+ vdu_modify - Information about VDU Modification (RwcalYang.YangData_RwProject_Project_VduModifyParams)
"""
drv = self._use_driver(account)
### First create required number of ports aka connection points
@@ -1098,29 +1168,33 @@
raise
- @rwstatus(ret_on_failure=[None])
- def do_get_vdu(self, account, vdu_id):
+ @rwcalstatus(ret_on_failure=[None])
+ def do_get_vdu(self, account, vdu_id, mgmt_network):
"""Get information about a virtual deployment unit.
Arguments:
account - a cloud account
vdu_id - id for the vdu
+ mgmt_network - mgmt_network if provided in NSD VL
Returns:
- Object of type RwcalYang.VDUInfoParams
+ Object of type RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList
"""
+ if mgmt_network not in [None, ""]:
+ account.openstack.mgmt_network = mgmt_network
+
drv = self._use_driver(account)
try:
vm_info = drv.nova_server_get(vdu_id)
vdu_info = drv.utils.compute.parse_cloud_vdu_info(vm_info)
except Exception as e:
- self.log.exception("Exception %s occured during get-vdu", str(e))
- raise
+ self.log.debug("Exception occured during get-vdu: %s", str(e))
+ raise
return vdu_info
- @rwstatus(ret_on_failure=[None])
+ @rwcalstatus(ret_on_failure=[None])
def do_get_vdu_list(self, account):
"""Get information about all the virtual deployment units
@@ -1128,9 +1202,9 @@
account - a cloud account
Returns:
- A list of objects of type RwcalYang.VDUInfoParams
+ A list of objects of type RwcalYang.YangData_RwProject_Project_VnfResources_VduInfoList
"""
- vnf_resources = RwcalYang.VNFResources()
+ vnf_resources = RwcalYang.YangData_RwProject_Project_VnfResources()
drv = self._use_driver(account)
try:
vms = drv.nova_server_list()
@@ -1138,8 +1212,8 @@
vdu = drv.utils.compute.parse_cloud_vdu_info(vm)
vnf_resources.vdu_info_list.append(vdu)
except Exception as e:
- self.log.exception("Exception %s occured during get-vdu-list", str(e))
- raise
+ self.log.debug("Exception occured during get-vdu-list: %s", str(e))
+ raise
return vnf_resources
diff --git a/rwcal/plugins/vala/rwcal_vsphere/CMakeLists.txt b/rwcal/plugins/vala/rwcal_vsphere/CMakeLists.txt
index 092d941..61758f4 100644
--- a/rwcal/plugins/vala/rwcal_vsphere/CMakeLists.txt
+++ b/rwcal/plugins/vala/rwcal_vsphere/CMakeLists.txt
@@ -17,4 +17,4 @@
include(rift_plugin)
-rift_install_python_plugin(rwcal_vsphere rwcal_vsphere.py)
+rift_install_gobject_python_plugin(rwcal_vsphere rwcal_vsphere.py COMPONENT ${INSTALL_COMPONENT})
diff --git a/rwcal/plugins/vala/rwcal_vsphere/rwcal_vsphere.py b/rwcal/plugins/vala/rwcal_vsphere/rwcal_vsphere.py
index 2dcbd8c..b3f560b 100644
--- a/rwcal/plugins/vala/rwcal_vsphere/rwcal_vsphere.py
+++ b/rwcal/plugins/vala/rwcal_vsphere/rwcal_vsphere.py
@@ -212,6 +212,10 @@
@rwstatus(ret_on_failure=[None])
def do_get_virtual_link(self, account, link_id):
raise NotImplementedError()
+
+ @rwstatus(ret_on_failure=[None])
+ def do_get_virtual_link_by_name(self, account, link_name):
+ raise NotImplementedError()
@rwstatus(ret_on_failure=[""])
def do_get_virtual_link_list(self, account):
@@ -229,10 +233,12 @@
def do_delete_vdu(self, account, vdu_id):
raise NotImplementedError()
- @rwstatus(ret_on_failure=[None])
- def do_get_vdu(self, account, vdu_id):
+ @rwcalstatus(ret_on_failure=[None])
+ def do_get_vdu(self, account, vdu_id, mgmt_network):
+ # mgmt_network - Added due to need for mgmt network.
+ # TO DO: Investigate the need for aws.
raise NotImplementedError()
- @rwstatus(ret_on_failure=[""])
+ @rwcalstatus(ret_on_failure=[None])
def do_get_vdu_list(self, account):
raise NotImplementedError()
diff --git a/rwcal/plugins/yang/CMakeLists.txt b/rwcal/plugins/yang/CMakeLists.txt
index a1b24fe..6fb1d5b 100644
--- a/rwcal/plugins/yang/CMakeLists.txt
+++ b/rwcal/plugins/yang/CMakeLists.txt
@@ -1,5 +1,5 @@
#
-# Copyright 2016 RIFT.IO Inc
+# Copyright 2016-2017 RIFT.IO Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -34,13 +34,15 @@
YANG_FILES
${source_yang_files}
${rw_cal_log_file}
- COMPONENT ${PKG_LONG_NAME}
+ COMPONENT ${INSTALL_COMPONENT}
DEPENDS
mano-types_yang
+ rwprojectmano_yang
LIBRARIES
rwschema_yang_gen
rwyang
rwlog
rwlog-mgmt_yang_gen
mano-types_yang_gen
+ rwprojectmano_yang_gen
)
diff --git a/rwcal/plugins/yang/rwcal.yang b/rwcal/plugins/yang/rwcal.yang
index 1ed2f7b..62930d3 100644
--- a/rwcal/plugins/yang/rwcal.yang
+++ b/rwcal/plugins/yang/rwcal.yang
@@ -1,7 +1,7 @@
/*
*
- * Copyright 2016 RIFT.IO Inc
+ * Copyright 2016-2017 RIFT.IO Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,10 +27,6 @@
prefix rwbase;
}
- import rw-pb-ext {
- prefix "rwpb";
- }
-
import rw-yang-types {
prefix "rwt";
}
@@ -43,6 +39,19 @@
prefix "manotypes";
}
+ import ietf-inet-types {
+ prefix "inet";
+ }
+
+ import rw-project {
+ prefix "rw-project";
+ }
+
+ revision 2017-02-08 {
+ description
+ "Update model to support projects.";
+ }
+
revision 2014-12-30 {
description
"Initial revision.";
@@ -51,6 +60,7 @@
}
+
typedef connection-status {
description "Connection status for the cloud account";
type enumeration {
@@ -88,7 +98,6 @@
grouping connection-status {
container connection-status {
config false;
- rwpb:msg-new CloudConnectionStatus;
leaf status {
type connection-status;
}
@@ -98,6 +107,39 @@
}
}
+ grouping custom-meta-data {
+ description "Grouping for instance-specific meta data";
+ list custom-meta-data {
+ description
+ "List of meta-data to be associated with the instance";
+ key "name";
+ leaf name {
+ description "Name of the meta-data parameter";
+ type string;
+ }
+
+ leaf data-type {
+ description "Data-type the meta-data parameter";
+ type manotypes:meta-data-type;
+ default "STRING";
+ }
+
+ leaf value {
+ description "Value of the meta-data parameter";
+ type string;
+ }
+
+ leaf destination {
+ description "Type of input parameter";
+ type enumeration {
+ enum "CLOUD_INIT";
+ enum "CLOUD_METADATA";
+ }
+ default "CLOUD_METADATA";
+ }
+ }
+ }
+
uses connection-status;
grouping provider-auth {
@@ -203,7 +245,6 @@
leaf mgmt-network {
type string;
- mandatory true;
}
leaf plugin-name {
@@ -352,78 +393,106 @@
}
}
}
+
+ container prop_cloud1 {
+ leaf host {
+ description "This is a single-host cloud. IP address of host";
+ type string;
+ mandatory true;
+ }
+ leaf username {
+ description "Username to access host";
+ type string;
+ }
+ leaf password {
+ description "Password for user";
+ type string;
+ }
+ leaf mgmt-network {
+ description "Name of bridge used for management access to VMs on cloud";
+ type string;
+ mandatory true;
+ }
+ leaf public-ip-pool {
+ description "Public IP pool for VMs";
+ type string;
+ mandatory true;
+ }
+ leaf wan-interface {
+ description "WAN interface name";
+ type string;
+ mandatory true;
+ }
+ leaf firewall {
+ description "Firewall services";
+ type string;
+ }
+ leaf plugin-name {
+ type string;
+ default "rwcal_brocade";
+ }
+ leaf dynamic-flavor-support {
+ type boolean;
+ default true;
+ }
+ }
}
}
-
+
+ grouping instance-timeout {
+ leaf vdu-instance-timeout {
+ description "VDU instantiation timeout";
+ type uint64;
+ default 300;
+ }
+ }
+
grouping vm-info-item {
leaf vm-name {
- rwpb:field-inline "true";
- rwpb:field-string-max 255;
type string;
}
leaf vm-size {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf vm-id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf flavor-id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf image-id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf state {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf availability-zone {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf tenant-name {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf host-name {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf management-ip {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf public-ip {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf allocate-public-address {
- rwpb:field-inline "true";
description "If this VM should allocate a floating public IP address";
type boolean;
default false;
@@ -433,8 +502,6 @@
key "ip-address";
leaf ip-address {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
}
@@ -443,8 +510,6 @@
key "ip-address";
leaf ip-address {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
}
@@ -452,8 +517,6 @@
list port-list {
key "port-id";
leaf port-id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
}
@@ -461,8 +524,6 @@
list network-list {
key "network-id";
leaf network-id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
}
@@ -530,13 +591,13 @@
leaf disk_format {
description "Format of the Disk";
- type disk-format;
+ type string;
default "qcow2";
}
leaf container_format {
description "Format of the container";
- type container-format;
+ type string;
default "bare";
}
@@ -554,8 +615,18 @@
container user-tags {
description "User tags associated with Image";
leaf checksum {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
+ type string;
+ }
+ }
+
+ list properties {
+ key "name";
+ leaf name {
+ description "Name of the image property";
+ type string;
+ }
+ leaf property_value {
+ description "Value of the image property";
type string;
}
}
@@ -563,20 +634,14 @@
grouping network-info-item {
leaf network-name {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf network-id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf subnet {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
@@ -585,38 +650,26 @@
grouping port-info-item {
leaf port-name {
- rwpb:field-inline "true";
- rwpb:field-string-max 255;
type string;
}
leaf port-id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf port-state {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf network-id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf ip-address {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf vm-id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
@@ -639,163 +692,156 @@
}
}
- container cloud-accounts {
- list cloud-account-list {
- rwpb:msg-new CloudAccount;
- key "name";
+ augment "/rw-project:project" {
+ container cloud-accounts {
+ list cloud-account-list {
+ key "name";
- leaf name {
- type string;
+ leaf name {
+ type string;
+ }
+ uses provider-auth;
+ uses instance-timeout;
}
- uses provider-auth;
}
}
- container vim-resources {
- rwpb:msg-new VimResources;
- config false;
-
- list vminfo-list {
- rwpb:msg-new VMInfoItem;
+ augment "/rw-project:project" {
+ container vim-resources {
config false;
- key "vm-id";
- uses vm-info-item;
- }
+ list vminfo-list {
+ config false;
+ key "vm-id";
- list imageinfo-list {
- rwpb:msg-new ImageInfoItem;
- config false;
- key "id";
-
- uses image-info-item;
- }
-
- list tenantinfo-list {
- rwpb:msg-new TenantInfoItem;
- config false;
- key "tenant-id";
-
- leaf tenant-name {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
- type string;
+ uses vm-info-item;
}
- leaf tenant-id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
- type string;
- }
- }
+ list imageinfo-list {
+ config false;
+ key "id";
- list userinfo-list {
- rwpb:msg-new UserInfoItem;
- config false;
- key "user-id";
-
- leaf user-name{
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
- type string;
+ uses image-info-item;
}
- leaf user-id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
- type string;
- }
- }
+ list tenantinfo-list {
+ config false;
+ key "tenant-id";
- list roleinfo-list {
- rwpb:msg-new RoleInfoItem;
- config false;
- key "role-id";
+ leaf tenant-name {
+ type string;
+ }
- leaf role-name {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
- type string;
+ leaf tenant-id {
+ type string;
+ }
}
- leaf role-id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
- type string;
- }
- }
+ list userinfo-list {
+ config false;
+ key "user-id";
- list hostinfo-list {
- rwpb:msg-new HostInfoItem;
- config false;
- key "host-id";
+ leaf user-name{
+ type string;
+ }
- leaf host-name {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
- type string;
+ leaf user-id {
+ type string;
+ }
}
- leaf host-id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
- type string;
- }
- }
+ list roleinfo-list {
+ config false;
+ key "role-id";
- list networkinfo-list {
- rwpb:msg-new NetworkInfoItem;
- config false;
- key "network-id";
+ leaf role-name {
+ type string;
+ }
- uses network-info-item;
- }
-
- list portinfo-list {
- rwpb:msg-new PortInfoItem;
- config false;
- key "port-id";
-
- uses port-info-item;
- }
-
- list flavorinfo-list {
- rwpb:msg-new FlavorInfoItem;
- config false;
- key "id";
-
- leaf id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
- type string;
+ leaf role-id {
+ type string;
+ }
}
- leaf name {
- rwpb:field-inline "true";
- rwpb:field-string-max 255;
- type string;
+ list hostinfo-list {
+ config false;
+ key "host-id";
+
+ leaf host-name {
+ type string;
+ }
+
+ leaf host-id {
+ type string;
+ }
}
- uses manotypes:vm-flavor;
- uses manotypes:guest-epa;
- uses manotypes:vswitch-epa;
- uses manotypes:hypervisor-epa;
- uses manotypes:host-epa;
- uses manotypes:placement-group-input;
+ list networkinfo-list {
+ config false;
+ key "network-id";
+
+ uses network-info-item;
+ }
+
+ list portinfo-list {
+ config false;
+ key "port-id";
+
+ uses port-info-item;
+ }
+
+ list flavorinfo-list {
+ config false;
+ key "id";
+
+ leaf id {
+ type string;
+ }
+
+ leaf name {
+ type string;
+ }
+
+ uses manotypes:vm-flavor;
+ uses manotypes:guest-epa;
+ uses manotypes:vswitch-epa;
+ uses manotypes:hypervisor-epa;
+ uses manotypes:host-epa;
+ uses manotypes:placement-group-input;
+ }
}
}
+
+ grouping virtual-cp-info-params {
+
+ leaf connection-point-id {
+ description "Connection point id";
+ type string;
+ }
+ leaf name {
+ description "Name of virtual connection point";
+ type string;
+ }
+
+ leaf ip-address {
+ description "IP address of the virtual connection point";
+ type inet:ip-address;
+ }
+
+ leaf mac-address {
+ description "MAC address of the virtual connection point";
+ type string;
+ }
+ }
+
grouping virtual-link-create-params {
leaf name {
description "Name of the Virtual-Link";
- rwpb:field-inline "true";
- rwpb:field-string-max 255;
type string;
}
leaf subnet {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf associate-public-ip {
@@ -809,18 +855,47 @@
type string;
}
+ list virtual-cps {
+ key "name";
+
+ leaf name {
+ description "Name of virtual connection point";
+ type string;
+ }
+
+ leaf type {
+ description "Type of the Virtual Connection Point";
+ type manotypes:connection-point-type;
+ }
+
+ leaf security-group {
+ description "Name of the security group";
+ type string;
+ }
+
+ leaf port-security-enabled {
+ description "Enables the port security";
+ type boolean;
+ }
+
+ leaf static-ip-address {
+ description "Static IP address for the connection point";
+ type inet:ip-address;
+ }
+ }
+
uses manotypes:provider-network;
uses manotypes:ip-profile-info;
}
- container virtual-link-req-params {
- description "This object defines the parameters required to create a virtual-link";
- rwpb:msg-new VirtualLinkReqParams;
- uses virtual-link-create-params;
+ augment "/rw-project:project" {
+ container virtual-link-req-params {
+ description "This object defines the parameters required to create a virtual-link";
+ uses virtual-link-create-params;
+ }
}
-
grouping connection-point-type {
leaf type {
description
@@ -830,7 +905,8 @@
SR-IOV : Use SR-IOV interface.
E1000 : Emulate E1000 interface.
RTL8139 : Emulate RTL8139 interface.
- PCNET : Emulate PCNET interface.";
+ PCNET : Emulate PCNET interface.
+ VPORT : Virtual Port.";
type enumeration {
enum VIRTIO;
enum PCI-PASSTHROUGH;
@@ -838,6 +914,7 @@
enum E1000;
enum RTL8139;
enum PCNET;
+ enum VPORT;
}
default "VIRTIO";
}
@@ -847,8 +924,6 @@
grouping vdu-create-params {
leaf name {
description "Name of the VDU";
- rwpb:field-inline "true";
- rwpb:field-string-max 255;
type string;
}
@@ -860,7 +935,7 @@
pass as metadata during the VM creation.";
type string;
}
-
+
uses manotypes:vm-flavor;
uses manotypes:guest-epa;
uses manotypes:vswitch-epa;
@@ -868,37 +943,27 @@
uses manotypes:host-epa;
leaf node-id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf flavor-id {
description "CAL assigned flavor-id for the VDU image";
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf image-id {
description "CAL assigned image-id for the VDU image";
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf image-name {
description "Image name which can be used to lookup the image-id";
type string;
- rwpb:field-inline "true";
- rwpb:field-string-max 256;
}
leaf image-checksum {
description "Image md5sum checksum used in combination with image name to lookup image-id ";
type string;
- rwpb:field-inline "true";
- rwpb:field-string-max 32;
}
uses manotypes:placement-group-input;
@@ -931,11 +996,27 @@
description "Name of the security group";
type string;
}
+
leaf port-security-enabled {
description "Enables the port security";
type boolean;
}
+ leaf static-ip-address {
+ description "Static IP address for the connection point";
+ type inet:ip-address;
+ }
+
+ leaf port-order {
+ description "Port Sequence Order";
+ type uint32;
+ }
+
+ list virtual_cps {
+ key "name";
+ uses virtual-cp-info-params;
+ }
+
uses connection-point-type;
}
@@ -963,7 +1044,15 @@
}
}
- uses manotypes:supplemental-boot-data;
+ container supplemental-boot-data {
+ uses manotypes:config-file;
+ leaf boot-data-drive {
+ description "Some VIMs implement additional drives to host config-files or meta-data";
+ type boolean;
+ default false;
+ }
+ uses custom-meta-data;
+ }
list volumes {
key "name";
@@ -972,70 +1061,140 @@
description "Name of the disk-volumes, e.g. vda, vdb etc";
type string;
}
- uses manotypes:volume-info;
- }
- }
- container vdu-init-params {
- description "This object defines the parameters required to create a VDU";
- rwpb:msg-new VDUInitParams;
- uses vdu-create-params;
- }
-
- container vdu-modify-params {
- description "This object defines the parameters required to modify VDU";
- rwpb:msg-new VDUModifyParams;
-
- leaf vdu-id {
- description "CAL assigned id for VDU to which this connection point belongs";
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
- type string;
- }
-
- leaf image-id {
- description "CAL assigned image-id for the VDU image";
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
- type string;
- }
-
- list connection-points-add {
- key "name";
- leaf name {
- description "Name of the connection point";
+ leaf description {
+ description "Description for Volume";
type string;
}
- leaf virtual-link-id {
- description "CAL assigned resource Id for the Virtual Link";
+
+ leaf size {
+ description "Size of disk in GB";
+ type uint64;
+ }
+
+ choice volume-source {
+ description
+ "Defines the source of the volume. Possible options are
+ 1. Ephemeral -- Empty disk
+ 2. Image -- Refer to image to be used for volume
+ 3. Volume -- Reference of pre-existing volume to be used
+ ";
+
+ case ephemeral {
+ leaf ephemeral {
+ type empty;
+ }
+ }
+
+ case image {
+ uses manotypes:image-properties;
+ }
+
+ case volume {
+ leaf volume-ref {
+ description "Reference for pre-existing volume in VIM";
+ type string;
+ }
+ }
+ }
+
+ leaf device-bus {
+ description "Type of disk-bus on which this disk is exposed to guest";
+ type enumeration {
+ enum ide;
+ enum usb;
+ enum virtio;
+ enum scsi;
+ }
+ }
+
+ leaf device-type {
+ description "The type of device as exposed to guest";
+ type enumeration {
+ enum disk;
+ enum cdrom;
+ enum floppy;
+ enum lun;
+ }
+ }
+
+ leaf boot-volume {
+ description "This flag indicates if this is boot volume or not";
+ type boolean;
+ }
+
+ leaf boot-priority {
+ description "Boot priority associated with volume";
+ type int32;
+ }
+ }
+ }
+
+ augment "/rw-project:project" {
+ container vdu-init-params {
+ description "This object defines the parameters required to create a VDU";
+ uses vdu-create-params;
+ }
+ }
+
+ augment "/rw-project:project/vdu-init-params/vm-flavor" {
+ uses manotypes:vm-flavor-name;
+ }
+
+ augment "/rw-project:project" {
+ container vdu-modify-params {
+ description "This object defines the parameters required to modify VDU";
+
+ leaf vdu-id {
+ description "CAL assigned id for VDU to which this connection point belongs";
type string;
}
- leaf associate-public-ip {
- type boolean;
- default false;
- }
- leaf port-security-enabled {
- description "Enables the port security";
- type boolean;
+
+ leaf static-ip-address {
+ description "Static IP address for the connection point";
+ type inet:ip-address;
}
uses connection-point-type;
- }
- list connection-points-remove {
- key "connection-point-id";
- leaf connection-point-id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
+ leaf image-id {
+ description "CAL assigned image-id for the VDU image";
type string;
}
+
+ list connection-points-add {
+ key "name";
+ leaf name {
+ description "Name of the connection point";
+ type string;
+ }
+ leaf virtual-link-id {
+ description "CAL assigned resource Id for the Virtual Link";
+ type string;
+ }
+ leaf associate-public-ip {
+ type boolean;
+ default false;
+ }
+ leaf port-security-enabled {
+ description "Enables the port security";
+ type boolean;
+ }
+
+ uses connection-point-type;
+ }
+
+ list connection-points-remove {
+ key "connection-point-id";
+ leaf connection-point-id {
+ type string;
+ }
+ }
}
}
grouping connection-point-info-params {
leaf connection-point-id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
@@ -1046,15 +1205,11 @@
leaf virtual-link-id {
description "CAL assigned resource ID of the Virtual-Link";
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf vdu-id {
description "CAL assigned id for VDU to which this connection point belongs";
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
@@ -1069,29 +1224,38 @@
}
leaf ip-address {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
- type string;
+ type inet:ip-address;
}
leaf public-ip {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf mac-addr {
- rwpb:field-inline "true";
- rwpb:field-string-max 48;
type string;
}
+
+ leaf port-order {
+ description "Port Sequence Order";
+ type uint32;
+ }
+
+ list virtual-cp-info {
+ key "ip-address";
+
+ leaf ip-address {
+ type inet:ip-address;
+ }
+
+ leaf mac-address {
+ type string;
+ }
+ }
}
grouping virtual-link-info-params {
leaf name {
description "Name of the Virtual-Link";
- rwpb:field-inline "true";
- rwpb:field-string-max 255;
type string;
}
@@ -1108,8 +1272,6 @@
leaf virtual-link-id {
description "CAL assigned resource ID of the Virtual-Link";
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
@@ -1118,9 +1280,12 @@
uses connection-point-info-params;
}
+ list virtual-connection-points {
+ key connection-point-id;
+ uses virtual-cp-info-params;
+ }
+
leaf subnet {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
@@ -1131,34 +1296,24 @@
grouping vdu-info-params {
leaf vdu-id {
description "CAL assigned id for VDU";
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf name {
description "Name of the VDU";
- rwpb:field-inline "true";
- rwpb:field-string-max 255;
type string;
}
leaf flavor-id {
description "CAL assigned flavor-id for the VDU image";
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf image-id {
description "CAL assigned image-id for the VDU image";
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf node-id {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
@@ -1174,14 +1329,10 @@
}
leaf management-ip {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
leaf public-ip {
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
@@ -1201,7 +1352,15 @@
description "Console URL from the VIM, if available";
}
- uses manotypes:supplemental-boot-data;
+ container supplemental-boot-data {
+ uses manotypes:config-file;
+ leaf boot-data-drive {
+ description "Some VIMs implement additional drives to host config-files or meta-data";
+ type boolean;
+ default false;
+ }
+ uses custom-meta-data;
+ }
list volumes {
key "name";
@@ -1213,30 +1372,29 @@
leaf volume-id {
description "CAL assigned volume-id ";
- rwpb:field-inline "true";
- rwpb:field-string-max 64;
type string;
}
+
+ uses custom-meta-data;
}
}
- container vnf-resources {
- rwpb:msg-new VNFResources;
- config false;
-
- list virtual-link-info-list {
- rwpb:msg-new VirtualLinkInfoParams;
+ augment "/rw-project:project" {
+ container vnf-resources {
config false;
- key virtual-link-id;
- uses virtual-link-info-params;
- }
- list vdu-info-list {
- rwpb:msg-new VDUInfoParams;
- config false;
- key vdu-id;
- uses vdu-info-params;
+ list virtual-link-info-list {
+ config false;
+ key virtual-link-id;
+ uses virtual-link-info-params;
+ }
+
+ list vdu-info-list {
+ config false;
+ key vdu-id;
+ uses vdu-info-params;
+ }
}
}
}
diff --git a/rwcal/rift/cal/client.py b/rwcal/rift/cal/client.py
index 4717b0b..d6b17bb 100644
--- a/rwcal/rift/cal/client.py
+++ b/rwcal/rift/cal/client.py
@@ -57,7 +57,7 @@
def upload_image(self, location, name=None):
"""Onboard image to cloudsim server."""
- image = RwcalYang.ImageInfoItem()
+ image = RwcalYang.YangData_RwProject_Project_VimResources_ImageinfoList()
image.name = name or os.path.basename(location)
image.location = location
image.disk_format = "qcow2"
diff --git a/rwcal/rift/cal/rwcal_status.py b/rwcal/rift/cal/rwcal_status.py
index 6867140..2978e29 100644
--- a/rwcal/rift/cal/rwcal_status.py
+++ b/rwcal/rift/cal/rwcal_status.py
@@ -22,6 +22,7 @@
import functools
import gi
gi.require_version('RwTypes', '1.0')
+gi.require_version('RwCal', '1.0')
from gi.repository import RwTypes, RwCal
diff --git a/rwcal/rift/cal/server/app.py b/rwcal/rift/cal/server/app.py
index 355d653..230b540 100644
--- a/rwcal/rift/cal/server/app.py
+++ b/rwcal/rift/cal/server/app.py
@@ -481,6 +481,18 @@
),
),
+ (r"/api/get_virtual_link_by_name", CalRequestHandler,
+ mk_attrs(
+ cal_method="get_virtual_link_by_name",
+ input_params=[
+ RPCParam("link_name"),
+ ],
+ output_params=[
+ RPCParam("response", "VirtualLinkInfoParams"),
+ ],
+ ),
+ ),
+
(r"/api/get_virtual_link_list", CalRequestHandler,
mk_attrs(
cal_method="get_virtual_link_list",
diff --git a/rwcal/rift/cal/server/server.py b/rwcal/rift/cal/server/server.py
index ef8b0d4..c115b78 100644
--- a/rwcal/rift/cal/server/server.py
+++ b/rwcal/rift/cal/server/server.py
@@ -113,7 +113,7 @@
"""Start the server."""
cal = self.get_cal_interface()
- account = RwcalYang.CloudAccount(account_type="cloudsim")
+ account = RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList(account_type="cloudsim")
tornado.platform.asyncio.AsyncIOMainLoop().install()
loop = asyncio.get_event_loop()
diff --git a/rwcal/src/CMakeLists.txt b/rwcal/src/CMakeLists.txt
index 9bbe77f..655f4b0 100644
--- a/rwcal/src/CMakeLists.txt
+++ b/rwcal/src/CMakeLists.txt
@@ -31,8 +31,6 @@
rw_vx_plugin
peas-1.0)
-add_dependencies(rwcal_api rwmanifest_yang.headers)
+install(TARGETS rwcal_api LIBRARY DESTINATION usr/lib COMPONENT ${INSTALL_COMPONENT})
-install(TARGETS rwcal_api LIBRARY DESTINATION usr/lib COMPONENT ${PKG_LONG_NAME})
-
-install(PROGRAMS rwvim.py DESTINATION usr/bin COMPONENT ${PKG_LONG_NAME})
+install(PROGRAMS rwvim.py DESTINATION usr/bin COMPONENT ${INSTALL_COMPONENT})
diff --git a/rwcal/test/CMakeLists.txt b/rwcal/test/CMakeLists.txt
index 79e66c5..637d9ff 100644
--- a/rwcal/test/CMakeLists.txt
+++ b/rwcal/test/CMakeLists.txt
@@ -62,6 +62,6 @@
RIFT.ware-ready.py
openstack_resources.py
DESTINATION usr/bin
- COMPONENT ${PKG_LONG_NAME}
+ COMPONENT ${INSTALL_COMPONENT}
)
diff --git a/rwcal/test/aws_resources.py b/rwcal/test/aws_resources.py
index 875de56..7f00176 100644
--- a/rwcal/test/aws_resources.py
+++ b/rwcal/test/aws_resources.py
@@ -67,7 +67,7 @@
"""
Returns AWS cal account
"""
- account = RwcalYang.CloudAccount()
+ account = RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList()
account.account_type = "aws"
account.aws.key = kwargs['key']
account.aws.secret = kwargs['secret']
@@ -158,7 +158,7 @@
Create Mission Control VM in AWS
"""
logger.info("Creating mission control VM")
- vdu = RwcalYang.VDUInitParams()
+ vdu = RwcalYang.YangData_RwProject_Project_VduInitParams()
vdu.name = MISSION_CONTROL_NAME
vdu.image_id = RIFT_IMAGE_AMI
vdu.flavor_id = 'c3.large'
@@ -173,7 +173,7 @@
inst=driver.get_instance(self._mc_id)
inst.wait_until_running()
- rc,rs =self._cal.get_vdu(self._acct,self._mc_id)
+ rc,rs =self._cal.get_vdu(self._acct,self._mc_id, "")
assert rc == RwStatus.SUCCESS
self._mc_public_ip = rs.public_ip
self._mc_private_ip = rs.management_ip
@@ -206,7 +206,7 @@
salt_master=self._mc_private_ip
node_id = str(uuid.uuid4())
- vdu = RwcalYang.VDUInitParams()
+ vdu = RwcalYang.YangData_RwProject_Project_VduInitParams()
vdu.name = LAUNCHPAD_NAME
vdu.image_id = RIFT_IMAGE_AMI
vdu.flavor_id = 'c3.xlarge'
@@ -223,7 +223,7 @@
inst=driver.get_instance(self._lp_id)
inst.wait_until_running()
- rc,rs =self._cal.get_vdu(self._acct,self._lp_id)
+ rc,rs =self._cal.get_vdu(self._acct,self._lp_id, "")
assert rc == RwStatus.SUCCESS
self._lp_public_ip = rs.public_ip
diff --git a/rwcal/test/cal_module_test/CMakeLists.txt b/rwcal/test/cal_module_test/CMakeLists.txt
index f637c28..f23e311 100644
--- a/rwcal/test/cal_module_test/CMakeLists.txt
+++ b/rwcal/test/cal_module_test/CMakeLists.txt
@@ -23,19 +23,22 @@
PROGRAMS
cal_module_test
DESTINATION usr/rift/systemtest/cal_module_test
- COMPONENT ${PKG_LONG_NAME})
+ COMPONENT ${INSTALL_COMPONENT}
+ )
install(
FILES
pytest/conftest.py
pytest/cal_module_test.py
DESTINATION usr/rift/systemtest/cal_module_test/pytest
- COMPONENT ${PKG_LONG_NAME})
+ COMPONENT ${INSTALL_COMPONENT}
+ )
install(
FILES
racfg/cal_module_test.racfg
DESTINATION
usr/rift/systemtest/cal_module_test
- COMPONENT ${PKG_LONG_NAME})
+ COMPONENT ${INSTALL_COMPONENT}
+ )
diff --git a/rwcal/test/cal_module_test/pytest/cal_module_test.py b/rwcal/test/cal_module_test/pytest/cal_module_test.py
index ca3568f..170e664 100644
--- a/rwcal/test/cal_module_test/pytest/cal_module_test.py
+++ b/rwcal/test/cal_module_test/pytest/cal_module_test.py
@@ -32,6 +32,8 @@
import pytest
+import rift.auto.mano
+
from gi import require_version
require_version('RwCal', '1.0')
@@ -45,6 +47,8 @@
logger = logging.getLogger('rwcal')
logging.basicConfig(level=logging.INFO)
+def short_id():
+ return uuid.uuid4().hex[:10]
class CloudConfig(object):
def __init__(self, cal, account):
@@ -142,7 +146,7 @@
Return:
CloudAccount details
"""
- account = RwcalYang.CloudAccount.from_dict({
+ account = RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList.from_dict({
"account_type": "aws",
"aws": {
"key": option.aws_user,
@@ -160,8 +164,8 @@
Returns:
FlavorInfoItem
"""
- flavor = RwcalYang.FlavorInfoItem.from_dict({
- "name": str(uuid.uuid4()),
+ flavor = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList.from_dict({
+ "name": rift.auto.mano.resource_name(short_id()),
"vm_flavor": {
"memory_mb": 1024,
"vcpu_count": 1,
@@ -177,15 +181,15 @@
Returns:
VDUInitParams
"""
- vdu = RwcalYang.VDUInitParams.from_dict({
- "name": str(uuid.uuid4()),
+ vdu = RwcalYang.YangData_RwProject_Project_VduInitParams.from_dict({
+ "name": rift.auto.mano.resource_name(short_id()),
"node_id": "123456789012345",
"image_id": self.image_id,
"flavor_id": "t2.micro"
})
c1 = vdu.connection_points.add()
- c1.name = str(uuid.uuid4())
+ c1.name = rift.auto.mano.resource_name(short_id())
c1.virtual_link_id = self.virtual_link_id
return vdu
@@ -199,8 +203,8 @@
Returns:
VirtualLinkReqParams
"""
- vlink = RwcalYang.VirtualLinkReqParams.from_dict({
- "name": str(uuid.uuid4()),
+ vlink = RwcalYang.YangData_RwProject_Project_VirtualLinkReqParams.from_dict({
+ "name": rift.auto.mano.resource_name(short_id()),
"subnet": '172.31.64.0/20',
})
@@ -273,7 +277,7 @@
Return:
CloudAccount details
"""
- account = RwcalYang.CloudAccount.from_dict({
+ account = RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList.from_dict({
'name': "cloudsim",
'account_type':'cloudsim_proxy'})
@@ -285,8 +289,8 @@
Returns:
ImageInfoItem
"""
- image = RwcalYang.ImageInfoItem.from_dict({
- "name": str(uuid.uuid4()),
+ image = RwcalYang.YangData_RwProject_Project_VimResources_ImageinfoList.from_dict({
+ "name": rift.auto.mano.resource_name(short_id()),
"location": os.path.join(os.getenv("RIFT_ROOT"), "images/rift-root-latest.qcow2"),
"disk_format": "qcow2",
"container_format": "bare",
@@ -300,8 +304,8 @@
Returns:
FlavorInfoItem
"""
- flavor = RwcalYang.FlavorInfoItem.from_dict({
- "name": str(uuid.uuid4()),
+ flavor = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList.from_dict({
+ "name": rift.auto.mano.resource_name(short_id()),
"vm_flavor": {
"memory_mb": 16392,
"vcpu_count": 4,
@@ -316,15 +320,15 @@
Returns:
VDUInitParams
"""
- vdu = RwcalYang.VDUInitParams.from_dict({
- "name": str(uuid.uuid4()),
+ vdu = RwcalYang.YangData_RwProject_Project_VduInitParams.from_dict({
+ "name": rift.auto.mano.resource_name(short_id()),
"node_id": "123456789012345",
"image_id": self.image_id,
"flavor_id": self.flavor_id,
})
c1 = vdu.connection_points.add()
- c1.name = str(uuid.uuid4())
+ c1.name = rift.auto.mano.resource_name(short_id())
c1.virtual_link_id = self.virtual_link_id
return vdu
@@ -335,8 +339,8 @@
Returns:
VirtualLinkReqParams
"""
- vlink = RwcalYang.VirtualLinkReqParams.from_dict({
- "name": str(uuid.uuid4()),
+ vlink = RwcalYang.YangData_RwProject_Project_VirtualLinkReqParams.from_dict({
+ "name": rift.auto.mano.resource_name(short_id()),
"subnet": '192.168.1.0/24',
})
@@ -382,7 +386,7 @@
Returns:
CloudAccount
"""
- acct = RwcalYang.CloudAccount.from_dict({
+ acct = RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList.from_dict({
"account_type": "openstack",
"openstack": {
"key": option.os_user,
@@ -408,8 +412,8 @@
Returns:
ImageInfoItem
"""
- image = RwcalYang.ImageInfoItem.from_dict({
- "name": str(uuid.uuid4()),
+ image = RwcalYang.YangData_RwProject_Project_VimResources_ImageinfoList.from_dict({
+ "name": rift.auto.mano.resource_name(short_id()),
"location": os.path.join(os.getenv("RIFT_ROOT"), "images/rift-root-latest.qcow2"),
"disk_format": "qcow2",
"container_format": "bare",
@@ -423,8 +427,8 @@
Returns:
FlavorInfoItem
"""
- flavor = RwcalYang.FlavorInfoItem.from_dict({
- "name": str(uuid.uuid4()),
+ flavor = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList.from_dict({
+ "name": rift.auto.mano.resource_name(short_id()),
"vm_flavor": {
"memory_mb": 16392,
"vcpu_count": 4,
@@ -441,9 +445,15 @@
node = flavor.guest_epa.numa_node_policy.node.add()
node.id = i
if i == 0:
- node.vcpu = [0, 1]
+ vcpu0 = node.vcpu.add()
+ vcpu0.id = 0
+ vcpu1 = node.vcpu.add()
+ vcpu1.id = 1
elif i == 1:
- node.vcpu = [2, 3]
+ vcpu2 = node.vcpu.add()
+ vcpu2.id = 2
+ vcpu3 = node.vcpu.add()
+ vcpu3.id = 3
node.memory_mb = 8196
dev = flavor.guest_epa.pcie_device.add()
@@ -458,15 +468,15 @@
Returns:
VDUInitParams
"""
- vdu = RwcalYang.VDUInitParams.from_dict({
- "name": str(uuid.uuid4()),
+ vdu = RwcalYang.YangData_RwProject_Project_VduInitParams.from_dict({
+ "name": rift.auto.mano.resource_name(short_id()),
"node_id": "123456789012345",
"image_id": self.image_id,
"flavor_id": self.flavor_id,
})
c1 = vdu.connection_points.add()
- c1.name = str(uuid.uuid4())
+ c1.name = rift.auto.mano.resource_name(short_id())
c1.virtual_link_id = self.virtual_link_id
return vdu
@@ -477,8 +487,8 @@
Returns:
VirtualLinkReqParams
"""
- vlink = RwcalYang.VirtualLinkReqParams.from_dict({
- "name": str(uuid.uuid4()),
+ vlink = RwcalYang.YangData_RwProject_Project_VirtualLinkReqParams.from_dict({
+ "name": rift.auto.mano.resource_name(short_id()),
"subnet": '192.168.1.0/24',
})
@@ -596,7 +606,7 @@
ids = []
for vdu in vdus.vdu_info_list:
- status, vdu_single = cal.get_vdu(account, vdu.vdu_id)
+ status, vdu_single = cal.get_vdu(account, vdu.vdu_id, "")
assert status == RwStatus.SUCCESS
assert vdu_single.vdu_id == vdu.vdu_id
ids.append(vdu.vdu_id)
@@ -607,7 +617,7 @@
account = cloud_config.account
cal = cloud_config.cal
- vdu_modify = RwcalYang.VDUModifyParams()
+ vdu_modify = RwcalYang.YangData_RwProject_Project_VduModifyParams()
vdu_modify.vdu_id = cloud_config.vdu_id
c1 = vdu_modify.connection_points_add.add()
c1.name = "c_modify1"
diff --git a/rwcal/test/cal_module_test/racfg/cal_module_test.racfg b/rwcal/test/cal_module_test/racfg/cal_module_test.racfg
index cd6d57a..a3ac4b1 100644
--- a/rwcal/test/cal_module_test/racfg/cal_module_test.racfg
+++ b/rwcal/test/cal_module_test/racfg/cal_module_test.racfg
@@ -4,8 +4,8 @@
"target_vm":"VM",
"test_description":"System test targeting module tests for CAL accounts",
"run_as_root": true,
- "status":"working",
- "keywords":["nightly","smoke","MANO","openstack"],
+ "status":"broken",
+ "keywords":["nightly","MANO","openstack"],
"timelimit": 2400,
"networks":[],
"vms":[
diff --git a/rwcal/test/cloudtool_cal.py b/rwcal/test/cloudtool_cal.py
index 92f4891..1bc9da8 100755
--- a/rwcal/test/cloudtool_cal.py
+++ b/rwcal/test/cloudtool_cal.py
@@ -167,7 +167,7 @@
for network in netlist.networkinfo_list:
print(network)
- vm = RwcalYang.VMInfoItem()
+ vm = RwcalYang.YangData_RwProject_Project_VimResources_VminfoList()
vm.vm_name = vm_name
vm.flavor_id = size.id
vm.image_id = image.id
@@ -176,7 +176,7 @@
nets = dict()
for network in netlist.networkinfo_list:
if network.network_name != "public":
- nwitem = RwcalYang.VMInfoItem_NetworkList()
+ nwitem = RwcalYang.YangData_RwProject_Project_VimResources_VminfoList_NetworkList()
nwitem.network_id = network.network_id
nets[network.network_name] = nwitem
@@ -422,7 +422,7 @@
print("creating image \"%s\" using %s ..." % \
(cmdargs.image_name, cmdargs.file_name))
- img = RwcalYang.ImageInfoItem()
+ img = RwcalYang.YangData_RwProject_Project_VimResources_ImageinfoList()
img.name = cmdargs.image_name
img.location = cmdargs.file_name
img.disk_format = "qcow2"
@@ -452,7 +452,7 @@
print(flv)
elif cmdargs.which == 'create':
account.openstack.key = 'admin'
- flavor = RwcalYang.FlavorInfoItem()
+ flavor = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList()
flavor.name = cmdargs.flavor_name
flavor.vm_flavor.memory_mb = cmdargs.memory_size
flavor.vm_flavor.vcpu_count = cmdargs.vcpu_count
@@ -961,7 +961,7 @@
if cmdargs.provider_type == 'OPENSTACK':
- account = RwcalYang.CloudAccount()
+ account = RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList()
account.account_type = "openstack"
account.openstack.key = cmdargs.user
account.openstack.secret = cmdargs.passwd
diff --git a/rwcal/test/ec2.py b/rwcal/test/ec2.py
index 59ad049..175017a 100644
--- a/rwcal/test/ec2.py
+++ b/rwcal/test/ec2.py
@@ -178,7 +178,7 @@
kwds = {'subnet_id': __default_subnet__}
else:
kwds = {'network_interfaces': net_ifs}
- print net_ifs
+ print(net_ifs)
new_reservation = self._conn.run_instances(
image_id=self._ami,
@@ -220,7 +220,7 @@
addr = "%s.%s.10%d.0/25" % (subnet_addrs_split[0], subnet_addrs_split[1], i)
try:
subnet = vpc_conn.create_subnet(vpc.id, addr)
- except boto.exception.EC2ResponseError, e:
+ except boto.exception.EC2ResponseError as e:
if 'InvalidSubnet.Conflict' == e.error_code:
subnet = vpc_conn.get_all_subnets(filters=[('vpcId', vpc.id), ('cidrBlock', addr)])[0]
else:
diff --git a/rwcal/test/openstack_resources.py b/rwcal/test/openstack_resources.py
index f7fb00d..b4bc5ad 100755
--- a/rwcal/test/openstack_resources.py
+++ b/rwcal/test/openstack_resources.py
@@ -107,7 +107,7 @@
"""
Returns cal account
"""
- account = RwcalYang.CloudAccount()
+ account = RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList()
account.account_type = "openstack"
account.openstack.key = openstack_info['username']
account.openstack.secret = openstack_info['password']
@@ -222,7 +222,7 @@
Creates a VM. The VM name is derived from username
"""
- vm = RwcalYang.VDUInitParams()
+ vm = RwcalYang.YangData_RwProject_Project_VduInitParams()
vm.name = name
vm.flavor_id = self._flavor_id
vm.image_id = self._image_id
@@ -239,7 +239,7 @@
def create_network(self, name):
logger.info("Creating network with name: %s" %name)
- network = RwcalYang.NetworkInfoItem()
+ network = RwcalYang.YangData_RwProject_Project_VimResources_NetworkinfoList()
network.network_name = name
network.subnet = openstack_info['subnets'][openstack_info['subnet_index']]
@@ -265,7 +265,7 @@
def create_image(self, location):
- img = RwcalYang.ImageInfoItem()
+ img = RwcalYang.YangData_RwProject_Project_VimResources_ImageinfoList()
img.name = basename(location)
img.location = location
img.disk_format = "qcow2"
@@ -299,7 +299,7 @@
"""
Create Flavor suitable for rift_ping_pong VNF
"""
- flavor = RwcalYang.FlavorInfoItem()
+ flavor = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList()
flavor.name = FLAVOR_NAME
flavor.vm_flavor.memory_mb = 16384 # 16GB
flavor.vm_flavor.vcpu_count = 4
diff --git a/rwcal/test/test_aws_image_get.py b/rwcal/test/test_aws_image_get.py
new file mode 100644
index 0000000..c9b3738
--- /dev/null
+++ b/rwcal/test/test_aws_image_get.py
@@ -0,0 +1,218 @@
+#!/usr/bin/python3
+
+#
+# Copyright 2016 RIFT.IO Inc
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+import sys
+import rw_peas
+from gi import require_version
+require_version('RwCal', '1.0')
+
+from gi.repository import RwcalYang
+from gi.repository.RwTypes import RwStatus
+import argparse
+import logging
+import rwlogger
+
+persistent_resources = {
+ 'vms' : [],
+ 'networks' : [],
+}
+
+
+RIFT_IMAGE_AMI = 'ami-7070231a'
+
+logging.basicConfig(level=logging.ERROR)
+logger = logging.getLogger('rift.cal.awsresources')
+logger.setLevel(logging.INFO)
+
+def get_cal_plugin():
+ """
+ Load AWS cal plugin
+ """
+ plugin = rw_peas.PeasPlugin('rwcal_aws', 'RwCal-1.0')
+ engine, info, extension = plugin()
+ cal = plugin.get_interface("Cloud")
+ rwloggerctx = rwlogger.RwLog.Ctx.new("Cal-Log")
+ try:
+ rc = cal.init(rwloggerctx)
+ assert rc == RwStatus.SUCCESS
+ except Exception as e:
+ logger.error("ERROR:Cal plugin instantiation failed with exception %s", repr(e))
+ else:
+ logger.info("AWS Cal plugin successfully instantiated")
+ return cal
+
+def get_cal_account(**kwargs):
+ """
+ Returns AWS cal account
+ """
+ account = RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList()
+ account.account_type = "aws"
+ account.aws.key = kwargs['key']
+ account.aws.secret = kwargs['secret']
+ account.aws.region = kwargs['region']
+ if 'ssh_key' in kwargs and kwargs['ssh_key'] is not None:
+ account.aws.ssh_key = kwargs['ssh_key']
+ account.aws.availability_zone = kwargs['availability_zone']
+ if 'vpcid' in kwargs and kwargs['vpcid'] is not None:
+ account.aws.vpcid = kwargs['vpcid']
+ if 'default_subnet_id' in kwargs and kwargs['default_subnet_id'] is not None:
+ account.aws.default_subnet_id = kwargs['default_subnet_id']
+ return account
+
+class AWSResources(object):
+ """
+ Class with methods to manage AWS resources
+ """
+ def __init__(self, **kwargs):
+ self._cal = get_cal_plugin()
+ self._acct = get_cal_account(**kwargs)
+
+ def get_image_list(self):
+ """
+ Get Image list
+ """
+ logger.info("Initiating Get image list")
+ rc, rsp = self._cal.get_image_list(self._acct)
+
+ print("Return resp: rsp ", rsp)
+
+ logger.info("Get image list complete")
+
+
+ def get_image(self, image_ami_id):
+ """
+ Get Image from AMI id
+ """
+ logger.info("Initiating Get image")
+ rc, rsp = self._cal.get_image(self._acct, image_ami_id)
+
+ print("Return code: rc ", rc)
+ print("Return resp: rsp ", rsp)
+
+ logger.info("Get image complete")
+
+
+
+def main():
+ """
+ Main routine
+
+ New AWS credentials were created as follows:
+ User: aws_riftio
+ Access Key ID: AKIAJQ4D3X5WO3P6JXKA
+ Secret Access key: 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
+ Pasword: RhN*q2ze*fpY
+
+ The following AWS cloud account config can be used on LP CLI:
+ cloud account AWS account-type aws aws key AKIAJQ4D3X5WO3P6JXKA secret 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 region us-east-1 vpcid vpc-cb1cd2af ssh-key rift-awskey availability-zone us-east-1c default-subnet-id subnet-73796d04 plugin-name rwcal_aws dynamic-flavor-support true`
+ """
+ parser = argparse.ArgumentParser(description='Script to manage AWS resources')
+
+ parser.add_argument('--aws-key',
+ action = 'store',
+ dest = 'aws_key',
+ type = str,
+ help='AWS key')
+
+ parser.add_argument('--aws-secret',
+ action = 'store',
+ dest = 'aws_secret',
+ type = str,
+ help='AWS secret')
+
+ parser.add_argument('--aws-region',
+ action = 'store',
+ dest = 'aws_region',
+ type = str,
+ help='AWS region')
+
+ parser.add_argument('--aws-az',
+ action = 'store',
+ dest = 'aws_az',
+ type = str,
+ help='AWS Availability zone')
+
+ parser.add_argument('--aws-sshkey',
+ action = 'store',
+ dest = 'aws_sshkey',
+ type = str,
+ help='AWS SSH Key to login to instance')
+
+ parser.add_argument('--aws-vpcid',
+ action = 'store',
+ dest = 'aws_vpcid',
+ type = str,
+ help='AWS VPC ID to use to indicate non default VPC')
+
+ parser.add_argument('--aws-default-subnet',
+ action = 'store',
+ dest = 'aws_default_subnet',
+ type = str,
+ help='AWS Default subnet id in VPC to be used for mgmt network')
+
+ argument = parser.parse_args()
+
+ '''
+ User: aws_riftio
+ Access Key ID: AKIAJQ4D3X5WO3P6JXKA
+ Secret Access key: 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
+ Pasword: RhN*q2ze*fpY
+
+ cloud account AWS account-type aws aws key AKIAJQ4D3X5WO3P6JXKA secret 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 region us-east-1 vpcid vpc-cb1cd2af ssh-key rift-awskey availability-zone us-east-1c default-subnet-id subnet-73796d04 plugin-name rwcal_aws dynamic-flavor-support true
+ '''
+
+ argument.aws_key = "AKIAJQ4D3X5WO3P6JXKA"
+ argument.aws_secret = "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"
+ argument.aws_region = "us-east-1"
+ argument.aws_az = "us-east-1c"
+ argument.aws_sshkey = "rift-awskey"
+ argument.aws_vpcid = "vpc-cb1cd2af"
+ argument.aws_default_subnet = "subnet-73796d04"
+
+ if (argument.aws_key is None or argument.aws_secret is None or argument.aws_region is None or
+ argument.aws_az is None):
+ logger.error("Missing mandatory params. AWS Key, Secret, Region, AZ and SSH key are mandatory params")
+ sys.exit(-1)
+
+
+ ### Start processing
+ logger.info("Instantiating cloud-abstraction-layer")
+ drv = AWSResources(key=argument.aws_key, secret=argument.aws_secret, region=argument.aws_region, availability_zone = argument.aws_az,
+ ssh_key = argument.aws_sshkey, vpcid = argument.aws_vpcid, default_subnet_id = argument.aws_default_subnet)
+ logger.info("Instantiating cloud-abstraction-layer.......[Done]")
+
+ logger.info("Testing image list APIs")
+ drv.get_image_list()
+ logger.info("Finished testing image list APIs")
+
+ logger.info("Testing get image APIs for rift ping image - Present in Owner account")
+ drv.get_image('ami-eb0a5f81')
+ logger.info("Finished testing get image APIs")
+
+ logger.info("Testing get image APIs for public vyos image")
+ drv.get_image('ami-9ea315f6')
+ logger.info("Finished testing get image APIs")
+
+ logger.info("Testing get image APIs for public PalotAlto FW image")
+ drv.get_image('ami-34ca984f')
+ logger.info("Finished testing get image APIs")
+
+
+if __name__ == '__main__':
+ main()
diff --git a/rwcal/test/test_container_cal.py b/rwcal/test/test_container_cal.py
index 3ec5ca1..fe3105c 100644
--- a/rwcal/test/test_container_cal.py
+++ b/rwcal/test/test_container_cal.py
@@ -66,7 +66,7 @@
# The account object is not currently used, but it is required by the CAL
# interface, so we create an empty object here to represent it.
- account = RwcalYang.CloudAccount()
+ account = RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList()
account.account_type = "lxc"
# Make sure that any containers that were previously created have been
@@ -88,7 +88,7 @@
logger.info(args.rootfs)
# Create an image that can be used to create VMs
- image = RwcalYang.ImageInfoItem()
+ image = RwcalYang.YangData_RwProject_Project_VimResources_ImageinfoList()
image.name = 'rift-master'
image.lxc.size = '2.5G'
image.lxc.template_path = template
@@ -99,7 +99,7 @@
# Create a VM
vms = []
for index in range(args.num_vms):
- vm = RwcalYang.VMInfoItem()
+ vm = RwcalYang.YangData_RwProject_Project_VimResources_VminfoList()
vm.vm_name = 'rift-s{}'.format(index + 1)
vm.image_id = image.id
@@ -108,14 +108,14 @@
vms.append(vm)
# Create the default and data networks
- network = RwcalYang.NetworkInfoItem(network_name='virbr0')
+ network = RwcalYang.YangData_RwProject_Project_VimResources_NetworkinfoList(network_name='virbr0')
cal.create_network(account, network)
os.system('/usr/sbin/brctl show')
# Create pairs of ports to connect the networks
for index, vm in enumerate(vms):
- port = RwcalYang.PortInfoItem()
+ port = RwcalYang.YangData_RwProject_Project_VimResources_PortinfoList()
port.port_name = "eth0"
port.network_id = network.network_id
port.vm_id = vm.vm_id
diff --git a/rwcal/test/test_openstack_install.py b/rwcal/test/test_openstack_install.py
index 0e4a61f..98a00f8 100644
--- a/rwcal/test/test_openstack_install.py
+++ b/rwcal/test/test_openstack_install.py
@@ -370,9 +370,9 @@
def _get_cal_account(self):
"""
- Creates an object for class RwcalYang.CloudAccount()
+ Creates an object for class RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList()
"""
- account = RwcalYang.CloudAccount()
+ account = RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList()
account.account_type = "openstack"
account.openstack.key = "{}_user".format(self.test_prefix)
account.openstack.secret = "mypasswd"
diff --git a/rwcal/test/test_rwcal_openstack.py b/rwcal/test/test_rwcal_openstack.py
index 8278a5e..c2f54c2 100644
--- a/rwcal/test/test_rwcal_openstack.py
+++ b/rwcal/test/test_rwcal_openstack.py
@@ -43,9 +43,9 @@
# Important information about openstack installation. This needs to be manually verified
#
openstack_info = {
- 'username' : 'xxxx',
- 'password' : 'xxxxxx',
- 'auth_url' : 'http://10.66.4.19:5000/v2.0/',
+ 'username' : 'xxxxxx',
+ 'password' : 'xxxxx',
+ 'auth_url' : 'http://10.66.4.102:5000/v2.0/',
'project_name' : 'xxxxx',
'mgmt_network' : 'private',
'reserved_flavor' : 'm1.medium',
@@ -73,9 +73,9 @@
def get_cal_account():
"""
- Creates an object for class RwcalYang.CloudAccount()
+ Creates an object for class RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList()
"""
- account = RwcalYang.CloudAccount()
+ account = RwcalYang.YangData_RwProject_Project_CloudAccounts_CloudAccountList()
account.name = "Gruntxx"
account.account_type = "openstack"
account.openstack.key = openstack_info['username']
@@ -236,9 +236,9 @@
def _get_image_info_request(self):
"""
- Returns request object of type RwcalYang.ImageInfoItem()
+ Returns request object of type RwcalYang.YangData_RwProject_Project_VimResources_ImageinfoList()
"""
- img = RwcalYang.ImageInfoItem()
+ img = RwcalYang.YangData_RwProject_Project_VimResources_ImageinfoList()
img.name = "rift.cal.unittest.image"
img.location = '/net/sharedfiles/home1/common/vm/rift-root-latest.qcow2'
img.disk_format = "qcow2"
@@ -286,9 +286,9 @@
def _get_flavor_info_request(self):
"""
- Returns request object of type RwcalYang.FlavorInfoItem()
+ Returns request object of type RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList()
"""
- flavor = RwcalYang.FlavorInfoItem()
+ flavor = RwcalYang.YangData_RwProject_Project_VimResources_FlavorinfoList()
flavor.name = 'rift.cal.unittest.flavor'
flavor.vm_flavor.memory_mb = 16384 # 16GB
flavor.vm_flavor.vcpu_count = 4
@@ -363,7 +363,7 @@
"""
Returns request object of type RwcalYang.VMInfoItem
"""
- vm = RwcalYang.VMInfoItem()
+ vm = RwcalYang.YangData_RwProject_Project_VimResources_VminfoList()
vm.vm_name = 'rift.cal.unittest.vm'
vm.flavor_id = flavor_id
vm.image_id = image_id
@@ -695,9 +695,9 @@
def _get_network_info_request(self):
"""
- Returns request object of type RwcalYang.NetworkInfoItem
+ Returns request object of type RwcalYang.YangData_RwProject_Project_VimResources_NetworkinfoList
"""
- network = RwcalYang.NetworkInfoItem()
+ network = RwcalYang.YangData_RwProject_Project_VimResources_NetworkinfoList()
network.network_name = 'rift.cal.unittest.network'
network.subnet = '192.168.16.0/24'
if openstack_info['physical_network']:
@@ -762,9 +762,9 @@
def _get_port_info_request(self, network_id, vm_id):
"""
- Returns an object of type RwcalYang.PortInfoItem
+ Returns an object of type RwcalYang.YangData_RwProject_Project_VimResources_PortinfoList
"""
- port = RwcalYang.PortInfoItem()
+ port = RwcalYang.YangData_RwProject_Project_VimResources_PortinfoList()
port.port_name = 'rift.cal.unittest.port'
port.network_id = network_id
if vm_id != None:
@@ -887,10 +887,14 @@
"""
logger.info("Openstack-CAL-Test: Test Get VDU List APIs")
rc, rsp = self.cal.get_vdu_list(self._acct)
- self.assertEqual(rc, RwStatus.SUCCESS)
+ self.assertEqual(rc.status, RwStatus.SUCCESS)
logger.info("Openstack-CAL-Test: Received %d VDUs" %(len(rsp.vdu_info_list)))
for vdu in rsp.vdu_info_list:
- rc, vdu2 = self.cal.get_vdu(self._acct, vdu.vdu_id)
+ rc, vdu2 = self.cal.get_vdu(self._acct, vdu.vdu_id, "")
+ self.assertEqual(rc.status, RwStatus.SUCCESS)
+ # Make changes for the third argument (currently None for mgmt_network).
+ # This is the mgmt_network published in the vdur (vdu.mgmt_network).
+ # Pass accordingly as per the use case of the test.
self.assertEqual(vdu2.vdu_id, vdu.vdu_id)
@@ -909,9 +913,9 @@
def _get_virtual_link_request_info(self):
"""
- Returns object of type RwcalYang.VirtualLinkReqParams
+ Returns object of type RwcalYang.YangData_RwProject_Project_VirtualLinkReqParams
"""
- vlink = RwcalYang.VirtualLinkReqParams()
+ vlink = RwcalYang.YangData_RwProject_Project_VirtualLinkReqParams()
vlink.name = 'rift.cal.virtual_link'
vlink.subnet = '192.168.1.0/24'
if openstack_info['physical_network']:
@@ -925,9 +929,9 @@
def _get_vdu_request_info(self, virtual_link_id):
"""
- Returns object of type RwcalYang.VDUInitParams
+ Returns object of type RwcalYang.YangData_RwProject_Project_VduInitParams
"""
- vdu = RwcalYang.VDUInitParams()
+ vdu = RwcalYang.YangData_RwProject_Project_VduInitParams()
vdu.name = "cal.vdu"
vdu.node_id = OpenStackTest.NodeID
vdu.image_id = self._image.id
@@ -963,9 +967,9 @@
def _get_vdu_modify_request_info(self, vdu_id, virtual_link_id):
"""
- Returns object of type RwcalYang.VDUModifyParams
+ Returns object of type RwcalYang.YangData_RwProject_Project_VduModifyParams
"""
- vdu = RwcalYang.VDUModifyParams()
+ vdu = RwcalYang.YangData_RwProject_Project_VduModifyParams()
vdu.vdu_id = vdu_id
c1 = vdu.connection_points_add.add()
c1.name = "c_modify1"
@@ -975,9 +979,9 @@
def _get_rbsh_vdu_request_info(self, vlink_list):
"""
- Returns object of type RwcalYang.VDUInitParams
+ Returns object of type RwcalYang.YangData_RwProject_Project_VduInitParams
"""
- vdu = RwcalYang.VDUInitParams()
+ vdu = RwcalYang.YangData_RwProject_Project_VduInitParams()
vdu.name = "cal_rbsh_vdu"
vdu.vm_flavor.memory_mb = 2048
vdu.vm_flavor.vcpu_count = 1
@@ -1034,7 +1038,7 @@
logger.info("Openstack-CAL-Test: Test Create Virtual Link API")
vlink_list = []
for ctr in range(3):
- vlink = RwcalYang.VirtualLinkReqParams()
+ vlink = RwcalYang.YangData_RwProject_Project_VirtualLinkReqParams()
vlink.name = 'rift.cal.virtual_link' + str(ctr)
vlink.subnet = '11.0.{}.0/24'.format(str(1 + ctr))
@@ -1062,7 +1066,11 @@
test_vdu_id = rsp
## Check if VDU get is successful
- rc, rsp = self.cal.get_vdu(self._acct, test_vdu_id)
+ rc, rsp = self.cal.get_vdu(self._acct, test_vdu_id, "")
+ # Make changes for the third argument (currently None for mgmt_network).
+ # This is the mgmt_network published in the vdur (vdu.mgmt_network).
+ # Pass accordingly as per the use case of the test.
+ self.assertEqual(rc.status, RwStatus.SUCCESS)
logger.debug("Get VDU response %s", rsp)
self.assertEqual(rsp.vdu_id, test_vdu_id)
@@ -1073,8 +1081,11 @@
vdu_state = 'inactive'
cp_state = 'inactive'
for i in range(15):
- rc, rsp = self.cal.get_vdu(self._acct, test_vdu_id)
- self.assertEqual(rc, RwStatus.SUCCESS)
+ rc, rsp = self.cal.get_vdu(self._acct, test_vdu_id, "")
+ # Make changes for the third argument (currently None for mgmt_network).
+ # This is the mgmt_network published in the vdur (vdu.mgmt_network).
+ # Pass accordingly as per the use case of the test.
+ self.assertEqual(rc.status, RwStatus.SUCCESS)
logger.info("Openstack-CAL-Test: Iter %d VDU with id : %s. Reached State : %s, mgmt ip %s" %(i, test_vdu_id, rsp.state, rsp.management_ip))
if (rsp.state == 'active') and ('management_ip' in rsp) and ('public_ip' in rsp):
vdu_state = 'active'
@@ -1094,7 +1105,7 @@
### Check vdu list as well
rc, rsp = self.cal.get_vdu_list(self._acct)
- self.assertEqual(rc, RwStatus.SUCCESS)
+ self.assertEqual(rc.status, RwStatus.SUCCESS)
found = False
logger.debug("Get VDU response %s", rsp)
for vdu in rsp.vdu_info_list:
@@ -1103,7 +1114,7 @@
self.assertEqual(found, True)
logger.info("Openstack-CAL-Test: Passed VDU list" )
- @unittest.skip("Skipping test_create_delete_virtual_link_and_vdu")
+ #@unittest.skip("Skipping test_create_delete_virtual_link_and_vdu")
def test_create_delete_virtual_link_and_vdu(self):
"""
Test to create VDU
@@ -1132,18 +1143,30 @@
vdu_id = rsp
## Check if VDU create is successful
- rc, rsp = self.cal.get_vdu(self._acct, rsp)
+ rc, rsp = self.cal.get_vdu(self._acct, rsp, "")
+ # Make changes for the third argument (currently None for mgmt_network).
+ # This is the mgmt_network published in the vdur (vdu.mgmt_network).
+ # Pass accordingly as per the use case of the test.
+
+ self.assertEqual(rc.status, RwStatus.SUCCESS)
self.assertEqual(rsp.vdu_id, vdu_id)
### Wait until vdu_state is active
for i in range(50):
- rc, rs = self.cal.get_vdu(self._acct, vdu_id)
- self.assertEqual(rc, RwStatus.SUCCESS)
+ rc, rs = self.cal.get_vdu(self._acct, vdu_id, "")
+ self.assertEqual(rc.status, RwStatus.SUCCESS)
+ # Make changes for the third argument (currently None for mgmt_network).
+ # This is the mgmt_network published in the vdur (vdu.mgmt_network).
+ # Pass accordingly as per the use case of the test.
+ self.assertEqual(rc.status, RwStatus.SUCCESS)
logger.info("Openstack-CAL-Test: VDU with id : %s. Reached State : %s" %(vdu_id, rs.state))
if rs.state == 'active':
break
- rc, rs = self.cal.get_vdu(self._acct, vdu_id)
- self.assertEqual(rc, RwStatus.SUCCESS)
+ rc, rs = self.cal.get_vdu(self._acct, vdu_id, "")
+ # Make changes for the third argument (currently None for mgmt_network).
+ # This is the mgmt_network published in the vdur (vdu.mgmt_network).
+ # Pass accordingly as per the use case of the test.
+ self.assertEqual(rc.status, RwStatus.SUCCESS)
self.assertEqual(rs.state, 'active')
logger.info("Openstack-CAL-Test: VDU with id : %s reached expected state : %s" %(vdu_id, rs.state))
logger.info("Openstack-CAL-Test: VDUInfo: %s" %(rs))
@@ -1174,7 +1197,7 @@
time.sleep(5)
### Verify that VDU and virtual link are successfully deleted
rc, rsp = self.cal.get_vdu_list(self._acct)
- self.assertEqual(rc, RwStatus.SUCCESS)
+ self.assertEqual(rc.status, RwStatus.SUCCESS)
for vdu in rsp.vdu_info_list:
self.assertNotEqual(vdu.vdu_id, vdu_id)
@@ -1188,9 +1211,9 @@
def _get_vol_vdu_request_info(self, vlink_list):
"""
- Returns object of type RwcalYang.VDUInitParams
+ Returns object of type RwcalYang.YangData_RwProject_Project_VduInitParams
"""
- vdu = RwcalYang.VDUInitParams()
+ vdu = RwcalYang.YangData_RwProject_Project_VduInitParams()
vdu.name = "cal_vdu"
vdu.vm_flavor.memory_mb = 512
vdu.vm_flavor.vcpu_count = 1
@@ -1230,7 +1253,7 @@
"""
logger.info("Openstack-CAL-Test: Test Create Virtual Link API")
vlink_list = []
- vlink = RwcalYang.VirtualLinkReqParams()
+ vlink = RwcalYang.YangData_RwProject_Project_VirtualLinkReqParams()
vlink.name = 'rift.cal.virtual_link'
vlink.subnet = '11.0.1.0/24'
@@ -1258,7 +1281,12 @@
test_vdu_id = rsp
## Check if VDU get is successful
- rc, rsp = self.cal.get_vdu(self._acct, test_vdu_id)
+ rc, rsp = self.cal.get_vdu(self._acct, test_vdu_id, "")
+ self.assertEqual(rc.status, RwStatus.SUCCESS)
+ # Make changes for the third argument (currently None for mgmt_network).
+ # This is the mgmt_network published in the vdur (vdu.mgmt_network).
+ # Pass accordingly as per the use case of the test.
+
logger.debug("Get VDU response %s", rsp)
self.assertEqual(rsp.vdu_id, test_vdu_id)
@@ -1269,8 +1297,11 @@
vdu_state = 'inactive'
cp_state = 'inactive'
for i in range(5):
- rc, rsp = self.cal.get_vdu(self._acct, test_vdu_id)
- self.assertEqual(rc, RwStatus.SUCCESS)
+ rc, rsp = self.cal.get_vdu(self._acct, test_vdu_id, "")
+ # Make changes for the third argument (currently None for mgmt_network).
+ # This is the mgmt_network published in the vdur (vdu.mgmt_network).
+ # Pass accordingly as per the use case of the test.
+ self.assertEqual(rc.status, RwStatus.SUCCESS)
logger.info("Openstack-CAL-Test: VDU with id : %s. Reached State : %s, mgmt ip %s" %(test_vdu_id, rsp.state, rsp.management_ip))
if (rsp.state == 'active') and ('management_ip' in rsp) and ('public_ip' in rsp):
vdu_state = 'active'
@@ -1294,7 +1325,7 @@
### Check vdu list as well
rc, rsp = self.cal.get_vdu_list(self._acct)
- self.assertEqual(rc, RwStatus.SUCCESS)
+ self.assertEqual(rc.status, RwStatus.SUCCESS)
found = False
logger.debug("Get VDU response %s", rsp)
for vdu in rsp.vdu_info_list: