def startStopDeviceGroup(self, deviceGroupObjList='all', action='start'): """ Description Start one or more Device Groups and all its protocols. Parameters deviceGroupObj: |: 'all' or a list of Device Group objects. Ex: ['/api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1'] action: : 'start'|'stop' """ if deviceGroupObjList == 'all': queryData = {'from': '/', 'nodes': [{'node': 'topology', 'properties': [], 'where': []}, {'node': 'deviceGroup', 'properties': ['href'], 'where': []}] } queryResponse = self.ixnObj.query(data=queryData) try: topologyGroupList = queryResponse.json()['result'][0]['topology'] except IndexError: raise IxNetRestApiException('\nNo Device Group objects found') deviceGroupObjList = [] for dg in topologyGroupList: for dgHref in dg['deviceGroup']: deviceGroupObjList.append(dgHref['href']) url = self.ixnObj.sessionUrl+'/topology/deviceGroup/operations/%s' % action response = self.ixnObj.post(url, data={'arg1': deviceGroupObjList}) self.ixnObj.waitForComplete(response, url+'/'+response.json()['id']) time.sleep(3)