mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-11-03 20:27:54 +00:00 
			
		
		
		
	@@ -33,7 +33,8 @@ class TestGroup(LFCliBase):
 | 
				
			|||||||
        self.tg_profile = self.local_realm.new_test_group_profile()
 | 
					        self.tg_profile = self.local_realm.new_test_group_profile()
 | 
				
			||||||
        if group_name is None and list_groups is None and (tg_action is not None or cx_action is not None or
 | 
					        if group_name is None and list_groups is None and (tg_action is not None or cx_action is not None or
 | 
				
			||||||
                                                           add_cx_list is not None or rm_cx_list is not None or show_group is not None):
 | 
					                                                           add_cx_list is not None or rm_cx_list is not None or show_group is not None):
 | 
				
			||||||
            raise ValueError("Group name must be set if manipulating test groups")
 | 
					            raise ValueError(
 | 
				
			||||||
 | 
					                "Group name must be set if manipulating test groups")
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            self.tg_profile.group_name = group_name
 | 
					            self.tg_profile.group_name = group_name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -71,7 +72,8 @@ class TestGroup(LFCliBase):
 | 
				
			|||||||
            if self.tg_profile.check_group_exists():
 | 
					            if self.tg_profile.check_group_exists():
 | 
				
			||||||
                self.tg_profile.rm_group()
 | 
					                self.tg_profile.rm_group()
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                print("%s not found, no action taken" % self.tg_profile.group_name)
 | 
					                print("%s not found, no action taken" %
 | 
				
			||||||
 | 
					                      self.tg_profile.group_name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def show_info(self):
 | 
					    def show_info(self):
 | 
				
			||||||
        time.sleep(.5)
 | 
					        time.sleep(.5)
 | 
				
			||||||
@@ -94,12 +96,14 @@ class TestGroup(LFCliBase):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def update_cxs(self):
 | 
					    def update_cxs(self):
 | 
				
			||||||
        if len(self.add_cx_list) > 0:
 | 
					        if len(self.add_cx_list) > 0:
 | 
				
			||||||
            print("Adding cxs %s to %s" % (', '.join(self.add_cx_list), self.tg_profile.group_name))
 | 
					            print("Adding cxs %s to %s" %
 | 
				
			||||||
 | 
					                  (', '.join(self.add_cx_list), self.tg_profile.group_name))
 | 
				
			||||||
            for cx in self.add_cx_list:
 | 
					            for cx in self.add_cx_list:
 | 
				
			||||||
                self.tg_profile.add_cx(cx)
 | 
					                self.tg_profile.add_cx(cx)
 | 
				
			||||||
                self.tg_profile.cx_list.append(cx)
 | 
					                self.tg_profile.cx_list.append(cx)
 | 
				
			||||||
        if len(self.rm_cx_list) > 0:
 | 
					        if len(self.rm_cx_list) > 0:
 | 
				
			||||||
            print("Removing cxs %s from %s" % (', '.join(self.rm_cx_list), self.tg_profile.group_name))
 | 
					            print("Removing cxs %s from %s" %
 | 
				
			||||||
 | 
					                  (', '.join(self.rm_cx_list), self.tg_profile.group_name))
 | 
				
			||||||
            for cx in self.rm_cx_list:
 | 
					            for cx in self.rm_cx_list:
 | 
				
			||||||
                self.tg_profile.rm_cx(cx)
 | 
					                self.tg_profile.rm_cx(cx)
 | 
				
			||||||
                if cx in self.tg_profile.cx_list:
 | 
					                if cx in self.tg_profile.cx_list:
 | 
				
			||||||
@@ -118,21 +122,31 @@ def main():
 | 
				
			|||||||
    ./testgroup.py --group_name group1 --add_group --list_groups
 | 
					    ./testgroup.py --group_name group1 --add_group --list_groups
 | 
				
			||||||
    ''')
 | 
					    ''')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    parser.add_argument('--group_name', help='specify the name of the test group to use', default=None)
 | 
					    parser.add_argument(
 | 
				
			||||||
    parser.add_argument('--list_groups', help='list all existing test groups', action='store_true', default=False)
 | 
					        '--group_name', help='specify the name of the test group to use', default=None)
 | 
				
			||||||
 | 
					    parser.add_argument('--list_groups', help='list all existing test groups',
 | 
				
			||||||
 | 
					                        action='store_true', default=False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    tg_group = parser.add_mutually_exclusive_group()
 | 
					    tg_group = parser.add_mutually_exclusive_group()
 | 
				
			||||||
    tg_group.add_argument('--add_group', help='add new test group', action='store_true', default=False)
 | 
					    tg_group.add_argument(
 | 
				
			||||||
    tg_group.add_argument('--del_group', help='delete test group', action='store_true', default=False)
 | 
					        '--add_group', help='add new test group', action='store_true', default=False)
 | 
				
			||||||
    parser.add_argument('--show_group', help='show connections in current test group', action='store_true', default=False)
 | 
					    tg_group.add_argument(
 | 
				
			||||||
 | 
					        '--del_group', help='delete test group', action='store_true', default=False)
 | 
				
			||||||
 | 
					    parser.add_argument('--show_group', help='show connections in current test group',
 | 
				
			||||||
 | 
					                        action='store_true', default=False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cx_group = parser.add_mutually_exclusive_group()
 | 
					    cx_group = parser.add_mutually_exclusive_group()
 | 
				
			||||||
    cx_group.add_argument('--start_group', help='start all cxs in chosen test group', default=None)
 | 
					    cx_group.add_argument(
 | 
				
			||||||
    cx_group.add_argument('--stop_group', help='stop all cxs in chosen test group', default=None)
 | 
					        '--start_group', help='start all cxs in chosen test group', default=None)
 | 
				
			||||||
    cx_group.add_argument('--quiesce_group', help='quiesce all cxs in chosen test groups', default=None)
 | 
					    cx_group.add_argument(
 | 
				
			||||||
 | 
					        '--stop_group', help='stop all cxs in chosen test group', default=None)
 | 
				
			||||||
 | 
					    cx_group.add_argument(
 | 
				
			||||||
 | 
					        '--quiesce_group', help='quiesce all cxs in chosen test groups', default=None)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    parser.add_argument('--add_cx', help='add cx to chosen test group', nargs='*',  default=[])
 | 
					    parser.add_argument(
 | 
				
			||||||
    parser.add_argument('--remove_cx', help='remove cx from chosen test group', nargs='*', default=[])
 | 
					        '--add_cx', help='add cx to chosen test group', nargs='*',  default=[])
 | 
				
			||||||
 | 
					    parser.add_argument(
 | 
				
			||||||
 | 
					        '--remove_cx', help='remove cx from chosen test group', nargs='*', default=[])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    args = parser.parse_args()
 | 
					    args = parser.parse_args()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user