def set_vld(self, source): try: vld = source['vld'] for vld_data in vld: id = vld_data.get('id') name = vld_data.get('name') short_name = vld_data.get('short-name') vendor = vld_data.get('vendor') description = vld_data.get('description') version = vld_data.get('version') type = vld_data.get('type') root_bandwidth = vld_data.get('root_bandwidth') leaf_bandwidth = vld_data.get('leaf_bandwidth') mgmt_network = vld_data.get('mgmt-network') vim_network_name = vld_data.get('vim-network-name') ip_profile_ref = vld_data.get('ip-profile-ref') vnfd_connection_point_ref_vld = vld_data.get('vnfd-connection-point-ref') for vnfd_connection_point_ref_data in vnfd_connection_point_ref_vld: member_vnf_index_ref = vnfd_connection_point_ref_data.get('member-vnf-index-ref') order = vnfd_connection_point_ref_data.get('order') vnfd_id_ref = vnfd_connection_point_ref_data.get('vnfd-id-ref') vnfd_connection_point_ref = vnfd_connection_point_ref_data.get('vnfd-connection-point-ref') # print(vnfd_connection_point_ref) vnfd_connection_point_ref_instance = OsmSchema.VnfdConnectionPointRef(member_vnf_index_ref, order, vnfd_id_ref, vnfd_connection_point_ref) self.list_vnfd_connection_point_ref.append(vnfd_connection_point_ref_instance) vld_instance = OsmSchema.Vld(id, name, short_name, vendor, description, version, type, root_bandwidth, leaf_bandwidth, mgmt_network, vim_network_name, ip_profile_ref, self.list_vnfd_connection_point_ref) self.list_vld.append(vld_instance) except KeyError: print("One or more key not found!")
def set_ip_profiles(self, source): try: ip_profiles = source.get('ip-profiles') if ip_profiles is not None: for ip_profiles_data in ip_profiles: name = ip_profiles_data['name'] description = ip_profiles_data.get('description') ip_profile_params = ip_profiles_data['ip-profile-params'] gateway_address = ip_profile_params.get('gateway-address') ip_version = ip_profile_params.get('ip-version') subnet_address = ip_profile_params.get('subnet-address') subnet_prefix_pool = ip_profile_params.get('subnet-prefix-pool') security_group = ip_profile_params.get('security_group') dns_server_data = ip_profile_params.get('dns-server') for dns_server_address in dns_server_data: address = dns_server_address.get('address') dns_server_instance = OsmSchema.DnsServer(address) self.list_dns_server.append(dns_server_instance) dhcp_params = ip_profile_params.get('dhcp-params') enabled = dhcp_params.get('enabled') start_address = dhcp_params.get('start-address') count = dhcp_params.get('count') dhcp_params_instance = OsmSchema.DhcpParams(enabled, start_address, count) self.list_dhcp_params.append(dhcp_params_instance) ip_profile_params_instance = OsmSchema.IpProfileParams(ip_version, subnet_address, gateway_address, security_group, self.list_dns_server, self.list_dhcp_params, subnet_prefix_pool) ip_profiles_instance = OsmSchema.IpProfiles(name, description, ip_profile_params_instance) self.list_ip_profiles.append(ip_profiles_instance) except KeyError: print("One or more key not found!")
def set_vnffg(self, source): try: vnffgd = source.get('vnffgd') if vnffgd is not None: for vnffgd_data in vnffgd: vnffgd_id = vnffgd_data.get('id') vnffgd_name = vnffgd_data.get('name') vnffgd_short_name = vnffgd_data.get('short-name') vnffgd_vendor = vnffgd_data.get('vendor') vnffgd_description = vnffgd_data.get('description') vnffgd_version = vnffgd_data.get('version') rsp = vnffgd_data['rsp'] for rsp_data in rsp: rsp_id = rsp_data.get('id') rsp_name = rsp_data.get('name') rsp_vnfd_connection_point_ref = rsp_data.get('vnfd-connection-point-ref') rsp_member_vnf_index_ref = rsp_data.get('member-vnf-index-ref') rsp_order = rsp_data.get('order') rsp_vnfd_id_ref = rsp_data.get('vnfd-id-ref') rsp_instance = OsmSchema.Rsp(rsp_id, rsp_name, rsp_vnfd_connection_point_ref, rsp_member_vnf_index_ref, rsp_order, rsp_vnfd_id_ref) self.list_rsp.append(rsp_instance) classifier = vnffgd_data['classifier'] for classifier_data in classifier: classifier_id = classifier_data.get('id') classifier_name = classifier_data.get('name') classifier_rsp_id_ref = classifier_data.get('rsp-id-ref') classifier_member_vnf_index_ref = classifier_data.get('member-vnf-index-ref') classifier_vnfd_id_ref = classifier_data.get('vnfd-id-ref') classifier_vnfd_connection_point_ref = classifier_data.get('vnfd-connection-point-ref') match_attributes = classifier_data['match-attributes'] for match_attributes_data in match_attributes: match_attributes_id = match_attributes_data.get('id') match_attributes_ip_proto = match_attributes_data.get('ip-proto') match_attributes_source_ip_address = match_attributes_data.get('source-ip-address') match_attributes_destination_ip_address = match_attributes_data.get('destination-ip-address') match_attributes_source_port = match_attributes_data.get('source-port') match_attributes_destination_port = match_attributes_data.get('destination-port') match_attributes_instance = OsmSchema.MatchAttributes(match_attributes_id, match_attributes_ip_proto, match_attributes_source_ip_address, match_attributes_destination_ip_address, match_attributes_source_port, match_attributes_destination_port) self.list_match_attributes.append(match_attributes_instance) classifier_instance = OsmSchema.Classifier(classifier_id, classifier_name, classifier_rsp_id_ref, self.list_match_attributes, classifier_member_vnf_index_ref, classifier_vnfd_id_ref, classifier_vnfd_connection_point_ref) self.list_classifier.append(classifier_instance) vnffgd_instance = OsmSchema.Vnffgd(vnffgd_id, vnffgd_name, vnffgd_short_name, vnffgd_vendor, vnffgd_description, vnffgd_version, self.list_rsp, self.list_classifier) self.list_vnffgd.append(vnffgd_instance) except KeyError: print("One or more key not found!")
def split_forwarding_path(self): if len(self.utilityFunctions.list_vnffgd) is not 0: for i in range(len(self.NSDs)): nsd_fg = self.NSDs[i] for fg in self.utilityFunctions.list_vnffgd: vnffgd_instance = OsmSchema.Vnffgd(fg.id, fg.name, fg.short_name, fg.vendor, fg.description, fg.version, [], []) for classifier in fg.classifier: for constituent_vnf in nsd_fg.ConstituentVnfd: if classifier is not None and constituent_vnf is not None: if str(classifier.member_vnf_index_ref) == str( constituent_vnf.member_vnf_index): vnffgd_instance.classifier.append( classifier) for rsp in fg.rsp: if rsp.id is not None: vnffgd_instance.rsp.append(rsp) for constituent_vnf in nsd_fg.ConstituentVnfd: if rsp.id is None: if str(rsp.member_vnf_index_ref) == str( constituent_vnf.member_vnf_index): vnffgd_instance.rsp.append(rsp) nsd_fg.vnffgd.append(vnffgd_instance) self.NSDs[i] = nsd_fg
def split_network_function(self): for network_function_set in self.network_function_sets: sub_nsd = OsmSchema.Nsd("", "", "", "", "", "", "", [], [], [], [], []) network_function_list = [] for network_function in network_function_set: network_function_list.append( self.get_network_function_object(network_function)) sub_nsd.ConstituentVnfd = network_function_list self.NSDs.append(sub_nsd)
def set_constituent_vnfd(self, source): try: constituent_vnfd = source['constituent-vnfd'] for constituent_vnfd_data in constituent_vnfd: member_vnf_index = constituent_vnfd_data.get('member-vnf-index') vnfd_id_ref = constituent_vnfd_data.get('vnfd-id-ref') start_by_default = constituent_vnfd_data.get('start-by-default') constituent_vnfd_instance = OsmSchema.ConstituentVnfd(member_vnf_index, start_by_default, vnfd_id_ref) self.list_constituent_vnfd.append(constituent_vnfd_instance) except KeyError: print("One or more key not found!")
def handle_elan_links(self, virtual_link_elan, nsd_vl): vld_instance = OsmSchema.Vld( virtual_link_elan.id, virtual_link_elan.name, virtual_link_elan.short_name, virtual_link_elan.vendor, virtual_link_elan.description, virtual_link_elan.version, virtual_link_elan.type, virtual_link_elan.root_bandwidth, virtual_link_elan.leaf_bandwidth, virtual_link_elan.mgmt_network, virtual_link_elan.vim_network_name, virtual_link_elan.ip_profile_ref, []) for vnf in nsd_vl.ConstituentVnfd: for vnfd_connection_point_ref_inner in virtual_link_elan.vnfd_connection_point_ref_vld: if vnfd_connection_point_ref_inner is not None and vnf is not None: if vnfd_connection_point_ref_inner.member_vnf_index_ref == vnf.member_vnf_index: vld_instance.vnfd_connection_point_ref_vld.append( vnfd_connection_point_ref_inner) return vld_instance