# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

from azure.cli.testsdk import *


class MobileNetworkScenario(ScenarioTest):
    @ResourceGroupPreparer(name_prefix='cli_test_mobile_network', location='eastus')
    def test_mobile_network(self, resource_group):
        self.kwargs.update({
            'mobile_network': self.create_random_name('mobile_network_', 20),
        })
        self.cmd('mobile-network create -n {mobile_network} -g {rg} --identifier {{mcc:001,mnc:01}}', checks=[
            self.check('publicLandMobileNetworkIdentifier.mcc', '001'),
            self.check('publicLandMobileNetworkIdentifier.mnc', '01')
        ])
        self.cmd('mobile-network update -n {mobile_network} -g {rg} --tags {{tag:test,tag2:test2}}', checks=[
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network list -g {rg}', checks=[
            self.check('[0].publicLandMobileNetworkIdentifier.mcc', '001'),
            self.check('[0].publicLandMobileNetworkIdentifier.mnc', '01'),
            self.check('[0].tags.tag', 'test'),
            self.check('[0].tags.tag2', 'test2')
        ])
        self.cmd('mobile-network show -n {mobile_network} -g {rg}', checks=[
            self.check('publicLandMobileNetworkIdentifier.mcc', '001'),
            self.check('publicLandMobileNetworkIdentifier.mnc', '01'),
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network delete -n {mobile_network} -g {rg} -y')

    @ResourceGroupPreparer(name_prefix='cli_test_mobile_network', location='eastus')
    def test_mobile_network_site(self, resource_group):
        self.kwargs.update({
            'mobile_network': self.create_random_name('mobile_network_', 20),
            'site_name': self.create_random_name('site_', 10)
        })
        self.cmd('mobile-network create -n {mobile_network} -g {rg} --identifier {{mcc:001,mnc:01}}', checks=[
            self.check('publicLandMobileNetworkIdentifier.mcc', '001'),
            self.check('publicLandMobileNetworkIdentifier.mnc', '01')
        ])
        self.cmd('mobile-network site create --mobile-network-name {mobile_network} -n {site_name} -g {rg} ', checks=[
            self.check('name', '{site_name}'),
        ])
        self.cmd('mobile-network site update --mobile-network-name {mobile_network} -n {site_name} -g {rg} --tags {{tag:test,tag2:test2}}', checks=[
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network site list --mobile-network-name {mobile_network} -g {rg}', checks=[
            self.check('[0].tags.tag', 'test'),
            self.check('[0].tags.tag2', 'test2')
        ])
        self.cmd('mobile-network site show --mobile-network-name {mobile_network} -n {site_name} -g {rg}', checks=[
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network site delete --mobile-network-name {mobile_network} -n {site_name} -g {rg} -y')

    @ResourceGroupPreparer(name_prefix='cli_test_mobile_network', location='eastus')
    def test_mobile_network_pccp(self, resource_group):
        self.kwargs.update({
            'mobile_network': self.create_random_name('mobile_network_', 20),
            'site_name': self.create_random_name('site_', 10),
            'pccp_name': self.create_random_name('pccp_', 10)
        })
        self.cmd('mobile-network create -n {mobile_network} -g {rg} --identifier {{mcc:001,mnc:01}}', checks=[
            self.check('publicLandMobileNetworkIdentifier.mcc', '001'),
            self.check('publicLandMobileNetworkIdentifier.mnc', '01')
        ])
        site = self.cmd('mobile-network site create --mobile-network-name {mobile_network} -n {site_name} -g {rg} ', checks=[
            self.check('name', '{site_name}'),
        ]).get_output_in_json()
        self.kwargs.update({
            'site_id': site['id']
        })
        self.cmd('mobile-network pccp create -n {pccp_name} -g {rg} --access-interface {{name:N2,ipv4Address:10.28.128.2,ipv4Subnet:10.28.128.0/24,ipv4Gateway:10.28.128.1}} '
                 '--local-diagnostics {{authentication-type:AAD}} --platform {{type:AKS-HCI}} '
                 '--sites [{{id:{site_id}}}] --sku G0', checks=[
            self.check('controlPlaneAccessInterface.ipv4Address', '10.28.128.2'),
            self.check('controlPlaneAccessInterface.ipv4Gateway', '10.28.128.1'),
            self.check('controlPlaneAccessInterface.ipv4Subnet', '10.28.128.0/24'),
            self.check('controlPlaneAccessInterface.name', 'N2'),
            self.check('localDiagnosticsAccess.authenticationType', 'AAD'),
            self.check('platform.type', 'AKS-HCI'),
            self.check('name', '{pccp_name}'),
            self.check('sku', 'G0'),
            self.check('sites[0].id', '{site_id}')
        ])
        self.cmd('mobile-network pccp update -n {pccp_name} -g {rg} --ue-mtu 1500 --tags {{tag:test,tag2:test2}}', checks=[
            self.check('ueMtu', '1500'),
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network pccp list -g {rg} ', checks=[
            self.check('[0].controlPlaneAccessInterface.ipv4Address', '10.28.128.2'),
            self.check('[0].controlPlaneAccessInterface.ipv4Gateway', '10.28.128.1'),
            self.check('[0].controlPlaneAccessInterface.ipv4Subnet', '10.28.128.0/24'),
            self.check('[0].controlPlaneAccessInterface.name', 'N2'),
            self.check('[0].localDiagnosticsAccess.authenticationType', 'AAD'),
            self.check('[0].platform.type', 'AKS-HCI'),
            self.check('[0].name', '{pccp_name}'),
            self.check('[0].sku', 'G0'),
            self.check('[0].ueMtu', '1500'),
        ])
        self.cmd('mobile-network pccp show -n {pccp_name} -g {rg}', checks=[
            self.check('controlPlaneAccessInterface.ipv4Address', '10.28.128.2'),
            self.check('controlPlaneAccessInterface.ipv4Gateway', '10.28.128.1'),
            self.check('controlPlaneAccessInterface.ipv4Subnet', '10.28.128.0/24'),
            self.check('controlPlaneAccessInterface.name', 'N2'),
            self.check('localDiagnosticsAccess.authenticationType', 'AAD'),
            self.check('platform.type', 'AKS-HCI'),
            self.check('name', '{pccp_name}'),
            self.check('sku', 'G0'),
            self.check('ueMtu', '1500'),
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network pccp version list')
        self.cmd('mobile-network pccp version show --version-name pmn-2211-0-80', checks=[
            self.check('name', 'pmn-2211-0-80')
        ])
        self.cmd('mobile-network pccp delete -n {pccp_name} -g {rg} -y')

    @ResourceGroupPreparer(name_prefix='cli_test_mobile_network', location='eastus')
    def test_mobile_network_pcdp(self, resource_group):
        self.kwargs.update({
            'mobile_network': self.create_random_name('mobile_network_', 20),
            'site_name': self.create_random_name('site_', 10),
            'pccp_name': self.create_random_name('pccp_', 10),
            'pcdp_name': self.create_random_name('pcdp_', 10),
        })
        self.cmd('mobile-network create -n {mobile_network} -g {rg} --identifier {{mcc:001,mnc:01}}', checks=[
            self.check('publicLandMobileNetworkIdentifier.mcc', '001'),
            self.check('publicLandMobileNetworkIdentifier.mnc', '01')
        ])
        site = self.cmd('mobile-network site create --mobile-network-name {mobile_network} -n {site_name} -g {rg} ', checks=[
            self.check('name', '{site_name}'),
        ]).get_output_in_json()
        self.kwargs.update({
            'site_id': site['id']
        })
        self.cmd('mobile-network pccp create -n {pccp_name} -g {rg} --access-interface {{name:N2,ipv4Address:10.28.128.2,ipv4Subnet:10.28.128.0/24,ipv4Gateway:10.28.128.1}} '
                 '--local-diagnostics {{authentication-type:AAD}} --platform {{type:AKS-HCI}} '
                 '--sites [{{id:{site_id}}}] --sku G0', checks=[
            self.check('controlPlaneAccessInterface.ipv4Address', '10.28.128.2'),
            self.check('controlPlaneAccessInterface.ipv4Gateway', '10.28.128.1'),
            self.check('controlPlaneAccessInterface.ipv4Subnet', '10.28.128.0/24'),
            self.check('controlPlaneAccessInterface.name', 'N2'),
            self.check('localDiagnosticsAccess.authenticationType', 'AAD'),
            self.check('platform.type', 'AKS-HCI'),
            self.check('name', '{pccp_name}'),
            self.check('sku', 'G0'),
            self.check('sites[0].id', '{site_id}')
        ])
        self.cmd('mobile-network pcdp create -n {pcdp_name} -g {rg} --pccp-name {pccp_name} --access-interface {{name:N2,ipv4Address:10.28.128.2,ipv4Subnet:10.28.128.0/24,ipv4Gateway:10.28.128.1}}', checks=[
            self.check('userPlaneAccessInterface.ipv4Address', '10.28.128.2'),
            self.check('userPlaneAccessInterface.ipv4Gateway', '10.28.128.1'),
            self.check('userPlaneAccessInterface.ipv4Subnet', '10.28.128.0/24'),
            self.check('userPlaneAccessInterface.name', 'N2')
        ])
        self.cmd('mobile-network pcdp update -n {pcdp_name} -g {rg} --pccp-name {pccp_name} --tags {{tag:test,tag2:test2}}', checks=[
            self.check('userPlaneAccessInterface.ipv4Address', '10.28.128.2'),
            self.check('userPlaneAccessInterface.ipv4Gateway', '10.28.128.1'),
            self.check('userPlaneAccessInterface.ipv4Subnet', '10.28.128.0/24'),
            self.check('userPlaneAccessInterface.name', 'N2'),
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network pcdp list -g {rg} --pccp-name {pccp_name}', checks=[
            self.check('[0].userPlaneAccessInterface.ipv4Address', '10.28.128.2'),
            self.check('[0].userPlaneAccessInterface.ipv4Gateway', '10.28.128.1'),
            self.check('[0].userPlaneAccessInterface.ipv4Subnet', '10.28.128.0/24'),
            self.check('[0].userPlaneAccessInterface.name', 'N2'),
            self.check('[0].tags.tag', 'test'),
            self.check('[0].tags.tag2', 'test2')
        ])
        self.cmd('mobile-network pcdp show -g {rg} -n {pcdp_name} --pccp-name {pccp_name}', checks=[
            self.check('userPlaneAccessInterface.ipv4Address', '10.28.128.2'),
            self.check('userPlaneAccessInterface.ipv4Gateway', '10.28.128.1'),
            self.check('userPlaneAccessInterface.ipv4Subnet', '10.28.128.0/24'),
            self.check('userPlaneAccessInterface.name', 'N2'),
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network pcdp delete -g {rg} -n {pcdp_name} --pccp-name {pccp_name} -y')

    @ResourceGroupPreparer(name_prefix='cli_test_mobile_network', location='eastus')
    def test_mobile_network_data_network(self, resource_group):
        self.kwargs.update({
            'mobile_network': self.create_random_name('mobile_network_', 20),
            'data_network': self.create_random_name('dn', 10)
        })
        self.cmd('mobile-network create -n {mobile_network} -g {rg} --identifier {{mcc:001,mnc:01}}', checks=[
            self.check('publicLandMobileNetworkIdentifier.mcc', '001'),
            self.check('publicLandMobileNetworkIdentifier.mnc', '01')
        ])
        self.cmd('mobile-network data-network create -n {data_network} -g {rg} --mobile-network-name {mobile_network}', checks=[
            self.check('name', '{data_network}')
        ])
        self.cmd('mobile-network data-network update -n {data_network} -g {rg} --mobile-network-name {mobile_network} --tags {{tag:test,tag2:test2}}', checks=[
            self.check('name', '{data_network}'),
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network data-network list  --mobile-network-name {mobile_network} -g {rg} ', checks=[
            self.check('[0].name', '{data_network}'),
            self.check('[0].tags.tag', 'test'),
            self.check('[0].tags.tag2', 'test2')
        ])
        self.cmd('mobile-network data-network show -n {data_network} --mobile-network-name {mobile_network} -g {rg}', checks=[
            self.check('name', '{data_network}'),
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network data-network delete -n {data_network} --mobile-network-name {mobile_network} -g {rg} -y')

    @ResourceGroupPreparer(name_prefix='cli_test_mobile_network', location='eastus')
    def test_mobile_network_attached_data_network(self, resource_group):
        self.kwargs.update({
            'mobile_network': self.create_random_name('mobile_network_', 20),
            'site_name': self.create_random_name('site_', 10),
            'pccp_name': self.create_random_name('pccp', 10),
            'pcdp_name': self.create_random_name('pcdp', 10),
            'data_network': self.create_random_name('dn', 10)
        })
        self.cmd('mobile-network create -n {mobile_network} -g {rg} --identifier {{mcc:001,mnc:01}}', checks=[
            self.check('publicLandMobileNetworkIdentifier.mcc', '001'),
            self.check('publicLandMobileNetworkIdentifier.mnc', '01')
        ])
        site = self.cmd('mobile-network site create --mobile-network-name {mobile_network} -n {site_name} -g {rg} ', checks=[
            self.check('name', '{site_name}'),
        ]).get_output_in_json()
        self.kwargs.update({
            'site_id': site['id']
        })
        self.cmd('mobile-network pccp create -n {pccp_name} -g {rg} --access-interface {{name:N2,ipv4Address:10.28.128.2,ipv4Subnet:10.28.128.0/24,ipv4Gateway:10.28.128.1}} '
                 '--local-diagnostics {{authentication-type:AAD}} --platform {{type:AKS-HCI}} '
                 '--sites [{{id:{site_id}}}] --sku G0', checks=[
            self.check('controlPlaneAccessInterface.ipv4Address', '10.28.128.2'),
            self.check('controlPlaneAccessInterface.ipv4Gateway', '10.28.128.1'),
            self.check('controlPlaneAccessInterface.ipv4Subnet', '10.28.128.0/24'),
            self.check('controlPlaneAccessInterface.name', 'N2'),
            self.check('localDiagnosticsAccess.authenticationType', 'AAD'),
            self.check('platform.type', 'AKS-HCI'),
            self.check('name', '{pccp_name}'),
            self.check('sku', 'G0'),
            self.check('sites[0].id', '{site_id}')
        ])
        self.cmd('mobile-network pcdp create -n {pcdp_name} -g {rg} --pccp-name {pccp_name} --access-interface {{name:N2,ipv4Address:10.28.128.2,ipv4Subnet:10.28.128.0/24,ipv4Gateway:10.28.128.1}}', checks=[
            self.check('userPlaneAccessInterface.ipv4Address', '10.28.128.2'),
            self.check('userPlaneAccessInterface.ipv4Gateway', '10.28.128.1'),
            self.check('userPlaneAccessInterface.ipv4Subnet', '10.28.128.0/24'),
            self.check('userPlaneAccessInterface.name', 'N2')
        ])
        self.cmd('mobile-network data-network create -n {data_network} -g {rg} --mobile-network-name {mobile_network}', checks=[
             self.check('name', '{data_network}')
         ])
        self.cmd('mobile-network attached-data-network create -n {data_network} -g {rg} --pccp-name {pccp_name} --pcdp-name {pcdp_name} --dns-addresses [1.1.1.1]'
                 ' --data-interface {{name:N2,ipv4Address:10.28.128.2,ipv4Subnet:10.28.128.0/24,ipv4Gateway:10.28.128.1}}', checks=[
            self.check('dnsAddresses[0]', '1.1.1.1'),
            self.check('userPlaneDataInterface.ipv4Address', '10.28.128.2'),
            self.check('userPlaneDataInterface.ipv4Gateway', '10.28.128.1'),
            self.check('userPlaneDataInterface.ipv4Subnet', '10.28.128.0/24'),
            self.check('userPlaneDataInterface.name', 'N2')
        ])
        self.cmd('mobile-network attached-data-network update -n {data_network} -g {rg} --pccp-name {pccp_name} --pcdp-name {pcdp_name} --tags {{tag:test,tag2:test2}}', checks=[
            self.check('dnsAddresses[0]', '1.1.1.1'),
            self.check('userPlaneDataInterface.ipv4Address', '10.28.128.2'),
            self.check('userPlaneDataInterface.ipv4Gateway', '10.28.128.1'),
            self.check('userPlaneDataInterface.ipv4Subnet', '10.28.128.0/24'),
            self.check('userPlaneDataInterface.name', 'N2'),
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network attached-data-network list -g {rg} --pccp-name {pccp_name} --pcdp-name {pcdp_name}', checks=[
            self.check('[0].dnsAddresses[0]', '1.1.1.1'),
            self.check('[0].userPlaneDataInterface.ipv4Address', '10.28.128.2'),
            self.check('[0].userPlaneDataInterface.ipv4Gateway', '10.28.128.1'),
            self.check('[0].userPlaneDataInterface.ipv4Subnet', '10.28.128.0/24'),
            self.check('[0].userPlaneDataInterface.name', 'N2'),
            self.check('[0].tags.tag', 'test'),
            self.check('[0].tags.tag2', 'test2')
        ])
        self.cmd('mobile-network attached-data-network show -n {data_network} --pccp-name {pccp_name} --pcdp-name {pcdp_name} -g {rg}', checks=[
            self.check('dnsAddresses[0]', '1.1.1.1'),
            self.check('userPlaneDataInterface.ipv4Address', '10.28.128.2'),
            self.check('userPlaneDataInterface.ipv4Gateway', '10.28.128.1'),
            self.check('userPlaneDataInterface.ipv4Subnet', '10.28.128.0/24'),
            self.check('userPlaneDataInterface.name', 'N2'),
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network attached-data-network delete -n {data_network} --pccp-name {pccp_name} --pcdp-name {pcdp_name} -g {rg} -y')

    @ResourceGroupPreparer(name_prefix='cli_test_mobile_network', location='eastus')
    def test_mobile_network_service(self, resource_group):
        self.kwargs.update({
            'mobile_network': self.create_random_name('mobile_network_', 20),
            'service': self.create_random_name('ser', 10)
        })
        self.cmd('mobile-network create -n {mobile_network} -g {rg} --identifier {{mcc:001,mnc:01}}', checks=[
            self.check('publicLandMobileNetworkIdentifier.mcc', '001'),
            self.check('publicLandMobileNetworkIdentifier.mnc', '01')
        ])
        self.cmd('mobile-network service create -n {service} -g {rg} --mobile-network-name {mobile_network} '
                 '--pcc-rules [{{ruleName:default-rule,rulePrecedence:10,serviceDataFlowTemplates:[{{templateName:IP-to-server,direction:Uplink,protocol:[ip],remoteIpList:[10.3.4.0/24]}}]}}] --service-precedence 10', checks=[
            self.check('pccRules[0].ruleName', 'default-rule'),
            self.check('pccRules[0].rulePrecedence', '10'),
            self.check('pccRules[0].serviceDataFlowTemplates[0].direction', 'Uplink'),
            self.check('pccRules[0].serviceDataFlowTemplates[0].protocol[0]', 'ip'),
            self.check('pccRules[0].serviceDataFlowTemplates[0].remoteIpList[0]', '10.3.4.0/24'),
            self.check('pccRules[0].serviceDataFlowTemplates[0].templateName', 'IP-to-server'),
            self.check('servicePrecedence', '10')
        ])
        self.cmd('mobile-network service update --mobile-network-name {mobile_network} -g {rg} -n {service} --tags {{tag:test,tag2:test2}}', checks=[
            self.check('pccRules[0].ruleName', 'default-rule'),
            self.check('pccRules[0].rulePrecedence', '10'),
            self.check('pccRules[0].serviceDataFlowTemplates[0].direction', 'Uplink'),
            self.check('pccRules[0].serviceDataFlowTemplates[0].protocol[0]', 'ip'),
            self.check('pccRules[0].serviceDataFlowTemplates[0].remoteIpList[0]', '10.3.4.0/24'),
            self.check('pccRules[0].serviceDataFlowTemplates[0].templateName', 'IP-to-server'),
            self.check('servicePrecedence', '10'),
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network service list --mobile-network-name {mobile_network} -g {rg} ', checks=[
            self.check('[0].pccRules[0].ruleName', 'default-rule'),
            self.check('[0].pccRules[0].rulePrecedence', '10'),
            self.check('[0].pccRules[0].serviceDataFlowTemplates[0].direction', 'Uplink'),
            self.check('[0].pccRules[0].serviceDataFlowTemplates[0].protocol[0]', 'ip'),
            self.check('[0].pccRules[0].serviceDataFlowTemplates[0].remoteIpList[0]', '10.3.4.0/24'),
            self.check('[0].pccRules[0].serviceDataFlowTemplates[0].templateName', 'IP-to-server'),
            self.check('[0].servicePrecedence', '10'),
            self.check('[0].tags.tag', 'test'),
            self.check('[0].tags.tag2', 'test2')
        ])
        self.cmd('mobile-network service show --mobile-network-name {mobile_network} -n {service} -g {rg}', checks=[
            self.check('pccRules[0].ruleName', 'default-rule'),
            self.check('pccRules[0].rulePrecedence', '10'),
            self.check('pccRules[0].serviceDataFlowTemplates[0].direction', 'Uplink'),
            self.check('pccRules[0].serviceDataFlowTemplates[0].protocol[0]', 'ip'),
            self.check('pccRules[0].serviceDataFlowTemplates[0].remoteIpList[0]', '10.3.4.0/24'),
            self.check('pccRules[0].serviceDataFlowTemplates[0].templateName', 'IP-to-server'),
            self.check('servicePrecedence', '10'),
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network service delete --mobile-network-name {mobile_network} -n {service} -g {rg} -y')

    @ResourceGroupPreparer(name_prefix='cli_test_mobile_network', location='eastus')
    def test_mobile_network_sim(self, resource_group):
        self.kwargs.update({
            'mobile_network': self.create_random_name('mobile_network_', 20),
            'sim_group': self.create_random_name('simgroup', 15),
            'sim': self.create_random_name('sim', 10),
        })
        mobile_network = self.cmd('mobile-network create -n {mobile_network} -g {rg} --identifier {{mcc:001,mnc:01}}', checks=[
            self.check('publicLandMobileNetworkIdentifier.mcc', '001'),
            self.check('publicLandMobileNetworkIdentifier.mnc', '01')
        ]).get_output_in_json()
        self.kwargs.update({
            'mobile_network_id': mobile_network['id']
        })
        self.cmd('mobile-network sim group create -n {sim_group} -g {rg} --mobile-network {{id:{mobile_network_id}}}', checks=[
            self.check('mobileNetwork.id', '{mobile_network_id}'),
            self.check('name', '{sim_group}')
        ])
        self.cmd('mobile-network sim group update -n {sim_group} -g {rg} --tags {{tag:test,tag2:test2}}', checks=[
            self.check('mobileNetwork.id', '{mobile_network_id}'),
            self.check('name', '{sim_group}'),
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network sim group list  -g {rg}', checks=[
            self.check('[0].mobileNetwork.id', '{mobile_network_id}'),
            self.check('[0].name', '{sim_group}'),
            self.check('[0].tags.tag', 'test'),
            self.check('[0].tags.tag2', 'test2')
        ])
        self.cmd('mobile-network sim group show -n {sim_group} -g {rg}', checks=[
            self.check('mobileNetwork.id', '{mobile_network_id}'),
            self.check('name', '{sim_group}'),
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network sim create -g {rg} --sim-group-name {sim_group} -n {sim} --international-msi 0000000000 --operator-key-code 00000000000000000000000000000000 --authentication-key 00000000000000000000000000000000', checks=[
             self.check('internationalMobileSubscriberIdentity', '0000000000'),
             self.check('name', '{sim}')
         ])
        self.cmd('mobile-network sim list -g {rg} --sim-group-name {sim_group} ', checks=[
            self.check('[0].internationalMobileSubscriberIdentity', '0000000000'),
            self.check('[0].name', '{sim}')
        ])
        self.cmd('mobile-network sim show -g {rg} -n {sim} --sim-group-name {sim_group} ', checks=[
            self.check('internationalMobileSubscriberIdentity', '0000000000'),
            self.check('name', '{sim}')
        ])
        self.cmd('mobile-network sim delete -g {rg} -n {sim} --sim-group-name {sim_group} -y')
        self.cmd('mobile-network sim group delete -n {sim_group} -g {rg} -y')

    @ResourceGroupPreparer(name_prefix='cli_test_mobile_network', location='eastus')
    def test_mobile_network_slice(self, resource_group):
        self.kwargs.update({
            'mobile_network': self.create_random_name('mobile_network_', 20),
            'slice': self.create_random_name('slice', 10)
        })
        self.cmd('mobile-network create -n {mobile_network} -g {rg} --identifier {{mcc:001,mnc:01}}', checks=[
            self.check('publicLandMobileNetworkIdentifier.mcc', '001'),
            self.check('publicLandMobileNetworkIdentifier.mnc', '01')
        ])
        self.cmd('mobile-network slice create --mobile-network-name {mobile_network} -n {slice} -g {rg} --snssai {{sst:1,sd:123abc}}', checks=[
            self.check('name', '{slice}'),
            self.check('snssai.sd', '123abc'),
            self.check('snssai.sst', 1)
        ])
        self.cmd('mobile-network slice update --mobile-network-name {mobile_network} -n {slice} -g {rg} --tags {{tag:test,tag2:test2}}', checks=[
            self.check('name', '{slice}'),
            self.check('snssai.sd', '123abc'),
            self.check('snssai.sst', 1),
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network slice list --mobile-network-name {mobile_network} -g {rg}', checks=[
            self.check('[0].name', '{slice}'),
            self.check('[0].snssai.sd', '123abc'),
            self.check('[0].snssai.sst', 1),
            self.check('[0].tags.tag', 'test'),
            self.check('[0].tags.tag2', 'test2')
        ])
        self.cmd('mobile-network slice show --mobile-network-name {mobile_network} -n {slice} -g {rg}', checks=[
            self.check('name', '{slice}'),
            self.check('snssai.sd', '123abc'),
            self.check('snssai.sst', 1),
            self.check('tags.tag', 'test'),
            self.check('tags.tag2', 'test2')
        ])
        self.cmd('mobile-network slice delete --mobile-network-name {mobile_network} -n {slice} -g {rg} -y')

    @ResourceGroupPreparer(name_prefix='cli_test_mobile_network', location='westcentralus')
    def test_mobile_network_bulk_sim_upload(self, resource_group):
        self.kwargs.update({
            'mobile_network': self.create_random_name('mobile_network_', 20),
            'sim_group': self.create_random_name('simgroup', 15),
        })
        mobile_network = self.cmd('mobile-network create -n {mobile_network} -g {rg} --identifier {{mcc:001,mnc:01}}', checks=[
            self.check('publicLandMobileNetworkIdentifier.mcc', '001'),
            self.check('publicLandMobileNetworkIdentifier.mnc', '01')
        ]).get_output_in_json()
        self.kwargs.update({
            'mobile_network_id': mobile_network['id']
        })
        sim_group = self.cmd('mobile-network sim group create -n {sim_group} -g {rg} --mobile-network {{id:{mobile_network_id}}}', checks=[
            self.check('mobileNetwork.id', '{mobile_network_id}'),
            self.check('name', '{sim_group}')
        ]).get_output_in_json()
        self.kwargs.update({
            'sim_group_id': sim_group['id'],
            'sims': '{name:bulk-upload-sim-01,authentication-key:00000000000000000000000000000000,operator-key-code:00000000000000000000000000000000,international-msi:0000000000},{name:bulk-upload-sim-02,authentication-key:00000000000000000000000000000001,operator-key-code:00000000000000000000000000000001,international-msi:0000000001}'
        })
        self.cmd('mobile-network sim group bulk-upload-sims -g {rg} --sim-group-name {sim_group} --sims ["{sims}"] ', checks=[
            self.check('status', 'Succeeded')
        ])
        self.cmd('mobile-network sim group bulk-delete-sims -g {rg} --sim-group-name {sim_group} --sims [bulk-upload-sim-01,bulk-upload-sim-02] ', checks=[
            self.check('status', 'Succeeded')
        ])
        self.cmd('mobile-network sim group delete -n {sim_group} -g {rg} -y')