def test_process_pdus(stc): plLogger = PLLogger.GetLogger('methodology') plLogger.LogInfo('test_ConfigTemplatePdusCommand.test_process_pdus()') # Test case to show that we can change the sourceAddr of the IPv4 PDU. # Single StreamBlock in the template tagged with ttStreamBlock. root = etree.fromstring(template_1()) p, v = pdus_1() assert CfgPdusCmd.process_pdus(p, v, root.find('.//StreamBlock')) r = etree.fromstring(root.find('.//StreamBlock').get('FrameConfig')) assert r.find('.//sourceAddr').text == '3.2.3.2' # Test case to show that we can change the sourceAddr of the IPv4 PDU # for the ttStreamBlock tagged StreamBlock, but not touch the ttStreamBlock2 # tagged StreamBlock. root = etree.fromstring(template_2()) assert CfgPdusCmd.process_pdus(p, v, root.find('.//StreamBlock')) for sb, t in zip(root.findall('.//StreamBlock'), ['3.2.3.2', '4.4.4.4']): r = etree.fromstring(sb.get('FrameConfig')) assert r.find('.//sourceAddr').text == t # Test case to show that we can change the sourceAddr of the IPv4 PDU # for both StreamBlocks independently. root = etree.fromstring(template_2()) ps, vs = pdus_2() for sb, p, v in zip(root.findall('.//StreamBlock'), ps, vs): assert CfgPdusCmd.process_pdus([p], [v], sb) for sb, t in zip(root.findall('.//StreamBlock'), ['3.2.3.2', '1.4.1.4']): r = etree.fromstring(sb.get('FrameConfig')) assert r.find('.//sourceAddr').text == t