当前位置: 首页>>代码示例>>Python>>正文


Python NetworkData.shared方法代码示例

本文整理汇总了Python中tests.FUNCvirNetNB.dependencies.Nbdata.NetworkData.shared方法的典型用法代码示例。如果您正苦于以下问题:Python NetworkData.shared方法的具体用法?Python NetworkData.shared怎么用?Python NetworkData.shared使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tests.FUNCvirNetNB.dependencies.Nbdata.NetworkData的用法示例。


在下文中一共展示了NetworkData.shared方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CASE11

# 需要导入模块: from tests.FUNCvirNetNB.dependencies.Nbdata import NetworkData [as 别名]
# 或者: from tests.FUNCvirNetNB.dependencies.Nbdata.NetworkData import shared [as 别名]
    def CASE11 ( self,main ):

        """
        Test Post Error Json Create Network
        """
        import os

        try:
            from tests.FUNCvirNetNB.dependencies.Nbdata import NetworkData
        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( "ONOS Post Error Json Create Network test Start" )
        main.case( "Virtual Network NBI Test - Network" )
        main.caseExplanation  = "Test Network Post With Error json " +\
                                "The wrong Json can't post network successfully"

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

        main.step( "Generate Post Data" )
        network = NetworkData()
        network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc'
        network.tenant_id = '26cd996094344a0598b0a1af1d525cdc'
        #The network.admin_state_up should be True or False,when the admin_state_up is 'tttttttttt',the Json can't post.
        network.admin_state_up = 'tttttttttt'
        #The network.routerExternal should be True or False,when the routerExternal is 'ffffffffffff',the Json can't post.
        network.routerExternal = 'ffffffffffff'
        #The network.shared should be True or False,when the shared is 'ffffffffffffff',the Json can't post.
        network.shared = 'ffffffffffffff'
        postdata = network.DictoJson()

        main.step( "Post Data via HTTP" )
        Poststatus, result = main.ONOSrest.send( ctrlip, port, '', path+'networks/',
                                                'POST', None, postdata)

        utilities.assert_equals(
                expect='500',
                actual=Poststatus,
                onpass="The Json is wrong,can't post",
                onfail="Wrong Json can post successfully " )
开发者ID:castroflavio,项目名称:OnosSystemTest,代码行数:47,代码来源:FUNCvirNetNB.py

示例2: CASE3

# 需要导入模块: from tests.FUNCvirNetNB.dependencies.Nbdata import NetworkData [as 别名]
# 或者: from tests.FUNCvirNetNB.dependencies.Nbdata.NetworkData import shared [as 别名]
    def CASE3( self,main ):

        """
        Test Update Network
        """
        import os

        try:
            from tests.FUNCvirNetNB.dependencies.Nbdata import NetworkData
        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( "ONOS Network Update test Start" )
        main.case( "Virtual Network NBI Test - Network" )
        main.caseExplanation  = "Test Network Update NBI " +\
                                "Verify Update Data same with Stored Data"

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

        main.step( "Generate Post Data" )
        network = NetworkData()
        network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc'
        network.tenant_id = '26cd996094344a0598b0a1af1d525cdc'
        network.shared = False
        postdata = network.DictoJson()

        network.shared = True
        postdatanew = network.DictoJson()

        main.step( "Post Data via HTTP" )
        Poststatus, result = main.ONOSrest.send( ctrlip, port, '', path+'networks',
                                                 'POST', None, postdata )
        utilities.assert_equals(
                expect='200',
                actual=Poststatus,
                onpass="Post Success",
                onfail="Post Failed " + str( Poststatus ) + str( result ) )

        main.step( "Update Data via HTTP" )
        Updatestatus, result = main.ONOSrest.send( ctrlip, port, network.id, path+'networks/',
                                                   'PUT', None, postdatanew)
        utilities.assert_equals(
                expect='200',
                actual=Updatestatus,
                onpass="Update Success",
                onfail="Update Failed " + str( Updatestatus ) + str( result ) )

        main.step( "Get Data via HTTP" )
        Getstatus, result = main.ONOSrest.send( ctrlip, port, network.id, path+'networks/',
                                                'GET', None, None )
        utilities.assert_equals(
                expect='200',
                actual=Getstatus,
                onpass="Get Success",
                onfail="Get Failed " + str( Getstatus ) + str( result ) )

        main.step( "Compare Update data." )
        IDcmpresult = network.JsonCompare( postdatanew, result, 'network', 'id' )
        TanantIDcmpresult = network.JsonCompare( postdatanew, result, 'network', 'tenant_id' )
        Shareresult = network.JsonCompare( postdatanew, result, 'network', 'shared' )

        Cmpresult = IDcmpresult and TanantIDcmpresult and Shareresult
        utilities.assert_equals(
                expect=True,
                actual=Cmpresult,
                onpass="Compare Success",
                onfail="Compare Failed:ID compare:" + str( IDcmpresult ) + \
                       ",Tenant id compare:"+ str( TanantIDcmpresult ) + \
                       ",Name compare:" + str( Shareresult ) )

        deletestatus,result = main.ONOSrest.send( ctrlip, port, network.id, path+'networks/',
                                                 'DELETE', None, None )

        utilities.assert_equals(
                expect='200',
                actual=deletestatus,
                onpass="Delete Network Success",
                onfail="Delete Network Failed" )

        if Cmpresult != True:
            main.log.error( "Update Network compare failed" )
开发者ID:git2052,项目名称:OnosSystemTest,代码行数:88,代码来源:FUNCvirNetNB.py


注:本文中的tests.FUNCvirNetNB.dependencies.Nbdata.NetworkData.shared方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。