def test_set_sequenceable_properties(stc): plLogger = PLLogger.GetLogger("methodology") plLogger.LogInfo("start") ctor = CScriptableCreator() stc_sys = CStcSystem.Instance() assert stc_sys is not None sequencer = stc_sys.GetObject("Sequencer") # Sequencer Command List will look as follows: # # IterationGroupCommand # SequencerWhileCommand # ObjectIteratorCommand # IteratorConfigCommand # LoadTemplateCommand # IteratorValidateCommand pkg = "spirent.methodology" group_cmd = ctor.Create(pkg + ".IterationGroupCommand", sequencer) assert group_cmd is not None # IteratorCommand while_cmd = ctor.Create("SequencerWhileCommand", group_cmd) assert while_cmd is not None iter_cmd = ctor.Create(pkg + ".ObjectIteratorCommand", while_cmd) assert iter_cmd is not None config_cmd = ctor.Create(pkg + ".IteratorConfigCommand", while_cmd) assert config_cmd is not None net_prof_cmd = ctor.Create(pkg + ".LoadTemplateCommand", while_cmd) assert net_prof_cmd is not None valid_cmd = ctor.Create(pkg + ".IteratorValidateCommand", while_cmd) assert valid_cmd is not None while_cmd.Set("ExpressionCommand", iter_cmd.GetObjectHandle()) while_cmd.SetCollection( "CommandList", [config_cmd.GetObjectHandle(), net_prof_cmd.GetObjectHandle(), valid_cmd.GetObjectHandle()] ) group_cmd.SetCollection("CommandList", [while_cmd.GetObjectHandle()]) sequencer.SetCollection("CommandList", [group_cmd.GetObjectHandle()]) all_cmd_list = [group_cmd, while_cmd, iter_cmd, config_cmd, net_prof_cmd, valid_cmd] MethodologyGroupCommandUtils.set_sequenceable_properties(sequencer.GetCollection("CommandList"), False) sp_list = sequencer.GetObjects("SequenceableCommandProperties") plLogger.LogInfo("sp_list contains: " + str(len(sp_list))) for cmd in all_cmd_list: sp = cmd.GetObject("SequenceableCommandProperties", RelationType("SequenceableProperties")) plLogger.LogInfo("cmd: " + cmd.GetType()) assert sp is not None check_sequenceable_properties(sp, False) MethodologyGroupCommandUtils.set_sequenceable_properties(sequencer.GetCollection("CommandList"), True) for cmd in all_cmd_list: sp = cmd.GetObject("SequenceableCommandProperties", RelationType("SequenceableProperties")) assert sp is not None check_sequenceable_properties(sp, True)