def CASE2( self, main ):
        """
        Configure Network Subnet Port
        """
        import os

        try:
            from tests.FUNCovsdbtestL3.dependencies.Nbdata import NetworkData
            from tests.FUNCovsdbtestL3.dependencies.Nbdata import SubnetData
            from tests.FUNCovsdbtestL3.dependencies.Nbdata import VirtualPortData
            from tests.FUNCovsdbtestL3.dependencies.Nbdata import RouterData
            from tests.FUNCovsdbtestL3.dependencies.Nbdata import RouterInterfaceData
            from tests.FUNCovsdbtestL3.dependencies.Nbdata import FloatingIpData

        except ImportError:
            main.log.exception( "Something wrong with import file or code error." )
            main.log.info( "Import Error, please check!" )
            main.cleanup()
            main.exit()

        main.log.info( "Configure Network Subnet Port Start" )
        main.case( "Configure Network Subnet Port" )
        main.caseExplanation = "Configure Network Subnet Port " +\
                                "Verify post is OK"

        ctrlip = os.getenv( main.params['CTRL']['ip1'] )
        httpport = main.params['HTTP']['port']
        path = main.params['HTTP']['path']

        main.step( "Generate Post Data of Inner Network" )
        network = NetworkData()
        network.id = '1000000000000002'
        network.tenant_id = '1000000000000001'      
        subnet1 = SubnetData()
        subnet1.id = "1000000000000003"
        subnet1.tenant_id = network.tenant_id
        subnet1.network_id = network.id
        subnet1.gateway_ip = '192.168.33.254'
        subnet1.start = "192.168.33.1"
        subnet1.end = "192.168.33.254"
        subnet1.cidr = "192.168.33.0/24"
        subnet2 = SubnetData()
        subnet2.id = "1000000000000004"
        subnet2.tenant_id = network.tenant_id
        subnet2.network_id = network.id
        subnet2.gateway_ip = '192.168.44.254'
        subnet2.start = "192.168.44.1"
        subnet2.end = "192.168.44.254"
        subnet2.cidr = "192.168.44.0/24"
        
        port1 = VirtualPortData()
        port1.id = "00000000-0000-0000-0000-000000000001"
        port1.subnet_id = subnet1.id
        port1.tenant_id = network.tenant_id
        port1.network_id = network.id
        port1.macAddress = "00:00:00:00:00:01"
        port1.ip_address = "192.168.33.1"
        port2 = VirtualPortData()
        port2.id = "00000000-0000-0000-0000-000000000002"
        port2.subnet_id = subnet2.id
        port2.tenant_id = network.tenant_id
        port2.network_id = network.id
        port2.macAddress = "00:00:00:00:00:02"
        port2.ip_address = "192.168.44.1"
         
        main.step("Generate Post Data of Ext Network")
        exnetwork = NetworkData()
        exnetwork.id = '1000000000000011'
        exnetwork.tenant_id = '1000000000000001'
        exsubnet = SubnetData()
        exsubnet.id = "1000000000000012"
        exsubnet.tenant_id = exnetwork.tenant_id
        exsubnet.network_id = exnetwork.id
        exsubnet.gateway_ip = '172.16.0.1'
        exsubnet.start = "172.16.0.1"
        exsubnet.end = "172.16.0.254"
        exsubnet.cidr = "172.16.0.0/24"
        rgwport = VirtualPortData()
        rgwport.id = "00000000-0000-0000-0000-000000000003"
        rgwport.subnet_id = exsubnet.id
        rgwport.tenant_id = exnetwork.tenant_id
        rgwport.network_id = exnetwork.id
        rgwport.macAddress = "00:00:00:00:00:03"
        rgwport.ip_address = "172.16.0.100"
        rgwport.deviceId = '1000000000000010'
        exgwport = VirtualPortData()
        exgwport.id = "00000000-0000-0000-0000-100000000011"
        exgwport.subnet_id = exsubnet.id
        exgwport.tenant_id = exnetwork.tenant_id
        exgwport.network_id = exnetwork.id
        exgwport.macAddress = "52:54:00:d0:bf:31"
        #exgwport.macAddress = "00:00:00:00:10:11"
        exgwport.ip_address = "172.16.0.1"
        exgwport.deviceId = None
        
        router = RouterData()
        router.id = '1000000000000010'
        router.network_id = exnetwork.id
        router.tenant_id = network.tenant_id
        router.subnet_id = exsubnet.id
        router.ip_address = '172.16.0.100'
        router.gw_port_id = rgwport.id
         
        main.step("Generate Post Data of Inner RouteInterface")
        riport1 = VirtualPortData()
        riport1.state = 'DOWN'
        riport1.id = "00000000-0000-0000-0000-000000000004"
        riport1.subnet_id = subnet1.id
        riport1.tenant_id = network.tenant_id
        riport1.network_id = network.id
        riport1.ip_address = '192.168.33.254'
        riport1.macAddress = "00:00:00:00:00:04"
        riport1.deviceId = router.id
        riport2 = VirtualPortData()
        riport2.state = 'DOWN'
        riport2.id = "00000000-0000-0000-0000-000000000005"
        riport2.subnet_id = subnet2.id
        riport2.tenant_id = network.tenant_id
        riport2.network_id = network.id
        riport2.ip_address = '192.168.44.254'
        riport2.macAddress = "00:00:00:00:00:05"
        riport2.deviceId = router.id
        routerinterface1 = RouterInterfaceData()
        routerinterface1.id = riport1.deviceId
        routerinterface1.subnet_id = riport1.subnet_id
        routerinterface1.tenant_id = riport1.tenant_id
        routerinterface1.port_id = riport1.id
        routerinterface2 = RouterInterfaceData()
        routerinterface2.id = riport2.deviceId
        routerinterface2.subnet_id = riport2.subnet_id
        routerinterface2.tenant_id = riport2.tenant_id
        routerinterface2.port_id = riport2.id
         
        main.step("Generate Post Data of Inner FloatingIp")
        flport = VirtualPortData()
        flport.id = "9352e05c-58b8-4f2c-b4df-c20435ser56466"
        flport.subnet_id = exsubnet.id
        flport.tenant_id = exnetwork.tenant_id
        flport.network_id = exnetwork.id
        flport.deviceId = '91a546ea-8add-47e7-ad98-15677c74b337'
        flport.macAddress = "00:00:00:00:00:06"
        flport.ip_address = "172.16.0.101"
        #export1 = VirtualPortData()
        #export1.id = "00000000-0000-0000-0000-100000000001"
        #export1.subnet_id = exsubnet.id
        #export1.tenant_id = exnetwork.tenant_id
        #export1.network_id = exnetwork.id
        #export1.macAddress = "00:00:00:00:10:01"
        #export1.ip_address = "192.168.22.4"
        floatingip = FloatingIpData()
        floatingip.id = flport.deviceId
        floatingip.floating_network_id = exnetwork.id
        floatingip.tenant_id = router.tenant_id
        floatingip.floating_ip_address = '172.16.0.101'
        floatingip.router_id = router.id
        #floatingip.port_id = flport.id
        floatingip.port_id = port1.id
        floatingip.fixed_ip_address = '192.168.33.1'
        
        
        
        networkpostdata = network.DictoJson()
        subnet1postdata = subnet1.DictoJson()
        subnet2postdata = subnet2.DictoJson()
        port1postdata = port1.DictoJson()
        port2postdata = port2.DictoJson()
        exnetworkpostdata = exnetwork.DictoJson()
        exsubnetpostdata = exsubnet.DictoJson()
        rgwportpostdata = rgwport.DictoJson()
        exgwportpostdata = exgwport.DictoJson()
        routerpostdata = router.DictoJson()
        riportpostdata1 = riport1.DictoJson()
        routerinterfacedata1 = routerinterface1.DictoJson()
        riportpostdata2 = riport2.DictoJson()
        routerinterfacedata2 = routerinterface2.DictoJson()
        flportpostdata = flport.DictoJson()
        #export1postdata = export1.DictoJson()
        floatingippostdata = floatingip.DictoJson()

        main.step( "Post Network Data via HTTP(Post port need post network)" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'networks/',
                                                 'POST', None, networkpostdata )
        utilities.assert_equals(
                expect='200',
                actual=Poststatus,
                onpass="******",
                onfail="Post Network Failed " + str( Poststatus ) + "," + str( result ) )

        main.step( "Post Subnet1 Data via HTTP(Post port need post subnet)" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'subnets/',
                                                 'POST', None, subnet1postdata )
        utilities.assert_equals(
                expect='202',
                actual=Poststatus,
                onpass="******",
                onfail="Post Subnet1 Failed " + str( Poststatus ) + "," + str( result ) )
        
        main.step( "Post Subnet2 Data via HTTP(Post port need post subnet)" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'subnets/',
                                                 'POST', None, subnet2postdata )
        utilities.assert_equals(
                expect='202',
                actual=Poststatus,
                onpass="******",
                onfail="Post Subnet2 Failed " + str( Poststatus ) + "," + str( result ) )        

        main.step( "Post Port1 Data via HTTP" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'ports/',
                                                 'POST', None, port1postdata )
        utilities.assert_equals(
                expect='200',
                actual=Poststatus,
                onpass="******" + str(port1postdata),
                onfail="Post Port1 Failed " + str( Poststatus ) + "," + str( result ) )

        main.step( "Post Port2 Data via HTTP" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'ports/',
                                                 'POST', None, port2postdata )
        utilities.assert_equals(
                expect='200',
                actual=Poststatus,
                onpass="******",
                onfail="Post Port2 Failed " + str( Poststatus ) + "," + str( result ) )
        
        main.step( "Post ExNetwork Data via HTTP(Post port need post network)" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'networks/',
                                                 'POST', None, exnetworkpostdata )
        utilities.assert_equals(
                expect='200',
                actual=Poststatus,
                onpass="******",
                onfail="Post ExNetwork Failed " + str( Poststatus ) + "," + str( result ) )

        main.step( "Post ExSubnet Data via HTTP(Post port need post subnet)" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'subnets/',
                                                 'POST', None, exsubnetpostdata )
        utilities.assert_equals(
                expect='202',
                actual=Poststatus,
                onpass="******",
                onfail="Post ExSubnet Failed " + str( Poststatus ) + "," + str( result ) )

        main.step( "Post GwPort Data via HTTP" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'ports/',
                                                 'POST', None, rgwportpostdata )
        utilities.assert_equals(
                expect='200',
                actual=Poststatus,
                onpass="******",
                onfail="Post GwPort Failed " + str( Poststatus ) + "," + str( result ) )
        
        main.step( "Post exPort Data via HTTP" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'ports/',
                                                 'POST', None, exgwportpostdata )
        utilities.assert_equals(
                expect='200',
                actual=Poststatus,
                onpass="******",
                onfail="Post exPort Failed " + str( Poststatus ) + "," + str( result ) )
 
        main.step( "Post Router Data via HTTP" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'routers/',
                                                 'POST', None, routerpostdata )
        utilities.assert_equals(
                expect='201',
                actual=Poststatus,
                onpass="******",
                onfail="Post Router Failed " + str( Poststatus ) + "," + str( result ) )
        
        main.step( "Post RIPort1 Data via HTTP" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'ports/',
                                                 'POST', None, riportpostdata1 )
        utilities.assert_equals(
                expect='200',
                actual=Poststatus,
                onpass="******",
                onfail="Post RIPort1 Failed " + str( Poststatus ) + "," + str( result ) )
                
        main.step( "Post RouterInterface1 Data via HTTP")
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'routers/' +
                                                 router.id + '/add_router_interface/', 
                                                 'PUT', None, routerinterfacedata1 )
        utilities.assert_equals(
                expect='200',
                actual=Poststatus,
                onpass="******",
                onfail="Post RouterInterface1 Failed " + str( Poststatus ) + "," + str( result ) )
        
        main.step( "Post RIPort2 Data via HTTP" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'ports/',
                                                 'POST', None, riportpostdata2 )
        utilities.assert_equals(
                expect='200',
                actual=Poststatus,
                onpass="******",
                onfail="Post RIPort2 Failed " + str( Poststatus ) + "," + str( result ) )
                
        main.step( "Post RouterInterface2 Data via HTTP")
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'routers/' +
                                                 router.id + '/add_router_interface/', 
                                                 'PUT', None, routerinterfacedata2 )
        utilities.assert_equals(
                expect='200',
                actual=Poststatus,
                onpass="******",
                onfail="Post RouterInterface2 Failed " + str( Poststatus ) + "," + str( result ) )        
         
        main.step( "Post FLPort Data via HTTP" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'ports/',
                                                 'POST', None, flportpostdata )
        utilities.assert_equals(
                expect='200',
                actual=Poststatus,
                onpass="******",
                onfail="Post FLPort Failed " + str( Poststatus ) + "," + str( result ) )
        
        main.step( "Post FloatingIp Data via HTTP" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'floatingips/',
                                                 'POST', None, floatingippostdata )
        utilities.assert_equals(
                expect='201',
                actual=Poststatus,
                onpass="******",
                onfail="Post FloatingIp Failed " + str( Poststatus ) + "," + str( result ) )
        """
    def CASE4( self, main ):
        """
        Test Connection of North-South
        """
        import os
        import json

        try:
            from tests.FUNCovsdbtestL3.dependencies.Nbdata import NetworkData
            from tests.FUNCovsdbtestL3.dependencies.Nbdata import SubnetData
            from tests.FUNCovsdbtestL3.dependencies.Nbdata import VirtualPortData
            from tests.FUNCovsdbtestL3.dependencies.Nbdata import RouterData
            from tests.FUNCovsdbtestL3.dependencies.Nbdata import RouterInterfaceData
            from tests.FUNCovsdbtestL3.dependencies.Nbdata import FloatingIpData

        except ImportError:
            main.log.exception( "Something wrong with import file or code error." )
            main.log.info( "Import Error, please check!" )
            main.cleanup()
            main.exit()

        main.log.info( "Configure Network Subnet Port Start" )
        main.case( "Configure Network Subnet Port" )
        main.caseExplanation = "Configure Network Subnet Port " +\
                                "Verify post is OK"

        ctrlip = os.getenv( main.params['CTRL']['ip1'] )
        httpport = main.params['HTTP']['port']
        path = main.params['HTTP']['path']

        main.step( "Get External Gateway Port Data via HTTP" )
        Getstatus, result = main.ONOSrest.send( ctrlip, httpport, 'externalgateway-update-id', path + 'ports/',
                                                 'GET', None, None )
        utilities.assert_equals(
                expect='200',
                actual=Getstatus,
                onpass="******" + str(result),
                onfail="Get Port Failed " + str( Getstatus ) + "," + str( result ) )

        main.step("Generate Post Data of Inner FloatingIp")
        exgwport = json.loads(str(result))
        rgwport = VirtualPortData()
        rgwport.id = "00000000-0000-0000-0000-000000000003"
        rgwport.subnet_id = exgwport['port']['fixed_ips'][0]['subnet_id']
        rgwport.tenant_id = exgwport['port']['tenant_id']
        rgwport.network_id = exgwport['port']['network_id']
        rgwport.macAddress = "00:00:00:00:00:03"
        rgwport.ip_address = exgwport['port']['fixed_ips'][0]['ip_address'] + "00"
        rgwport.deviceId = '1000000000000010'
        router = RouterData()
        router.id = '1000000000000010'
        router.network_id = exgwport['port']['network_id']
        router.tenant_id = exgwport['port']['tenant_id']
        router.subnet_id = exgwport['port']['fixed_ips'][0]['subnet_id']
        router.ip_address = exgwport['port']['fixed_ips'][0]['ip_address'] + "00" 
        router.gw_port_id = rgwport.id
        
        flport = VirtualPortData()
        flport.id = "9352e05c-58b8-4f2c-b4df-c20435ser56466"
        flport.subnet_id = exgwport['port']['fixed_ips'][0]['subnet_id']
        flport.tenant_id = exgwport['port']['tenant_id']
        flport.network_id = exgwport['port']['network_id']
        flport.deviceId = '91a546ea-8add-47e7-ad98-15677c74b337'
        flport.macAddress = "00:00:00:00:00:06"
        flport.ip_address = exgwport['port']['fixed_ips'][0]['ip_address'] + "01" 
        floatingip = FloatingIpData()
        floatingip.id = flport.deviceId
        floatingip.floating_network_id = exgwport['port']['network_id']
        floatingip.tenant_id = exgwport['port']['tenant_id']
        floatingip.floating_ip_address = exgwport['port']['fixed_ips'][0]['ip_address'] + "01" 
        floatingip.router_id = '1000000000000010'
        floatingip.port_id = "00000000-0000-0000-0000-000000000001"
        floatingip.fixed_ip_address = '192.168.33.1'

        rgwportpostdata = rgwport.DictoJson()
        routerpostdata = router.DictoJson()
        flportpostdata = flport.DictoJson()
        floatingippostdata = floatingip.DictoJson()

        main.step( "Post GwPort Data via HTTP" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'ports/',
                                                 'POST', None, rgwportpostdata )
        utilities.assert_equals(
                expect='200',
                actual=Poststatus,
                onpass="******",
                onfail="Post GwPort Failed " + str( Poststatus ) + "," + str( result ) )
 
        main.step( "Post Router Data via HTTP" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'routers/',
                                                 'POST', None, routerpostdata )
        utilities.assert_equals(
                expect='201',
                actual=Poststatus,
                onpass="******",
                onfail="Post Router Failed " + str( Poststatus ) + "," + str( result ) )       
         
        main.step( "Post FLPort Data via HTTP" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'ports/',
                                                 'POST', None, flportpostdata )
        utilities.assert_equals(
                expect='200',
                actual=Poststatus,
                onpass="******",
                onfail="Post FLPort Failed " + str( Poststatus ) + "," + str( result ) )
        
        main.step( "Post FloatingIp Data via HTTP" )
        Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'floatingips/',
                                                 'POST', None, floatingippostdata )
        utilities.assert_equals(
                expect='201',
                actual=Poststatus,
                onpass="******",
                onfail="Post FloatingIp Failed " + str( Poststatus ) + "," + str( result ) )

        main.step( "Check network connecting with internet from host" )
        #main.OVSDB1.setHostportIp( hostname="host1", hostport1="host1-eth0", ip="192.168.33.1" )
        pingResult1 = main.OVSDB1.hostPing( src="192.168.33.1", hostname="host1", target="114.114.114.114" )
        stepResult = pingResult1
        utilities.assert_equals( expect=main.TRUE,
                                 actual=stepResult,
                                 onpass="******" +\
                                        str( ctrlip ),
                                 onfail="Failed to connect with internet:114.114.114.114,controller is " +\
                                        str( ctrlip ) )