Merge "Support for cfg-file translation to openmano" into v1.1
diff --git a/models/openmano/python/rift/openmano/openmano_client.py b/models/openmano/python/rift/openmano/openmano_client.py
index 09fb43d..8a89ee1 100755
--- a/models/openmano/python/rift/openmano/openmano_client.py
+++ b/models/openmano/python/rift/openmano/openmano_client.py
@@ -96,7 +96,7 @@
class OpenmanoCliAPI(object):
""" This class implements the necessary funtionality to interact with """
- CMD_TIMEOUT = 30
+ CMD_TIMEOUT = 120
def __init__(self, log, host, port, tenant):
self._log = log
diff --git a/models/plugins/yang/nsd.yang b/models/plugins/yang/nsd.yang
index 3d08627..0cadca3 100644
--- a/models/plugins/yang/nsd.yang
+++ b/models/plugins/yang/nsd.yang
@@ -272,7 +272,11 @@
to leafref, whose target is in a different module.
Once that is resovled this will switched to use
leafref";
- type string;
+ type leafref {
+ path "../../../constituent-vnfd" +
+ "[member-vnf-index = current()/../member-vnf-index-ref]" +
+ "/vnfd-id-ref";
+ }
}
leaf vnfd-connection-point-ref {
@@ -531,7 +535,9 @@
description
"Identifier for the VNFD.";
type leafref {
- path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
+ path "../../../constituent-vnfd" +
+ "[member-vnf-index = current()/../member-vnf-index-ref]" +
+ "/vnfd-id-ref";
}
}
}
@@ -545,14 +551,14 @@
key vnf-source-ref;
leaf vnf-source-ref {
type leafref {
- path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
+ path "../../constituent-vnfd/vnfd-id-ref";
}
}
leaf vnf-depends-on-ref {
description
"Reference to VNF that sorce VNF depends.";
type leafref {
- path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
+ path "../../constituent-vnfd/vnfd-id-ref";
}
}
}
@@ -644,7 +650,11 @@
to leafref, whose target is in a different module.
Once that is resovled this will switched to use
leafref";
- type string;
+ type leafref {
+ path "../../../../constituent-vnfd" +
+ "[member-vnf-index = current()/../member-vnf-index-ref]" +
+ "/vnfd-id-ref";
+ }
}
leaf vnfd-connection-point-ref {
@@ -659,7 +669,11 @@
to leafref, whose target is in a different module.
Once that is resovled this will switched to use
leafref";
- type string;
+ type leafref {
+ path "/vnfd:vnfd-catalog/vnfd:vnfd" +
+ "[vnfd:id = current()/../vnfd-id-ref]/" +
+ "vnfd:connection-point/vnfd:name";
+ }
}
}
} //rsp
@@ -709,7 +723,11 @@
to leafref, whose target is in a different module.
Once that is resovled this will switched to use
leafref";
- type string;
+ type leafref {
+ path "../../../constituent-vnfd" +
+ "[member-vnf-index = current()/../member-vnf-index-ref]" +
+ "/vnfd-id-ref";
+ }
}
leaf vnfd-connection-point-ref {
@@ -724,7 +742,11 @@
to leafref, whose target is in a different module.
Once that is resovled this will switched to use
leafref";
- type string;
+ type leafref {
+ path "/vnfd:vnfd-catalog/vnfd:vnfd" +
+ "[vnfd:id = current()/../vnfd-id-ref]/" +
+ "vnfd:connection-point/vnfd:name";
+ }
}
list match-attributes {
@@ -793,7 +815,7 @@
list vnfd-monitoring-param {
description "A list of VNFD monitoring params";
- key "vnfd-id-ref vnfd-monitoring-param-ref";
+ key "member-vnf-index-ref vnfd-monitoring-param-ref";
leaf vnfd-id-ref {
description
@@ -808,7 +830,11 @@
Once that is resolved this will switched to use
leafref";
- type yang:uuid;
+ type leafref {
+ path "../../../constituent-vnfd" +
+ "[member-vnf-index = current()/../member-vnf-index-ref]" +
+ "/vnfd-id-ref";
+ }
}
leaf vnfd-monitoring-param-ref {
@@ -820,10 +846,12 @@
}
}
- leaf-list member-vnf-index-ref {
- description
- "Optional reference to member-vnf within constituent-vnfds";
- type uint64;
+ leaf member-vnf-index-ref {
+ description
+ "Mandatory reference to member-vnf within constituent-vnfds";
+ type leafref {
+ path "../../../constituent-vnfd/member-vnf-index";
+ }
}
}
}
diff --git a/models/plugins/yang/vnfd.yang b/models/plugins/yang/vnfd.yang
index 3fa141f..a825be1 100644
--- a/models/plugins/yang/vnfd.yang
+++ b/models/plugins/yang/vnfd.yang
@@ -180,7 +180,7 @@
"Use the default management interface on this VDU.";
leaf vdu-id {
type leafref {
- path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:vdu/vnfd:id";
+ path "../../vdu/id";
}
}
}
@@ -190,7 +190,7 @@
"Use the ip address associated with this connection point.";
leaf cp {
type leafref {
- path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:connection-point/vnfd:name";
+ path "../../connection-point/name";
}
}
}
diff --git a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/riftcm_config_plugin.py b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/riftcm_config_plugin.py
index f285afd..640e4b5 100644
--- a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/riftcm_config_plugin.py
+++ b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/riftcm_config_plugin.py
@@ -191,6 +191,11 @@
raise NotImplementedError
@abc.abstractmethod
+ def get_Service_name(self):
+ """ Get the service name specific to the plugin """
+ pass
+
+ @abc.abstractmethod
@asyncio.coroutine
def apply_config(self, agent_nsr, agent_vnfr, config, rpc_ip):
""" Notification on configuration of an NSR """
diff --git a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_conagent.py b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_conagent.py
index 543e51b..5578a35 100644
--- a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_conagent.py
+++ b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_conagent.py
@@ -141,19 +141,23 @@
.format(vnfr.name, method, rc))
return rc
- def is_vnfr_config_agent_managed(self, vnfr):
- if (not vnfr.has_field('netconf') and
- not vnfr.has_field('juju') and
- not vnfr.has_field('script')):
- return False
+ def get_vnfr_config_agent(self, vnfr):
+ # if (not vnfr.has_field('netconf') and
+ # not vnfr.has_field('juju') and
+ # not vnfr.has_field('script')):
+ # return False
for agent in self._plugin_instances.values():
try:
if agent.is_vnfr_managed(vnfr.id):
- return True
+ return agent
except Exception as e:
self._log.debug("Check if VNFR {} is config agent managed: {}".
format(vnfr.name, e))
+
+ def is_vnfr_config_agent_managed(self, vnfr):
+ if self.get_vnfr_config_agent(vnfr):
+ return True
return False
def _on_config_agent(self, config_agent):
diff --git a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_config.py b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_config.py
index 26af056..7a24d70 100644
--- a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_config.py
+++ b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_config.py
@@ -678,10 +678,6 @@
if vnfr_name:
inp['vnfr_name'] = vnfr_name
- # TODO (pjoseph): Add config agents, we need to identify which all
- # config agents are required from this NS and provide only those
- inp['config-agent'] = {}
-
# Add parameters for initial config
inp['parameter'] = {}
for parameter in parameters:
@@ -696,6 +692,20 @@
format(nsr_obj.nsr_name, parameter, e))
+ # Add config agents specific to each VNFR
+ inp['config-agent'] = {}
+ for vnfr in nsr_obj.agent_nsr.vnfrs:
+ # Get the config agent for the VNFR
+ # If vnfr name is specified, add only CA specific to that
+ if (vnfr_name is None) or \
+ (vnfr_name == vnfr.name):
+ agent = self._config_agent_mgr.get_vnfr_config_agent(vnfr.vnfr_msg)
+ if agent:
+ if agent.agent_type != riftcm_config_plugin.DEFAULT_CAP_TYPE:
+ inp['config-agent'][vnfr.member_vnf_index] = agent.agent_data
+ inp['config-agent'][vnfr.member_vnf_index] \
+ ['service-name'] = agent.get_service_name(vnfr.id)
+
# Add vnfrs specific data
inp['vnfr'] = {}
for vnfr in nsr_obj.vnfrs:
@@ -730,6 +740,7 @@
inp['vnfr'][vnfr['member_vnf_index_ref']] = v
+
self._log.debug("Input data for {}: {}".
format((vnfr_name if vnfr_name else nsr_obj.nsr_name),
inp))