def test_GetNetworkProfileList(self): ''' @summary: 获取网络的配置集列表 ''' self.nwproapi = NetworkProfilesAPIs() LogPrint().info("Test: To get all NetworkProfiles list.") r = self.nwproapi.getNetworkProfileList(self.nw_id) if r['status_code']==self.dm.expected_status_code: LogPrint().info('PASS: Get NetworkProfile list SUCCESS.') self.flag = True else: LogPrint().error('FAIL: Get Network Profile list FAIL. Returned status code "%s" is WRONG.' % r['status_code']) self.flag = False self.assertTrue(self.flag)
def test_GetNetworkProfileInfo(self): ''' @summary: 获取网络的配置集信息 @note: 操作成功,验证返回码和接口信息 ''' self.nwproapi = NetworkProfilesAPIs() LogPrint().info("Test: Get network %s's profile %s info." % (self.dm.nw_name, self.dm.profile_name)) r = self.nwproapi.getNetworkProfileInfo(self.nw_id, self.dm.profile_name) if r['status_code']==self.dm.expected_status_code: dict_actual = r['result'] dict_expected = xmltodict.parse((self.dm.profile_info %self.nw_id)) dictCompare = DictCompare() if dictCompare.isSubsetDict(dict_expected, dict_actual): LogPrint().info("PASS: Get network %s's profile %s info SUCCESS." % (self.dm.nw_name, self.dm.profile_name) ) self.flag = True else: LogPrint().error("FAIL: Returned messages are INCORRECT.") self.flag = False else: LogPrint().error("FAIL: Get NetworkProfile Info FAILED. Returned status code '%s' is WRONG." % r['status_code'] ) self.flag = False self.assertTrue(self.flag)
class ITC060202_GetNetworkProfileInfo(BaseTestCase): ''' @summary: ITC-06网络管理-02配置集管理-02获取配置集详情 ''' def setUp(self): ''' @summary: 初始化测试数据、测试环境。 ''' # 初始化测试数据 self.dm = super(self.__class__, self).setUp() self.nwapi = NetworkAPIs() #首先新建一个网络并获取其id LogPrint().info("Pre-Test-1: Create a new network '%s'." % self.dm.nw_name) self.nw_id = self.nwapi.createNetwork(self.dm.nw_info)['result']['network']['@id'] #为该网络创建多个配置集 LogPrint().info("Pre-Test-2: Create multi-profiles for network '%s'." % self.dm.nw_name) self.proapi = ProfilesAPIs() self.proapi.createProfiles(self.dm.profile_info,self.nw_id) def test_GetNetworkProfileInfo(self): ''' @summary: 获取网络的配置集信息 @note: 操作成功,验证返回码和接口信息 ''' self.nwproapi = NetworkProfilesAPIs() LogPrint().info("Test: Get network %s's profile %s info." % (self.dm.nw_name, self.dm.profile_name)) r = self.nwproapi.getNetworkProfileInfo(self.nw_id, self.dm.profile_name) if r['status_code']==self.dm.expected_status_code: dict_actual = r['result'] dict_expected = xmltodict.parse((self.dm.profile_info %self.nw_id)) dictCompare = DictCompare() if dictCompare.isSubsetDict(dict_expected, dict_actual): LogPrint().info("PASS: Get network %s's profile %s info SUCCESS." % (self.dm.nw_name, self.dm.profile_name) ) self.flag = True else: LogPrint().error("FAIL: Returned messages are INCORRECT.") self.flag = False else: LogPrint().error("FAIL: Get NetworkProfile Info FAILED. Returned status code '%s' is WRONG." % r['status_code'] ) self.flag = False self.assertTrue(self.flag) def tearDown(self): ''' @summary: 清除该网络及配置集 ''' LogPrint().info("Post-Test: Delete network '%s' and it's profiles." % self.dm.nw_name) self.assertTrue(smart_delete_network(self.dm.nw_name,self.dm.dc_name))
class ITC060201_GetNetworkProfileList(BaseTestCase): ''' @summary: ITC-06网络管理-02配置集管理-01获取配置集列表 ''' def setUp(self): ''' @summary: 初始化测试数据、测试环境。 ''' self.dm = super(self.__class__, self).setUp() self.nwapi = NetworkAPIs() #首先新建一个网络并获取其id LogPrint().info("Pre-Test-1: Create a new network '%s'." % self.dm.nw_name) self.nw_id = self.nwapi.createNetwork(self.dm.nw_info)['result']['network']['@id'] #为该网络创建多个配置集 LogPrint().info("Pre-Test-2: Create multi-profiles for network '%s'." % self.dm.nw_name) self.proapi = ProfilesAPIs() @BaseTestCase.drive_data(self, self.dm.profile_info) def do_test(xml_info): self.proapi.createProfiles(xml_info,self.nw_id) do_test() def test_GetNetworkProfileList(self): ''' @summary: 获取网络的配置集列表 ''' self.nwproapi = NetworkProfilesAPIs() LogPrint().info("Test: To get all NetworkProfiles list.") r = self.nwproapi.getNetworkProfileList(self.nw_id) if r['status_code']==self.dm.expected_status_code: LogPrint().info('PASS: Get NetworkProfile list SUCCESS.') self.flag = True else: LogPrint().error('FAIL: Get Network Profile list FAIL. Returned status code "%s" is WRONG.' % r['status_code']) self.flag = False self.assertTrue(self.flag) def tearDown(self): ''' @summary: 清除该网络及配置集 ''' LogPrint().info("Post-Test: Delete network '%s' and it's profiles." % self.dm.nw_name) self.assertTrue(smart_delete_network(self.dm.nw_name,self.dm.dc_name))