def create_service_network(self, tenant_name, network, subnet,<EOL>dhcp_range=True):
network_info = {}<EOL>subnet_ip_mask = subnet.cidr.split('<STR_LIT:/>')<EOL>if self._default_md is None:<EOL><INDENT>self._set_default_mobility_domain()<EOL><DEDENT>vlan_id = '<STR_LIT:0>'<EOL>gw_ip = subnet.gateway_ip<EOL>part_name = network.part_name<EOL>if not part_name:<EOL><INDENT>part_name = self._part_name<EOL><DEDENT>if network.vlan_id:<EOL><INDENT>vlan_id = str(network.vlan_id)<EOL>if network.mob_domain_name is not None:<EOL><INDENT>mob_domain_name = network.mob_domain_name<EOL><DEDENT>else:<EOL><INDENT>mob_domain_name = self._default_md<EOL><DEDENT><DEDENT>else:<EOL><INDENT>mob_domain_name = None<EOL><DEDENT>seg_id = str(network.segmentation_id)<EOL>seg_str = "<STR_LIT>" + seg_id<EOL>cfg_args = [<EOL>seg_str,<EOL>"<STR_LIT>" + subnet_ip_mask[<NUM_LIT:1>],<EOL>"<STR_LIT>" + gw_ip,<EOL>"<STR_LIT>" + network.name,<EOL>"<STR_LIT>" + vlan_id,<EOL>"<STR_LIT>" + tenant_name + '<STR_LIT::>' + part_name<EOL>]<EOL>cfg_args = '<STR_LIT:;>'.join(cfg_args)<EOL>ip_range = '<STR_LIT:U+002C>'.join(["<STR_LIT>" % (p['<STR_LIT:start>'], p['<STR_LIT:end>']) for p in<EOL>subnet.allocation_pools])<EOL>dhcp_scopes = {'<STR_LIT>': ip_range,<EOL>'<STR_LIT>': subnet.cidr,<EOL>'<STR_LIT>': gw_ip}<EOL>network_info = {"<STR_LIT>": vlan_id,<EOL>"<STR_LIT>": mob_domain_name,<EOL>"<STR_LIT>": network.config_profile,<EOL>"<STR_LIT>": network.name,<EOL>"<STR_LIT>": cfg_args,<EOL>"<STR_LIT>": tenant_name,<EOL>"<STR_LIT>": part_name,<EOL>"<STR_LIT:description>": network.name,<EOL>"<STR_LIT>": subnet_ip_mask[<NUM_LIT:1>],<EOL>"<STR_LIT>": gw_ip}<EOL>if seg_id:<EOL><INDENT>network_info["<STR_LIT>"] = seg_id<EOL><DEDENT>if dhcp_range:<EOL><INDENT>network_info["<STR_LIT>"] = dhcp_scopes<EOL><DEDENT>if hasattr(subnet, '<STR_LIT>'):<EOL><INDENT>network_info["<STR_LIT>"] = subnet.secondary_gw<EOL><DEDENT>if self._is_iplus:<EOL><INDENT>prof = self._config_profile_get(network.config_profile)<EOL>if prof and prof.get('<STR_LIT>') == '<STR_LIT>':<EOL><INDENT>network_info["<STR_LIT>"] = '<STR_LIT::>'.join((tenant_name, part_name))<EOL><DEDENT>else:<EOL><INDENT>network_info["<STR_LIT>"] = "<STR_LIT>"<EOL><DEDENT><DEDENT>LOG.info("<STR_LIT>", network_info)<EOL>res = self._create_network(network_info)<EOL>if res and res.status_code in self._resp_ok:<EOL><INDENT>LOG.info("<STR_LIT>", network_info)<EOL><DEDENT>else:<EOL><INDENT>LOG.error("<STR_LIT>",<EOL>network_info)<EOL>raise dexc.DfaClientRequestFailed(reason=self._failure_msg(res))<EOL><DEDENT>
Create network on the DCNM.

        :param tenant_name: name of tenant the network belongs to
        :param network: network parameters
        :param subnet: subnet parameters of the network