コード例 #1
0
 def get_all_edges(self):
     """Get all edges on NSX-v backend."""
     self.__set_api_version('4.0')
     self.__set_endpoint('/edges')
     edges = []
     response = self.get()
     paging_info = response.json()['edgePage']['pagingInfo']
     page_size = int(paging_info['pageSize'])
     total_count = int(paging_info['totalCount'])
     msg = "There are total %s edges and page size is %s" % (total_count,
                                                             page_size)
     LOG.info(msg)
     pages = utils.ceil(total_count, page_size)
     for i in xrange(pages):
         start_index = page_size * i
         params = {'startindex': start_index}
         response = self.get(params=params)
         edges += response.json()['edgePage']['data']
     return edges
コード例 #2
0
 def get_all_edges(self):
     """Get all edges on NSX-v backend."""
     self.__set_api_version('4.0')
     self.__set_endpoint('/edges')
     edges = []
     response = self.get()
     paging_info = response.json()['edgePage']['pagingInfo']
     page_size = int(paging_info['pageSize'])
     total_count = int(paging_info['totalCount'])
     msg = "There are total %s edges and page size is %s" % (total_count,
                                                             page_size)
     LOG.info(msg)
     pages = utils.ceil(total_count, page_size)
     for i in xrange(pages):
         start_index = page_size * i
         params = {'startindex': start_index}
         response = self.get(params=params)
         edges += response.json()['edgePage']['data']
     return edges
コード例 #3
0
 def get_all_logical_switches(self):
     lswitches = []
     self.__set_api_version('2.0')
     vdn_scope_id = self.get_vdn_scope_id()
     endpoint = "/vdn/scopes/%s/virtualwires" % (vdn_scope_id)
     self.__set_endpoint(endpoint)
     response = self.get()
     paging_info = response.json()['dataPage']['pagingInfo']
     page_size = int(paging_info['pageSize'])
     total_count = int(paging_info['totalCount'])
     msg = ("There are total %s logical switches and page size is %s" %
            (total_count, page_size))
     LOG.info(msg)
     pages = utils.ceil(total_count, page_size)
     LOG.info("Total pages: %s" % pages)
     for i in xrange(pages):
         start_index = page_size * i
         params = {'startindex': start_index}
         response = self.get(params=params)
         lswitches += response.json()['dataPage']['data']
     return lswitches
コード例 #4
0
 def get_all_logical_switches(self):
     lswitches = []
     self.__set_api_version('2.0')
     vdn_scope_id = self.get_vdn_scope_id()
     endpoint = "/vdn/scopes/%s/virtualwires" % (vdn_scope_id)
     self.__set_endpoint(endpoint)
     response = self.get()
     paging_info = response.json()['dataPage']['pagingInfo']
     page_size = int(paging_info['pageSize'])
     total_count = int(paging_info['totalCount'])
     msg = ("There are total %s logical switches and page size is %s"
            % (total_count, page_size))
     LOG.info(msg)
     pages = utils.ceil(total_count, page_size)
     LOG.info("Total pages: %s" % pages)
     for i in xrange(pages):
         start_index = page_size * i
         params = {'startindex': start_index}
         response = self.get(params=params)
         lswitches += response.json()['dataPage']['data']
     return lswitches