X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=lcm%2Flcm%2Fpub%2Fmsapi%2Fnfvolcm.py;h=b2d74407ff2b21bedd97d6069387087bab75512f;hb=0614226c5097a7ce3c91521db551592304566155;hp=fa906535e583ec59e493db3076a5265e13210fd7;hpb=0e1b730ec0e0ac058e07ccf995c65204fa8a748a;p=vfc%2Fgvnfm%2Fvnflcm.git diff --git a/lcm/lcm/pub/msapi/nfvolcm.py b/lcm/lcm/pub/msapi/nfvolcm.py index fa906535..b2d74407 100644 --- a/lcm/lcm/pub/msapi/nfvolcm.py +++ b/lcm/lcm/pub/msapi/nfvolcm.py @@ -11,23 +11,30 @@ # 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 json +import logging +from lcm.pub.exceptions import NFLCMException from lcm.pub.utils.restcall import req_by_msb -#call gvnfm driver -def vnfd_rawdata_get(vnfdid): - ret = req_by_msb("openoapi/nslcm/v1/vnfs/%s" % vnfdid, "GET") - return ret +logger = logging.getLogger(__name__) + #call gvnfm driver -def get_packageid_by_vnfdid(vnfdid): +def get_packageinfo_by_vnfdid(vnfdid): ret = req_by_msb("openoapi/nslcm/v1/vnfs/%s" % vnfdid, "GET") - return ret + if ret[0] != 0: + logger.error("Status code is %s, detail is %s.", ret[2], ret[1]) + raise NFLCMException("Failed to query package_info of vnfdid(%s) from nslcm." % vnfdid) + return json.JSONDecoder().decode(ret[1]) #call gvnfm driver def apply_grant_to_nfvo(data): ret = req_by_msb("openoapi/nslcm/v1/grantvnf" , "POST", data) - return ret + if ret[0] != 0: + logger.error("Status code is %s, detail is %s.", ret[2], ret[1]) + raise NFLCMException("Nf instancing apply grant exception") + return json.JSONDecoder().decode(ret[1]) #call gvnfm driver def notify_lcm_to_nfvo(data, nf_inst_id):