def configBgpNumberOfAs(self, routerId, numberOfAs): """ Description Set the total number of BGP AS # List. In the GUI, under NetworkGroup, BGP Route Range tab, bottom tab ASPathSegments, enter number of AS # Segments. NOTE! Currently, this API will get the first Network Group object even if there are multiple Network Groups. Network Groups could be filtered by the name or by the first route range address. Haven't decided yet. Don't want to filter by name because in a situation where customers are also using Spirent, Spirent doesn't go by name. Parameters routerId: The Device Group router ID numberOfAs: The total number of AS list to create. Requirements getDeviceGroupByRouterId() """ deviceGroupObj = self.getDeviceGroupByRouterId(routerId=routerId) if deviceGroupObj == 0: raise IxNetRestApiException('No Device Group found for router ID: %s' % routerId) queryData = {'from': deviceGroupObj, 'nodes': [{'node': 'networkGroup', 'properties': [], 'where': []}, {'node': 'ipv4PrefixPools', 'properties': [], 'where': []}, {'node': 'bgpIPRouteProperty', 'properties': [], 'where': []}, {'node': 'bgpAsPathSegmentList', 'properties': [], 'where': []} ]} queryResponse = self.ixnObj.query(data=queryData) try: bgpStack = queryResponse.json()['result'][0]['networkGroup'][0]['ipv4PrefixPools'][0]['bgpIPRouteProperty'][0]['bgpAsPathSegmentList'] except: raise IxNetRestApiException('No object found in DeviceGroup object: deviceGroup/networkGroup/ipv4PrefixPools/bgpIPRouteProperty/bgpAsPathSegmentList: %s' % deviceGroupObj) if bgpStack == []: return IxNetRestApiException('No ipv4PrefixPools bgpIPRouteProperty object found.') bgpRouteObj = bgpStack[0]['href'] response = self.ixnObj.get(self.ixnObj.httpHeader+bgpRouteObj) asNumberInSegmentMultivalue = response.json()['numberOfAsNumberInSegment'] self.ixnObj.patch(self.ixnObj.httpHeader+bgpRouteObj, data={'numberOfAsNumberInSegment': numberOfAs})