From: Philip Joseph Date: Thu, 5 Jan 2017 08:10:20 +0000 (+0000) Subject: New feature: Support for ping pong charm X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F70%2F1170%2F1;p=osm%2FSO.git New feature: Support for ping pong charm Signed-off-by: Philip Joseph --- diff --git a/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py b/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py index ca4bb674..cce685ca 100755 --- a/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py +++ b/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py @@ -834,14 +834,14 @@ class VirtualNetworkFunction(ManoDescriptor): member_vdu.member_vdu_ref = vdu.id - def write_to_file(self, outdir, output_format, use_vca_conf=False): + def write_to_file(self, outdir, output_format): dirpath = "%s/%s" % (outdir, self.name) if not os.path.exists(dirpath): os.makedirs(dirpath) super(VirtualNetworkFunction, self).write_to_file(['vnfd', 'rw-vnfd'], dirpath, output_format) - self.add_scripts(outdir, use_vca_conf=use_vca_conf) + self.add_scripts(outdir) def add_cloud_init(self, outdir): script_dir = os.path.join(outdir, self.name, 'cloud_init') @@ -1700,10 +1700,8 @@ def generate_ping_pong_descriptors(fmt="json", ) if write_to_file: - ping.write_to_file(out_dir, ping_fmt if ping_fmt is not None else fmt, - use_vca_conf=use_vca_conf) - pong.write_to_file(out_dir, pong_fmt if ping_fmt is not None else fmt, - use_vca_conf=use_vca_conf) + ping.write_to_file(out_dir, ping_fmt if ping_fmt is not None else fmt) + pong.write_to_file(out_dir, pong_fmt if ping_fmt is not None else fmt) nsd_catalog.write_config(out_dir, vnfd_list) nsd_catalog.write_to_file(out_dir, ping_fmt if nsd_fmt is not None else fmt) diff --git a/models/plugins/yang/vnfd.yang b/models/plugins/yang/vnfd.yang index fb1bd03e..e218a925 100644 --- a/models/plugins/yang/vnfd.yang +++ b/models/plugins/yang/vnfd.yang @@ -342,6 +342,13 @@ module vnfd type inet:port-number; } + leaf ssh-key { + description + "Whether SSH keys need to be generated and passed + to the RO and VCA during instantiation."; + type boolean; + } + container dashboard-params { description "Parameters for the VNF dashboard"; diff --git a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_config.py b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_config.py index 7fbe1230..3fa827ee 100644 --- a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_config.py +++ b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_config.py @@ -1084,6 +1084,7 @@ class ConfigManagerConfig(object): if k in vdu: d[k] = vdu[k] vdu_data.append(d) + v['vdur'].append(vdu_data) inp['vnfr'][vnfr['member_vnf_index_ref']] = v @@ -1202,27 +1203,33 @@ class ConfigManagerConfig(object): inp_file = get_input_file(parameters) - vnfd = vnfr.vnfd - vnf_cfg = vnfd.vnf_configuration - - for conf in vnf_cfg.initial_config_primitive: - self._log.debug("VNFR {} initial config: {}". - format(vnfr_name, conf)) - - if not conf.user_defined_script: - self._log.debug("VNFR {} did not fine user defined script: {}". - format(vnfr_name, conf)) - continue - - script = self.get_script_file(conf.user_defined_script, - vnfd.name, - vnfd.id, - 'vnfd') + script = get_script_file(conf['user_defined_script'], + nsd.name, + nsd.id) + + cmd = "{0} {1}".format(script, inp_file) + self._log.debug("Running the CMD: {}".format(cmd)) + + process = yield from asyncio. \ + create_subprocess_shell( + cmd, loop=self._loop, + stdout=asyncio.subprocess.PIPE, + stderr=asyncio.subprocess.PIPE) + yield from process.wait() + if process.returncode: + script_out, script_err = yield from process.communicate() + msg = "NSR {} initial config using {} failed with {}". \ + format(nsr_name, script, process.returncode) + self._log.error(msg) + self._log.error("Script {} stderr: {}". + format(script, script_err)) + raise InitialConfigError(msg) + else: + os.remove(inp_file) - yield from self.process_initial_config(nsr_obj, - conf.as_dict(), - script, - vnfr_name=vnfr_name) + except KeyError as e: + self._log.debug("Did not find initial config: {}". + format(e)) class ConfigManagerNSR(object):