def network_create_func(self, net):
net_id = net['<STR_LIT:id>']<EOL>net_name = net.get('<STR_LIT:name>')<EOL>network_db_elem = self.get_network(net_id)<EOL>if self.fw_api.is_network_source_fw(network_db_elem, net_name):<EOL><INDENT>LOG.info("<STR_LIT>", net_name)<EOL>return<EOL><DEDENT>if not network_db_elem:<EOL><INDENT>self.network[net_id] = {}<EOL>self.network[net_id].update(net)<EOL><DEDENT>net_name = net.get('<STR_LIT:name>')<EOL>tenant_id = net.get('<STR_LIT>')<EOL>net_ext_name = self.cfg.dcnm.dcnm_net_ext<EOL>nobj = re.search(net_ext_name, net_name)<EOL>try:<EOL><INDENT>seg_id = int((net_name[nobj.start(<NUM_LIT:0>) + len(net_ext_name) - <NUM_LIT:1>:]<EOL>if nobj else None))<EOL><DEDENT>except (IndexError, TypeError, ValueError):<EOL><INDENT>seg_id = None<EOL><DEDENT>query_net = self.get_network_by_segid(seg_id) if seg_id else None<EOL>if query_net:<EOL><INDENT>if query_net.source.lower() == '<STR_LIT>':<EOL><INDENT>prev_id = query_net.network_id<EOL>params = dict(columns=dict(network_id=net_id))<EOL>self.update_network(prev_id, **params)<EOL>prev_info = self.network.pop(prev_id)<EOL>prev_info['<STR_LIT:id>'] = net_id<EOL>self.network[net_id] = prev_info<EOL>updated_net_name = (<EOL>net_name[:nobj.start(<NUM_LIT:0>) + len(net_ext_name) - <NUM_LIT:1>])<EOL>try:<EOL><INDENT>body = {'<STR_LIT>': {'<STR_LIT:name>': updated_net_name, }}<EOL>dcnm_net = self.neutronclient.update_network(<EOL>net_id, body=body).get('<STR_LIT>')<EOL>LOG.debug('<STR_LIT>', dcnm_net)<EOL><DEDENT>except Exception as exc:<EOL><INDENT>LOG.exception('<STR_LIT>'<EOL>'<STR_LIT>',<EOL>{'<STR_LIT>': updated_net_name,<EOL>'<STR_LIT>': str(exc)})<EOL>return<EOL><DEDENT><DEDENT>LOG.info('<STR_LIT>'<EOL>'<STR_LIT>',<EOL>{'<STR_LIT:name>': net_name, '<STR_LIT:source>': '<STR_LIT>'})<EOL>return<EOL><DEDENT>if network_db_elem:<EOL><INDENT>LOG.debug("<STR_LIT>" % net_name)<EOL>return<EOL><DEDENT>tenant_name = self.get_project_name(tenant_id)<EOL>if not tenant_name:<EOL><INDENT>LOG.error('<STR_LIT>'<EOL>'<STR_LIT>',<EOL>{'<STR_LIT:name>': net_name, '<STR_LIT>': tenant_id})<EOL>return<EOL><DEDENT>pseg_id = self.network[net_id].get('<STR_LIT>')<EOL>seg_id = self._get_segmentation_id(net_id, pseg_id, '<STR_LIT>')<EOL>self.network[net_id]['<STR_LIT>'] = seg_id<EOL>try:<EOL><INDENT>cfgp, fwd_mod = self.dcnm_client.get_config_profile_for_network(<EOL>net.get('<STR_LIT:name>'))<EOL>self.network[net_id]['<STR_LIT>'] = cfgp<EOL>self.network[net_id]['<STR_LIT>'] = fwd_mod<EOL>self.add_network_db(net_id, self.network[net_id],<EOL>'<STR_LIT>',<EOL>constants.SUBNET_PENDING)<EOL>LOG.debug('<STR_LIT>', self.network)<EOL><DEDENT>except dexc.DfaClientRequestFailed:<EOL><INDENT>self.add_network_db(net_id, self.network[net_id], '<STR_LIT>',<EOL>constants.CREATE_FAIL)<EOL>LOG.error('<STR_LIT>', self.network)<EOL><DEDENT>
Create network in database and dcnm
        :param net: network dictionary