From: Philip Joseph Date: Wed, 11 Jan 2017 16:49:14 +0000 (+0000) Subject: Merge from master X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=12021c59a748f44dc4bd01b2b5edf5dc6047357b;p=osm%2FSO.git Merge from master Signed-off-by: Philip Joseph --- 12021c59a748f44dc4bd01b2b5edf5dc6047357b diff --cc examples/ping_pong_ns/CMakeLists.txt index 2dd5b28c,34f7a030..d85209ed --- a/examples/ping_pong_ns/CMakeLists.txt +++ b/examples/ping_pong_ns/CMakeLists.txt @@@ -67,12 -67,8 +67,13 @@@ rift_python_install_tree COMPONENT ${PKG_LONG_NAME} FILES rift/mano/examples/ping_pong_nsd.py + rift/mano/examples/ping_setup.py + rift/mano/examples/ping_rate.py + rift/mano/examples/ping_start_stop.py + rift/mano/examples/pong_setup.py + rift/mano/examples/pong_start_stop.py rift/mano/examples/start_traffic.py + rift/mano/examples/ping_set_rate.py ) install( diff --cc examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py index 8999507f,ef2dd90e..4a16c7a8 --- a/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py +++ b/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py @@@ -118,12 -118,9 +118,13 @@@ class VirtualNetworkFunction(ManoDescri def __init__(self, name, instance_count=1): self.vnfd_catalog = None self.vnfd = None + self.mano_ut = False + self.use_ns_init_conf = False + self.use_vca_conf = False + self.use_charm = False self.instance_count = instance_count self._placement_groups = [] + self.use_vnf_init_conf = False super(VirtualNetworkFunction, self).__init__(name) def add_placement_group(self, group): @@@ -850,38 -325,23 +851,55 @@@ with open(script_file, "w") as f: f.write("{}".format(cfg)) + # Copy the vnf_init_config script + if self.use_vnf_init_conf and ('ping' in self.name): + script_name = 'ping_set_rate.py' + + src_path = os.path.dirname(os.path.abspath(os.path.realpath(__file__))) + script_src = os.path.join(src_path, script_name) + if not os.path.exists(script_src): + src_path = os.path.join(os.environ['RIFT_ROOT'], + 'modules/core/mano/examples/ping_pong_ns/rift/mano/examples') + script_src = os.path.join(src_path, script_name) + + dest_path = os.path.join(outdir, self.name, 'scripts') + os.makedirs(dest_path, exist_ok=True) + + shutil.copy2(script_src, dest_path) + + def add_scripts(self, outdir): + if not self.use_charm: + self.add_cloud_init(outdir) + + if self.use_vca_conf and not self.use_charm: + self.add_vca_scripts(outdir) + + def add_vca_scripts(self, outdir): + dest_path = os.path.join(outdir, self.name, 'scripts') + try: + os.makedirs(dest_path) + except OSError: + if not os.path.isdir(dest_path): + raise + + if 'pong_' in self.name: + scripts = ['pong_setup.py', 'pong_start_stop.py'] + else: + scripts = ['ping_setup.py', 'ping_rate.py', 'ping_start_stop.py'] + + for script_name in scripts: + src_path = os.path.dirname(os.path.abspath( + os.path.realpath(__file__))) + script_src = os.path.join(src_path, script_name) + if not os.path.exists(script_src): + src_path = os.path.join(os.environ['RIFT_ROOT'], + 'modules/core/mano/examples/' + 'ping_pong_ns/rift/mano/examples') + script_src = os.path.join(src_path, script_name) + + shutil.copy2(script_src, dest_path) + + class NetworkService(ManoDescriptor): def __init__(self, name): super(NetworkService, self).__init__(name) @@@ -1084,9 -547,11 +1105,11 @@@ exit {"name": "number", "data_type": "STRING", "mandatory": True}, ] }) - vnf_config.service_primitive.append(config) + vnf_config.config_primitive.append(config) - def default_config(self, const_vnfd, vnfd, mano_ut, use_ns_init_conf): + def default_config(self, const_vnfd, vnfd, mano_ut, + use_ns_init_conf, + use_vnf_init_conf): vnf_config = vnfd.vnfd.vnf_configuration vnf_config.config_attributes.config_priority = 0 @@@ -1188,7 -655,7 +1227,8 @@@ def compose(self, vnfd_list, cpgroup_list, mano_ut, use_ns_init_conf=True, - use_vnf_init_conf=True,): ++ use_vnf_init_conf=True, + use_vca_conf=False): if mano_ut: # Disable NS initial config primitive @@@ -1251,9 -719,8 +1292,9 @@@ constituent_vnfd.start_by_default = False constituent_vnfd.vnfd_id_ref = vnfd.descriptor.vnfd[0].id - self.default_config(constituent_vnfd, vnfd, mano_ut, - use_ns_init_conf, use_vnf_init_conf) + if use_vca_conf is False: + self.default_config(constituent_vnfd, vnfd, mano_ut, - use_ns_init_conf) ++ use_ns_init_conf, use_vnf_init_conf) member_vnf_index += 1 # Enable config primitives if either mano_ut or @@@ -1468,8 -933,7 +1509,9 @@@ def generate_ping_pong_descriptors(fmt= ex_pong_userdata=None, use_placement_group=True, use_ns_init_conf=True, + use_vnf_init_conf=True, + use_vca_conf=True, + use_charm=False, ): # List of connection point groups # Each connection point group refers to a virtual link @@@ -1626,8 -1085,7 +1669,9 @@@ cpgroup_list, mano_ut, use_ns_init_conf=use_ns_init_conf, - use_vnf_init_conf=use_vnf_init_conf,) ++ use_vnf_init_conf=use_vnf_init_conf, + use_vca_conf=use_vca_conf, + ) if write_to_file: ping.write_to_file(out_dir, ping_fmt if ping_fmt is not None else fmt) diff --cc models/plugins/yang/mano-types.yang index cfe58e47,fa6f39c9..b5bff233 --- a/models/plugins/yang/mano-types.yang +++ b/models/plugins/yang/mano-types.yang @@@ -116,30 -122,7 +123,14 @@@ module mano-type "The value should be hidden by the UI. Only applies to parameters with default values."; type boolean; + default false; + } + + leaf out { + description "If this is an output of the primitive execution"; + type boolean; + default false; } - leaf parameter-type { - description "Type of this parameter, whether this in IN or OUT"; - type enumeration { - enum OUT; - enum IN; - } - default "IN"; - } - leaf parameter-path { - description "A Leafref to the parameter path with the attribute selection. - At present only attribute ip-address() is supported. - For example, to get the ip address of VNF connection point - the xpath would look something along the following lines, - /vnfd-catalog/vnfd[id='x']/connection-point[name='cp']/ip-address()"; - type string; - } } @@@ -320,38 -327,9 +342,44 @@@ list initial-config-primitive { rwpb:msg-new InitialConfigPrimitive; description - "Initial set of configuration primitives."; + "Initial set of configuration primitives."; key "seq"; - uses initial-config; + leaf seq { + description + "Sequence number for the configuration primitive."; + type uint64; + } + + choice primtive-type { + case primtive-definition { + leaf name { + description + "Name of the configuration primitive."; + type string; + } + + uses primitive-parameter-value; ++ ++ leaf user-defined-script { ++ description ++ "A user defined script."; ++ type string; ++ } + } + + case primitive-ref { + leaf config-primitive-ref { + description + "Reference to a config primitive name. + NOTE: The config primitive referred should have + all the input paramaters predefined either + with default values or dependency references."; + type leafref { + path "../../config-primitive/name"; + } + } + } + } } leaf config-template {