Fix merge conflicts 71/1171/1
authorPhilip Joseph <philip.joseph@riftio.com>
Thu, 12 Jan 2017 09:16:22 +0000 (09:16 +0000)
committerPhilip Joseph <philip.joseph@riftio.com>
Thu, 23 Feb 2017 14:19:32 +0000 (19:49 +0530)
Signed-off-by: Philip Joseph <philip.joseph@riftio.com>
models/plugins/yang/vnfd.yang
rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_config.py

index e218a92..fb1bd03 100644 (file)
@@ -342,13 +342,6 @@ 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";
 
index 3fa827e..98c8882 100644 (file)
@@ -1193,39 +1193,28 @@ class ConfigManagerConfig(object):
 
                 yield from self.process_initial_config(nsr_obj, conf, script)
 
-                    parameters = []
-                    try:
-                        parameters = conf['parameter']
-                    except Exception as e:
-                        self._log.debug("Parameter conf: {}, e: {}".
-                                        format(conf, e))
-                        pass
-
-                    inp_file = get_input_file(parameters)
-
-                    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)
+    @asyncio.coroutine
+    def process_vnf_initial_config(self, nsr_obj, vnfr):
+        '''Apply the initial-config-primitives specified in VNFD'''
+
+        vnfr_name = vnfr.name
+
+        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.id,
+                                              vnfd.name,
+                                              'vnfd')
 
             except KeyError as e:
                 self._log.debug("Did not find initial config: {}".