X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=examples%2Fping_pong_ns%2Frift%2Fmano%2Fexamples%2Fping_pong_nsd.py;h=db066f83b6ed6ceeb027f7c92b128b0fc1d31e0e;hb=55e01f61d558380f6cc8b34a2d7834819371defd;hp=5348e00b70cd617d83e12bfc62d0c74ba226840c;hpb=f04e0aed7b77ad8833fa18ee083b5332bdb0da20;p=osm%2FSO.git 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 5348e00b..db066f83 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 @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# +# # Copyright 2016 RIFT.IO Inc # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -127,7 +127,7 @@ class VirtualNetworkFunction(ManoDescriptor): def compose(self, image_name, cloud_init="", cloud_init_file="", endpoint=None, mon_params=[], mon_port=8888, mgmt_port=8888, num_vlr_count=1, num_ivlr_count=1, - num_vms=1, image_md5sum=None, mano_ut=False): + num_vms=1, image_md5sum=None, mano_ut=False, use_static_ip=False): self.descriptor = RwVnfdYang.YangData_Vnfd_VnfdCatalog() self.id = str(uuid.uuid1()) vnfd = self.descriptor.vnfd.add() @@ -156,6 +156,11 @@ class VirtualNetworkFunction(ManoDescriptor): cp = vnfd.connection_point.add() cp.type_yang = 'VPORT' cp.name = '%s/cp%d' % (self.name, i) + if use_static_ip: + if 'pong_' in self.name: + cp.static_ip_address = '31.31.31.31' + else: + cp.static_ip_address = '31.31.31.32' if endpoint is not None: endp = VnfdYang.YangData_Vnfd_VnfdCatalog_Vnfd_HttpEndpoint( @@ -214,12 +219,18 @@ class VirtualNetworkFunction(ManoDescriptor): node = vdu.guest_epa.numa_node_policy.node.add() node.id = 0 node.memory_mb = 512 - node.vcpu = [0, 1] + vcpu = node.vcpu.add() + vcpu.id = 0 + vcpu = node.vcpu.add() + vcpu.id = 1 node = vdu.guest_epa.numa_node_policy.node.add() node.id = 1 node.memory_mb = 512 - node.vcpu = [2, 3] + vcpu = node.vcpu.add() + vcpu.id = 2 + vcpu = node.vcpu.add() + vcpu.id = 3 # specify the vswitch EPA vdu.vswitch_epa.ovs_acceleration = 'DISABLED' @@ -254,7 +265,8 @@ class VirtualNetworkFunction(ManoDescriptor): internal_cp.name = cp_name + "/icp{}".format(i) internal_cp.id = cp_name + "/icp{}".format(i) internal_cp.type_yang = 'VPORT' - internal_vlds[i].internal_connection_point_ref.append(internal_cp.id) + ivld_cp = internal_vlds[i].internal_connection_point_ref.add() + ivld_cp.id_ref = internal_cp.id internal_interface = vdu.internal_interface.add() internal_interface.name = 'fab%d' % i @@ -637,7 +649,7 @@ exit 0 ip_profile.ip_profile_params.ip_version = "ipv4" ip_profile.ip_profile_params.subnet_address = "31.31.31.0/24" ip_profile.ip_profile_params.gateway_address = "31.31.31.210" - + vld_id = 1 for cpgroup in cpgroup_list: vld = nsd.vld.add() @@ -885,6 +897,7 @@ def generate_ping_pong_descriptors(fmt="json", ex_pong_userdata=None, use_placement_group=True, use_ns_init_conf=True, + use_static_ip=False, ): # List of connection point groups # Each connection point group refers to a virtual link @@ -929,6 +942,7 @@ def generate_ping_pong_descriptors(fmt="json", num_vms=num_vnf_vms, image_md5sum=ping_md5sum, mano_ut=mano_ut, + use_static_ip=use_static_ip, ) pong = VirtualNetworkFunction("pong_vnfd%s" % (suffix)) @@ -969,6 +983,7 @@ def generate_ping_pong_descriptors(fmt="json", num_vms=num_vnf_vms, image_md5sum=pong_md5sum, mano_ut=mano_ut, + use_static_ip=use_static_ip, ) # Initialize the member VNF index